[Angular]How do I control the refresh timing with input binding other than with the numeric value
See original GitHub issue@Input() a
...
this.chartObj = new Chart(this.el.nativeElement.getContext('2d'), {
...
options: {
plugins: {
streaming: {
refresh: 1000, // onRefresh callback will be called every 1s
onRefresh: (chart: Chart) => {
// something
}
}
}
}
});
With the above snippet, I’d like to control the refresh the chart when I get the new input data a
but apparently, the datasets only get updated every 1s.
I’ve tried using ngOnChanges
cycle, pushing the new data to the datasets and update the chart instance but it didn’t seem to work.
this.chartObj.config.data.datasets.push({
// label: 'Dataset ' + config.data.datasets.length,
// backgroundColor: color(newColor).alpha(0.5).rgbString(),
// borderColor: newColor,
fill: false,
lineTension: 0,
data
});
this.chartObj.update();
What am I missing?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Property binding best practices - Angular
Use the syntax for template expressions to help avoid side effects. In general, the correct syntax prevents you from assigning a value to...
Read more >Angular 2 - [(ngModel)] not updating after [value] changes
1. The ngModelChange thing doesn't work either. It's really weird because the value in the input GETS UPDATED, but not the expression {{product....
Read more >The "value" binding - Knockout.js
If this parameter is an observable value, the binding will update the element's value whenever the value changes. If the parameter isn't observable,...
Read more >ngRepeat - AngularJS: API
When DOM elements are re-used, ngRepeat updates the scope for the element, which will automatically update any active bindings on the template. However,...
Read more >Understanding Angular property binding and interpolation
String Interpolation · No visible side effects: The expression shouldn't attempt to modify the application's state in any way; it is only allowed ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you are using strict type checking, run
npm install @types/chart.js
and use the following code:A timestamp (for example,
Date.now()
) must be set tox
property even if you don’t need to show the x-axis labels. To hide the x-axis labels, use the following code: