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 a Pareto chart
4
var chart = anychart.pareto([
5
{x: "Defect 1", value: 19},
6
{x: "Defect 2", value: 9},
7
{x: "Defect 3", value: 28},
8
{x: "Defect 4", value: 87},
9
{x: "Defect 5", value: 14},
10
]);
11
12
// percent axis
13
percentAxis = chart.yAxis(1);
14
15
// create horizontal line marker
16
lineMarker = chart.lineMarker();
17
// bind to percent axis
18
lineMarker.axis(percentAxis);
19
lineMarker.value(80);
20
lineMarker.stroke("#FF0000", 1, "5 2");
21
22
// create horizontal line marker
23
textMarker = chart.textMarker();
24
// bind to percent axis
25
textMarker.axis(percentAxis);
26
textMarker.text("80%");
27
// set marker alignment
28
textMarker.align("right");
29
// set anchor
30
textMarker.anchor("right-bottom");
31
textMarker.offsetX(5);
32
textMarker.value(80);
33
textMarker.fontColor("#FF0000");
34
35
36
// set the chart title
37
chart.title("Pareto Chart: Axes Lines");
38
39
// set the container id
40
chart.container("container");
41
42
// initiate drawing the chart
43
chart.draw();
44
});