Line plot and step plot draw wrong lines in output when changed via data[-1]
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 371
- Avg merge
- 26d 1h
- Merged PRs (30d)
- 1
Description
#### Wave SDK Version, OS
1.3.3 20240614125607
OpenSuSE Tumbleweed 20240613
#### Actual behavior
The plots produced by wave the wave plot_card type "line" and "step" produce in the output wrong lines from the first value to the new added value when using the online update of the data via card.data[-1] .

#### Expected behavior
The horizontal line should be missing.
#### Steps To Reproduce
The code to reproduce:
```python
from h2o_wave import main, app, Q, ui, data, run_on, on
import random
import time
@app('/')
async def serve(q: Q):
if not q.client.initialized:
q.page['example'] = ui.plot_card(
box='1 1 4 4',
title='Rate',
data=data('time rate', -100, rows= []),
plot=ui.plot([ui.mark(type='line', x='=time', y='=rate', y_min=0)])
)
q.client.initialized = True
await q.page.save()
await update_rates(q)
await q.page.save()
async def update_rates(q):
card = q.page['example']
i=100
while True:
card.data[-1] = [i, random.random()*100]
await q.page.save()
i=i+1
await q.sleep(0.1)
```
Can this be fixed somehow?
Thanks, Michael
Contributor guide
Research direction
Start by running the supplied Python reproduction through the serve and update_rates entry points, focusing on ui.plot_card and the card.data[-1] update. Compare the line and step plots after repeated updates and trace where the output lines are produced. Done means the horizontal line from the first value to the newly added value is absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100