echarts页面赋值,调用

function dochart1(json){
var option = {
    title: {
        text: '数据增量'
    },
    tooltip : {
        trigger: 'axis',
        axisPointer : {            // 坐标轴指示器,坐标轴触发有效
            type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
        }
    },
    legend: {
        data: json.legendData //['行业协会','市场监管','相关机构','第三方合作','爬虫抓取','公开市场','客户','车辆','深度']
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis : [
        {
            type : 'category',
            data : json.xAxisData //['一月','二月','三月','四月','五月','六月','七月']
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series:json.series
    /*series : [
        {
            name:'行业协会',
            type:'bar',
            data:[320, 332, 301, 334, 390, 330, 320]
        },
        {
            name:'市场监管',
            type:'bar',
            stack: '广告',
            data:[120, 132, 101, 134, 90, 230, 210]
        },
        {
            name:'相关机构',
            type:'bar',
            stack: '广告',
            data:[220, 182, 191, 234, 290, 330, 310]
        },
        {
            name:'第三方合作',
            type:'bar',
            stack: '广告',
            data:[150, 232, 201, 154, 190, 330, 410]
        },
        {
            name:'爬虫抓取',
            type:'bar',
            data:[862, 1018, 964, 1026, 1679, 1600, 1570],
            markLine : {
                lineStyle: {
                    normal: {
                        type: 'dashed'
                    }
                },
                data : [
                    [{type : 'min'}, {type : 'max'}]
                ]
            }
        },
        {
            name:'公开市场',
            type:'bar',
            barWidth : 5,
            stack: '爬虫抓取',
            data:[620, 732, 701, 734, 1090, 1130, 1120]
        },
        {
            name:'客户',
            type:'bar',
            stack: '爬虫抓取',
            data:[120, 132, 101, 134, 290, 230, 220]
        },
        {
            name:'车辆',
            type:'bar',
            stack: '爬虫抓取',
            data:[60, 72, 71, 74, 190, 130, 110]
        },
        {
            name:'深度',
            type:'bar',
            stack: '爬虫抓取',
            data:[62, 82, 91, 84, 109, 110, 120]
        }
    ]*/
};
echarts.init($('#main1')[0]).setOption(option);
}
 
 
$(function(){
        $.post("/__sys/ajax.aspx?rmd=" + Math.random(),{"type":"DashBoard_DataBar"},function(data,textStatus){
                var json = eval("(" + data +")");
                //alert(data);
                //alert(json);
                console.log(json);
                dochart1(json);
        });
        $.post("/__sys/ajax.aspx?rmd=" + Math.random(),{"type":"Query_AddCarDataByDay"},function(data,textStatus){
                var json = eval("(" + data +")");
                console.log(json);
                dochart2(json);
        });

    dochart3();
    dochart4();
});
</script>

猜你喜欢

转载自blog.csdn.net/yijiupingfan0914/article/details/79971452