QCustomPlot Discussion and Comments

Use same Data for Graph and BarsReturn to overview

Hello together,

I am using a QSharedPointer<QCPGraphDataContainer> for storing my data. Up to now I used only Graph plots.
Now I want to plot also some bar charts.
Is there any possibility to overgive a QCPBars the same Data container ?
setData() seems to only accept a QCPBarsDataContainer and I don't want to copy all my Data over to a new container only for that.
If I compare the basic Storage Classes QCPBarsData () and QCPGraphData() they look quite similar so I ask myself weather there exists a possibility to use my original QCPGraphDataContainer also for bar plots.

Any ideas ?

Thanks in advance,

Wow, i was about ready to give you a snarky comment that it doesnt make any sense for them to use the same data.... but the two data structures are actually identical.

Seems to me like QCPBarsData and QCPGraphData should be subclassed from QCPData and both QCPGraph and QCPBars should use a QCPDataContainer that contains QCPData.

o.k. so this sounds to me as if there is no possibility for me as user to achieve that, right? Or did you intend that one should oneself intercept in the sourcecode?


you could do that in the source code if you wanted to, but i think it should probably be done in the official version, because that seems like something that can be done quickly and will be a common use case. if you modify QCPGraphData and QCPBarsData to subclass a new class called QCPData, and then modify the data container to be a QVector<QCPData>, you could then use the same data in both of them.