74 int xp1 = 0, yp1 = 0, xp2 = 0, yp2 = 0;
75 zoomRect.getCoords(&xp1, &yp1, &xp2, &yp2);
76 auto x1 = xAxis->pixelToCoord(xp1);
77 auto x2 = xAxis->pixelToCoord(xp2);
78 auto y1 = yAxis->pixelToCoord(yp1);
79 auto y2 = yAxis->pixelToCoord(yp2);
81 xAxis->setRange(x1, x2);
82 yAxis->setRange(y1, y2);
88 QCustomPlot::mouseReleaseEvent(event);
157 if (
x.size()!=
y.size())
160 QCPGraph *graph =
new QCPGraph(xAxis, yAxis);
162 graph->setName(QString::fromStdString(
name));
163 graph->setPen(QPen(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)), 2));
164 graph->setLineStyle(QCPGraph::lsNone);
165 graph->setScatterStyle(symbol);
169 QVector<double> ticks;
170 QVector<QString> labels;
172 for (
int i=0; i<
y.size(); i++)
174 labels << QString::fromStdString(
x[i]);
176 QSharedPointer<QCPAxisTickerText> textTicker(
new QCPAxisTickerText);
177 textTicker->addTicks(ticks, labels);
178 xAxis->setTicker(textTicker);
179 xAxis->setTickLabelRotation(60);
180 xAxis->setSubTicks(
false);
181 xAxis->setTickLength(0, 4);
183 graph->setData(ticks, yvals);
229 if (
x.size()!=
y.size())
232 QCPGraph *graph =
new QCPGraph(xAxis, yAxis);
234 graph->setName(QString::fromStdString(
name));
235 QPen Pen = QPen(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
238 graph->setLineStyle(QCPGraph::lsLine);
243 xAxis->setTickLabelRotation(60);
244 xAxis->setSubTicks(
false);
245 xAxis->setTickLength(0, 4);
247 graph->setData(xvals, yvals);
262 QSharedPointer<QCPAxisTickerLog> logTicker(
new QCPAxisTickerLog);
263 logTicker->setLogBase(10);
264 logTicker->setSubTickCount(10);
265 yAxis->setTicker(logTicker);
266 yAxis->setScaleType(QCPAxis::ScaleType::stLogarithmic);
270 yAxis->setScaleType(QCPAxis::ScaleType::stLinear);
293 legend->setVisible(onoff);
295 { axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignTop|Qt::AlignHCenter);
296 legend->setBrush(QColor(255, 255, 255, 100));
297 legend->setBorderPen(Qt::NoPen);
298 QFont legendFont = font();
299 legendFont.setPointSize(10);
300 legend->setFont(legendFont);
301 setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
317 QCPGraph *points =
new QCPGraph(xAxis, yAxis);
318 points->setLineStyle(QCPGraph::lsNone);
319 points->setScatterStyle(
shapes[shape_counter]);
320 points->setPen(QPen(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)),2));
322 QMap<double,QString> ticks;
323 for (map<
string,
vector<double>>::const_iterator set=data.begin(); set!=data.end(); set++ )
325 for (
int i=0; i<set->second.size(); i++)
326 points->addData(x_val,set->second[i]);
328 ticks[x_val]=QString::fromStdString(set->first);
334 QSharedPointer<QCPAxisTickerText> textTicker(
new QCPAxisTickerText);
335 textTicker->addTicks(ticks);
336 xAxis->setTicker(textTicker);
337 xAxis->setTickLabelRotation(60);
338 xAxis->setSubTicks(
false);
339 xAxis->setTickLength(0, 4);
350 QVector<QCPScatterStyle::ScatterShape> shapes;
351 shapes << QCPScatterStyle::ssCross;
352 shapes << QCPScatterStyle::ssPlus;
353 shapes << QCPScatterStyle::ssCircle;
354 shapes << QCPScatterStyle::ssDisc;
355 shapes << QCPScatterStyle::ssSquare;
356 shapes << QCPScatterStyle::ssDiamond;
357 shapes << QCPScatterStyle::ssStar;
358 shapes << QCPScatterStyle::ssTriangle;
359 shapes << QCPScatterStyle::ssTriangleInverted;
360 shapes << QCPScatterStyle::ssCrossSquare;
361 shapes << QCPScatterStyle::ssPlusSquare;
362 shapes << QCPScatterStyle::ssCrossCircle;
363 shapes << QCPScatterStyle::ssPlusCircle;
364 shapes << QCPScatterStyle::ssPeace;
365 shapes << QCPScatterStyle::ssCross;
366 shapes << QCPScatterStyle::ssPlus;
367 shapes << QCPScatterStyle::ssCircle;
368 shapes << QCPScatterStyle::ssDisc;
369 shapes << QCPScatterStyle::ssSquare;
370 shapes << QCPScatterStyle::ssDiamond;
371 shapes << QCPScatterStyle::ssStar;
372 shapes << QCPScatterStyle::ssTriangle;
373 shapes << QCPScatterStyle::ssTriangleInverted;
374 shapes << QCPScatterStyle::ssCrossSquare;
375 shapes << QCPScatterStyle::ssPlusSquare;
376 shapes << QCPScatterStyle::ssCrossCircle;
377 shapes << QCPScatterStyle::ssPlusCircle;
378 shapes << QCPScatterStyle::ssPeace;