Open AlexandreSajus opened 4 months ago
I believe you have to index the decimator
property when you have multiple traces: https://docs.taipy.io/en/latest/manuals/gui/viselements/chart/#p-decimator
page = """
<|{data}|chart|x=Time|y[1]=A|y[2]=B|decimator[1]=decimator_instance|decimator[2]=decimator_instance|>
"""
I initially couldn't get the decimator to work for your example even after the modification I made, and lowering NOP to 10. Seems like even when Decimator.threshold=None
, there's still some threshold before the decimator kicks in. Maybe the devs can shed more light on this.
In the meantime, explicitly setting threshold to NOP seems to work:
from taipy.gui import Gui
from taipy.gui.data.decimator import MinMaxDecimator
import pandas as pd
import numpy as np
NOP = 10
decimator_instance = MinMaxDecimator(n_out=NOP, threshold=NOP)
data = pd.DataFrame(
{
"Time": np.arange(0, 10, 0.1),
"A": np.arange(0, 10, 0.1) + np.random.randn(100) + 10,
"B": np.arange(0, 10, 0.1) + np.random.randn(100),
}
)
page = """
<|{data}|chart|x=Time|y[1]=A|y[2]=B|decimator[1]=decimator_instance|decimator[2]=decimator_instance|>
"""
Gui(page).run()
Thanks finding the workaround, this does indeed seem to work properly. We should definitely still look at this, having to explicitely set the threshold does not make sense from the user's perspective
This issue has been labelled as "🥶Waiting for contributor" because it has been inactive for more than 14 days. If you would like to continue working on this issue, please add another comment or create a PR that links to this issue. If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. Otherwise, you will be unassigned in 14 days. For more information please refer to the contributing guidelines.
This issue has been unassigned automatically because it has been marked as "🥶Waiting for contributor" for more than 14 days with no activity.
The decimator should work with multiple traces in a line chart
Without decimator:
With decimator:
Code: