apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.69k stars 19.62k forks source link

[Bug] The Candlestick/OHLC chart swaps "open" with "close" in the tooltips #20455

Closed eduardoejp closed 3 weeks ago

eduardoejp commented 4 weeks ago

Version

5.5.1

Link to Minimal Reproduction

https://codepen.io/eduardoejp/pen/bGXYQEq

Steps to Reproduce

Just created a candlestick chart using JavaScript. I got the data in question from Bitcoin's time-series. Noticed that prices increase in red candles and decrease in green candles, which is the opposite of what it should do.

I looked over the code in order to fix it and send a pull-request... but the code for the chart actually looks correct. I have no clue why there's a problem in the first place, so I can't suggest a solution. Perhaps I overlooked something.

Current Behavior

You set the "open", "close", "high" and "low" values for each data-point. The "high" and "low" values are correctly displayed in the tooltip for each data-point. But the "open" and "close" values are swapped.

Expected Behavior

You set the "open", "close", "high" and "low" values for each data-point. Each value is correctly displayed in the tooltip for each data-point.

Environment

- OS: Ubuntu Linux
- Browser: Both Firefox and Chromium
- Framework: No framework is being used.

Any additional comments?

If you zoom out and look at the tooltips of the aggregated candles, all the data in the tooltips is correctly placed.

This problem only occurs in the tooltips of the individual candles.

Ovilia commented 3 weeks ago

Not a bug. Read the doc at https://echarts.apache.org/en/option.html#series-candlestick

eduardoejp commented 3 weeks ago

@Ovilia

We use red to represent increasing and blue decreasing by default.

For someone accustomed to the western use of candlesticks, it never ocurred to me that different colors are used elsewhere. I just assumed that westeners copied the original japanese color scheme.

Thank you for taking a look at this and pointing me to the documentation. 🙏