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 stage = anychart.graphics.create("container");
3
4
var lineChart = anychart.line();
5
lineChart.line([1, 2, 3, 4]);
6
lineChart.line([2, 3, 4, 1]);
7
lineChart.line([3, 4, 1, 2]);
8
lineChart.line([4, 1, 2, 3]);
9
lineChart.bounds(0, 0, "50%", "100%");
10
lineChart.palette(["#827717", "#c77532", "#998675"]);
11
lineChart.container(stage);
12
lineChart.draw();
13
14
var columnChart = anychart.column();
15
columnChart.column([1, 2, 3, 4]);
16
columnChart.column([2, 3, 4, 1]);
17
columnChart.column([3, 4, 1, 2]);
18
columnChart.column([4, 1, 2, 3]);
19
columnChart.bounds("50%", 0, "50%", "100%");
20
21
// Gets palette of the line chart.
22
var lineChartPalette = lineChart.palette();
23
24
columnChart.palette(lineChartPalette);
25
columnChart.container(stage);
26
columnChart.draw();
27
28
var title = anychart.standalones.title();
29
title.text("Get and use palette.");
30
title.container(stage);
31
title.draw();
32
});