HighCharts之2D数值带有百分数的面积图
1、HighCharts之2D数值带有百分数的面积图源码
AreaPercentage.html:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>HighCharts 2D数值带有百分数的面积图</title> <script type="text/javascript" src="../scripts/jquery-1.11.0.js"></script> <script type="text/javascript" src="../scripts/js/highcharts.js"></script> <script type="text/javascript"> $(function(){ $('#percentageAreaChart').highcharts({ chart: { type: 'area' }, title: { text: '2013年水果销售量' }, subtitle: { text: '水果销量' }, xAxis: { categories: ['一月', '二月', '三月', '四月', '五月', '六月', '七月','八月','九月','十月','十一月','十二月'], tickmarkPlacement: 'on', title: { enabled: true } }, yAxis: { title: { text: '百分比(%)' } }, tooltip: { pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.percentage:.1f}%</b> ({point.y:,.0f} kg)<br/>', shared: true }, plotOptions: { area: { stacking: 'percent', lineColor: '#ffffff', lineWidth: 1, marker: { lineWidth: 1, lineColor: '#ffffff' } } }, series: [{ name: '苹果', data: [561, 145, 365, 879, 1245, 345, 268,654,945,451,615,341] }, { name: '梨子', data: [306, 207, 451, 654, 354, 245, 874,652,478,984,875,243] }, { name: '橘子', data: [156, 421, 214, 754, 410, 623, 894,451,652,874,356,524] }, { name: '荔枝', data: [851, 331, 554, 245, 439, 718, 245,653,451,698,321,684] }, { name: '草莓', data: [245, 352, 852, 746, 313, 430, 246,895,675,235,654,745] }] }); }); </script> </head> <body> <div id="percentageAreaChart" style="width: 1200px; height: 500px; margin: 0 auto"></div> </body> </html>
2、运行结果