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

[Bug] encode y: [a,b] does not behave as expected #20521

Open
drush opened this issue Nov 15, 2024 · 4 comments
Open

[Bug] encode y: [a,b] does not behave as expected #20521

drush opened this issue Nov 15, 2024 · 4 comments
Labels
en This issue is in English support topic: custom

Comments

@drush
Copy link

drush commented Nov 15, 2024

Version

5.5.1

Link to Minimal Reproduction

echarts Editor

Steps to Reproduce

  1. E has [timestamp, min, max and avg]
  2. Plot avg as line (this works)
  3. Plot min, max as area 'range' that should be plotted to 'float' above the x-axis

Current Behavior

encode: { y: [min, max] } anchors to y=0, is the x-axis rather than floating above.

Expected Behavior

the area should be plotted in the range from min to max, rather than from 0 to min.

Environment

- OS: any
- Browser: chrome
- Framework: NA

Any additional comments?

No response

@drush drush added the bug label Nov 15, 2024
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels Nov 15, 2024
@drush
Copy link
Author

drush commented Nov 15, 2024

screenshot-Examples - Apache ECharts-Safari-2024-11-15

@helgasoft
Copy link

helgasoft commented Nov 15, 2024

not-a-bug, here is one way of displaying a confidence band - Demo
📌 please close issue if problem solved.

@drush
Copy link
Author

drush commented Nov 15, 2024

@helgasoft I appreciate your proposed workaround, but it is not a complete solution and I still believe this is a bug for these reasons:

  • Your approach essentially 'paints over' the bottom portion which may get close to the visual effect desried, but also changes the semantics of the chart itself.
  • This approach does not allow for multiple series to be plotted. The 'paint over' area would overlap all series.
  • The docs allow for y: [a,b] as an exceptable syntax. If the y param cannot in fact handle or do anything with an array, then it should throw an error in this case.

An ideal solution may allow you to specify the line and area in a single series configuration, as opposed to the 2 above, for example. :

option = {
  dataset: {
    source: data
  },
  xAxis: { type: 'category' },
  yAxis: { type: 'value' },
  series: [
    {
      type: 'line',
      encode: { x: 0, y: [3, 1, 2] }, // specify line first, then upper, lower bounds of area
      name: 'Min-Max Range',
      areaStyle: { opacity: 0.25 }, // Enable area fill
      lineStyle: { opacity: 1 }, // show the avg line
      symbol: 'none'
    }
  ]
};

The best alternative we've been able to utilize thus far is plotting data points as a scatter and then showing the average through line as 2 series. This is not our preferred format however, 'confidence bands' would be better.

@Ovilia
Copy link
Contributor

Ovilia commented Nov 18, 2024

You may need to wait until v6.0 releases so that you can use the new lineRange custom series. It's expected to be released around Feb 2025. Before that, you can refer to its source code to write your own custom series if you wish.

@Ovilia Ovilia added support topic: custom and removed bug pending We are not sure about whether this is a bug/new feature. labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English support topic: custom
Projects
None yet
Development

No branches or pull requests

3 participants