|
RealTime multiple chart |
Posted by Thanos on Jan-04-2017 18:12 |
|
Hi,
I need to create a realtime scrollable, zoomable etc chart (exactly like the Qt example "realtimezoomscroll") with more than one different charts (like the Qt example "financedemo"). The only relative information I found about this topic is the next link of your forum:
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=&thread=1205941374
So, according the instructions of the previous link and using the example "realtimezoomscroll", I created a MultiChart and I added to this 2 different XYChart
MultiChart m = new MultiChart(800, 600);
XYChart xyChart1 = new XYChart(800, 300);
xyChart1.setPlotArea(50, 50, 720, 250, ........);
XYChart xyChart2 = ...
xyChart2.setPlotArea = ...
m.addChart(0, 0, xyChart1);
m.addChart(0, 300, xyChart2);
Then I tried to replace the current XYChart c, with the Multichart m, into the next 2 lines of the "realtimezoomscroll" example:
delete viewer->getChart();
viewer->setChart(m);
When the application is trying to run it crashes and I got the message:
Runtime Error!
R6025
-pure virtual function call
Sorry if my approach sounds quite stupid, since I am quiet new with your library, but I couldn't mentioned another way to achieve what I need. Could you advise me please about this problem?
Thanks in advance
Regards
Thanos |
Re: RealTime multiple chart |
Posted by Peter Kwan on Jan-05-2017 03:35 |
|
Hi Thanos,
Without seeing the exact code, it is hard to know the exact cause of the problem. In the "Realtime Chart with Zooming and Scrolling" example, there are also code to draw the "programmable track cursor", using code like:
trackLineLabel((XYChart *)m_ChartViewer->getChart(), m_ChartViewer->getPlotAreaMouseX());
In your case, the chart has changed to a MultiChart, so casting to (XYChart *) will not be correct and will probably cause the code to crash. You would need to modify the "programmable track cursor" code to use MultiChart as well.
I have attached a modified "realtimezoomscroll.cpp" and "realtimezoomscroll.h" for your reference. The modified code uses two XYChart objects in a MultiChart. You can use them to replace the files of the same name in the original Qt sample code to try it.
Hope this can help.
Regards
Peter Kwan
|
Re: RealTime multiple chart |
Posted by Thanos on Jan-05-2017 16:12 |
|
Hi Peter,
thank you very much for your immediate and accurate response. Your customer support is great !!!
It seems that the example you sent me fits exactly to my needs. I will try to adapt it to my code and I will keep you updated for any further issue.
Regards
Thanos |
|