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: