当前位置:编程学习 > JAVA >>

Highcharts 关于动态设定yAxis.plotLines

我做项目时有个报表图,我想要设置一个固定值,就是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);
--------------------编程问答-------------------- opt.yAxis.plotLines[0].value = 3000;这样就可以了 --------------------编程问答-------------------- options.yAxis.plotLines[0].value = 3000;
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,