react-chartjs icon indicating copy to clipboard operation
react-chartjs copied to clipboard

new feature support: stream chart

Open yuqkevin opened this issue 9 years ago • 0 comments

Hi there,

I'm working on a dashboard project and find that react-chartjs does not support stream chart which chart.js does by addData() and removeData(). So I just added couple lines into react-chartjs core.js to support this feature. I've tested changes on dev environment and it just works.

The component jsx looks like this: <LineChart data={this.state.chartData} options={this.state.chartOptions} width={500} height={200} stream />

The nextPoints is a json object under chartData with values and label like this (2-lines in example): chartData: { labels: [...], datasets: [{ ... }, { ... }], nextPoints: { values: [<val1>, <val2>], label: <newLabel> } }

I really appreciate it if you can take a quick review.

Thanks, Kevin

yuqkevin avatar Nov 23 '16 18:11 yuqkevin