简体   繁体   中英

In QCustomPlot how do you draw both a line graph and bar chart for the same data in realtime?

I am using QtCreator and have installed the QCustomPlot library in my project. I want to be able to draw both a line graph and bar chart for the same data. The data is held in an array which is constantly updated by another function - hence, how do you create a realtime line graph and bar chart on the same axes?

This is the statements that set the x and y coordinates of points.

QVector<double> x(140), y(140);
for (int q=5; i<145; i+5)
{
    x[q] = q;
    y[q] = GraphReadings[((q/5)*2)+2];
}

There's an example on the QCustomPlot tutorials site for this: http://www.qcustomplot.com/index.php/demos/styleddemo

This example shows a line graph and bar graph on the same axes, however doesn't share exactly the same data but the general idea of how to do it is there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM