1. 程式人生 > >echarts 實線改變成虛線

echarts 實線改變成虛線

option = {
    title: {
        text: '折線圖堆疊'
    },
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data:['郵件營銷','聯盟廣告','視訊廣告','直接訪問','搜尋引擎']
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    toolbox: {
        feature: {
            saveAsImage: {}
        }
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['週一','週二','週三','週四','週五','週六','週日']
    },
    yAxis: {
        type: 'value'
    },
    series: [
        {
            name:'郵件營銷',
            type:'line',
            stack: '總量',
            smooth:false,   //關鍵點,為true是不支援虛線的,實線就用true
            itemStyle:{
                normal:{
                    lineStyle:{
                        width:2,
                        type:'dotted'  //'dotted'虛線 'solid'實線
                    }
                }
            },            
            data:[120, 132, 101, 134, 90, 230, 210]
        },
        {
            name:'聯盟廣告',
            type:'line',
            stack: '總量',
            smooth:false,   //關鍵點,為true是不支援虛線的,實線就用true
            itemStyle:{
                normal:{
                    lineStyle:{
                        width:2,
                        type:'dotted'  //'dotted'虛線 'solid'實線
                    }
                }
            },            
            data:[220, 182, 191, 234, 290, 330, 310]
        },
        {
            name:'視訊廣告',
            type:'line',
            stack: '總量',
            data:[150, 232, 201, 154, 190, 330, 410]
        },
    ]

};