Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the best way to dynamically update the data? #1

Open
tatachi1 opened this issue Jan 17, 2025 · 3 comments
Open

What is the best way to dynamically update the data? #1

tatachi1 opened this issue Jan 17, 2025 · 3 comments

Comments

@tatachi1
Copy link

If I use $state it will update the component and cause bad results

@spren9er
Copy link
Owner

You can use the data property from EChartsTile component and pass data directly (preferred way).

Alternatively, you need to update option property (including your chart data). For this, you can define your data as $state and declare option with $derived.

You can do some experiments with test app in this repo (svg/+page.svelte), e.g.

  • Remove data from scatterOption
  • Add some dynamic chartData
  • Use <EChartsTile option={scatterOption} data={chartData} />

@tatachi1
Copy link
Author

That's useful, but every update will have this warning, how to get rid of it ,I use setInterval() to update the data

Image

@spren9er
Copy link
Owner

Can you give an example? I can't reproduce this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants