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

[🐛 BUG] Chart disappears after a change #1339

Closed FlorianJacta closed 3 months ago

FlorianJacta commented 3 months ago

What went wrong? 🤔

When a chart is changed/updated, the chart disappears.

Expected Behavior

The charts should not disappear.

Steps to Reproduce Issue

Run the code below and change the slider value. The chart disappears.

from taipy.gui import Gui
from math import cos, exp

value = 10

page = """
# Taipy *Getting Started*

Value: <|{value}|text|>

<|{value}|slider|on_change=on_slider|>

<|{data}|chart|>
"""

def on_slider(state):
    state.data = compute_data(state.value)

def compute_data(decay:int)->list:
    return [cos(i/6) * exp(-i*decay/600) for i in range(100)]

data = compute_data(value)

Gui(page).run(title="Frontend Demo")

image

Solution Proposed

No response

Screenshots

No response

Runtime Environment

No response

Browsers

Chrome

OS

Windows

Version of Taipy

develop-5/30/2024

Additional Context

No response

Acceptance Criteria

Code of Conduct

arcanaxion commented 3 months ago

I opened an issue for this in #1064.

I also noticed this:

This bug is not present when installing the latest release (3.1.1) from whl. But it is still present if I build from the 3.1.1 source commit. Any ideas? Node version: v20.12.1

FredLL-Avaiga commented 3 months ago

It looks like it might be caused by the latest version of plotly.js...

FlorianJacta commented 3 months ago

@arcanaxion I did not have this problem a few weeks ago installing from develop

FredLL-Avaiga commented 3 months ago

If you install from develop and reinstall all the npm dependencies you'll get the latest plotly.js which brings this unwanted behavior :-(