echarts [Bug] Using Line chart type,legend throw error out.

2skhul33  于 5个月前  发布在  Echarts
关注(0)|答案(2)|浏览(46)

Version

5.4.0

Reproduction Link

Steps to Reproduce

version 5.4.0

Current Behavior

echarts.js:1591 Uncaught TypeError: Cannot read properties of undefined (reading 'type')
at LineView2.render (LineView.js:567:36)
at Task2.progress (Chart.js:233:20)
at Task2._doProgress (task.js:187:10)
at Task2.perform (task.js:153:16)
at echarts.js:1825:24
at GlobalModel2. (Global.js:654:10)
at Array.forEach ()
at each (util.js:205:13)
at GlobalModel2.eachSeries (Global.js:651:5)
at renderSeries (echarts.js:1813:15)

Expected Behavior

I can't do anything in legend except scroll buttons

Environment

- OS:mac
- Browser:chrome
- Framework:none

Any additional comments?

option = {
    "grid": {
        "top": 16,
        "right": 160,
        "bottom": 24,
        "left": 60
    },
    "legend": {
        "show": true,
        "orient": "vertical",
        "type": "scroll",
        "animationDurationUpdate": 160,
        "right": 0,
        "selected": {
            "举报监控1线": true,
            "举报监控2线": false,
            "举报监控3线": false,
            "举报监控4线": false,
            "举报监控5线": false,
            "举报监控6线": false,
            "举报监控7线": false,
            "举报监控8线": false,
            "举报监控1线-前一日": true,
            "举报监控2线-前一日": true,
            "举报监控3线-前一日": true,
            "举报监控4线-前一日": true,
            "举报监控5线-前一日": true,
            "举报监控6线-前一日": true,
            "举报监控7线-前一日": true,
            "举报监控8线-前一日": true,
            "举报监控1-预警": true,
            "举报监控2-预警": true,
            "举报监控3-预警": true,
            "举报监控4-预警": true,
            "举报监控5-预警": true,
            "举报监控6-预警": true,
            "举报监控7-预警": true,
            "举报监控8-预警": true
        },
        "data": [
            {
                "name": "举报监控1线"
            },
            {
                "name": "举报监控2线"
            },
            {
                "name": "举报监控3线"
            },
            {
                "name": "举报监控4线"
            },
            {
                "name": "举报监控5线"
            },
            {
                "name": "举报监控6线"
            },
            {
                "name": "举报监控7线"
            },
            {
                "name": "举报监控8线"
            }
        ]
    },
    "xAxis": [
        {
            "type": "time",
            "axisLabel": {
                "color": "#5F6063",
                "fontSize": 12
            },
            "axisTick": {
                "show": false
            },
            "axisLine": {
                "lineStyle": {
                    "color": "#C8C9CC"
                }
            }
        }
    ],
    "yAxis": [
        {
            "axisLabel": {
                "color": "#5F6063",
                "fontSize": 12
            },
            "splitLine": {
                "lineStyle": {
                    "type": "dashed"
                }
            },
            "type": "value"
        }
    ],
    "series": [
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控1线",
            "itemStyle": {
                "color": "#3491FA"
            },
            "data": [
                [
                    1646150400000,
                    43598
                ],
                [
                    1646154000000,
                    80655
                ],
                [
                    1646157600000,
                    42300
                ],
                [
                    1646161200000,
                    74783
                ],
                [
                    1646164800000,
                    48897
                ],
                [
                    1646168400000,
                    13850
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控2线",
            "itemStyle": {
                "color": "#14C9C9"
            },
            "data": [
                [
                    1646150400000,
                    53096
                ],
                [
                    1646154000000,
                    82320
                ],
                [
                    1646157600000,
                    13959
                ],
                [
                    1646161200000,
                    15822
                ],
                [
                    1646164800000,
                    29189
                ],
                [
                    1646168400000,
                    76236
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控3线",
            "itemStyle": {
                "color": "#00B42A"
            },
            "data": [
                [
                    1646150400000,
                    72094
                ],
                [
                    1646154000000,
                    86553
                ],
                [
                    1646157600000,
                    60285
                ],
                [
                    1646161200000,
                    49645
                ],
                [
                    1646164800000,
                    47203
                ],
                [
                    1646168400000,
                    27309
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控4线",
            "itemStyle": {
                "color": "#9FDB1D"
            },
            "data": [
                [
                    1646150400000,
                    34913
                ],
                [
                    1646154000000,
                    95583
                ],
                [
                    1646157600000,
                    6330
                ],
                [
                    1646161200000,
                    705
                ],
                [
                    1646164800000,
                    11534
                ],
                [
                    1646168400000,
                    19314
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控5线",
            "itemStyle": {
                "color": "#FADC19"
            },
            "data": [
                [
                    1646150400000,
                    60066
                ],
                [
                    1646154000000,
                    3784
                ],
                [
                    1646157600000,
                    87573
                ],
                [
                    1646161200000,
                    94298
                ],
                [
                    1646164800000,
                    48674
                ],
                [
                    1646168400000,
                    51378
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控6线",
            "itemStyle": {
                "color": "#FF7D00"
            },
            "data": [
                [
                    1646150400000,
                    32353
                ],
                [
                    1646154000000,
                    71825
                ],
                [
                    1646157600000,
                    60284
                ],
                [
                    1646161200000,
                    33771
                ],
                [
                    1646164800000,
                    96328
                ],
                [
                    1646168400000,
                    86376
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控7线",
            "itemStyle": {
                "color": "#F53F3F"
            },
            "data": [
                [
                    1646150400000,
                    56096
                ],
                [
                    1646154000000,
                    49415
                ],
                [
                    1646157600000,
                    17815
                ],
                [
                    1646161200000,
                    6051
                ],
                [
                    1646164800000,
                    39671
                ],
                [
                    1646168400000,
                    66010
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控8线",
            "itemStyle": {
                "color": "#722ED1"
            },
            "data": [
                [
                    1646150400000,
                    76293
                ],
                [
                    1646154000000,
                    27485
                ],
                [
                    1646157600000,
                    81845
                ],
                [
                    1646161200000,
                    7956
                ],
                [
                    1646164800000,
                    86984
                ],
                [
                    1646168400000,
                    17409
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "lineStyle": {
                "type": "dashed"
            },
            "name": "举报监控1线-前一日",
            "itemStyle": {
                "color": "#3491FA"
            },
            "data": [
                [
                    1646150400000,
                    82678
                ],
                [
                    1646154000000,
                    85872
                ],
                [
                    1646157600000,
                    78249
                ],
                [
                    1646161200000,
                    84027
                ],
                [
                    1646164800000,
                    88403
                ],
                [
                    1646168400000,
                    42504
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "lineStyle": {
                "type": "dashed"
            },
            "name": "举报监控2线-前一日",
            "itemStyle": {
                "color": "#14C9C9"
            },
            "data": [
                [
                    1646150400000,
                    80599
                ],
                [
                    1646154000000,
                    71581
                ],
                [
                    1646157600000,
                    23339
                ],
                [
                    1646161200000,
                    24612
                ],
                [
                    1646164800000,
                    74124
                ],
                [
                    1646168400000,
                    79979
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "lineStyle": {
                "type": "dashed"
            },
            "name": "举报监控3线-前一日",
            "itemStyle": {
                "color": "#00B42A"
            },
            "data": [
                [
                    1646150400000,
                    65508
                ],
                [
                    1646154000000,
                    71837
                ],
                [
                    1646157600000,
                    59574
                ],
                [
                    1646161200000,
                    18915
                ],
                [
                    1646164800000,
                    9332
                ],
                [
                    1646168400000,
                    92060
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "lineStyle": {
                "type": "dashed"
            },
            "name": "举报监控4线-前一日",
            "itemStyle": {
                "color": "#9FDB1D"
            },
            "data": [
                [
                    1646150400000,
                    82256
                ],
                [
                    1646154000000,
                    92162
                ],
                [
                    1646157600000,
                    1160
                ],
                [
                    1646161200000,
                    61541
                ],
                [
                    1646164800000,
                    63299
                ],
                [
                    1646168400000,
                    8568
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "lineStyle": {
                "type": "dashed"
            },
            "name": "举报监控5线-前一日",
            "itemStyle": {
                "color": "#FADC19"
            },
            "data": [
                [
                    1646150400000,
                    6287
                ],
                [
                    1646154000000,
                    42557
                ],
                [
                    1646157600000,
                    61508
                ],
                [
                    1646161200000,
                    20122
                ],
                [
                    1646164800000,
                    32276
                ],
                [
                    1646168400000,
                    88950
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "lineStyle": {
                "type": "dashed"
            },
            "name": "举报监控6线-前一日",
            "itemStyle": {
                "color": "#FF7D00"
            },
            "data": [
                [
                    1646150400000,
                    850
                ],
                [
                    1646154000000,
                    30781
                ],
                [
                    1646157600000,
                    7618
                ],
                [
                    1646161200000,
                    48103
                ],
                [
                    1646164800000,
                    60910
                ],
                [
                    1646168400000,
                    78382
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "lineStyle": {
                "type": "dashed"
            },
            "name": "举报监控7线-前一日",
            "itemStyle": {
                "color": "#F53F3F"
            },
            "data": [
                [
                    1646150400000,
                    64969
                ],
                [
                    1646154000000,
                    80990
                ],
                [
                    1646157600000,
                    2154
                ],
                [
                    1646161200000,
                    46017
                ],
                [
                    1646164800000,
                    79549
                ],
                [
                    1646168400000,
                    87259
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "lineStyle": {
                "type": "dashed"
            },
            "name": "举报监控8线-前一日",
            "itemStyle": {
                "color": "#722ED1"
            },
            "data": [
                [
                    1646150400000,
                    29568
                ],
                [
                    1646154000000,
                    69111
                ],
                [
                    1646157600000,
                    42090
                ],
                [
                    1646161200000,
                    41043
                ],
                [
                    1646164800000,
                    51447
                ],
                [
                    1646168400000,
                    26474
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控1-预警",
            "itemStyle": {
                "color": "#FF0000"
            },
            "data": [
                [
                    1646150400000,
                    14549
                ],
                [
                    1646154000000,
                    32377
                ],
                [
                    1646157600000,
                    31587
                ],
                [
                    1646161200000,
                    98009
                ],
                [
                    1646164800000,
                    75883
                ],
                [
                    1646168400000,
                    23586
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控2-预警",
            "itemStyle": {
                "color": "#FF0000"
            },
            "data": [
                [
                    1646150400000,
                    61074
                ],
                [
                    1646154000000,
                    84901
                ],
                [
                    1646157600000,
                    76919
                ],
                [
                    1646161200000,
                    11275
                ],
                [
                    1646164800000,
                    95853
                ],
                [
                    1646168400000,
                    13427
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控3-预警",
            "itemStyle": {
                "color": "#FF0000"
            },
            "data": [
                [
                    1646150400000,
                    32882
                ],
                [
                    1646154000000,
                    78418
                ],
                [
                    1646157600000,
                    61274
                ],
                [
                    1646161200000,
                    19552
                ],
                [
                    1646164800000,
                    31794
                ],
                [
                    1646168400000,
                    42736
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控4-预警",
            "itemStyle": {
                "color": "#FF0000"
            },
            "data": [
                [
                    1646150400000,
                    70919
                ],
                [
                    1646154000000,
                    7570
                ],
                [
                    1646157600000,
                    29931
                ],
                [
                    1646161200000,
                    36557
                ],
                [
                    1646164800000,
                    3302
                ],
                [
                    1646168400000,
                    68369
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控5-预警",
            "itemStyle": {
                "color": "#FF0000"
            },
            "data": [
                [
                    1646150400000,
                    28921
                ],
                [
                    1646154000000,
                    76956
                ],
                [
                    1646157600000,
                    33867
                ],
                [
                    1646161200000,
                    82283
                ],
                [
                    1646164800000,
                    17142
                ],
                [
                    1646168400000,
                    83946
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控6-预警",
            "itemStyle": {
                "color": "#FF0000"
            },
            "data": [
                [
                    1646150400000,
                    11196
                ],
                [
                    1646154000000,
                    85477
                ],
                [
                    1646157600000,
                    16724
                ],
                [
                    1646161200000,
                    32621
                ],
                [
                    1646164800000,
                    8354
                ],
                [
                    1646168400000,
                    96175
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控7-预警",
            "itemStyle": {
                "color": "#FF0000"
            },
            "data": [
                [
                    1646150400000,
                    47161
                ],
                [
                    1646154000000,
                    74459
                ],
                [
                    1646157600000,
                    27815
                ],
                [
                    1646161200000,
                    30169
                ],
                [
                    1646164800000,
                    72703
                ],
                [
                    1646168400000,
                    14523
                ]
            ]
        },
        {
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "type": "line",
            "smooth": true,
            "showSymbol": false,
            "name": "举报监控8-预警",
            "itemStyle": {
                "color": "#FF0000"
            },
            "data": [
                [
                    1646150400000,
                    16950
                ],
                [
                    1646154000000,
                    75731
                ],
                [
                    1646157600000,
                    54834
                ],
                [
                    1646161200000,
                    64849
                ],
                [
                    1646164800000,
                    83022
                ],
                [
                    1646168400000,
                    13854
                ]
            ]
        }
    ]
}
wmtdaxz3

wmtdaxz31#

@lszgit241 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED

TITLE

[Bug] used

hgqdbh6s

hgqdbh6s2#

I ran your demo but found no errors.

相关问题