echarts-散點圖數值對實現折線圖

1.代碼示例

option = {
    legend: {
        data:['曲線1', '曲線2']
    },
   tooltip : {
        trigger: 'axis',
        axisPointer: {
        type: 'cross',
        animation: false,
        }
    },
    toolbox: {
        show: true,
        feature: {
            dataZoom: {
                yAxisIndex: 'none'
            },
            dataView: {readOnly: false},
            magicType: {type: ['line', 'bar']},
            restore: {},
            saveAsImage: {}
        }
    },
    grid: {
        top: 70,
        bottom: 50
    },
     xAxis: {
        type: 'category',
        name:'寬度(mm)',
        nameTextStyle:{
        color:'#333'
        },
        boundaryGap: true
    },
    yAxis:{
        name:'高度(mm)',
        type: 'value',
        nameTextStyle:{
            color:'#333'
        }
    },
    series: [{
        name:'曲線1',
        symbolSize: 5,
        data: [
            [0, 2],
            [2, 5],
            [3, 9],
            [5, 16],
            [7, 24],
            [9, 18],
            [12, 15],
            [15, 5],
            [17, 2],
            [19, 1]
        ],
        type: 'line',
        smooth:true,
        showSymbol: false,
        barGap: 0
    },
    {
        name:'曲線2',
        symbolSize: 5,
        data: [
            [0, 1],
            [2, 3],
            [3, 7],
            [5, 13],
            [7, 21],
            [9, 16],
            [12, 12],
            [15, 3],
            [17, 1],
            [19, 0]
        ],
        type: 'line',
        smooth:true,
        showSymbol:false,
        barGap: 0
    }
    ]
};

2.圖片示例

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章