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
3
// create data
4
var data = [
5
{x: "Jan", low: 1000, q1: 1050, median: 1200, q3: 1800, high: 2000, outliers: [800, 2500, 3200]},
6
{x: "Feb", low: 2500, q1: 3000, median: 3800, q3: 3900, high: 4000},
7
{x: "Mar", low: 2000, q1: 2300, median: 2500, q3: 2900, high: 3000},
8
{x: "Apr", low: 4000, q1: 5000, median: 6500, q3: 6900, high: 7200, outliers: [8930]},
9
{x: "May", low: 8000, q1: 8400, median: 8500, q3: 8800, high: 9000, outliers: [6950, 3000]}
10
];
11
12
// create a chart
13
var chart = anychart.box();
14
15
// create a series and set the data
16
series = chart.box(data);
17
18
// configure stems
19
series.normal().stemStroke("#dd2c00", 0.5);
20
series.hovered().stemStroke("#dd2c00", 1);
21
series.selected().stemStroke("#dd2c00", 2);
22
23
// set the chart title
24
var title = chart.title("Box Chart: Stems");
25
26
// set the interactivity mode
27
chart.interactivity("by-x");
28
29
// set the container id
30
chart.container("container");
31
32
// initiate drawing the chart
33
chart.draw();
34
});