[๐ BUG] Decimator does not work in candlestick charts (and should it?)
What went wrong? ๐ค
One of the only reasons I would use default taipy charts instead of Plotly figures is the decimator.
BUT the decimator is not only situational but also rarely works:
1 - The doc uses decimator like this decimator={decimator} and this does not work, decimator=decimator is the only syntax that works
2 - Candlesticks charts, maybe the only use case for decimator, don't work with decimators. Try this example:
import yfinance
from taipy.gui import Gui
from taipy.gui.data import MinMaxDecimator
import taipy.gui.builder as tgb
# Extraction of a month of stock data for AAPL using the
# yfinance package (see https://pypi.org/project/yfinance/).
ticker = yfinance.Ticker("AAPL")
# The returned value is a Pandas DataFrame.
stock = ticker.history(interval="1d", start="1990-01-01", end="2024-01-01")
# Copy the DataFrame's index to a new column
stock["Date"] = stock.index
decimator = MinMaxDecimator(500)
with tgb.Page() as page:
tgb.chart(
"{stock}",
type="candlestick",
x="Date",
open="Open",
close="Close",
low="Low",
high="High",
decimator="decimator",
)
Gui(page).run()
This issue is part of a bigger issue of: we should not support tgb.chart anymore as it offers no benefits compared to tgb.chart(figure=plt.Figure())
Version of Taipy
4.0.1
Acceptance Criteria
- [ ] A unit test reproducing the bug is added.
- [ ] Any new code is covered by a unit tested.
- [ ] Check code coverage is at least 90%.
- [ ] The bug reporter validated the fix.
- [ ] Related issue(s) in taipy-doc are created for documentation and Release Notes are updated.
Code of Conduct
- [X] I have checked the existing issues.
- [ ] I am willing to work on this issue (optional)
Candlestick is a very niche type. We can calculate the whole candlestick data beforehand on the backend and send the compiled candlestick data to the frontend without losing any data points. Not sure if we should support this one specifically but if more request come we could potentially add it. @FabienLelaquais, any thoughts?
1 - The doc uses decimator like this decimator={decimator} and this does not work, decimator=decimator is the only syntax that works
This has stumped me before. Could someone chime in if this is a taipy or documentation issue?
Candlestick charts is a great use case where decimators make sense, but dramatically impacts the way they are applied at this point. We plan to open the decimator API, and applying this to candlesticks is an excellent example to demonstrate the feature.