This article mainly introduces jQuery. Highcharts. js's method of drawing a bar chart and a pie chart. It is very practical and can be directly used in projects. In data statistics and analysis, customers sometimes need to display the column chart, pie chart, and graph in a chart, that is to say, we can see the specific data from the bar chart, the change trend from the graph, and the proportion of each part of the data from the pie chart. Highcharts allows you to easily implement the three-in-one effect.
The Code is as follows:
Var chart;
$ (Document). ready (function (){
Chart = new Highcharts. Chart ({
Chart :{
RenderTo: 'Container ',
DefaultSeriesType: 'region'
},
Title :{
Text: 'historic and Estimated Worldwide Population Growth by region'
},
Subtitle :{
Text: 'source: Wikipedia.org'
},
XAxis :{
Categories: ['20160301', '20160301', '20160301', '20160301', '20160301', '20160301'],
TickmarkPlacement: 'on ',
Title :{
Enabled: false
}
},
YAxis :{
Title :{
Text: 'billions'
},
Labels :{
Formatter: function (){
Return this. value/1000;
}
}
},
Tooltip :{
Formatter: function (){
Return ''+
This. x + ':' + Highcharts. numberFormat (this. y, 0, ',') + 'millions ';
}
},
PlotOptions :{
Area :{
Stacking: 'normal ',
LineColor: '#666666 ',
LineWidth: 1,
Marker :{
LineWidth: 1,
LineColor: '#666666'
}
}
},
Series :[{
Name: 'asa ',
Data: [502,635,809,947,140 2, 3634,526 8]
},{
Name: 'Africa ',
Data: [106,107,111,133,221,767,176 6]
},{
Name: 'Europe ',
Data: [163,203,276,408,547,729,628]
},{
Name: 'America ',
Data: [18, 31, 54,156,339,818,120 1]
},{
Name: 'oceana ',
Data: [2, 2, 2, 6, 13, 30, 46]
}]
});
});
The above is all the content described in this article. I hope it will be helpful for you to use jQuery to draw a pie chart.