HTMLcopy
1
<script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-core.min.js"></script>
2
<script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-pareto.min.js"></script>
3
<div id="container1"></div>
CSScopy
6
1
html, body, #container1 {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// set data
4
var data = [
5
{x: 'Heart disease', value: 659041},
6
{x: 'Alzheimer disease', value: 150005},
7
{x: 'Cancer', value: 599601},
8
{x: 'Accidents', value: 173040},
9
{x: 'Kidney disease', value: 51567},
10
{x: 'Suicide', value: 47511},
11
{x: 'CLRD', value: 156979},
12
{x: 'Stroke', value: 121499},
13
{x: 'Diabetes', value: 87647},
14
{x: 'Influenza and pneumonia', value: 49783}
15
];
16
17
// create a pareto chart
18
var chart = anychart.pareto();
19
// feed the data into the chart
20
chart.data(data);
21
22
// set the chart title
23
chart.title('Number of Deaths for 10 Leading Causes of Death in U.S. in 2019');
24
// set the measure y axis title
25
chart.yAxis(0).title('Number of deaths');
26
// set the cumulative percentage y axis title
27
chart.yAxis(1).title('Cumulative percentage');
28
29
// set the chart container id
30
chart.container('container1');
31
// draw the chart
32
chart.draw();
33
34
});