问题
I need to update option in the chart and I need to show the chart with new option. I WANT that the chart IS NOT RELOAD this is my ts.
@ViewChild(BaseChartDirective) chart: any;
lineChartOptions: any = {
responsive: true,
zoom:{
// Boolean to enable zooming
enabled: false,
sensitivity: 0.5,
// Enable drag-to-zoom behavior
drag: true,
// Zooming directions. Remove the appropriate direction to disable
// Eg. 'y' would only allow zooming in the y direction
mode: 'xy',
rangeMin: {
// Format of min zoom range depends on scale type
x: null,
y: null
},
rangeMax: {
// Format of max zoom range depends on scale type
x: null,
y: null
}
}
Now when an external event becames and I need to chage option and active zoom:
handleExternalEvent(){
this.lineChartOptions.zoom.enabled=true;
this.chart.chart.update();
}
The problem is update doesn't work. If I do "this.chart.refresh()" the new chart with new options it reloaded but, I don't want reload chart. ANyone can help me?
来源:https://stackoverflow.com/questions/53171508/how-update-option-without-reload-chart-ng2-chart