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 whiskers
19
series.whiskerWidth(30);
20
series.normal().whiskerStroke("#dd2c00", 0.5);
21
series.hovered().whiskerStroke("#dd2c00", 1);
22
series.selected().whiskerStroke("#dd2c00", 2);
23
24
// set the chart title
25
var title = chart.title("Box Chart: Whiskers");
26
27
// set the interactivity mode
28
chart.interactivity("by-x");
29
30
// set the container id
31
chart.container("container");
32
33
// initiate drawing the chart
34
chart.draw();
35
});