Skip to content

在柱状图中设置markArea报错 #10074

@ctc1995

Description

@ctc1995

Version

2.0

Steps to reproduce

option = {
    xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
        type: 'value'
    },
    series: [{
        data: [120, 200, 150, 80, 70, 110, 130],
        type: 'bar',
        markLine: {
            symbol: 'none',
            lineStyle: {
                color: 'blue',
                type: 'solid',
                width: 4,
            },
            data: [
                    [{
                        x: '20%',
                        y: '42.5%'
                    },
                    {
                        x: '22.6%',
                        y: '11.4%'
                    }],
                    [{
                        x: '31.8%',
                        y: '11.4%'
                    },
                    {
                        x: '34%',
                        y: '31%'
                    }], // 自己去计算百分比
                ]
        },
        markArea: {
            data: [
                [
                    {
                        x: '20%',
                        y: '42.5%'
                    },
                    {
                        x: '22.6%',
                        y: '11.4%'
                    }
                ]
            ]
        }
    }]
};

这段代码,在运行时会报如下错误:
Cannot read property '0' of undefined
我想要用echarts绘制一个带有连接线的柱状图。我通过markLine可以绘制连接线,但是我需要在连接区域写样式,并且加入一些标签说明。当我定义markArea时发生了上述报错。
请问我该如何设置markArea?

What is expected?

期望获得一个梯形区域

What is actually happening?

报错!
Cannot read property '0' of undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingWe are not sure about whether this is a bug/new feature.staleInactive for a long time. Will be closed in 7 days.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions