网站首页
百度ECharts
ECharts实例
ECharts入门
地图大全
ECharts官网
源代码:
点击运行 》
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Highcharts 实例</title> <script src="/js/jquery-1.9.0.min.js"></script> <!-- 引入 highcharts.js --> <script src="/js/highcharts.js"></script> </head> <body> <div id="myChart" width='100%' height='450'></div> <script type="text/javascript"> $(document).ready(function() { var chart = { type: 'column' }; var title = { text: 'Highcharts图表之固定布局柱形图' }; var xAxis = { categories: ['HTML4', 'CSS', 'VUE3'] }; var yAxis = [{ min: 0, title: { text: '访问量' } }, { title: { text: '下载量' }, opposite: true }]; var legend = { shadow: false }; var tooltip = { shared: true }; var credits = { enabled: false }; var plotOptions = { column: { grouping: false, shadow: false, borderWidth: 0 } }; var series= [{ name: 'Em1', color: 'rgba(165,170,217,1)', data: [150, 73, 20], pointPadding: 0.3, pointPlacement: -0.2 }, { name: 'Em2', color: 'rgba(126,86,134,.9)', data: [140, 90, 40], pointPadding: 0.4, pointPlacement: -0.2 }, { name: 'Pr1', color: 'rgba(248,161,63,1)', data: [183.6, 178.8, 198.5], tooltip: { valuePrefix: '$', valueSuffix: ' M' }, pointPadding: 0.3, pointPlacement: 0.2, yAxis: 1 }, { name: 'Pr2', color: 'rgba(186,60,61,.9)', data: [203.6, 198.8, 208.5], tooltip: { valuePrefix: '$', valueSuffix: ' M' }, pointPadding: 0.4, pointPlacement: 0.2, yAxis: 1 }]; var json = {}; json.chart = chart; json.title = title; json.xAxis = xAxis; json.yAxis = yAxis; json.credits = credits; json.legend = legend; json.tooltip = tooltip; json.plotOptions = plotOptions; json.series = series; $('#myChart').highcharts(json); }); </script> </body> </html>
运行结果: