Avaiga / taipy

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

[DOCS] Improve decimator for datetime axis or improve documentation #2285

Open FlorianJacta opened 2 days ago

FlorianJacta commented 2 days ago

Issue Description

The documentation should explain how to make the decimator work with datetime if using datetime is possible. This is either documentation or an issue to improve Taipy.

Right now, the decimation is behaving in a strange way without any good feedback for the user.

from datetime import datetime

import numpy as np
import pandas as pd

from taipy.gui import Gui
import taipy.gui.builder as tgb
from taipy.gui.data.decimator import MinMaxDecimator

x_values = np.linspace(1, 100, 50000)
y_values = np.log(x_values) * np.sin(x_values / 5)
noise_mask = np.random.rand(*y_values.shape) < 0.01
noise_values = np.random.uniform(-0.5, 0.5, size=np.sum(noise_mask))
y_values_noise = np.copy(y_values)
y_values_noise[noise_mask] += noise_values

data = pd.DataFrame({"X": x_values, "Y": y_values_noise})
data["X"] = pd.to_timedelta(data["X"], unit="s") + datetime.now()

decimator = MinMaxDecimator(200)

if __name__ == "__main__":
    with tgb.Page() as page:
        tgb.chart("{data}", type="markers", x="X", y="Y", decimator=decimator)

    gui = Gui(page=page)
    gui.run()

Code of Conduct

Acceptance Criteria

Kritika75 commented 13 hours ago

Hey @FlorianJacta,

I’d love to work on this issue! Could you please assign it to me?

A little about me - I’m Kritika, a programmer skilled in HTML, CSS, JavaScript, Python, Django, and Kotlin. I was a top performer in GirlScript Summer of Code 2024, securing rank 58 out of 60,000 participants. During the program, I made 38 pull requests and earned 8 badges