chart.js

Programmatically set layout and ticks padding


I have a use-case where I draw icons above chart.js' ticks. Those icons are responsive so I resize them using options.onResize. I am aware of options.layout.padding.top and options.scales.x.ticks.padding, but those are set on initialization and changing them in onResize using chart.options.layout.padding.top and chart.options.scales.x.ticks.padding doesn't modify that initial padding.

Is there an documented API I can use to change those layout and ticks padding?


Solution

  • When chart is initialized it creates an instance of an chart in an canvas. if it it gets new data the chart does get the new data but doesnt update the canvas beacause it doesnt get the command to update the view. the command itself is chart.update() code link chart.js.