At the moment, Chart does not allow to redraw the figure manually.
However, it is done automatically on resize, using a protected method.
I renamed this protected method to redraw so one could call it manually when needed
Why not simply use Chart.draw?
This reason is that Chart.draw excepts a figure parameter, but that figure might not have the size of the chart.
Chart._resize does not except a figure, but it creates a figure that is suitable for the chart size.
Alternative approach
There is an alternative approach that was not taken in this PR:
We can add a method named Chart.create_figure() that builds a figure with the right width and height, like it does in the _resize method. Now, one could create a suitable figure and use it in Chart.draw manually.
I think the first solution (which is implemented in this PR) is better.
The Problem
At the moment,
Chart
does not allow to redraw the figure manually. However, it is done automatically on resize, using a protected method.I renamed this protected method to
redraw
so one could call it manually when neededWhy not simply use
Chart.draw
?This reason is that
Chart.draw
excepts a figure parameter, but that figure might not have the size of the chart.Chart._resize
does not except a figure, but it creates a figure that is suitable for the chart size.Alternative approach
There is an alternative approach that was not taken in this PR: We can add a method named
Chart.create_figure()
that builds a figure with the right width and height, like it does in the_resize
method. Now, one could create a suitable figure and use it inChart.draw
manually.I think the first solution (which is implemented in this PR) is better.
PR Checklist: