highcharts 动态设置series

$.ajax({
    url: ctx + "/projectReport/report3",
    type: 'post',
    dataType: "json",
    async: false,
    cache: false,
    success: function (odata3) {
        if (odata3.result == 1) {
            var series=[];
            var projectNames=odata3.projectNames;
            var countRecordproject=odata3.countRecordproject;
            for(var i=0;i<projectNames.length;i++){
                series.push({"name":projectNames[i],"data":eval("["+countRecordproject[i]+"]")});
            }
            $('#container3').highcharts({
                title: {
                    text: '公司未结款项目收款统计图',
                    x: -20 //center
                },
                subtitle: {
                    x: -20
                },
                chart: {
                    type: 'line',
                    width: 800,
                    height: 460
                },
                credits: {
                    enabled: false
                },//去除水印
                xAxis: {
                    title: {
                        text: '日期(//)'
                    },
                    categories: odata3.showXdate.split(","),
                    crosshair: true
                },
                yAxis: {
                    title: {
                        text: '金额(元)'
                    }
                },
                //绑定鼠标放上后显示的字段
                tooltip: {
                    pointFormat: '{series.name}: {point.percentage:.1f}%'
                },
                legend: {
                    layout: 'vertical',
                    align: 'right',
                    verticalAlign: 'middle',
                    borderWidth: 0
                },
                plotOptions: {
                    line: {
                        connectNulls:true,//该设置会连接空值点
                        // gapSize:1,//缺失点小于gapSize则连接
                        dataLabels: {
                            enabled: true
                        },
                        enableMouseTracking: false
                    }
                },
                series:series
            });
        }
    }
});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值