HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
51
1
anychart.onDocumentReady(function() {
2
// chart type
3
var chart = anychart.polar();
4
5
chart.title().text("Polar Chart");
6
7
chart.line([
8
{x: 0, value: 0},
9
{x: 10, value: 1},
10
{x: 20, value: 2},
11
{x: 30, value: 3},
12
{x: 40, value: 4},
13
{x: 50, value: 5},
14
{x: 60, value: 6},
15
{x: 70, value: 7},
16
{x: 80, value: 8},
17
{x: 90, value: 9},
18
{x: 100, value: 10}
19
]).tooltip().enabled(false);
20
21
chart.xScale().maximum(100).ticks().interval(10);
22
23
chart.yScale().ticks().interval(2);
24
25
chart.xAxis().labels().fontWeight(900);
26
chart.container("container").draw();
27
28
chartXml = chart.toXml();
29
30
var body = document.getElementsByTagName("body")[0];
31
32
var button = document.createElement("div");
33
button.style.padding = "2px";
34
button.style.textAlign = "center";
35
button.style.position = "fixed";
36
button.style.top = "2px";
37
button.style.right = "2px";
38
button.style.backgroundColor = "#444444";
39
button.style.border = "1px solid #444444";
40
button.style.borderRadius = "5px";
41
button.style.color = "white";
42
button.style.fontFamily = "Tahoma";
43
button.style.cursor = "pointer";
44
button.style.MozUserSelect= "none";
45
button.style.KhtmlUserSelect= "none";
46
button.style.WebkitUserSelect= "none";
47
button.style.userSelect= "none";
48
button.innerHTML = "Show<br/>XML config";
49
button.onclick = function(){alert(chartXml)};
50
body.appendChild(button);
51
});