Highcharts 关于动态设定yAxis.plotLines

zgr1231 2012-08-20 05:28:04
我做项目时有个报表图,我想要设置一个固定值,就是yAxis.plotLines,但是我动态设定yAxis.plotLines.value时,不会出现,但是我直接写上去又能执行!求解!

var options = {
chart: {
renderTo: 'container' //关联页面元素div#id
},
title: { //图表标题
// text: '2011年东北三大城市水果消费量统计图'
},
subtitle: {
// text: 'Source: WorldClimate.com'
},
xAxis: { //x轴
//categories: ['柑橘', '香蕉','苹果', '梨子'], //X轴类别
//labels:{y:18} //x轴标签位置:距X轴下方18像素
},
yAxis: { //y轴
title: {text: '处理天数(天)'}, //y轴标题
lineWidth: 2, //基线宽度
plotLines : [ {
color : 'red',
width : 2//,
//value:9
} ]
},
legend: {
layout: 'vertical',
align: 'left',
x: 80,
verticalAlign: 'top',
y: 60,
floating: true,
backgroundColor: '#FFFFFF'
},

tooltip: {
formatter: function() {
var s;
if (this.point.name) { // the pie chart
s = ''+
this.point.name +': '+ this.y +' fruits';
} else {
s = ''+
this.x +': '+ this.y+"天";
}
return s;
}
},
exporting: {
enabled: false //设置导出按钮不可用
},
series: [{ //数据列
type: 'column',
name: '实际办理天数'//,
// data: [8.4, 9.8, 11.4, 15.6]
},
{
type: 'column',
name: '规定办理天数'//,
// data: [1, 1, 1, 1,1]
},
{
type: 'spline',
name: '规定天数总和'//,
//data: [6.5, 9.4, 13.2, 18.6]
},
{
type: 'spline',
name: '处理天数总和'//,
// data: [8.03, 9, 11.6, 17]
}]
};
options.yAxis.plotLines=nodeTotalDays;
chart = new Highcharts.Chart(options);
...全文
643 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wenlin999 2013-11-13
  • 打赏
  • 举报
回复
options.yAxis.plotLines[0].value = 3000;
wenlin999 2013-11-13
  • 打赏
  • 举报
回复
opt.yAxis.plotLines[0].value = 3000;这样就可以了

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧