Some questions about qcustomplot
Posted: Sun Apr 16, 2017 11:18 am
Hi
I change the code like the follow, it can show the graph, but it can't zoom, why? and I want get the point when I click the graph, how can I do it ? And another question is if I use the function, I hope it can close the graph last time show, how can I do it?
ccHistogramWindowDlg* hDlg = new ccHistogramWindowDlg(parent);
ccHistogramWindow* histogram = hDlg->window();
histogram->addGraph();
histogram->graph(0)->setData(x, y);
histogram->graph(0)->setPen((QColor(255, 10, 0)));
if (XorY == 1)
{
histogram->xAxis->setLabel("X");
}
else
{
histogram->xAxis->setLabel("Y");
}
//histogram->xAxis->setLabel("X");
histogram->yAxis->setLabel("Z");
histogram->xAxis->setRange(x1, x2);
histogram->yAxis->setRange(y1, y2);
histogram->setTitle("daoyun");
histogram->replot();
histogram->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
hDlg->show();
histogram->refresh();
return true;
I change the code like the follow, it can show the graph, but it can't zoom, why? and I want get the point when I click the graph, how can I do it ? And another question is if I use the function, I hope it can close the graph last time show, how can I do it?
ccHistogramWindowDlg* hDlg = new ccHistogramWindowDlg(parent);
ccHistogramWindow* histogram = hDlg->window();
histogram->addGraph();
histogram->graph(0)->setData(x, y);
histogram->graph(0)->setPen((QColor(255, 10, 0)));
if (XorY == 1)
{
histogram->xAxis->setLabel("X");
}
else
{
histogram->xAxis->setLabel("Y");
}
//histogram->xAxis->setLabel("X");
histogram->yAxis->setLabel("Z");
histogram->xAxis->setRange(x1, x2);
histogram->yAxis->setRange(y1, y2);
histogram->setTitle("daoyun");
histogram->replot();
histogram->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
hDlg->show();
histogram->refresh();
return true;