Skip to content

Fix vtkChartXY axis updates

Andras Lasso requested to merge lassoan/vtk:improve-chart-axis-api into master

API improvement:

vtkAxis did not have an API to change minimum and maximum value with one vtkChart::UpdateRange event. This prevented precise shift an axis without temporarily changing its range width (distance between minimum and maximum value), and increased complexity and inefficiency when synchronizing axes between multiple charts.

SetRange and SetUnscaledRange methods now invoke only one vtkChart::UpdateRange event (after both minimum and maximum values are updated).

Fixing minor issues:

  1. Added a missing vtkCommand::InteractionEvent invocation when vtkChartXY axes range are adjusted using ZoomAxis action (this event indicates that the user adjusted axes and so the application can propagate this change to other charts).

  2. Fixed vtkChartXY transform computation logic

vtkChartXY unnecessarily recomputed transforms when axes were modified after the chart's last modified timestamp. Also, vtkChartXY never recomputed transforms when chart properties changed after axes changed, even when recomputation would have been necessary.

Now a separate timestamp stores the last transform computation time and that is used to decide if an update is needed or not.

Merge request reports