网站首页
百度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> <script src="js/data.js"></script> </head> <body> <div id="myChart" style="width: 100%; height: 400px;"></div> <script language="JavaScript"> $(document).ready(function() { var data = { table: 'datatable' }; var chart = { type: 'column' }; var title = { text: '从网页中的 HTML 表格中读取数据' }; var yAxis = { allowDecimals: false, title: { text: 'Units' } }; var tooltip = { formatter: function () { return '<b>' + this.series.name + '</b><br/>' + this.point.y + ' ' + this.point.name.toLowerCase(); } }; var credits = { enabled: false }; var json = {}; json.chart = chart; json.title = title; json.data = data; json.yAxis = yAxis; json.credits = credits; json.tooltip = tooltip; $('#myChart').highcharts(json); }); </script> <table id="datatable"> <thead> <tr><th></th><th>Jane</th><th>John</th></tr> </thead> <tbody> <tr><th>Apples</th><td>3</td><td>4</td></tr> <tr><th>Pears</th><td>2</td><td>0</td></tr> <tr><th>Plums</th><td>5</td><td>11</td></tr> <tr><th>Bananas</th><td>1</td><td>1</td></tr> <tr><th>Oranges</th><td>2</td><td>4</td></tr> </tbody> </table> </body> </html>
运行结果: