Avaiga / taipy

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

Possibility to use decimator on Plotly charts #1515

Closed FlorianJacta closed 1 month ago

FlorianJacta commented 3 months ago

Description

The goal would be to allow users to use the decimator alongside Plotly charts.

import yfinance as yf
from taipy.gui import Gui
from taipy.gui.data.decimator import MinMaxDecimator, RDP, LTTB

df_AAPL = yf.Ticker("AAPL").history(interval="1d", period = "max")
df_AAPL["DATE"] = df_AAPL.index.astype('int64').astype(float)

n_out = 50
decimator_instance = MinMaxDecimator(n_out=n_out)

decimate_data_count = len(df_AAPL)

import plotly.express as px

fig = px.line(df_AAPL, x="DATE", y="Open", markers=True)

page = """
# Decimator

From a data length of <|{len(df_AAPL)}|> to <|{n_out}|>

## Without decimator

<|chart|figure={fig}|>

## With decimator

<|chart|figure={fig}|decimator=decimator_instance|>
"""

gui = Gui(page)
gui.run(port=5026, title="Decimator")

Acceptance Criteria

Code of Conduct

dinhlongviolin1 commented 2 months ago

We wont be applying directly for the fig. But, we might expose the decimator so the user can apply it themselves.

FlorianJacta commented 2 months ago

What do you mean?

dinhlongviolin1 commented 2 months ago

it is an on going PR but you will get it soon enough with a proper API unnamed unnamed-2

FlorianJacta commented 2 months ago

Great news!