标签:
Highcharts是一个制作图表的纯Javascript类库,主要特性如下:
下载插件
Highcharts下载地址
http://www.highcharts.com/download
jquery下载地址
1、需要引入的脚本
<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>
2、前端显示片段
$(‘#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)
});
3、控制器数据绑定片段
演示效果如下:



实现代码已全部开源
github:
https://github.com/cheng5x/YcHighCharts
oschina.net:
http://git.oschina.net/cheng5x/YcHighCharts
(原创)Highcharts图表.net版开源,支持webform 和 mvc3,完全开源
标签:
原文地址:http://www.cnblogs.com/cheng5x/p/4701696.html