HTMLcopy
1
<div id="container"></div>
CSScopy
8
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
// The data used in this sample can be obtained from the CDN
3
// https://cdn.anychart.com/samples/stock-general-features/load-csv-data/data.csv
4
anychart.data.loadCsvFile(
5
'https://cdn.anychart.com/samples/polar-charts/polar-chart-with-multiple-line-series/data.csv',
6
function (data) {
7
var dataSet = anychart.data.set(data);
8
9
// map data for the first series, take x from the zero column and value from the first column of data set
10
var firstSeriesData = dataSet.mapAs({ x: 0, value: 1 });
11
12
// map data for the second series, take x from the zero column and value from the second column of data set
13
var secondSeriesData = dataSet.mapAs({ x: 0, value: 2 });
14
15
// create polar chart
16
var chart = anychart.polar();
17
18
// set chart yScale settings
19
chart.yScale().minimum(-1).maximum(1.5);
20
chart.yScale().ticks().interval(0.5);
21
22
// set chart xScale settings
23
chart.xScale().maximum(360);
24
chart.xScale().ticks().interval(30);
25
26
// set xAxis formatting settings
27
chart.xAxis().labels().format('{%Value}\xb0');
28
29
// set chart legend settings
30
chart.legend().enabled(true).align('center');
31
32
var series1 = chart.line(firstSeriesData);
33
series1.name('SIN(x)').markers(false);
34
35
var series2 = chart.line(secondSeriesData);
36
series2.name('COS(x)').markers(false);
37
38
// set container id for the chart
39
chart.container('container');
40
// initiate chart drawing
41
chart.draw();
42
}
43
);
44
});