Closed Billy-Sheppard closed 8 months ago
The API looks exactly the way I would like it to 🚀 Thank you for supporting this!
Just one question, is it possible to make to_chart(self)
not self-consuming, i.e to_chart(&self)
? (btw, it also corresponds to self-convertion clippy lint)
Of course, in any case, we serialize the data and send it to JS, but this makes it possible to avoid some extra allocations, for example, if I just want to add new data points, without building a new dataset and/or cloning
Not critical though, provided API in the PR is totally enough for my use-cases, thanks 🙏
The reason its not &self
is to generally avoid having a version of the struct in rust out of sync with what was sent to the JS. E.g. in theory you should always run ChartExt::get() to get your chart every time you make a change, as things like render_mutate may or may not cause side effects after the fact. I suppose it should be into_chart()
to fit with clippy.
Makes sense to me
Example uses update on scatter chart.