We are running into a performance issue displaying the axes grids. The default function increases the number of labels depending on the zoom factor. I assume the code is trying to keep the labels equally spaced in screen space, but the issue is that the number of labels is unbounded. I suspect the cpu code keeps generating more and more labels, even though only a few can be seen, which slows the framerate below 1 FPS.
I can’t seem to find a property to set in python that fixes the number of ticks/labels, and creating custom ticks is not really an option either since the data ranges are always changing depending on what is visible. Anyone have a suggestion to fix the performance?
For what its worth, this is how I solved the issue:
diff --git a/Charts/Core/vtkAxis.cxx b/Charts/Core/vtkAxis.cxx
index d2c86ee8e9..c23a3390c2 100644
@@ -1267,6 +1267,13 @@ void vtkAxis::GenerateTickLabels(double min, double max)
double range = mult > 0.0 ? max - min : min - max;
n = vtkContext2D::FloatToInt(range / this->TickInterval);
+ constexpr int maxTicks = 21;
+ // We need to bound the total number of ticks.
+ if(n > maxTicks)
+ this->TickInterval = range / double(maxTicks);
+ n = vtkContext2D::FloatToInt(range / this->TickInterval);