在asp.net中使用highcharts做图形统计

在.net开发中一般都会使用到图形统计的功能,highcharts是个不错的选择。

其官网地址:http://www.hcharts.cn/

效果图:

引用js文件:

<script src="http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
<script src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>

这里直接引用了官网的js文件,使用的时候可以去下载下来。

<script type="text/javascript">
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
defaultSeriesType: 'line',
marginRight:120,
reflow:false
},
title: {
text: <%= strTitle %> //标题 没有数据的时候就不显示了
},

xAxis: {
categories: <%= xAxisCategories %>, //x轴坐标
tickPixelInterval:0.2,
title: {
text: '测量次数'
}
},
yAxis: {
title: {
text: '测量值'
},
tickPixelInterval:20, //设置y轴刻度
max:<%= Ymax %>, // 定义Y轴 最大值
min:<%= Ymin %> // 定义最小值


},
tooltip: {
formatter: function() {
return ''+ this.series.name +': '+ this.y;
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: true
}
},
legend: {
layout: 'vertical',//horizontal 水平显示
align: 'right',
verticalAlign: 'middle',
borderWidth: 0


},
credits: {
      enabled: false
},
exporting:{
enabled: false //不显示下载和打印功能
},
series: <%= returnValue %>
});



});
</script>

html中

<div id="container" style="MIN-WIDTH: 800px; MARGIN-TOP: 5px; HEIGHT: 400px"><FONT face="宋体"></FONT></div>


cs文件

public string returnValue = "";
public string xAxisCategories = "";
public string strTitle ="";

public str

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值