-
Notifications
You must be signed in to change notification settings - Fork 128
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
stream data from server #134
Comments
Please share your |
I have this block of code that gets data from the server: and this block of code on refresh:
So no matter what i do, as long as there is a state being update on the page, even though its just the side menu drawer state the data on the charts resets. |
Try to call
|
Doesnt seem to help. Here are the version from my package.json file |
I don't think a re-rendering of the component is required here, so why don't you push the received data into the datasets and call |
I am also facing the same issue, whenever i am getting data from Websocket, live chart data starts from beginning, even after i am pushing the data into datasets and applying chart.update('quiet') does not working.. here is my options code:
|
Seems like even i am getting the same issue. I am updating the data set on button click. Every time the button is clicked the old data is lost and it plots from the latest value. `import React, { useRef, useState } from "react"; import "./App.css"; Chart.register(StreamingPlugin); function App() { const onUpdateData = (chart) => { Click here to update data <Line data={{ datasets: [ { label: "Dataset 1", backgroundColor: "rgba(255, 99, 132, 0.5)", borderColor: "rgb(255, 99, 132)", borderDash: [8, 4], fill: true, data: [], }, ], }} options={{ scales: { x: { type: "realtime", realtime: { duration: 20000, refresh: 1000, delay: 2000, onRefresh: onUpdateData, }, }, y: { title: { display: true, text: "Value", }, }, }, interaction: { intersect: false, }, }} /> ); } export default App; |
Yes, no matter what state changes on the page the chart resets. I still cant seem to figure it out.... |
is there any update on that matter ? |
Hello,
I have a server which send data over websockets. The client update a state of two variables.
When im trying to push this data to the chart inside onRefresh the chart's data resets since the date triggers re rendering of the page.
How can i solve this issue ?
The text was updated successfully, but these errors were encountered: