Megabit/Blazorise

Live data charts

Flearz opened this issue · 11 comments

Hello,
I got a server constantly calculating a sine wave, and I would like to represent it using a chart that would be updating in "real-time". I get my values by making constant http requests. Do you think it would be possible with blazorise ? Thanks for you job you're awesome.

Do you mean something like this https://nagix.github.io/chartjs-plugin-streaming/ ?

Yeah exactly, but I don't want to use pure JS in my project :)

For now you can just update dataset manually every n seconds. Although that would look pretty weird every time it updates.

I need to see how to handle third-party plugins for chartjs.

Thank, hope it will be successful.

@stsrki 你很棒!

Hi, is it possible to instead of refreshing the data every X seconds, add data as the api request comes in ?

Yes, you can use AddData or SetData methods on the chart.

But when I do, the dots are not linked by a line.

Thats what I use, my data is coming from SignalR. I made work by timing the refresh and the incoming data. But I would prefer to each time a data comes in, it is added to the chart. When I try to use AddData() and Update(), the dots are not linked.
image

It looks to me like chart options are not properly configured. Look at these

chartjs/Chart.js#800
https://www.chartjs.org/docs/latest/charts/line.html