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
x
1
anychart.onDocumentReady(function () {
2
var chart = anychart.line();
3
4
var series1 = chart.line([
5
{x: 'Cycling', value: 10},
6
{x: 'Swimming', value: 32},
7
{x: 'Run', value: 18}
8
]);
9
series1.markers(true);
10
11
var series2 = chart.line([
12
{x: 'Cycling', value: 15},
13
{x: 'Swimming', value: 9},
14
{x: 'Run', value: 29}
15
]);
16
17
chart.legend(true);
18
19
var item1 = series1.legendItem();
20
item1.text('Without IconTextSpacing');
21
22
var item2 = series2.legendItem();
23
24
// Set spacing.
25
item2.iconTextSpacing(30);
26
27
item2.text('IconTextSpacing is 30');
28
29
chart.title('Set spacing between icon and text');
30
chart.container('container');
31
chart.draw();
32
});