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
58
1
anychart.onDocumentReady(function() {
2
// this column represents JS equivalents every JSON object
3
var chart = anychart.fromJson(
4
{chart: { type: "line", // var chart = anychart.lineChart();
5
6
// set range marker
7
rangeAxesMarkers: [{ // chart.rangeMarker()
8
scale: 1, // .scale(chart.yScale())
9
from: 0, // .from(0)
10
to: 30000, // .to(30000)
11
fill: { // .fill({
12
keys: [ ".1 green", ".5 yellow", ".9 red"], // keys: [".1 green", ".5 yellow", ".9 red"],
13
angle: -90, // angle: -90,
14
opacity: 0.5 // opacity: 0.5
15
}}], // });
16
17
// set text marker at the top
18
"textAxesMarkers": [{ // chart.textMarker()
19
"scale": 1, // .scale(chart.yScale())
20
"offsetX": 10, // .offsetX(10)
21
"value": 25000, // .value(25000)
22
"fontSize": 15, // .text("Good")
23
"text": "Good", // .fontSize(15)
24
"fontWeight": 600}, // .fontWeight(600);
25
26
// set text marker at the center
27
{ // chart.textMarker(1)
28
"scale": 1, // .scale(chart.yScale())
29
"offsetX": 10, // .offsetX(10)
30
"value": 15000, // .value(15000)
31
"text": "Average", // .text("Average")
32
"fontSize": 15, // .fontSize(15)
33
"fontWeight": 600}, // .fontWeight(600);
34
35
// set text marker at the bottom
36
{ // chart.textMarker(2)
37
"scale": 1, // .scale(chart.yScale())
38
"offsetX": 10, // .offsetX(10)
39
"value": 5000, // .value(5000)
40
"text": "Severe", // .text("Severe")
41
"fontSize": 12, // .fontSize(12)
42
"fontWeight": 600}], // .fontWeight(600);
43
44
// data set
45
series: [{seriesType: "line", // chart.line([
46
data: [ {x: "2005", value: "10000"}, // [2005, 10000],
47
{x: "2006", value: "12000"}, // [2006, 12000],
48
{x: "2007", value: "18000"}, // [2007, 18000],
49
{x: "2008", value: "19000"}, // [2008, 19000],
50
{x: "2009", value: "29000"} // [2009, 29000]
51
]}], // ]);
52
title: {enabled: "false"}, // chart.title().enabled(false);
53
yScale: {minimum: "0", maximum: "30000"}, // chart.yScale().minimum(0).maximum(30000);
54
xAxes: {title: {enabled: "false"}}, // chart.xAxis().title().enabled(false);
55
yAxes: {title: "Sales"}, // chart.yAxis().title().text("Sales");
56
container: "container"}} // chart.container("container")
57
).draw();
58
});