Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ctc1995 opened this issue Mar 8, 2019 · 8 comments
Closed

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

ctc1995 opened this issue Mar 8, 2019 · 8 comments
Labels
pending We are not sure about whether this is a bug/new feature. stale Inactive for a long time. Will be closed in 7 days.

Comments

@ctc1995
Copy link

ctc1995 commented Mar 8, 2019

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

@echarts-bot
Copy link

echarts-bot bot commented Mar 8, 2019

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

Have a nice day! 🍵

@echarts-bot echarts-bot bot added bug pending We are not sure about whether this is a bug/new feature. waiting-for-help labels Mar 8, 2019
@ctc1995
Copy link
Author

ctc1995 commented Mar 13, 2019

@pissang 你好!请问一下,这个是什么原因呢?

@ctc1995
Copy link
Author

ctc1995 commented Mar 22, 2019

@pissang 非常抱歉,我没有将错误贴出来。
image
报这个错误,你看是否有帮助。
我代码中的markArea是这样的。

markArea: {
  silent: true,
  data: [
    [
      { name: '平均值到最大值', type: 'average' },
      { type: 'max' }
    ],
    [
      { name: '两个坐标之间的标域', coord: [10, 20] },
      { coord: [20, 30] }
    ],
    [
      { name: '60分到80分', yAxis: 60 },
      { yAxis: 80 }
    ],
    [
      { name: '所有数据范围区间', coord: ['min', 'min'] },
      { coord: ['max', 'max'] }
    ],
    [
      {
        name: '两个屏幕坐标之间的标域',
        x: 100,
        y: 100
      }, {
        x: '90%',
        y: '10%'
      }
    ]
  ]
}

@ctc1995
Copy link
Author

ctc1995 commented Mar 22, 2019

@pissang 非常抱歉,我没有将错误贴出来。
image
报这个错误,你看是否有帮助。
我代码中的markArea是这样的。

markArea: {
  silent: true,
  data: [
    [
      { name: '平均值到最大值', type: 'average' },
      { type: 'max' }
    ],
    [
      { name: '两个坐标之间的标域', coord: [10, 20] },
      { coord: [20, 30] }
    ],
    [
      { name: '60分到80分', yAxis: 60 },
      { yAxis: 80 }
    ],
    [
      { name: '所有数据范围区间', coord: ['min', 'min'] },
      { coord: ['max', 'max'] }
    ],
    [
      {
        name: '两个屏幕坐标之间的标域',
        x: 100,
        y: 100
      }, {
        x: '90%',
        y: '10%'
      }
    ]
  ]
}

造成报错的原因是如下代码:

[
      {
        name: '两个屏幕坐标之间的标域',
        x: 100,
        y: 100
      }, {
        x: '90%',
        y: '10%'
      }
    ]

@bubblegreen
Copy link

遇到相同的问题~

@JasonBoy
Copy link

用funnel图的时候一样的问题,好像必须加coord属性,
BTW: markArea能支持制定任意多的点么,而不是只有左上角跟右下角?

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

@github-actions github-actions bot added the stale Inactive for a long time. Will be closed in 7 days. label Mar 26, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 3, 2022

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending We are not sure about whether this is a bug/new feature. stale Inactive for a long time. Will be closed in 7 days.
Projects
None yet
Development

No branches or pull requests

4 participants