I tried myself, and it’s slow just as you described. BUILD_SHARED_LIBS is definitely not the problem, vtkChartXY simply can’t render 65536 bins as fast as you need. I’m not surprised that matplotlib is faster, though.
I suspect that the only way to speed things up is to create a table that has fewer values than your histogram. For example, use only every 100th value. This isn’t an ideal solution, of course, because you lose detail.
You said that vtkChartXY is not able to render 65536 bins that fast. So i changed vtkChart::BAR by vtkChart::LINE and now the code is much faster. I think they are still some small latences but it’s clearly acceptable and moving axis now is much more fluid.
I have two questions for the futur.
The first one:
Do you know some other enum of vtkChart which can even be faster? maybe scatter?
the second question (which also contain two question):
as i want that the user can be able de manually choose the dynamical range on the plot of the graph, do you know how can i interact with it via a cursor maybe, and second how can i have a better control on the movement of axis (i dont want users can move the graph just by clicking on it. i would like to set up the graph at the beginning than, allow user to make some zoom but nothing more)
Computing a histogram is a slow operation since it requires ordering the data set for binning. Also, I wonder why do you need 65k+ bins. Tens of bins are more than enough to draw conclusions. Once the histogram is computed, plotting it in 2ms is a good figure. You can get 500fps with that. I don’t see any problems.
If your dataset is large, decimating it is a good strategy to get fast histograms. In petroleum industry we do this all the time. We have seismic cubes with around a trillion data cells. Histograms with only a 0.01% sampling rate or less are quite common.