Line chart - displayed at unequal intervals on the X-axis according to time intervals

Line chart - displayed at unequal intervals on the X-axis according to time intervals

image.png

option

option = {
    
    
    "title": {
    
    
        "text": "X轴不等间距分布",
        "left": "center",
        "textStyle": {
    
    
            "fontSize": 14
        }
    },
    "tooltip": {
    
    
        "trigger": "axis",
        "axisPointer": {
    
    
            "type": "cross",
             label: {
    
    
                backgroundColor: '#6a7985'
              }
        }
    },
    "xAxis": [
        {
    
    
            "type": "value",
            "axisTick": {
    
    
                "show": false
            },
            "splitLine": {
    
    
                "show": false
            },
            "axisLabel": {
    
    
                "show": false
            }
        },
        {
    
    
            "nameTextStyle": {
    
    
                "padding": [
                    -35,
                    0,
                    0,
                    -250
                ]
            },
            "nameLocation": "start",
            "type": "value",
            "inverse": true
        }
    ],
    "yAxis": [
        {
    
    
            "nameLocation": "middle",
            "nameGap": 35,
            "splitLine": {
    
    
                "show": true
            },
            "axisLabel": {
    
    
                "show": true
            },
            "type": "value"
        },
        {
    
    
            "nameLocation": "start",
            "type": "value",
            "inverse": true
        }
    ],
    "series": [
        {
    
    
            "name": "设计值",
            "type": "line",
            "showSymbol": false,
            "smooth": true,
            "itemStyle": {
    
    
                "color": "red"
            },
            "data": [
                [
                    1,
                    14144.8231541636
                ],
                [
                    2,
                    12358.130070431354
                ],
                [
                    5,
                    3696.8328177394874
                ],
                
                [
                    6,
                    3122.386384899139
                ],
                [
                    8,
                    2958.9552944488523
                ]
            ],
            "markLine": {
    
    
                "symbol": [
                    "none",
                    "none"
                ],
                "silent": true,
                "label": {
    
    
                    "show": true,
                    "position": "start",
                    "formatter": "{b}",
                    "color": "#000000"
                },
                "lineStyle": {
    
    
                    "type": "solid",
                    "color": "#cccccc"
                },
                "data": [
                    {
    
    
                        "name": "1-1",
                        "xAxis": 1
                    },
                    {
    
    
                        "name": "1-2",
                        "xAxis": 2
                    },
                    {
    
    
                        "name": "1-5",
                        "xAxis": 5
                    },
                    {
    
    
                        "name": "1-6",
                        "xAxis": 6
                    },
                    {
    
    
                        "name": "1-8",
                        "xAxis":8
                    },
                    
                ]
            }
        }
    ]
}

Guess you like

Origin blog.csdn.net/weixin_43848576/article/details/135145874