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
// create line chart
3
var chart = anychart.line();
4
5
// set chart padding
6
chart.padding([10, 20, 5, 20]);
7
8
// turn on chart animation
9
chart.animation(true);
10
11
// turn on the crosshair
12
chart.crosshair(true);
13
14
// set chart title text settings
15
chart.title('Customers Activity during the Week');
16
17
// set y axis title
18
chart.yAxis().title('Activity occurrences');
19
20
// create logarithmic scale
21
var logScale = anychart.scales.log();
22
logScale.minimum(1).maximum(45000);
23
24
// set scale for the chart, this scale will be used in all scale dependent entries such axes, grids, etc
25
chart.yScale(logScale);
26
27
// create data set on our data,also we can pud data directly to series
28
var dataSet = anychart.data.set([
29
['Monday', '1120', '4732', '15176'],
30
['Tuesday', '720', '3689', '18910'],
31
['Wednesday', '404', '3904', '19004'],
32
['Thursday', '190', '754', '22233'],
33
['Friday', '15', '187 ', '922'],
34
['Saturday', '10', '45', '534'],
35
['Sunday', '7', '61', '343']
36
]);
37
38
// map data for the first series,take value from first column of data set
39
var firstSeriesData = dataSet.mapAs({ x: 0, value: 1 });
40
41
// map data for the second series,take value from second column of data set
42
var secondSeriesData = dataSet.mapAs({ x: 0, value: 2 });
43
44
// map data for the third series, take x from the zero column and value from the third column of data set
45
var thirdSeriesData = dataSet.mapAs({ x: 0, value: 3 });
46
47
// temp variable to store series instance
48
var series;
49
50
// setup first series
51
series = chart.line(firstSeriesData);
52
series.name('Review about the product');
53
// enable series data labels
54
series.labels().enabled(true).anchor('left-bottom').padding(5);
55
// enable series markers
56
series.markers(true);
57
58
// setup second series
59
series = chart.line(secondSeriesData);
60
series.name('Comment blog posts');
61
// enable series data labels
62
series.labels().enabled(true).anchor('left-bottom').padding(5);
63
// enable series markers
64
series.markers(true);
65
66
// setup third series
67
series = chart.line(thirdSeriesData);
68
series.name('Email delivery support');
69
// enable series data labels
70
series.labels().enabled(true).anchor('left-bottom').padding(5);
71
// enable series markers
72
series.markers(true);
73
74
// turn the legend on
75
chart.legend().enabled(true).fontSize(13).padding([0, 0, 20, 0]);
76
77
// set container for the chart and define padding
78
chart.container('container');
79
// initiate chart drawing
80
chart.draw();
81
});