Skip to content

柱状图的markArea属性通过x和y设置标记区域报错 #7055

@xiaobao66

Description

@xiaobao66

One-line summary [问题简述]

当在柱状图通过markArea属性设置绘制区域时,如果通过x和y属性设置绘制面积,程序会报错,提示Cannot read property '0' of undefined
at markAreaTransform (MarkAreaView.js:23)

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 3.8.5
  • Browser version [浏览器类型和版本]:
  • OS Version [操作系统类型和版本]:

Expected behaviour [期望结果]

能够通过x和y属性绘制标记区域

ECharts option [ECharts配置项]

option = {
    title: {
        show: true,
        text: 'echarts demo'
    },
    legend: {
        show: true,
        formatter: function(item) {
            return `${item}`
        },
        data: [{
            name: '访问量'
        }]
    },
    grid: {
        show: true
    },
    xAxis: {
        type: 'category',
        boundaryGap: true,
        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
    },
    yAxis: {
        type: 'value',
        axisLabel: {
            formatter: '{value}'
        }
    },
    tooltip: {
        show: true,
        trigger: 'axis'
    },
    toolbox: {
        show: true,
        feature: {
            saveAsImage: {}
        }
    },
    series: [{
        name: '访问量',
        type: 'bar',
        data: [10, 52, 200, 334, 390, 330, 220],
        markArea: {
            label: {
                normal: {
                    show: true
                }
            },
            data: [
                [{
                    name: 'set a area',
                    x: 50,
                    y: 100
                }, {
                    x: 80,
                    y: 200
                }]
            ]
        }
    }]
}

Other comments [其他信息]

https://jsfiddle.net/xiaobao/97nm56yg/
可以查看控制台,上面有报错信息

Metadata

Metadata

Assignees

No one assigned

    Labels

    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