Updating chart inside 'created' event listener
See original GitHub issueI’m trying to amend the top padding of my chart in a plugin inside the ‘created’ event listener but update() does not seem to work.
Here’s some code:
function myPlugin(options) {
return function myPlugin(chart) {
var theChart = chart;
chart.on('created', function (data) {
theChart.options.chartPadding.top = 160;
theChart.update();
});
};
}
The property is updated ok, but there is no visual update - Any ideas?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
JavaScript: Add Event Listener to an Event Listener
I have a onClick function defined for the chart which changes the data for the chart and calls an update() function. It looks...
Read more >Dynamically Add Chart Event Listener using Plain JS
This article tells you how to dynamically add chart event listener to your chart using plain JS.
Read more >Handling Events | Charts - Google Developers
Overview. Google charts can fire events that you can listen for. Events can be triggered by user actions, such as when a user...
Read more >Adding Listener to update charts on ButtonClick
Hi, non-coder getting to grips with Javascript. I want to change the isStacked status of a chart on ButtonClick.
Read more >Overview – Event Handling in Charts - CanvasJS.com
Sets the mouseover event handler for dataSeries/dataPoint which is triggered when user moves Mouse Over a dataSeries/dataPoint. Upon event, a parameter that ...
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 FreeTop 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
Top GitHub Comments
The true option will make sure existing options will stay but the one you specify will be overriden
Actually you can run
chart.update(null, {chartPadding: {top: 100, bottom: 0, left: 0, right: 0}}, true)
within your plugin initialization function. Just make sure that you don’t run it inside your created listener.