PDA

View Full Version : how to Plot multiple graphs of multiple range ?



karankumar1609
11th July 2013, 07:44
Hello,

I am working on an application which need to plot multiple data of multiple ranges.

This is exactly my problem is, how to plot multiple data of multiple range on same plot area...

I am using Qt5 QGraphicsView on linux.

Suppose we have a data having range (0 - 10,000) and other data having range (0 - 10). and both should be plot on same area where one scale moves (0 - 10,000) and other scale moves (0 - 10) respectively.
It will not be a problem if data have same range.. but problem is data have different range...

anyone have idea about that?

alainstgt
11th July 2013, 15:53
the simplest way, but not the cleanest, specially if you want to use markers or cursors, is to rescale internally the x-values to get the same range for both datasets.
So assuming you 1. dataset would have the values (x, y): (1000, 12), (2120, 15) ... (10000, 7)
and the 2. dataset values (1, 6), (2.5, 14) ... (10, 8)
rescale the 2. dataset to (1000, 6), (2500, 14) ... (10000, 8)
Another equivalent way is to change the conversion factor from physical units into pixels on the canvas.
In both cases, you might draw 2 different x-axis.

Did you take a look at Qwt?
If Qwt is too heavy for your need, take a look at KplotWidget from KDE. There are only very few changes to made to get it running on Qt.

Alain

karankumar1609
15th July 2013, 12:22
i did the same approach for that... and created my own graph..