Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
10.94k stars 775 forks source link

Add decimator support for chart mode="none" #1098

Closed arcanaxion closed 1 week ago

arcanaxion commented 5 months ago

Description Chart mode="none" is useful for stacked area charts, as shown in the docs. It would be great if decimators could be used with this mode.

Also, it seems that decimators do not recompute on zoom for mode="lines".

from taipy.gui import Gui
from taipy.gui.data import MinMaxDecimator
import pandas as pd
import numpy as np

N_OUT = 200
decimator = MinMaxDecimator(n_out=N_OUT, threshold=N_OUT)

n = 5000
df = pd.DataFrame({
    # "date": pd.date_range("2020-01-01", periods=n),
    "date": np.arange(n),
    "a": np.sin(np.linspace(0, 100, n)),
    "b": np.sin(np.linspace(0, 100, n)),
    "c": np.sin(np.linspace(0, 100, n)),
})
df1 = df
df2 = df
df3 = df

properties = {
    "x": "date",
    "y": ["a", "b", "c"],
    "decimator[1]": "decimator",
    "decimator[2]": "decimator",
    "decimator[3]": "decimator",
    "options": dict(stackgroup="first_group", fill="tonexty"),
}

page = """
<|{df1}|chart|properties=properties|mode=lines+markers|>

<|{df2}|chart|properties=properties|mode=lines|>

<|{df3}|chart|properties=properties|mode=none|>
"""

def on_change(state, var_name, var_value):
    print(var_name, type(var_value), var_value)

Gui(page).run(use_reloader=True)

Acceptance Criteria

jrobinAV commented 3 months ago

@dinhlongviolin1, you self-assigned this ticket. Should you move it to the sprint backlog? What are the priorities and the estimates?

jrobinAV commented 3 months ago

@dinhlongviolin1 If we want to implement it, we need to have a sampling algorithm working on all dimensions of the dataset.

github-actions[bot] commented 1 week ago

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.