Highcharts是一個製做圖表的純Javascript類庫,主要特性以下:javascript
下載插件前端
Highcharts下載地址java
http://www.highcharts.com/downloadjquery
jquery下載地址git
http://jquery.com/github
一、須要引入的腳本canvas
<script src="../../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script> <script src="../../Content/Highcharts-3.0.9/js/highcharts.js" type="text/javascript"></script> <script src="../../Content/Highcharts-3.0.9/js/modules/exporting.js" type="text/javascript"></script> <script src="../../Content/Highcharts-3.0.9/js/highcharts-more.js" type="text/javascript"></script>
二、前端顯示片斷瀏覽器
$('#canvasDiv').highcharts({ chart: { type: '@Model[0].Type' }, title: { text: '@Model[0].Title' }, subtitle: { text: '@Model[0].Subtitle' }, xAxis: { categories: @Html.Raw(Model[0].XAxis.CategoriesJson) }, yAxis: { title: { text: '@Model[0].YAxis.Title' }, labels: { formatter: function () { return this.value + '次' } } }, tooltip: { crosshairs: true, shared: true }, plotOptions: { spline: { marker: { radius: 4, lineColor: '#666666', lineWidth: 1 } } }, series: @Html.Raw(Model[0].SeriesJson) });
三、控制器數據綁定片斷ssh
演示效果以下:this
實現代碼已所有開源
github:
https://github.com/cheng5x/YcHighCharts
oschina.net: