MCPcopy Create free account
hub / github.com/LUX-Core/lux / getScatters

Method getScatters

src/qt/qcustomplot.cpp:20460–20503  ·  view source on GitHub ↗

! \internal This method retrieves an optimized set of data points via \ref getOptimizedScatterData and then converts them to pixel coordinates. The resulting points are returned in \a scatters, and can be passed to \ref drawScatterPlot. \a dataRange specifies the beginning and ending data indices that will be taken into account for conversion. In this function, the specified range may

Source from the content-addressed store, hash-verified

20458 getDataSegments.
20459*/
20460void QCPGraph::getScatters(QVector<QPointF> *scatters, const QCPDataRange &dataRange) const
20461{
20462 if (!scatters) return;
20463 QCPAxis *keyAxis = mKeyAxis.data();
20464 QCPAxis *valueAxis = mValueAxis.data();
20465 if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; scatters->clear(); return; }
20466
20467 QCPGraphDataContainer::const_iterator begin, end;
20468 getVisibleDataBounds(begin, end, dataRange);
20469 if (begin == end)
20470 {
20471 scatters->clear();
20472 return;
20473 }
20474
20475 QVector<QCPGraphData> data;
20476 getOptimizedScatterData(&data, begin, end);
20477
20478 if (mKeyAxis->rangeReversed() != (mKeyAxis->orientation() == Qt::Vertical)) // make sure key pixels are sorted ascending in data (significantly simplifies following processing)
20479 std::reverse(data.begin(), data.end());
20480
20481 scatters->resize(data.size());
20482 if (keyAxis->orientation() == Qt::Vertical)
20483 {
20484 for (int i=0; i<data.size(); ++i)
20485 {
20486 if (!qIsNaN(data.at(i).value))
20487 {
20488 (*scatters)[i].setX(valueAxis->coordToPixel(data.at(i).value));
20489 (*scatters)[i].setY(keyAxis->coordToPixel(data.at(i).key));
20490 }
20491 }
20492 } else
20493 {
20494 for (int i=0; i<data.size(); ++i)
20495 {
20496 if (!qIsNaN(data.at(i).value))
20497 {
20498 (*scatters)[i].setX(keyAxis->coordToPixel(data.at(i).key));
20499 (*scatters)[i].setY(valueAxis->coordToPixel(data.at(i).value));
20500 }
20501 }
20502 }
20503}
20504
20505/*! \internal
20506

Callers

nothing calls this directly

Calls 15

coordToPixelMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
rangeMethod · 0.80
pixelToCoordMethod · 0.80
dataMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected