You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is really an issue with the chartist library itself.
In the updateChart method if an already existing instance of this.chartist is found, its update method is called, passing the responsiveOptions into the 3rd argument.
The problem is that the 3rd argument to the Chartist.Base class update method is
{Boolean} [override] If set to true, the passed options will be used to extend the options that have been configured already. Otherwise the chart default options will be used as the base
The result is that changing charts on the same page (as my app does) does not handle changes to the responsiveOptions.
I was able to work around this by creating a ChartistGraph child class and override the updateChart method using two alternatives..
//Method 1 - Undefined ChartistGraph's chartist reference immediately before calling its updateChart.
class ChartistGraphExt extends ChartistGraph {
updateChart(config) {
this.chartist = undefined;
return super.updateChart(config);
}
}
///Method 2 - set the this.chartist.responsiveOptions property directly
class ChartistGraphExt extends ChartistGraph {
updateChart(config) {
if (this.chartist) {
this.chartist.responsiveOptions = config.responsiveOptions || [];
}
return super.updateChart(config);
}
}
Both work, but each obviously has its drawbacks. I believe the proper fix for this would require changes to the chartist library and this wrapper. However if there's a consensus on the best way to fix in this library, I'd be happy to implement and put up a PR.
The text was updated successfully, but these errors were encountered:
This is really an issue with the chartist library itself.
In the updateChart method if an already existing instance of this.chartist is found, its update method is called, passing the responsiveOptions into the 3rd argument.
The problem is that the 3rd argument to the Chartist.Base class update method is
{Boolean} [override] If set to true, the passed options will be used to extend the options that have been configured already. Otherwise the chart default options will be used as the base
The result is that changing charts on the same page (as my app does) does not handle changes to the responsiveOptions.
I was able to work around this by creating a ChartistGraph child class and override the updateChart method using two alternatives..
Both work, but each obviously has its drawbacks. I believe the proper fix for this would require changes to the chartist library and this wrapper. However if there's a consensus on the best way to fix in this library, I'd be happy to implement and put up a PR.
The text was updated successfully, but these errors were encountered: