54 mIsAntialiasing(false)
69 mIsAntialiasing(false)
71#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
73 setRenderHint(QPainter::NonCosmeticDefaultPen);
89 QPainter::setPen(pen);
103 QPainter::setPen(color);
117 QPainter::setPen(penStyle);
133 QPainter::drawLine(line);
135 QPainter::drawLine(line.toLine());
146 setRenderHint(QPainter::Antialiasing, enabled);
155 translate(-0.5, -0.5);
182 bool result = QPainter::begin(device);
183#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
185 setRenderHint(QPainter::NonCosmeticDefaultPen);
197 if (!enabled &&
mModes.testFlag(mode))
199 else if (enabled && !
mModes.testFlag(mode))
230 qDebug() << Q_FUNC_INFO <<
"Unbalanced save/restore";
240 if (qFuzzyIsNull(pen().widthF()))
389 mBrush(QBrush(fill)),
414 mPenDefined(pen.style() != Qt::NoPen)
446 mCustomPath(customPath),
535 painter->setBrush(
mBrush);
556 double w =
mSize/2.0;
579 painter->drawEllipse(QPointF(
x ,
y), w, w);
584 QBrush b = painter->brush();
585 painter->setBrush(painter->pen().color());
586 painter->drawEllipse(QPointF(
x ,
y), w, w);
587 painter->setBrush(b);
607 painter->
drawLine(QLineF(
x-w*0.707,
y-w*0.707,
x+w*0.707,
y+w*0.707));
608 painter->
drawLine(QLineF(
x-w*0.707,
y+w*0.707,
x+w*0.707,
y-w*0.707));
613 painter->
drawLine(QLineF(
x-w,
y+0.755*w,
x+w,
y+0.755*w));
614 painter->
drawLine(QLineF(
x+w,
y+0.755*w,
x,
y-0.977*w));
615 painter->
drawLine(QLineF(
x,
y-0.977*w,
x-w,
y+0.755*w));
620 painter->
drawLine(QLineF(
x-w,
y-0.755*w,
x+w,
y-0.755*w));
621 painter->
drawLine(QLineF(
x+w,
y-0.755*w,
x,
y+0.977*w));
622 painter->
drawLine(QLineF(
x,
y+0.977*w,
x-w,
y-0.755*w));
627 painter->
drawLine(QLineF(
x-w,
y-w,
x+w*0.95,
y+w*0.95));
628 painter->
drawLine(QLineF(
x-w,
y+w*0.95,
x+w*0.95,
y-w));
641 painter->
drawLine(QLineF(
x-w*0.707,
y-w*0.707,
x+w*0.670,
y+w*0.670));
642 painter->
drawLine(QLineF(
x-w*0.707,
y+w*0.670,
x+w*0.670,
y-w*0.707));
643 painter->drawEllipse(QPointF(
x,
y), w, w);
650 painter->drawEllipse(QPointF(
x,
y), w, w);
658 painter->drawEllipse(QPointF(
x,
y), w, w);
668 QTransform oldTransform = painter->transform();
669 painter->translate(
x,
y);
672 painter->setTransform(oldTransform);
753 mParentPlot(parentPlot),
773 qDebug() << Q_FUNC_INFO <<
"The parent plot's mCurrentLayer will be a dangling pointer. Should have been set to a valid layer or 0 beforehand.";
808 qDebug() << Q_FUNC_INFO <<
"layerable is already child of this layer" <<
reinterpret_cast<quintptr
>(layerable);
823 qDebug() << Q_FUNC_INFO <<
"layerable is not child of this layer" <<
reinterpret_cast<quintptr
>(layerable);
936 mParentLayerable(parentLayerable),
942 if (targetLayer.isEmpty())
945 qDebug() << Q_FUNC_INFO <<
"setting QCPlayerable initial layer to" << targetLayer <<
"failed.";
988 qDebug() << Q_FUNC_INFO <<
"no parent QCustomPlot set";
996 qDebug() << Q_FUNC_INFO <<
"there is no layer with name" << layerName;
1067 Q_UNUSED(onlySelectable)
1093 qDebug() << Q_FUNC_INFO <<
"called with mParentPlot already initialized";
1098 qDebug() << Q_FUNC_INFO <<
"called with parentPlot zero";
1132 qDebug() << Q_FUNC_INFO <<
"no parent QCustomPlot set";
1137 qDebug() << Q_FUNC_INFO <<
"layer" <<
layer->
name() <<
"is not in same QCustomPlot as this layerable";
1256 Q_UNUSED(selectionStateChanged)
1273 Q_UNUSED(selectionStateChanged)
1378 result.
expand(otherRange);
1396 double rangeFac = 1
e-3;
1401 if (sanitizedRange.
lower == 0.0 && sanitizedRange.
upper != 0.0)
1404 if (rangeFac < sanitizedRange.
upper*rangeFac)
1405 sanitizedRange.
lower = rangeFac;
1407 sanitizedRange.
lower = sanitizedRange.
upper*rangeFac;
1409 else if (sanitizedRange.
lower != 0.0 && sanitizedRange.
upper == 0.0)
1412 if (-rangeFac > sanitizedRange.
lower*rangeFac)
1413 sanitizedRange.
upper = -rangeFac;
1415 sanitizedRange.
upper = sanitizedRange.
lower*rangeFac;
1416 }
else if (sanitizedRange.
lower < 0 && sanitizedRange.
upper > 0)
1419 if (-sanitizedRange.
lower > sanitizedRange.
upper)
1422 if (-rangeFac > sanitizedRange.
lower*rangeFac)
1423 sanitizedRange.
upper = -rangeFac;
1425 sanitizedRange.
upper = sanitizedRange.
lower*rangeFac;
1429 if (rangeFac < sanitizedRange.
upper*rangeFac)
1432 sanitizedRange.
lower = sanitizedRange.
upper*rangeFac;
1436 return sanitizedRange;
1447 return sanitizedRange;
1676 QObject(parentPlot),
1677 mParentPlot(parentPlot)
1696 QHashIterator<QCP::MarginSide, QList<QCPLayoutElement*> > it(
mChildren);
1697 while (it.hasNext())
1700 if (!it.value().isEmpty())
1713 QHashIterator<QCP::MarginSide, QList<QCPLayoutElement*> > it(
mChildren);
1714 while (it.hasNext())
1717 const QList<QCPLayoutElement*>
elements = it.value();
1718 for (
int i=
elements.size()-1; i>=0; --i)
1719 elements.at(i)->setMarginGroup(it.key(), 0);
1738 for (
int i=0; i<
elements.size(); ++i)
1740 if (!
elements.at(i)->autoMargins().testFlag(side))
1760 qDebug() << Q_FUNC_INFO <<
"element is already child of this margin group side" <<
reinterpret_cast<quintptr
>(element);
1771 if (!
mChildren[side].removeOne(element))
1772 qDebug() << Q_FUNC_INFO <<
"element is not child of this margin group side" <<
reinterpret_cast<quintptr
>(element);
1864 mMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX),
1866 mOuterRect(0, 0, 0, 0),
1867 mMargins(0, 0, 0, 0),
1868 mMinimumMargins(0, 0, 0, 0),
1869 mAutoMargins(
QCP::msAll)
2017 QVector<QCP::MarginSide> sideVector;
2023 for (
int i=0; i<sideVector.size(); ++i)
2116 return QList<QCPLayoutElement*>();
2143 qDebug() << Q_FUNC_INFO <<
"parent plot not defined";
2277 for (
int i=0; i<elCount; ++i)
2288 QList<QCPLayoutElement*> result;
2289#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
2292 for (
int i=0; i<c; ++i)
2296 for (
int i=0; i<c; ++i)
2299 result << result.at(i)->elements(recursive);
2379 if (QWidget *w = qobject_cast<QWidget*>(parent()))
2380 w->updateGeometry();
2381 else if (
QCPLayout *l = qobject_cast<QCPLayout*>(parent()))
2382 l->sizeConstraintsChanged();
2420 el->setParent(
this);
2424 qDebug() << Q_FUNC_INFO <<
"Null element passed";
2446 qDebug() << Q_FUNC_INFO <<
"Null element passed";
2480 if (maxSizes.size() != minSizes.size() || minSizes.size() != stretchFactors.size())
2482 qDebug() << Q_FUNC_INFO <<
"Passed vector sizes aren't equal:" << maxSizes << minSizes << stretchFactors;
2483 return QVector<int>();
2485 if (stretchFactors.isEmpty())
2486 return QVector<int>();
2487 int sectionCount = stretchFactors.size();
2488 QVector<double> sectionSizes(sectionCount);
2491 for (
int i=0; i<sectionCount; ++i)
2492 minSizeSum += minSizes.at(i);
2493 if (totalSize < minSizeSum)
2496 for (
int i=0; i<sectionCount; ++i)
2498 stretchFactors[i] = minSizes.at(i);
2503 QList<int> minimumLockedSections;
2504 QList<int> unfinishedSections;
2505 for (
int i=0; i<sectionCount; ++i)
2506 unfinishedSections.append(i);
2507 double freeSize = totalSize;
2509 int outerIterations = 0;
2510 while (!unfinishedSections.isEmpty() && outerIterations < sectionCount*2)
2513 int innerIterations = 0;
2514 while (!unfinishedSections.isEmpty() && innerIterations < sectionCount*2)
2519 double nextMax = 1e12;
2520 for (
int i=0; i<unfinishedSections.size(); ++i)
2522 int secId = unfinishedSections.at(i);
2523 double hitsMaxAt = (maxSizes.at(secId)-sectionSizes.at(secId))/stretchFactors.at(secId);
2524 if (hitsMaxAt < nextMax)
2526 nextMax = hitsMaxAt;
2532 double stretchFactorSum = 0;
2533 for (
int i=0; i<unfinishedSections.size(); ++i)
2534 stretchFactorSum += stretchFactors.at(unfinishedSections.at(i));
2535 double nextMaxLimit = freeSize/stretchFactorSum;
2536 if (nextMax < nextMaxLimit)
2538 for (
int i=0; i<unfinishedSections.size(); ++i)
2540 sectionSizes[unfinishedSections.at(i)] += nextMax*stretchFactors.at(unfinishedSections.at(i));
2541 freeSize -= nextMax*stretchFactors.at(unfinishedSections.at(i));
2543 unfinishedSections.removeOne(nextId);
2546 for (
int i=0; i<unfinishedSections.size(); ++i)
2547 sectionSizes[unfinishedSections.at(i)] += nextMaxLimit*stretchFactors.at(unfinishedSections.at(i));
2548 unfinishedSections.clear();
2551 if (innerIterations == sectionCount*2)
2552 qDebug() << Q_FUNC_INFO <<
"Exceeded maximum expected inner iteration count, layouting aborted. Input was:" << maxSizes << minSizes << stretchFactors << totalSize;
2555 bool foundMinimumViolation =
false;
2556 for (
int i=0; i<sectionSizes.size(); ++i)
2558 if (minimumLockedSections.contains(i))
2560 if (sectionSizes.at(i) < minSizes.at(i))
2562 sectionSizes[i] = minSizes.at(i);
2563 foundMinimumViolation =
true;
2564 minimumLockedSections.append(i);
2567 if (foundMinimumViolation)
2569 freeSize = totalSize;
2570 for (
int i=0; i<sectionCount; ++i)
2572 if (!minimumLockedSections.contains(i))
2573 unfinishedSections.append(i);
2575 freeSize -= sectionSizes.at(i);
2578 for (
int i=0; i<unfinishedSections.size(); ++i)
2579 sectionSizes[unfinishedSections.at(i)] = 0;
2582 if (outerIterations == sectionCount*2)
2583 qDebug() << Q_FUNC_INFO <<
"Exceeded maximum expected outer iteration count, layouting aborted. Input was:" << maxSizes << minSizes << stretchFactors << totalSize;
2585 QVector<int> result(sectionCount);
2586 for (
int i=0; i<sectionCount; ++i)
2587 result[i] = qRound(sectionSizes.at(i));
2640 if (column >= 0 && column <
mElements.first().size())
2645 qDebug() << Q_FUNC_INFO <<
"Requested cell is empty. Row:" << row <<
"Column:" << column;
2647 qDebug() << Q_FUNC_INFO <<
"Invalid column. Row:" << row <<
"Column:" << column;
2649 qDebug() << Q_FUNC_INFO <<
"Invalid row. Row:" << row <<
"Column:" << column;
2699 qDebug() << Q_FUNC_INFO <<
"There is already an element in the specified row/column:" << row << column;
2701 qDebug() << Q_FUNC_INFO <<
"Can't add null element to row/column:" << row << column;
2737 qDebug() << Q_FUNC_INFO <<
"Invalid stretch factor, must be positive:" << factor;
2739 qDebug() << Q_FUNC_INFO <<
"Invalid column:" << column;
2762 qDebug() << Q_FUNC_INFO <<
"Invalid stretch factor, must be positive:" <<
mColumnStretchFactors.at(i);
2767 qDebug() << Q_FUNC_INFO <<
"Column count not equal to passed stretch factor count:" << factors;
2788 qDebug() << Q_FUNC_INFO <<
"Invalid stretch factor, must be positive:" << factor;
2790 qDebug() << Q_FUNC_INFO <<
"Invalid row:" << row;
2813 qDebug() << Q_FUNC_INFO <<
"Invalid stretch factor, must be positive:" <<
mRowStretchFactors.at(i);
2818 qDebug() << Q_FUNC_INFO <<
"Row count not equal to passed stretch factor count:" << factors;
2860 mElements.append(QList<QCPLayoutElement*>());
2864 int newColCount = qMax(
columnCount(), newColumnCount);
2867 while (
mElements.at(i).size() < newColCount)
2894 QList<QCPLayoutElement*> newRow;
2920 for (
int row=0; row<
rowCount(); ++row)
2927 QVector<int> minColWidths, minRowHeights, maxColWidths, maxRowHeights;
2937 int yOffset =
mRect.top();
2938 for (
int row=0; row<
rowCount(); ++row)
2942 int xOffset =
mRect.left();
2948 mElements.at(row).at(col)->setOuterRect(QRect(xOffset, yOffset, colWidths.at(col), rowHeights.at(row)));
2978 qDebug() << Q_FUNC_INFO <<
"Attempt to take invalid index:" << index;
2996 qDebug() << Q_FUNC_INFO <<
"Element not in this layout, couldn't take";
2998 qDebug() << Q_FUNC_INFO <<
"Can't take null element";
3005 QList<QCPLayoutElement*> result;
3008#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
3009 result.reserve(colC*rowC);
3011 for (
int row=0; row<rowC; ++row)
3013 for (
int col=0; col<colC; ++col)
3015 result.append(
mElements.at(row).at(col));
3020 int c = result.size();
3021 for (
int i=0; i<c; ++i)
3024 result << result.at(i)->elements(recursive);
3036 for (
int row=
rowCount()-1; row>=0; --row)
3038 bool hasElements =
false;
3059 bool hasElements =
false;
3060 for (
int row=0; row<
rowCount(); ++row)
3071 for (
int row=0; row<
rowCount(); ++row)
3080 QVector<int> minColWidths, minRowHeights;
3083 for (
int i=0; i<minColWidths.size(); ++i)
3084 result.rwidth() += minColWidths.at(i);
3085 for (
int i=0; i<minRowHeights.size(); ++i)
3086 result.rheight() += minRowHeights.at(i);
3095 QVector<int> maxColWidths, maxRowHeights;
3099 for (
int i=0; i<maxColWidths.size(); ++i)
3100 result.setWidth(qMin(result.width()+maxColWidths.at(i), QWIDGETSIZE_MAX));
3101 for (
int i=0; i<maxRowHeights.size(); ++i)
3102 result.setHeight(qMin(result.height()+maxRowHeights.at(i), QWIDGETSIZE_MAX));
3123 *minRowHeights = QVector<int>(
rowCount(), 0);
3124 for (
int row=0; row<
rowCount(); ++row)
3130 QSize minHint =
mElements.at(row).at(col)->minimumSizeHint();
3131 QSize min =
mElements.at(row).at(col)->minimumSize();
3132 QSize
final(min.width() > 0 ? min.width() : minHint.width(), min.height() > 0 ? min.height() : minHint.height());
3133 if (minColWidths->at(col) <
final.width())
3134 (*minColWidths)[col] =
final.width();
3135 if (minRowHeights->at(row) <
final.height())
3136 (*minRowHeights)[row] =
final.height();
3156 *maxColWidths = QVector<int>(
columnCount(), QWIDGETSIZE_MAX);
3157 *maxRowHeights = QVector<int>(
rowCount(), QWIDGETSIZE_MAX);
3158 for (
int row=0; row<
rowCount(); ++row)
3164 QSize maxHint =
mElements.at(row).at(col)->maximumSizeHint();
3165 QSize max =
mElements.at(row).at(col)->maximumSize();
3166 QSize
final(max.width() < QWIDGETSIZE_MAX ? max.width() : maxHint.width(), max.height() < QWIDGETSIZE_MAX ? max.height() : maxHint.height());
3167 if (maxColWidths->at(col) >
final.width())
3168 (*maxColWidths)[col] =
final.width();
3169 if (maxRowHeights->at(row) >
final.height())
3170 (*maxRowHeights)[row] =
final.height();
3231 qDebug() << Q_FUNC_INFO <<
"Invalid element index:" << index;
3246 qDebug() << Q_FUNC_INFO <<
"Invalid element index:" << index;
3261 qDebug() << Q_FUNC_INFO <<
"Invalid element index:" << index;
3276 qDebug() << Q_FUNC_INFO <<
"Invalid element index:" << index;
3292 qDebug() << Q_FUNC_INFO <<
"Invalid element index:" << index;
3311 qDebug() << Q_FUNC_INFO <<
"Invalid element index:" << index;
3320 QSize finalMinSize, finalMaxSize;
3321 QSize minSizeHint =
mElements.at(i)->minimumSizeHint();
3322 QSize maxSizeHint =
mElements.at(i)->maximumSizeHint();
3323 finalMinSize.setWidth(
mElements.at(i)->minimumSize().width() > 0 ?
mElements.at(i)->minimumSize().width() : minSizeHint.width());
3324 finalMinSize.setHeight(
mElements.at(i)->minimumSize().height() > 0 ?
mElements.at(i)->minimumSize().height() : minSizeHint.height());
3325 finalMaxSize.setWidth(
mElements.at(i)->maximumSize().width() < QWIDGETSIZE_MAX ?
mElements.at(i)->maximumSize().width() : maxSizeHint.width());
3326 finalMaxSize.setHeight(
mElements.at(i)->maximumSize().height() < QWIDGETSIZE_MAX ?
mElements.at(i)->maximumSize().height() : maxSizeHint.height());
3333 if (
insetRect.size().width() < finalMinSize.width())
3334 insetRect.setWidth(finalMinSize.width());
3335 if (
insetRect.size().height() < finalMinSize.height())
3336 insetRect.setHeight(finalMinSize.height());
3337 if (
insetRect.size().width() > finalMaxSize.width())
3338 insetRect.setWidth(finalMaxSize.width());
3339 if (
insetRect.size().height() > finalMaxSize.height())
3340 insetRect.setHeight(finalMaxSize.height());
3346 else if (al.testFlag(Qt::AlignRight))
insetRect.moveRight(
rect().
x()+
rect().width());
3349 else if (al.testFlag(Qt::AlignBottom))
insetRect.moveBottom(
rect().
y()+
rect().height());
3365 if (index >= 0 && index <
mElements.size())
3384 qDebug() << Q_FUNC_INFO <<
"Attempt to take invalid index:" << index;
3402 qDebug() << Q_FUNC_INFO <<
"Element not in this layout, couldn't take";
3404 qDebug() << Q_FUNC_INFO <<
"Can't take null element";
3427 if (
mElements.at(i)->realVisibility() &&
mElements.at(i)->selectTest(pos, onlySelectable) >= 0)
3453 mInsetRect.append(QRectF(0.6, 0.6, 0.4, 0.4));
3456 qDebug() << Q_FUNC_INFO <<
"Can't add null element";
3482 qDebug() << Q_FUNC_INFO <<
"Can't add null element";
3654 QVector2D lengthVec(dir.normalized());
3655 if (lengthVec.isNull())
3656 lengthVec = QVector2D(1, 0);
3657 QVector2D widthVec(-lengthVec.y(), lengthVec.x());
3661 QPen penBackup = painter->pen();
3662 QBrush brushBackup = painter->brush();
3663 QPen miterPen = penBackup;
3664 miterPen.setJoinStyle(Qt::MiterJoin);
3665 QBrush brush(painter->pen().color(), Qt::SolidPattern);
3671 QPointF points[3] = {pos.toPointF(),
3672 (pos-lengthVec+widthVec).toPointF(),
3673 (pos-lengthVec-widthVec).toPointF()
3675 painter->
setPen(miterPen);
3676 painter->setBrush(brush);
3677 painter->drawConvexPolygon(points, 3);
3678 painter->setBrush(brushBackup);
3679 painter->
setPen(penBackup);
3684 QPointF points[4] = {pos.toPointF(),
3685 (pos-lengthVec+widthVec).toPointF(),
3686 (pos-lengthVec*0.8f).toPointF(),
3687 (pos-lengthVec-widthVec).toPointF()
3689 painter->
setPen(miterPen);
3690 painter->setBrush(brush);
3691 painter->drawConvexPolygon(points, 4);
3692 painter->setBrush(brushBackup);
3693 painter->
setPen(penBackup);
3698 QPointF points[3] = {(pos-lengthVec+widthVec).toPointF(),
3700 (pos-lengthVec-widthVec).toPointF()
3702 painter->
setPen(miterPen);
3703 painter->drawPolyline(points, 3);
3704 painter->
setPen(penBackup);
3709 painter->setBrush(brush);
3710 painter->drawEllipse(pos.toPointF(),
mWidth*0.5,
mWidth*0.5);
3711 painter->setBrush(brushBackup);
3716 QVector2D widthVecPerp(-widthVec.y(), widthVec.x());
3717 QPointF points[4] = {(pos-widthVecPerp+widthVec).toPointF(),
3718 (pos-widthVecPerp-widthVec).toPointF(),
3719 (pos+widthVecPerp-widthVec).toPointF(),
3720 (pos+widthVecPerp+widthVec).toPointF()
3722 painter->
setPen(miterPen);
3723 painter->setBrush(brush);
3724 painter->drawConvexPolygon(points, 4);
3725 painter->setBrush(brushBackup);
3726 painter->
setPen(penBackup);
3731 QVector2D widthVecPerp(-widthVec.y(), widthVec.x());
3732 QPointF points[4] = {(pos-widthVecPerp).toPointF(),
3733 (pos-widthVec).toPointF(),
3734 (pos+widthVecPerp).toPointF(),
3735 (pos+widthVec).toPointF()
3737 painter->
setPen(miterPen);
3738 painter->setBrush(brush);
3739 painter->drawConvexPolygon(points, 4);
3740 painter->setBrush(brushBackup);
3741 painter->
setPen(penBackup);
3746 painter->
drawLine((pos+widthVec).toPointF(), (pos-widthVec).toPointF());
3751 painter->
drawLine((pos+widthVec).toPointF(), pos.toPointF());
3760 (pos-widthVec-lengthVec*0.2f*(
mInverted?-1:1)).toPointF());
3764 painter->
drawLine((pos+widthVec+lengthVec*0.2f*(
mInverted?-1:1)+dir.normalized()*qMax(1.0f, (
float)painter->pen().widthF())*0.5f).toPointF(),
3765 (pos-widthVec-lengthVec*0.2f*(
mInverted?-1:1)+dir.normalized()*qMax(1.0f, (
float)painter->pen().widthF())*0.5f).toPointF());
3779 draw(painter, pos, QVector2D(qCos(angle), qSin(angle)));
3806 QCPLayerable(parentAxis->parentPlot(),
"", parentAxis),
3807 mParentAxis(parentAxis)
3810 setParent(parentAxis);
3811 setPen(QPen(QColor(200,200,200), 0, Qt::DotLine));
3898 if (!
mParentAxis) { qDebug() << Q_FUNC_INFO <<
"invalid parent axis";
return; }
3913 if (!
mParentAxis) { qDebug() << Q_FUNC_INFO <<
"invalid parent axis";
return; }
3921 int zeroLineIndex = -1;
3927 for (
int i=lowTick; i <= highTick; ++i)
3941 for (
int i=lowTick; i <= highTick; ++i)
3943 if (i == zeroLineIndex)
continue;
3950 int zeroLineIndex = -1;
3956 for (
int i=lowTick; i <= highTick; ++i)
3970 for (
int i=lowTick; i <= highTick; ++i)
3972 if (i == zeroLineIndex)
continue;
3987 if (!
mParentAxis) { qDebug() << Q_FUNC_INFO <<
"invalid parent axis";
return; }
4115 mOrientation(orientation(type)),
4116 mSelectableParts(spAxis | spTickLabels | spAxisLabel),
4117 mSelectedParts(spNone),
4118 mBasePen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),
4119 mSelectedBasePen(QPen(Qt::blue, 2)),
4122 mLabelFont(mParentPlot->font()),
4123 mSelectedLabelFont(QFont(mLabelFont.family(), mLabelFont.pointSize(), QFont::Bold)),
4124 mLabelColor(Qt::black),
4125 mSelectedLabelColor(Qt::blue),
4128 mAutoTickLabels(true),
4129 mTickLabelType(ltNumber),
4130 mTickLabelFont(mParentPlot->font()),
4131 mSelectedTickLabelFont(QFont(mTickLabelFont.family(), mTickLabelFont.pointSize(), QFont::Bold)),
4132 mTickLabelColor(Qt::black),
4133 mSelectedTickLabelColor(Qt::blue),
4134 mDateTimeFormat(
"hh:mm:ss\ndd.MM.yy"),
4135 mDateTimeSpec(Qt::LocalTime),
4136 mNumberPrecision(6),
4137 mNumberFormatChar(
'g'),
4138 mNumberBeautifulPowers(true),
4145 mAutoTickStep(true),
4146 mAutoSubTicks(true),
4147 mTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),
4148 mSelectedTickPen(QPen(Qt::blue, 2)),
4149 mSubTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),
4150 mSelectedSubTickPen(QPen(Qt::blue, 2)),
4153 mRangeReversed(false),
4154 mScaleType(stLinear),
4156 mScaleLogBaseLogInv(1.0/qLn(mScaleLogBase)),
4160 mLowestVisibleTick(0),
4161 mHighestVisibleTick(-1),
4162 mCachedMarginValid(false),
4181 }
else if (type ==
atLeft)
4307 qDebug() << Q_FUNC_INFO <<
"Invalid logarithmic scale base (must be greater 1):" << base;
4423 if (alignment == Qt::AlignLeft)
4425 else if (alignment == Qt::AlignRight)
4428 setRange(position-size/2.0, position+size/2.0);
4534 if (approximateCount > 0)
4539 qDebug() << Q_FUNC_INFO <<
"approximateCount must be greater than zero:" << approximateCount;
4792 if (formatCode.isEmpty())
4794 qDebug() << Q_FUNC_INFO <<
"Passed formatCode is empty";
4800 QString allowedFormatChars =
"eEfgG";
4801 if (allowedFormatChars.contains(formatCode.at(0)))
4806 qDebug() << Q_FUNC_INFO <<
"Invalid number format code (first char not in 'eEfgG'):" << formatCode;
4809 if (formatCode.length() < 2)
4822 qDebug() << Q_FUNC_INFO <<
"Invalid number format code (second char not 'b' or first char neither 'e' nor 'g'):" << formatCode;
4825 if (formatCode.length() < 3)
4832 if (formatCode.at(2) ==
'c')
4835 }
else if (formatCode.at(2) ==
'd')
4840 qDebug() << Q_FUNC_INFO <<
"Invalid number format code (third char neither 'c' nor 'd'):" << formatCode;
5292 qDebug() << Q_FUNC_INFO <<
"Center of scaling operation doesn't lie in same logarithmic sign domain as range:" << center;
5314 int otherPixelSize, ownPixelSize;
5326 double newRangeSize = ratio*otherAxis->
range().
size()*ownPixelSize/(double)otherPixelSize;
5340 bool haveRange =
false;
5341 for (
int i=0; i<
p.size(); ++i)
5343 if (!
p.at(i)->realVisibility() && onlyVisiblePlottables)
5346 bool currentFoundRange;
5350 if (
p.at(i)->keyAxis() ==
this)
5351 plottableRange =
p.at(i)->getKeyRange(currentFoundRange, signDomain);
5353 plottableRange =
p.at(i)->getValueRange(currentFoundRange, signDomain);
5354 if (currentFoundRange)
5357 newRange = plottableRange;
5359 newRange.
expand(plottableRange);
5367 double center = (newRange.
lower+newRange.
upper)*0.5;
5437 else if (value <= 0 && mRange.upper > 0)
5459 else if (value <= 0 && mRange.upper > 0)
5505 details->setValue(part);
5518 QList<QCPAbstractPlottable*> result;
5536 QList<QCPGraph*> result;
5555 QList<QCPAbstractItem*> result;
5560 QList<QCPItemPosition*> positions =
mParentPlot->
mItems.at(itemId)->positions();
5561 for (
int posId=0; posId<positions.size(); ++posId)
5563 if (positions.at(posId)->keyAxis() ==
this || positions.at(posId)->valueAxis() ==
this)
5587 qDebug() << Q_FUNC_INFO <<
"Invalid margin side passed:" << (int)side;
5602 default: qDebug() << Q_FUNC_INFO <<
"invalid axis type";
return atLeft;
break;
5638 double subTickStep = 0;
5639 double subTickPosition = 0;
5640 int subTickIndex = 0;
5644 for (
int i=lowTick+1; i<=highTick; ++i)
5649 subTickPosition =
mTickVector.at(i-1) + k*subTickStep;
5678#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
5714 double magnitudeFactor = qPow(10.0, qFloor(qLn(
mTickStep)/qLn(10.0)));
5715 double tickStepMantissa =
mTickStep/magnitudeFactor;
5716 if (tickStepMantissa < 5)
5719 mTickStep = (int)(tickStepMantissa*2)/2.0*magnitudeFactor;
5723 mTickStep = (int)(tickStepMantissa/2.0)*2.0*magnitudeFactor;
5731 int tickcount = lastStep-firstStep+1;
5732 if (tickcount < 0) tickcount = 0;
5734 for (
int i=0; i<tickcount; ++i)
5742 double currentMag = lowerMag;
5745 while (currentMag < mRange.upper && currentMag > 0)
5753 double currentMag = lowerMag;
5756 while (currentMag <
mRange.
upper && currentMag < 0)
5764 qDebug() << Q_FUNC_INFO <<
"Invalid range for logarithmic plot: " <<
mRange.
lower <<
"-" <<
mRange.
upper;
5787 double magnitudeFactor = qPow(10.0, qFloor(qLn(
tickStep)/qLn(10.0)));
5788 double tickStepMantissa =
tickStep/magnitudeFactor;
5791 double epsilon = 0.01;
5794 double fracPart = modf(tickStepMantissa, &intPartf);
5798 if (fracPart < epsilon || 1.0-fracPart < epsilon)
5800 if (1.0-fracPart < epsilon)
5804 case 1: result = 4;
break;
5805 case 2: result = 3;
break;
5806 case 3: result = 2;
break;
5807 case 4: result = 3;
break;
5808 case 5: result = 4;
break;
5809 case 6: result = 2;
break;
5810 case 7: result = 6;
break;
5811 case 8: result = 3;
break;
5812 case 9: result = 2;
break;
5817 if (qAbs(fracPart-0.5) < epsilon)
5821 case 1: result = 2;
break;
5822 case 2: result = 4;
break;
5823 case 3: result = 4;
break;
5824 case 4: result = 2;
break;
5825 case 5: result = 4;
break;
5826 case 6: result = 4;
break;
5827 case 7: result = 2;
break;
5828 case 8: result = 4;
break;
5829 case 9: result = 4;
break;
5847 if (selectionStateChanged)
5857 if (selectionStateChanged)
5888 QVector<double> subTickPositions;
5889 QVector<double> tickPositions;
5891 tickPositions.reserve(highTick-lowTick+1);
5897 for (
int i=lowTick; i<=highTick; ++i)
5951 bool lowFound =
false;
5952 bool highFound =
false;
5975 if (!lowFound && highFound)
5976 lowIndex = highIndex+1;
5977 else if (lowFound && !highFound)
5978 highIndex = lowIndex-1;
6101 int lowTick, highTick;
6103 QVector<double> tickPositions;
6105 tickPositions.reserve(highTick-lowTick+1);
6109 for (
int i=lowTick; i<=highTick; ++i)
6163 basePen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),
6167 tickLabelPadding(0),
6168 tickLabelRotation(0),
6169 substituteExponent(true),
6170 numberMultiplyCross(false),
6174 subTickLengthOut(0),
6175 tickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),
6176 subTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),
6178 abbreviateDecimalPowers(false),
6179 reversedEndings(false),
6180 mParentPlot(parentPlot),
6214 double xCor = 0, yCor = 0;
6227 baseLine.setPoints(origin+QPointF(xCor, yCor), origin+QPointF(
alignmentRect.width()+xCor, yCor));
6229 baseLine.setPoints(origin+QPointF(xCor, yCor), origin+QPointF(xCor, -
alignmentRect.height()+yCor));
6231 baseLine = QLineF(baseLine.p2(), baseLine.p1());
6271 painter->setBrush(QBrush(
basePen.color()));
6272 QVector2D baseLineVector(baseLine.dx(), baseLine.dy());
6280 QSize tickLabelsSize(0, 0);
6287 for (
int i=0; i<maxLabelIndex; ++i)
6290 margin += tickLabelsSize.height();
6292 margin += tickLabelsSize.width();
6297 if (!
label.isEmpty())
6302 labelBounds = painter->fontMetrics().boundingRect(0, 0, 0, 0, Qt::TextDontClip,
label);
6305 QTransform oldTransform = painter->transform();
6306 painter->translate((origin.x()-margin-labelBounds.height()), origin.y());
6307 painter->rotate(-90);
6308 painter->drawText(0, 0,
alignmentRect.height(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter,
label);
6309 painter->setTransform(oldTransform);
6313 QTransform oldTransform = painter->transform();
6314 painter->translate((origin.x()+margin+labelBounds.height()), origin.y()-
alignmentRect.height());
6315 painter->rotate(90);
6316 painter->drawText(0, 0,
alignmentRect.height(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter,
label);
6317 painter->setTransform(oldTransform);
6320 painter->drawText(origin.x(), origin.y()-margin-labelBounds.height(),
alignmentRect.width(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter,
label);
6322 painter->drawText(origin.x(), origin.y()+margin,
alignmentRect.width(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter,
label);
6326 int selectionTolerance = 0;
6330 qDebug() << Q_FUNC_INFO <<
"mParentPlot is null";
6332 int selAxisInSize = selectionTolerance;
6333 int selTickLabelSize = (
QCPAxis::orientation(
type) == Qt::Horizontal ? tickLabelsSize.height() : tickLabelsSize.width());
6335 int selLabelSize = labelBounds.height();
6336 int selLabelOffset = selTickLabelOffset+selTickLabelSize+
labelPadding;
6377 QSize tickLabelsSize(0, 0);
6387 if (!
label.isEmpty())
6391 bounds = fontMetrics.boundingRect(0, 0, 0, 0, Qt::TextDontClip | Qt::AlignHCenter | Qt::AlignVCenter,
label);
6449 if (text.isEmpty())
return;
6451 QPointF labelAnchor;
6468 newCachedLabel->
pixmap.fill(Qt::transparent);
6470 cachePainter.
setPen(painter->pen());
6488 painter->drawPixmap(labelAnchor+cachedLabel->
offset, cachedLabel->
pixmap);
6489 finalSize = cachedLabel->
pixmap.size();
6506 drawTickLabel(painter, finalPosition.x(), finalPosition.y(), labelData);
6511 if (finalSize.width() > tickLabelsSize->width())
6512 tickLabelsSize->setWidth(finalSize.width());
6513 if (finalSize.height() > tickLabelsSize->height())
6514 tickLabelsSize->setHeight(finalSize.height());
6529 QTransform oldTransform = painter->transform();
6530 QFont oldFont = painter->font();
6533 painter->translate(
x,
y);
6538 if (!labelData.
expPart.isEmpty())
6540 painter->setFont(labelData.
baseFont);
6541 painter->drawText(0, 0, 0, 0, Qt::TextDontClip, labelData.
basePart);
6542 painter->setFont(labelData.
expFont);
6546 painter->setFont(labelData.
baseFont);
6551 painter->setTransform(oldTransform);
6552 painter->setFont(oldFont);
6568 bool useBeautifulPowers =
false;
6572 ePos = text.indexOf(
'e');
6574 useBeautifulPowers =
true;
6579 if (result.
baseFont.pointSizeF() > 0)
6581 if (useBeautifulPowers)
6590 result.
expPart = text.mid(ePos+1);
6592 while (result.
expPart.length() > 2 && result.
expPart.at(1) ==
'0')
6606 result.
totalBounds = QFontMetrics(result.
baseFont).boundingRect(0, 0, 0, 0, Qt::TextDontClip | Qt::AlignHCenter, result.
basePart);
6614 QTransform transform;
6694 x = -qSin(-radians)*labelData.
totalBounds.height()/2.0;
6722 return QPointF(
x,
y);
6739 finalSize = cachedLabel->
pixmap.size();
6747 if (finalSize.width() > tickLabelsSize->width())
6748 tickLabelsSize->setWidth(finalSize.width());
6749 if (finalSize.height() > tickLabelsSize->height())
6750 tickLabelsSize->setHeight(finalSize.height());
6901 QCPLayerable(keyAxis->parentPlot(),
"", keyAxis->axisRect()),
6903 mAntialiasedFill(true),
6904 mAntialiasedScatters(true),
6905 mAntialiasedErrorBars(false),
6907 mSelectedPen(Qt::black),
6908 mBrush(Qt::NoBrush),
6909 mSelectedBrush(Qt::NoBrush),
6911 mValueAxis(valueAxis),
6916 qDebug() << Q_FUNC_INFO <<
"Parent plot of keyAxis is not the same as that of valueAxis.";
6918 qDebug() << Q_FUNC_INFO <<
"keyAxis and valueAxis must be orthogonal to each other.";
7114 if (!
keyAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key axis";
return; }
7128 double center = (newRange.
lower+newRange.
upper)*0.5;
7154 if (!
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid value axis";
return; }
7168 double center = (newRange.
lower+newRange.
upper)*0.5;
7258 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
7280 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return QPointF(); }
7302 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
7428 double vLengthSqr = v.lengthSquared();
7429 if (!qFuzzyIsNull(vLengthSqr))
7431 double mu = QVector2D::dotProduct(
p-a, v)/vLengthSqr;
7433 return (a-
p).lengthSquared();
7435 return (b-
p).lengthSquared();
7437 return ((a + mu*v)-
p).lengthSquared();
7439 return (a-
p).lengthSquared();
7451 if (selectionStateChanged)
7452 *selectionStateChanged =
mSelected != selBefore;
7463 if (selectionStateChanged)
7464 *selectionStateChanged =
mSelected != selBefore;
7515 mParentPlot(parentPlot),
7516 mParentItem(parentItem),
7524 QList<QCPItemPosition*> currentChildren(
mChildren.toList());
7525 for (
int i=0; i<currentChildren.size(); ++i)
7526 currentChildren.at(i)->setParentAnchor(0);
7544 qDebug() << Q_FUNC_INFO <<
"no valid anchor id set:" <<
mAnchorId;
7549 qDebug() << Q_FUNC_INFO <<
"no parent item set";
7566 qDebug() << Q_FUNC_INFO <<
"provided pos is child already" <<
reinterpret_cast<quintptr
>(pos);
7578 qDebug() << Q_FUNC_INFO <<
"provided pos isn't child" <<
reinterpret_cast<quintptr
>(pos);
7619 mPositionType(ptAbsolute),
7631 QList<QCPItemPosition*> currentChildren(
mChildren.toList());
7632 for (
int i=0; i<currentChildren.size(); ++i)
7633 currentChildren.at(i)->setParentAnchor(0);
7673 bool recoverPixelPosition =
true;
7675 recoverPixelPosition =
false;
7677 recoverPixelPosition =
false;
7680 if (recoverPixelPosition)
7685 if (recoverPixelPosition)
7710 qDebug() << Q_FUNC_INFO <<
"can't set self as parent anchor" <<
reinterpret_cast<quintptr
>(
parentAnchor);
7715 while (currentParent)
7720 if (currentParentPos ==
this)
7722 qDebug() << Q_FUNC_INFO <<
"can't create recursive parent-child-relationship" <<
reinterpret_cast<quintptr
>(
parentAnchor);
7725 currentParent = currentParentPos->mParentAnchor;
7733 qDebug() << Q_FUNC_INFO <<
"can't set parent to be an anchor which itself depends on this position" <<
reinterpret_cast<quintptr
>(
parentAnchor);
7746 if (keepPixelPosition)
7756 if (keepPixelPosition)
7838 qDebug() << Q_FUNC_INFO <<
"No axis rect defined";
7849 if (
mKeyAxis.data()->orientation() == Qt::Horizontal)
7861 if (
mKeyAxis.data()->orientation() == Qt::Horizontal)
7873 if (
mValueAxis.data()->orientation() == Qt::Horizontal)
7885 qDebug() << Q_FUNC_INFO <<
"No axes defined";
7889 return QPointF(
x,
y);
7965 p.ry() /= (double)
mAxisRect.data()->height();
7971 p.ry() /= (double)
mAxisRect.data()->height();
7976 qDebug() << Q_FUNC_INFO <<
"No axis rect defined";
7984 double newKey, newValue;
7988 if (
mKeyAxis.data()->orientation() == Qt::Horizontal)
8000 if (
mKeyAxis.data()->orientation() == Qt::Horizontal)
8012 if (
mValueAxis.data()->orientation() == Qt::Horizontal)
8024 qDebug() << Q_FUNC_INFO <<
"No axes defined";
8206 mClipToAxisRect(false),
8211 if (rects.size() > 0)
8314 qDebug() << Q_FUNC_INFO <<
"position with name not found:" << name;
8330 for (
int i=0; i<
mAnchors.size(); ++i)
8332 if (
mAnchors.at(i)->name() == name)
8335 qDebug() << Q_FUNC_INFO <<
"anchor with name not found:" << name;
8349 for (
int i=0; i<
mAnchors.size(); ++i)
8351 if (
mAnchors.at(i)->name() == name)
8411 double vLengthSqr = v.lengthSquared();
8412 if (!qFuzzyIsNull(vLengthSqr))
8414 double mu = QVector2D::dotProduct(
p-a, v)/vLengthSqr;
8416 return (a-
p).lengthSquared();
8418 return (b-
p).lengthSquared();
8420 return ((a + mu*v)-
p).lengthSquared();
8422 return (a-
p).lengthSquared();
8447 QList<QLineF> lines;
8448 lines << QLineF(rect.topLeft(), rect.topRight()) << QLineF(rect.bottomLeft(), rect.bottomRight())
8449 << QLineF(rect.topLeft(), rect.bottomLeft()) << QLineF(rect.topRight(), rect.bottomRight());
8450 double minDistSqr = std::numeric_limits<double>::max();
8451 for (
int i=0; i<lines.size(); ++i)
8453 double distSqr =
distSqrToLine(lines.at(i).p1(), lines.at(i).p2(), pos);
8454 if (distSqr < minDistSqr)
8455 minDistSqr = distSqr;
8457 result = qSqrt(minDistSqr);
8462 if (rect.contains(pos))
8480 qDebug() << Q_FUNC_INFO <<
"called on item which shouldn't have any anchors (this method not reimplemented). anchorId" << anchorId;
8501 qDebug() << Q_FUNC_INFO <<
"anchor/position with name exists already:" << name;
8535 qDebug() << Q_FUNC_INFO <<
"anchor/position with name exists already:" << name;
8550 if (selectionStateChanged)
8551 *selectionStateChanged =
mSelected != selBefore;
8562 if (selectionStateChanged)
8563 *selectionStateChanged =
mSelected != selBefore;
9080 mAutoAddPlottableToLegend(true),
9081 mAntialiasedElements(
QCP::aeNone),
9082 mNotAntialiasedElements(
QCP::aeNone),
9084 mSelectionTolerance(8),
9085 mNoAntialiasingOnDrag(false),
9086 mBackgroundBrush(Qt::
white, Qt::SolidPattern),
9087 mBackgroundScaled(true),
9088 mBackgroundScaledMode(Qt::KeepAspectRatioByExpanding),
9090 mPlottingHints(
QCP::phCacheLabels|
QCP::phForceRepaint),
9091 mMultiSelectModifier(Qt::ControlModifier),
9092 mPaintBuffer(size()),
9093 mMouseEventElement(0),
9096 setAttribute(Qt::WA_NoMousePropagation);
9097 setAttribute(Qt::WA_OpaquePaintEvent);
9098 setMouseTracking(
true);
9099 QLocale currentLocale = locale();
9100 currentLocale.setNumberOptions(QLocale::OmitGroupSeparator);
9101 setLocale(currentLocale);
9128 defaultAxisRect->
setLayer(
"background");
9519 qDebug() << Q_FUNC_INFO <<
"index out of bounds:" << index;
9554 qDebug() << Q_FUNC_INFO <<
"plottable already added to this QCustomPlot:" <<
reinterpret_cast<quintptr
>(
plottable);
9559 qDebug() << Q_FUNC_INFO <<
"plottable not created with this QCustomPlot as parent:" <<
reinterpret_cast<quintptr
>(
plottable);
9586 qDebug() << Q_FUNC_INFO <<
"plottable not in list:" <<
reinterpret_cast<quintptr
>(
plottable);
9611 qDebug() << Q_FUNC_INFO <<
"index out of bounds:" << index;
9626 for (
int i=c-1; i >= 0; --i)
9650 QList<QCPAbstractPlottable*> result;
9683 if (currentDistance >= 0 && currentDistance < resultDistance)
9686 resultDistance = currentDistance;
9691 return resultPlottable;
9714 if (index >= 0 && index <
mGraphs.size())
9719 qDebug() << Q_FUNC_INFO <<
"index out of bounds:" << index;
9754 if (!keyAxis) keyAxis =
xAxis;
9755 if (!valueAxis) valueAxis =
yAxis;
9756 if (!keyAxis || !valueAxis)
9758 qDebug() << Q_FUNC_INFO <<
"can't use default QCustomPlot xAxis or yAxis, because at least one is invalid (has been deleted)";
9763 qDebug() << Q_FUNC_INFO <<
"passed keyAxis or valueAxis doesn't have this QCustomPlot as parent";
9799 if (index >= 0 && index <
mGraphs.size())
9815 for (
int i=c-1; i >= 0; --i)
9840 QList<QCPGraph*> result;
9844 result.append(
graph);
9859 if (index >= 0 && index <
mItems.size())
9864 qDebug() << Q_FUNC_INFO <<
"index out of bounds:" << index;
9901 qDebug() << Q_FUNC_INFO <<
"item either already in list or not created with this QCustomPlot as parent:" <<
reinterpret_cast<quintptr
>(
item);
9922 qDebug() << Q_FUNC_INFO <<
"item not in list:" <<
reinterpret_cast<quintptr
>(
item);
9933 if (index >= 0 && index <
mItems.size())
9937 qDebug() << Q_FUNC_INFO <<
"index out of bounds:" << index;
9952 for (
int i=c-1; i >= 0; --i)
9974 QList<QCPAbstractItem*> result;
9978 result.append(
item);
10008 if (currentDistance >= 0 && currentDistance < resultDistance)
10011 resultDistance = currentDistance;
10055 if (index >= 0 && index <
mLayers.size())
10060 qDebug() << Q_FUNC_INFO <<
"index out of bounds:" << index;
10090 qDebug() << Q_FUNC_INFO <<
"layer with name doesn't exist:" << name;
10107 qDebug() << Q_FUNC_INFO <<
"layer not a layer of this QCustomPlot:" <<
reinterpret_cast<quintptr
>(
layer);
10142 if (!
mLayers.contains(otherLayer))
10144 qDebug() << Q_FUNC_INFO <<
"otherLayer not a layer of this QCustomPlot:" <<
reinterpret_cast<quintptr
>(otherLayer);
10149 qDebug() << Q_FUNC_INFO <<
"A layer exists already with the name" << name;
10177 qDebug() << Q_FUNC_INFO <<
"layer not a layer of this QCustomPlot:" <<
reinterpret_cast<quintptr
>(
layer);
10182 qDebug() << Q_FUNC_INFO <<
"can't remove last layer";
10188 bool isFirstLayer = removedIndex==0;
10193 for (
int i=children.size()-1; i>=0; --i)
10194 children.at(i)->moveToLayer(targetLayer,
true);
10197 for (
int i=0; i<children.size(); ++i)
10198 children.at(i)->moveToLayer(targetLayer,
false);
10223 qDebug() << Q_FUNC_INFO <<
"layer not a layer of this QCustomPlot:" <<
reinterpret_cast<quintptr
>(
layer);
10226 if (!
mLayers.contains(otherLayer))
10228 qDebug() << Q_FUNC_INFO <<
"otherLayer not a layer of this QCustomPlot:" <<
reinterpret_cast<quintptr
>(otherLayer);
10262 const QList<QCPAxisRect*> rectList =
axisRects();
10263 if (index >= 0 && index < rectList.size())
10265 return rectList.at(index);
10268 qDebug() << Q_FUNC_INFO <<
"invalid axis rect index" << index;
10280 QList<QCPAxisRect*> result;
10281 QStack<QCPLayoutElement*> elementStack;
10285 while (!elementStack.isEmpty())
10291 elementStack.push(element);
10292 if (
QCPAxisRect *ar = qobject_cast<QCPAxisRect*>(element))
10313 bool searchSubElements =
true;
10314 while (searchSubElements && currentElement)
10316 searchSubElements =
false;
10321 currentElement = subElement;
10322 searchSubElements =
true;
10327 return currentElement;
10339 QList<QCPAxis*> result, allAxes;
10341 allAxes << rect->
axes();
10343 foreach (
QCPAxis *axis, allAxes)
10346 result.append(axis);
10361 QList<QCPLegend*> result;
10363 QStack<QCPLayoutElement*> elementStack;
10367 while (!elementStack.isEmpty())
10373 elementStack.push(subElement);
10374 if (
QCPLegend *leg = qobject_cast<QCPLegend*>(subElement))
10377 result.append(leg);
10427 if (painter.isActive())
10429 painter.setRenderHint(QPainter::HighQualityAntialiasing);
10439 qDebug() << Q_FUNC_INFO <<
"Couldn't activate painter on buffer";
10455 QList<QCPAxis*> allAxes;
10457 allAxes << rect->
axes();
10459 foreach (
QCPAxis *axis, allAxes)
10460 axis->
rescale(onlyVisiblePlottables);
10500bool QCustomPlot::savePdf(
const QString &fileName,
bool noCosmeticPen,
int width,
int height,
const QString &pdfCreator,
const QString &pdfTitle)
10502 bool success =
false;
10503#ifdef QT_NO_PRINTER
10505 Q_UNUSED(noCosmeticPen)
10508 qDebug() << Q_FUNC_INFO <<
"Qt was built without printer support (QT_NO_PRINTER). PDF not created.";
10510 int newWidth, newHeight;
10511 if (width == 0 || height == 0)
10513 newWidth = this->width();
10514 newHeight = this->height();
10518 newHeight = height;
10521 QPrinter printer(QPrinter::ScreenResolution);
10522 printer.setOutputFileName(fileName);
10523 printer.setOutputFormat(QPrinter::PdfFormat);
10524 printer.setFullPage(
true);
10525 printer.setColorMode(QPrinter::Color);
10526 printer.printEngine()->setProperty(QPrintEngine::PPK_Creator, pdfCreator);
10527 printer.printEngine()->setProperty(QPrintEngine::PPK_DocumentName, pdfTitle);
10530 printer.setPaperSize(
viewport().size(), QPrinter::DevicePixel);
10532 if (printpainter.
begin(&printer))
10543 draw(&printpainter);
10544 printpainter.end();
10591 return saveRastered(fileName, width, height, scale,
"PNG", quality);
10630 return saveRastered(fileName, width, height, scale,
"JPG", quality);
10666 return saveRastered(fileName, width, height, scale,
"BMP");
10700 QPainter painter(
this);
10737 else if (
QCPAxis *ax = qobject_cast<QCPAxis*>(clickedLayerable))
10739 else if (
QCPAbstractItem *ai = qobject_cast<QCPAbstractItem*>(clickedLayerable))
10741 else if (
QCPLegend *lg = qobject_cast<QCPLegend*>(clickedLayerable))
10745 else if (
QCPPlotTitle *pt = qobject_cast<QCPPlotTitle*>(clickedLayerable))
10750 el->mouseDoubleClickEvent(event);
10779 QWidget::mousePressEvent(event);
10799 QWidget::mouseMoveEvent(event);
10819 bool doReplot =
false;
10823 if (event->button() == Qt::LeftButton)
10828 bool selectionStateChanged =
false;
10839 bool selChanged =
false;
10841 selectionStateChanged |= selChanged;
10849 bool selChanged =
false;
10850 clickedLayerable->
selectEvent(event, additive, details, &selChanged);
10851 selectionStateChanged |= selChanged;
10854 if (selectionStateChanged)
10863 else if (
QCPAxis *ax = qobject_cast<QCPAxis*>(clickedLayerable))
10865 else if (
QCPAbstractItem *ai = qobject_cast<QCPAbstractItem*>(clickedLayerable))
10867 else if (
QCPLegend *lg = qobject_cast<QCPLegend*>(clickedLayerable))
10871 else if (
QCPPlotTitle *pt = qobject_cast<QCPPlotTitle*>(clickedLayerable))
10885 QWidget::mouseReleaseEvent(event);
10900 el->wheelEvent(event);
10902 QWidget::wheelEvent(event);
10930 painter->setClipRect(child->
clipRect().translated(0, -1));
10932 child->
draw(painter);
11016 if (this->legend ==
legend)
11028 for (
int i=0; i<
mLayers.size(); ++i)
11046 for (
int layerIndex=
mLayers.size()-1; layerIndex>=0; --layerIndex)
11048 const QList<QCPLayerable*> layerables =
mLayers.at(layerIndex)->children();
11051 for (
int i=layerables.size()-1; i>=0; --i)
11053 if (!layerables.at(i)->realVisibility())
11056 double dist = layerables.at(i)->
selectTest(pos, onlySelectable, &details);
11057 if (dist >= 0 && dist < minimumDistance)
11059 minimumDistance = dist;
11060 minimumDistanceLayerable = layerables.at(i);
11061 if (selectionDetails) *selectionDetails = details;
11065 return minimumDistanceLayerable;
11083 QPixmap buffer =
toPixmap(width, height, scale);
11084 if (!buffer.isNull())
11085 return buffer.save(fileName, format, quality);
11101 int newWidth, newHeight;
11102 if (width == 0 || height == 0)
11104 newWidth = this->width();
11105 newHeight = this->height();
11109 newHeight = height;
11111 int scaledWidth = qRound(scale*newWidth);
11112 int scaledHeight = qRound(scale*newHeight);
11114 QPixmap result(scaledWidth, scaledHeight);
11117 painter.
begin(&result);
11118 if (painter.isActive())
11123 if (!qFuzzyCompare(scale, 1.0))
11127 painter.scale(scale, scale);
11136 qDebug() << Q_FUNC_INFO <<
"Couldn't activate painter on pixmap";
11157 int newWidth, newHeight;
11158 if (width == 0 || height == 0)
11160 newWidth = this->width();
11161 newHeight = this->height();
11165 newHeight = height;
11168 if (painter->isActive())
11180 qDebug() << Q_FUNC_INFO <<
"Passed painter is not active";
11222 mColorInterpolation(ciRGB),
11224 mColorBufferInvalidated(true)
11233 return ((other.
mLevelCount == this->mLevelCount) &&
11235 (other.
mPeriodic == this->mPeriodic) &&
11249 qDebug() << Q_FUNC_INFO <<
"n must be greater or equal 2 but was" <<
n;
11340 qDebug() << Q_FUNC_INFO <<
"null pointer given as data";
11345 qDebug() << Q_FUNC_INFO <<
"null pointer given as scanLine";
11356 for (
int i=0; i<
n; ++i)
11365 for (
int i=0; i<
n; ++i)
11367 int index = (
data[dataIndexFactor*i]-range.
lower)*posToIndexFactor;
11379 for (
int i=0; i<
n; ++i)
11388 for (
int i=0; i<
n; ++i)
11567 for (QMap<double, QColor>::const_iterator it=
mColorStops.constBegin(); it!=
mColorStops.constEnd(); ++it)
11583 double indexToPosFactor = 1.0/(double)(
mLevelCount-1);
11586 double position = i*indexToPosFactor;
11587 QMap<double, QColor>::const_iterator it =
mColorStops.lowerBound(position);
11596 QMap<double, QColor>::const_iterator high = it;
11597 QMap<double, QColor>::const_iterator low = it-1;
11598 double t = (position-low.key())/(high.key()-low.key());
11603 mColorBuffer[i] = qRgb((1-t)*low.value().red() + t*high.value().red(),
11604 (1-t)*low.value().green() + t*high.value().green(),
11605 (1-t)*low.value().blue() + t*high.value().blue());
11610 QColor lowHsv = low.value().toHsv();
11611 QColor highHsv = high.value().toHsv();
11613 double hueDiff = highHsv.hueF()-lowHsv.hueF();
11615 hue = lowHsv.hueF() - t*(1.0-hueDiff);
11616 else if (hueDiff < -0.5)
11617 hue = lowHsv.hueF() + t*(1.0+hueDiff);
11619 hue = lowHsv.hueF() + t*hueDiff;
11620 if (hue < 0) hue += 1.0;
11621 else if (hue >= 1.0) hue -= 1.0;
11622 mColorBuffer[i] = QColor::fromHsvF(hue, (1-t)*lowHsv.saturationF() + t*highHsv.saturationF(), (1-t)*lowHsv.valueF() + t*highHsv.valueF()).rgb();
11770 mBackgroundBrush(Qt::NoBrush),
11771 mBackgroundScaled(true),
11772 mBackgroundScaledMode(Qt::KeepAspectRatioByExpanding),
11774 mRangeDrag(Qt::Horizontal|Qt::Vertical),
11775 mRangeZoom(Qt::Horizontal|Qt::Vertical),
11776 mRangeZoomFactorHorz(0.85),
11777 mRangeZoomFactorVert(0.85),
11791 if (setupDefaultAxes)
11817 QList<QCPAxis*> axesList =
axes();
11818 for (
int i=0; i<axesList.size(); ++i)
11829 return mAxes.value(type).size();
11839 QList<QCPAxis*> ax(
mAxes.value(type));
11840 if (index >= 0 && index < ax.size())
11842 return ax.at(index);
11845 qDebug() << Q_FUNC_INFO <<
"Axis index out of bounds:" << index;
11860 QList<QCPAxis*> result;
11878 QList<QCPAxis*> result;
11879 QHashIterator<QCPAxis::AxisType, QList<QCPAxis*> > it(
mAxes);
11880 while (it.hasNext())
11883 result << it.value();
11906 mAxes[type].append(newAxis);
11920 QList<QCPAxis*> result;
11942 QHashIterator<QCPAxis::AxisType, QList<QCPAxis*> > it(
mAxes);
11943 while (it.hasNext())
11946 if (it.value().contains(
axis))
11949 if (qobject_cast<QCustomPlot*>(
parentPlot()))
11955 qDebug() << Q_FUNC_INFO <<
"Axis isn't in axis rect:" <<
reinterpret_cast<quintptr
>(
axis);
11987 QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;
12049 connect(xAxis, SIGNAL(rangeChanged(
QCPRange)), xAxis2, SLOT(setRange(
QCPRange)));
12050 connect(yAxis, SIGNAL(rangeChanged(
QCPRange)), yAxis2, SLOT(setRange(
QCPRange)));
12065 QList<QCPAbstractPlottable*> result;
12085 QList<QCPGraph*> result;
12108 QList<QCPAbstractItem*> result;
12116 QList<QCPItemPosition*> positions =
mParentPlot->
mItems.at(itemId)->positions();
12117 for (
int posId=0; posId<positions.size(); ++posId)
12119 if (positions.at(posId)->axisRect() ==
this ||
12120 positions.at(posId)->keyAxis()->axisRect() ==
this ||
12121 positions.at(posId)->valueAxis()->axisRect() ==
this)
12147 QList<QCPAxis*> allAxes =
axes();
12148 for (
int i=0; i<allAxes.size(); ++i)
12149 allAxes.at(i)->setupTickVectors();
12167 QList<QCPLayoutElement*> result;
12444 const QList<QCPAxis*> axesList =
mAxes.value(type);
12445 if (axesList.isEmpty())
12448 bool isFirstVisible = !axesList.first()->visible();
12449 for (
int i=1; i<axesList.size(); ++i)
12451 int offset = axesList.at(i-1)->offset() + axesList.at(i-1)->calculateMargin();
12452 if (axesList.at(i)->visible())
12454 if (!isFirstVisible)
12455 offset += axesList.at(i)->tickLengthIn();
12456 isFirstVisible =
false;
12458 axesList.at(i)->setOffset(
offset);
12466 qDebug() << Q_FUNC_INFO <<
"Called with side that isn't specified as auto margin";
12472 if (axesList.size() > 0)
12473 return axesList.last()->offset() + axesList.last()->calculateMargin();
12492 if (event->buttons() & Qt::LeftButton)
12530 double diff = rangeDragHorzAxis->pixelToCoord(
mDragStart.x()) - rangeDragHorzAxis->pixelToCoord(event->pos().x());
12534 double diff = rangeDragHorzAxis->pixelToCoord(
mDragStart.x()) / rangeDragHorzAxis->pixelToCoord(event->pos().x());
12545 double diff = rangeDragVertAxis->pixelToCoord(
mDragStart.y()) - rangeDragVertAxis->pixelToCoord(event->pos().y());
12549 double diff = rangeDragVertAxis->pixelToCoord(
mDragStart.y()) / rangeDragVertAxis->pixelToCoord(event->pos().y());
12597 double wheelSteps =
event->delta()/120.0;
12660 mParentLegend(parent),
12661 mFont(parent->font()),
12662 mTextColor(parent->textColor()),
12663 mSelectedFont(parent->selectedFont()),
12664 mSelectedTextColor(parent->selectedTextColor()),
12753 if (
mRect.contains(pos.toPoint()))
12780 if (selectionStateChanged)
12781 *selectionStateChanged =
mSelected != selBefore;
12792 if (selectionStateChanged)
12793 *selectionStateChanged =
mSelected != selBefore;
12836 mPlottable(plottable)
12882 QRectF textRect = painter->fontMetrics().boundingRect(0, 0, 0, iconSize.height(), Qt::TextDontClip,
mPlottable->
name());
12883 QRectF iconRect(
mRect.topLeft(), iconSize);
12884 int textHeight = qMax(textRect.height(), iconSize.height());
12888 painter->setClipRect(iconRect, Qt::IntersectClip);
12895 painter->setBrush(Qt::NoBrush);
12896 painter->drawRect(iconRect);
12908 QSize result(0, 0);
12910 QFontMetrics fontMetrics(
getFont());
12912 textRect = fontMetrics.boundingRect(0, 0, 0, iconSize.height(), Qt::TextDontClip,
mPlottable->
name());
12914 result.setHeight(qMax(textRect.height(), iconSize.height()) +
mMargins.top() +
mMargins.bottom());
12998 bool hasSelectedItems =
false;
13003 hasSelectedItems =
true;
13007 if (hasSelectedItems)
13147 SelectableParts newSelected = selected;
13154 qDebug() << Q_FUNC_INFO <<
"spItems flag can not be set, it can only be unset with this function";
13155 newSelected &= ~spItems;
13243 return qobject_cast<QCPAbstractLegendItem*>(
elementAt(index));
13258 if (pli->plottable() == plottable)
13325 bool success =
remove(ali);
13364 QList<QCPAbstractLegendItem*> result;
13369 if (ali->selected())
13370 result.append(ali);
13451 if (selectionStateChanged)
13464 if (selectionStateChanged)
13529 mFont(QFont(
"sans serif", 13*1.5, QFont::Bold)),
13530 mTextColor(Qt::black),
13531 mSelectedFont(QFont(
"sans serif", 13*1.6, QFont::Bold)),
13532 mSelectedTextColor(Qt::blue),
13533 mSelectable(false),
13552 mFont(QFont(parentPlot->font().family(), parentPlot->font().pointSize()*1.5, QFont::Bold)),
13553 mTextColor(Qt::black),
13554 mSelectedFont(QFont(parentPlot->font().family(), parentPlot->font().pointSize()*1.6, QFont::Bold)),
13555 mSelectedTextColor(Qt::blue),
13556 mSelectable(false),
13661 QFontMetrics metrics(
mFont);
13662 QSize result = metrics.boundingRect(0, 0, 0, 0, Qt::AlignCenter,
mText).size();
13671 QFontMetrics metrics(
mFont);
13672 QSize result = metrics.boundingRect(0, 0, 0, 0, Qt::AlignCenter,
mText).size();
13674 result.setWidth(QWIDGETSIZE_MAX);
13687 if (selectionStateChanged)
13688 *selectionStateChanged =
mSelected != selBefore;
13699 if (selectionStateChanged)
13700 *selectionStateChanged =
mSelected != selBefore;
13838 mDataScaleType(
QCPAxis::stLinear),
13857 qDebug() << Q_FUNC_INFO <<
"internal color axis undefined";
13869 qDebug() << Q_FUNC_INFO <<
"internal axis rect was deleted";
13883 qDebug() << Q_FUNC_INFO <<
"internal axis rect was deleted";
13903 qDebug() << Q_FUNC_INFO <<
"internal axis rect was deleted";
13910 double logBaseTransfer = 10;
13911 QString labelTransfer;
13917 logBaseTransfer =
mColorAxis.data()->scaleLogBase();
13932 mColorAxis.data()->setScaleLogBase(logBaseTransfer);
13996 mAxisRect.data()->mGradientImageInvalidated =
true;
14009 qDebug() << Q_FUNC_INFO <<
"internal color axis undefined";
14035 qDebug() << Q_FUNC_INFO <<
"internal axis rect was deleted";
14055 qDebug() << Q_FUNC_INFO <<
"internal axis rect was deleted";
14070 QList<QCPColorMap*> result;
14074 if (cm->colorScale() ==
this)
14088 QList<QCPColorMap*> maps =
colorMaps();
14090 bool haveRange =
false;
14094 for (
int i=0; i<maps.size(); ++i)
14096 if (!maps.at(i)->realVisibility() && onlyVisibleMaps)
14099 if (maps.at(i)->colorScale() ==
this)
14101 bool currentFoundRange =
true;
14102 mapRange = maps.at(i)->data()->dataBounds();
14105 if (mapRange.
lower <= 0 && mapRange.
upper > 0)
14107 else if (mapRange.
lower <= 0 && mapRange.
upper <= 0)
14108 currentFoundRange =
false;
14109 }
else if (sign == -1)
14111 if (mapRange.
upper >= 0 && mapRange.
lower < 0)
14113 else if (mapRange.
upper >= 0 && mapRange.
lower >= 0)
14114 currentFoundRange =
false;
14116 if (currentFoundRange)
14119 newRange = mapRange;
14121 newRange.
expand(mapRange);
14130 double center = (newRange.
lower+newRange.
upper)*0.5;
14151 qDebug() << Q_FUNC_INFO <<
"internal axis rect was deleted";
14192 qDebug() << Q_FUNC_INFO <<
"internal axis rect was deleted";
14195 mAxisRect.data()->mousePressEvent(event);
14203 qDebug() << Q_FUNC_INFO <<
"internal axis rect was deleted";
14206 mAxisRect.data()->mouseMoveEvent(event);
14214 qDebug() << Q_FUNC_INFO <<
"internal axis rect was deleted";
14217 mAxisRect.data()->mouseReleaseEvent(event);
14225 qDebug() << Q_FUNC_INFO <<
"internal axis rect was deleted";
14250 QCPAxisRect(parentColorScale->parentPlot(), true),
14251 mParentColorScale(parentColorScale),
14252 mGradientImageInvalidated(true)
14261 connect(
axis(type), SIGNAL(selectionChanged(QCPAxis::SelectableParts)),
this, SLOT(
axisSelectionChanged(QCPAxis::SelectableParts)));
14262 connect(
axis(type), SIGNAL(selectableChanged(QCPAxis::SelectableParts)),
this, SLOT(
axisSelectableChanged(QCPAxis::SelectableParts)));
14290 bool mirrorHorz =
false;
14291 bool mirrorVert =
false;
14309 if (
rect().isEmpty())
14314 QVector<double>
data(
n);
14315 for (
int i=0; i<
n; ++i)
14320 h =
rect().height();
14322 QVector<QRgb*> pixels;
14323 for (
int y=0;
y<
h; ++
y)
14326 for (
int y=1;
y<
h; ++
y)
14327 memcpy(pixels.at(
y), pixels.first(),
n*
sizeof(QRgb));
14330 w =
rect().width();
14333 for (
int y=0;
y<
h; ++
y)
14337 for (
int x=0;
x<w; ++
x)
14338 pixels[
x] = lineColor;
14354 if (
QCPAxis *senderAxis = qobject_cast<QCPAxis*>(sender()))
14355 if (senderAxis->axisType() == type)
14378 if (
QCPAxis *senderAxis = qobject_cast<QCPAxis*>(sender()))
14379 if (senderAxis->axisType() == type)
14505 setPen(QPen(Qt::blue, 0));
14555 int n = key.size();
14556 n = qMin(
n, value.size());
14558 for (
int i=0; i<
n; ++i)
14560 newData.
key = key[i];
14561 newData.
value = value[i];
14562 mData->insertMulti(newData.
key, newData);
14578 int n = key.size();
14579 n = qMin(
n, value.size());
14580 n = qMin(
n, valueError.size());
14582 for (
int i=0; i<
n; ++i)
14584 newData.
key = key[i];
14585 newData.
value = value[i];
14588 mData->insertMulti(key[i], newData);
14601void QCPGraph::setDataValueError(
const QVector<double> &key,
const QVector<double> &value,
const QVector<double> &valueErrorMinus,
const QVector<double> &valueErrorPlus)
14604 int n = key.size();
14605 n = qMin(
n, value.size());
14606 n = qMin(
n, valueErrorMinus.size());
14607 n = qMin(
n, valueErrorPlus.size());
14609 for (
int i=0; i<
n; ++i)
14611 newData.
key = key[i];
14612 newData.
value = value[i];
14615 mData->insertMulti(key[i], newData);
14631 int n = key.size();
14632 n = qMin(
n, value.size());
14633 n = qMin(
n, keyError.size());
14635 for (
int i=0; i<
n; ++i)
14637 newData.
key = key[i];
14638 newData.
value = value[i];
14641 mData->insertMulti(key[i], newData);
14654void QCPGraph::setDataKeyError(
const QVector<double> &key,
const QVector<double> &value,
const QVector<double> &keyErrorMinus,
const QVector<double> &keyErrorPlus)
14657 int n = key.size();
14658 n = qMin(
n, value.size());
14659 n = qMin(
n, keyErrorMinus.size());
14660 n = qMin(
n, keyErrorPlus.size());
14662 for (
int i=0; i<
n; ++i)
14664 newData.
key = key[i];
14665 newData.
value = value[i];
14668 mData->insertMulti(key[i], newData);
14681void QCPGraph::setDataBothError(
const QVector<double> &key,
const QVector<double> &value,
const QVector<double> &keyError,
const QVector<double> &valueError)
14684 int n = key.size();
14685 n = qMin(
n, value.size());
14686 n = qMin(
n, valueError.size());
14687 n = qMin(
n, keyError.size());
14689 for (
int i=0; i<
n; ++i)
14691 newData.
key = key[i];
14692 newData.
value = value[i];
14697 mData->insertMulti(key[i], newData);
14710void QCPGraph::setDataBothError(
const QVector<double> &key,
const QVector<double> &value,
const QVector<double> &keyErrorMinus,
const QVector<double> &keyErrorPlus,
const QVector<double> &valueErrorMinus,
const QVector<double> &valueErrorPlus)
14713 int n = key.size();
14714 n = qMin(
n, value.size());
14715 n = qMin(
n, valueErrorMinus.size());
14716 n = qMin(
n, valueErrorPlus.size());
14717 n = qMin(
n, keyErrorMinus.size());
14718 n = qMin(
n, keyErrorPlus.size());
14720 for (
int i=0; i<
n; ++i)
14722 newData.
key = key[i];
14723 newData.
value = value[i];
14728 mData->insertMulti(key[i], newData);
14813 if (targetGraph ==
this)
14815 qDebug() << Q_FUNC_INFO <<
"targetGraph is this graph itself";
14822 qDebug() << Q_FUNC_INFO <<
"targetGraph not in same plot";
14876 mData->unite(dataMap);
14904 newData.
value = value;
14905 mData->insertMulti(newData.
key, newData);
14918 int n = qMin(keys.size(), values.size());
14920 for (
int i=0; i<
n; ++i)
14922 newData.
key = keys[i];
14923 newData.
value = values[i];
14924 mData->insertMulti(newData.
key, newData);
14934 QCPDataMap::iterator it =
mData->begin();
14935 while (it !=
mData->end() && it.key() < key)
14936 it =
mData->erase(it);
14945 if (
mData->isEmpty())
return;
14946 QCPDataMap::iterator it =
mData->upperBound(key);
14947 while (it !=
mData->end())
14948 it =
mData->erase(it);
14960 if (fromKey >= toKey ||
mData->isEmpty())
return;
14961 QCPDataMap::iterator it =
mData->upperBound(fromKey);
14962 QCPDataMap::iterator itEnd =
mData->upperBound(toKey);
14963 while (it != itEnd)
14964 it =
mData->erase(it);
14977 mData->remove(key);
14995 if (!
mKeyAxis || !
mValueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return -1; }
14997 if (
mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint()))
15027 if (
mData->isEmpty())
return;
15030 if (!
keyAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key axis";
return; }
15063 if (
mData->isEmpty())
return;
15066 if (!
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid value axis";
return; }
15091 if (!
mKeyAxis || !
mValueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
15092 if (
mKeyAxis.data()->range().size() <= 0 ||
mData->isEmpty())
return;
15096 QVector<QPointF> *lineData =
new QVector<QPointF>;
15097 QVector<QCPData> *scatterData = 0;
15099 scatterData =
new QVector<QCPData>;
15105#ifdef QCUSTOMPLOT_CHECK_DATA
15106 QCPDataMap::const_iterator it;
15107 for (it =
mData->constBegin(); it !=
mData->constEnd(); ++it)
15112 qDebug() << Q_FUNC_INFO <<
"Data point at" << it.key() <<
"invalid." <<
"Plottable name:" <<
name();
15132 delete scatterData;
15139 if (
mBrush.style() != Qt::NoBrush)
15142 painter->fillRect(QRectF(rect.left(), rect.top()+rect.height()/2.0, rect.width(), rect.height()/3.0),
mBrush);
15149 painter->
drawLine(QLineF(rect.left(), rect.top()+rect.height()/2.0, rect.right()+5, rect.top()+rect.height()/2.0));
15159 scaledStyle.
setPixmap(scaledStyle.
pixmap().scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
15161 scaledStyle.
drawShape(painter, QRectF(rect).center());
15232 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
15233 if (!linePixelData) { qDebug() << Q_FUNC_INFO <<
"null pointer passed as linePixelData";
return; }
15235 QVector<QCPData> lineData;
15237 linePixelData->reserve(lineData.size()+2);
15238 linePixelData->resize(lineData.size());
15243 for (
int i=0; i<lineData.size(); ++i)
15250 for (
int i=0; i<lineData.size(); ++i)
15273 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
15274 if (!linePixelData) { qDebug() << Q_FUNC_INFO <<
"null pointer passed as lineData";
return; }
15276 QVector<QCPData> lineData;
15278 linePixelData->reserve(lineData.size()*2+2);
15279 linePixelData->resize(lineData.size()*2);
15286 for (
int i=0; i<lineData.size(); ++i)
15289 (*linePixelData)[i*2+0].setX(lastValue);
15290 (*linePixelData)[i*2+0].setY(key);
15292 (*linePixelData)[i*2+1].setX(lastValue);
15293 (*linePixelData)[i*2+1].setY(key);
15299 for (
int i=0; i<lineData.size(); ++i)
15302 (*linePixelData)[i*2+0].setX(key);
15303 (*linePixelData)[i*2+0].setY(lastValue);
15305 (*linePixelData)[i*2+1].setX(key);
15306 (*linePixelData)[i*2+1].setY(lastValue);
15326 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
15327 if (!linePixelData) { qDebug() << Q_FUNC_INFO <<
"null pointer passed as lineData";
return; }
15329 QVector<QCPData> lineData;
15331 linePixelData->reserve(lineData.size()*2+2);
15332 linePixelData->resize(lineData.size()*2);
15339 for (
int i=0; i<lineData.size(); ++i)
15342 (*linePixelData)[i*2+0].setX(value);
15343 (*linePixelData)[i*2+0].setY(lastKey);
15345 (*linePixelData)[i*2+1].setX(value);
15346 (*linePixelData)[i*2+1].setY(lastKey);
15352 for (
int i=0; i<lineData.size(); ++i)
15355 (*linePixelData)[i*2+0].setX(lastKey);
15356 (*linePixelData)[i*2+0].setY(value);
15358 (*linePixelData)[i*2+1].setX(lastKey);
15359 (*linePixelData)[i*2+1].setY(value);
15379 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
15380 if (!linePixelData) { qDebug() << Q_FUNC_INFO <<
"null pointer passed as lineData";
return; }
15382 QVector<QCPData> lineData;
15384 linePixelData->reserve(lineData.size()*2+2);
15385 linePixelData->resize(lineData.size()*2);
15392 (*linePixelData)[0].setX(lastValue);
15393 (*linePixelData)[0].setY(lastKey);
15394 for (
int i=1; i<lineData.size(); ++i)
15397 (*linePixelData)[i*2-1].setX(lastValue);
15398 (*linePixelData)[i*2-1].setY(key);
15401 (*linePixelData)[i*2+0].setX(lastValue);
15402 (*linePixelData)[i*2+0].setY(key);
15404 (*linePixelData)[lineData.size()*2-1].setX(lastValue);
15405 (*linePixelData)[lineData.size()*2-1].setY(lastKey);
15411 (*linePixelData)[0].setX(lastKey);
15412 (*linePixelData)[0].setY(lastValue);
15413 for (
int i=1; i<lineData.size(); ++i)
15416 (*linePixelData)[i*2-1].setX(key);
15417 (*linePixelData)[i*2-1].setY(lastValue);
15420 (*linePixelData)[i*2+0].setX(key);
15421 (*linePixelData)[i*2+0].setY(lastValue);
15423 (*linePixelData)[lineData.size()*2-1].setX(lastKey);
15424 (*linePixelData)[lineData.size()*2-1].setY(lastValue);
15444 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
15445 if (!linePixelData) { qDebug() << Q_FUNC_INFO <<
"null pointer passed as linePixelData";
return; }
15447 QVector<QCPData> lineData;
15449 linePixelData->resize(lineData.size()*2);
15456 for (
int i=0; i<lineData.size(); ++i)
15459 (*linePixelData)[i*2+0].setX(zeroPointX);
15460 (*linePixelData)[i*2+0].setY(key);
15462 (*linePixelData)[i*2+1].setY(key);
15468 for (
int i=0; i<lineData.size(); ++i)
15471 (*linePixelData)[i*2+0].setX(key);
15472 (*linePixelData)[i*2+0].setY(zeroPointY);
15473 (*linePixelData)[i*2+1].setX(key);
15502 painter->
setPen(Qt::NoPen);
15504 painter->drawPolygon(QPolygonF(*lineData));
15509 painter->
setPen(Qt::NoPen);
15528 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
15537 for (
int i=0; i<scatterData->size(); ++i)
15541 for (
int i=0; i<scatterData->size(); ++i)
15551 for (
int i=0; i<scatterData->size(); ++i)
15555 for (
int i=0; i<scatterData->size(); ++i)
15572 if (
mainPen().style() != Qt::NoPen &&
mainPen().color().alpha() != 0)
15576 painter->setBrush(Qt::NoBrush);
15595 painter->pen().style() == Qt::SolidLine &&
15599 for (
int i=1; i<lineData->size(); ++i)
15600 painter->
drawLine(lineData->at(i-1), lineData->at(i));
15603 painter->drawPolyline(QPolygonF(*lineData));
15618 if (
mainPen().style() != Qt::NoPen &&
mainPen().color().alpha() != 0)
15622 pen.setCapStyle(Qt::FlatCap);
15624 painter->setBrush(Qt::NoBrush);
15625 painter->drawLines(*lineData);
15645 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
15647 QCPDataMap::const_iterator lower, upper;
15649 if (lower ==
mData->constEnd() || upper ==
mData->constEnd())
15653 int maxCount = std::numeric_limits<int>::max();
15657 maxCount = 2*keyPixelSpan+2;
15665 QCPDataMap::const_iterator it = lower;
15666 QCPDataMap::const_iterator upperEnd = upper+1;
15667 double minValue = it.value().value;
15668 double maxValue = it.value().value;
15669 QCPDataMap::const_iterator currentIntervalFirstPoint = it;
15673 double lastIntervalEndKey = currentIntervalStartKey;
15676 int intervalDataCount = 1;
15678 while (it != upperEnd)
15680 if (it.key() < currentIntervalStartKey+keyEpsilon)
15682 if (it.value().value < minValue)
15683 minValue = it.value().value;
15684 else if (it.value().value > maxValue)
15685 maxValue = it.value().value;
15686 ++intervalDataCount;
15689 if (intervalDataCount >= 2)
15691 if (lastIntervalEndKey < currentIntervalStartKey-keyEpsilon)
15692 lineData->append(
QCPData(currentIntervalStartKey+keyEpsilon*0.2, currentIntervalFirstPoint.value().value));
15693 lineData->append(
QCPData(currentIntervalStartKey+keyEpsilon*0.25, minValue));
15694 lineData->append(
QCPData(currentIntervalStartKey+keyEpsilon*0.75, maxValue));
15695 if (it.key() > currentIntervalStartKey+keyEpsilon*2)
15696 lineData->append(
QCPData(currentIntervalStartKey+keyEpsilon*0.8, (it-1).value().value));
15698 lineData->append(
QCPData(currentIntervalFirstPoint.key(), currentIntervalFirstPoint.value().value));
15699 lastIntervalEndKey = (it-1).value().key;
15700 minValue = it.value().value;
15701 maxValue = it.value().value;
15702 currentIntervalFirstPoint = it;
15704 if (keyEpsilonVariable)
15706 intervalDataCount = 1;
15711 if (intervalDataCount >= 2)
15713 if (lastIntervalEndKey < currentIntervalStartKey-keyEpsilon)
15714 lineData->append(
QCPData(currentIntervalStartKey+keyEpsilon*0.2, currentIntervalFirstPoint.value().value));
15715 lineData->append(
QCPData(currentIntervalStartKey+keyEpsilon*0.25, minValue));
15716 lineData->append(
QCPData(currentIntervalStartKey+keyEpsilon*0.75, maxValue));
15718 lineData->append(
QCPData(currentIntervalFirstPoint.key(), currentIntervalFirstPoint.value().value));
15725 QCPDataMap::const_iterator it = lower;
15726 QCPDataMap::const_iterator upperEnd = upper+1;
15727 double minValue = it.value().value;
15728 double maxValue = it.value().value;
15729 QCPDataMap::const_iterator minValueIt = it;
15730 QCPDataMap::const_iterator maxValueIt = it;
15731 QCPDataMap::const_iterator currentIntervalStart = it;
15737 int intervalDataCount = 1;
15739 while (it != upperEnd)
15741 if (it.key() < currentIntervalStartKey+keyEpsilon)
15743 if (it.value().value < minValue && it.value().value > valueMinRange && it.value().value < valueMaxRange)
15745 minValue = it.value().value;
15747 }
else if (it.value().value > maxValue && it.value().value > valueMinRange && it.value().value < valueMaxRange)
15749 maxValue = it.value().value;
15752 ++intervalDataCount;
15755 if (intervalDataCount >= 2)
15759 int dataModulo = qMax(1, qRound(intervalDataCount/(valuePixelSpan/4.0)));
15760 QCPDataMap::const_iterator intervalIt = currentIntervalStart;
15762 while (intervalIt != it)
15764 if ((c % dataModulo == 0 || intervalIt == minValueIt || intervalIt == maxValueIt) && intervalIt.value().value > valueMinRange && intervalIt.value().value < valueMaxRange)
15765 scatterData->append(intervalIt.value());
15769 }
else if (currentIntervalStart.value().value > valueMinRange && currentIntervalStart.value().value < valueMaxRange)
15770 scatterData->append(currentIntervalStart.value());
15771 minValue = it.value().value;
15772 maxValue = it.value().value;
15773 currentIntervalStart = it;
15775 if (keyEpsilonVariable)
15777 intervalDataCount = 1;
15782 if (intervalDataCount >= 2)
15786 int dataModulo = qMax(1, qRound(intervalDataCount/(valuePixelSpan/4.0)));
15787 QCPDataMap::const_iterator intervalIt = currentIntervalStart;
15789 while (intervalIt != it)
15791 if ((c % dataModulo == 0 || intervalIt == minValueIt || intervalIt == maxValueIt) && intervalIt.value().value > valueMinRange && intervalIt.value().value < valueMaxRange)
15792 scatterData->append(intervalIt.value());
15796 }
else if (currentIntervalStart.value().value > valueMinRange && currentIntervalStart.value().value < valueMaxRange)
15797 scatterData->append(currentIntervalStart.value());
15801 QVector<QCPData> *dataVector = 0;
15803 dataVector = lineData;
15804 else if (scatterData)
15805 dataVector = scatterData;
15808 QCPDataMap::const_iterator it = lower;
15809 QCPDataMap::const_iterator upperEnd = upper+1;
15810 dataVector->reserve(dataCount+2);
15811 while (it != upperEnd)
15813 dataVector->append(it.value());
15817 if (lineData && scatterData)
15818 *scatterData = *dataVector;
15833 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
15851 if (a-
y > skipSymbolMargin)
15852 painter->
drawLine(QLineF(
x, a,
x,
y+skipSymbolMargin));
15853 if (
y-b > skipSymbolMargin)
15854 painter->
drawLine(QLineF(
x,
y-skipSymbolMargin,
x, b));
15858 painter->
drawLine(QLineF(
x-barWidthHalf, a,
x+barWidthHalf, a));
15859 painter->
drawLine(QLineF(
x-barWidthHalf, b,
x+barWidthHalf, b));
15870 if (
x-a > skipSymbolMargin)
15871 painter->
drawLine(QLineF(a,
y,
x-skipSymbolMargin,
y));
15872 if (b-
x > skipSymbolMargin)
15873 painter->
drawLine(QLineF(
x+skipSymbolMargin,
y, b,
y));
15877 painter->
drawLine(QLineF(a,
y-barWidthHalf, a,
y+barWidthHalf));
15878 painter->
drawLine(QLineF(b,
y-barWidthHalf, b,
y+barWidthHalf));
15892 if (
x-a > skipSymbolMargin)
15893 painter->
drawLine(QLineF(a,
y,
x-skipSymbolMargin,
y));
15894 if (b-
x > skipSymbolMargin)
15895 painter->
drawLine(QLineF(
x+skipSymbolMargin,
y, b,
y));
15899 painter->
drawLine(QLineF(a,
y-barWidthHalf, a,
y+barWidthHalf));
15900 painter->
drawLine(QLineF(b,
y-barWidthHalf, b,
y+barWidthHalf));
15911 if (a-
y > skipSymbolMargin)
15912 painter->
drawLine(QLineF(
x, a,
x,
y+skipSymbolMargin));
15913 if (
y-b > skipSymbolMargin)
15914 painter->
drawLine(QLineF(
x,
y-skipSymbolMargin,
x, b));
15918 painter->
drawLine(QLineF(
x-barWidthHalf, a,
x+barWidthHalf, a));
15919 painter->
drawLine(QLineF(
x-barWidthHalf, b,
x+barWidthHalf, b));
15940 if (!
mKeyAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key axis";
return; }
15941 if (
mData->isEmpty())
15943 lower =
mData->constEnd();
15944 upper =
mData->constEnd();
15949 QCPDataMap::const_iterator lbound =
mData->lowerBound(
mKeyAxis.data()->range().lower);
15950 QCPDataMap::const_iterator ubound =
mData->upperBound(
mKeyAxis.data()->range().upper);
15951 bool lowoutlier = lbound !=
mData->constBegin();
15952 bool highoutlier = ubound !=
mData->constEnd();
15954 lower = (lowoutlier ? lbound-1 : lbound);
15955 upper = (highoutlier ? ubound : ubound-1);
15970 if (upper ==
mData->constEnd() && lower ==
mData->constEnd())
15972 QCPDataMap::const_iterator it = lower;
15974 while (it != upper && count < maxCount)
15999 if (!
mKeyAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key axis";
return; }
16002 if (
mKeyAxis.data()->orientation() == Qt::Vertical)
16021 lineData->remove(lineData->size()-2, 2);
16042 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return QPointF(); }
16050 point.setY(lowerKey);
16054 point.setY(lowerKey);
16057 point.setX(lowerKey);
16061 point.setX(lowerKey);
16075 point.setY(lowerKey);
16078 point.setX(lowerKey);
16107 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return QPointF(); }
16115 point.setY(upperKey);
16119 point.setY(upperKey);
16122 point.setX(upperKey);
16126 point.setX(upperKey);
16140 point.setY(upperKey);
16143 point.setX(upperKey);
16166 return QPolygonF();
16170 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return QPolygonF(); }
16171 if (!
mChannelFillGraph.data()->mKeyAxis) { qDebug() << Q_FUNC_INFO <<
"channel fill target key axis invalid";
return QPolygonF(); }
16174 return QPolygonF();
16176 if (lineData->isEmpty())
return QPolygonF();
16177 QVector<QPointF> otherData;
16179 if (otherData.isEmpty())
return QPolygonF();
16180 QVector<QPointF> thisData;
16181 thisData.reserve(lineData->size()+otherData.size());
16182 for (
int i=0; i<lineData->size(); ++i)
16183 thisData << lineData->at(i);
16186 QVector<QPointF> *staticData = &thisData;
16187 QVector<QPointF> *croppedData = &otherData;
16194 if (staticData->first().x() > staticData->last().x())
16196 int size = staticData->size();
16197 for (
int i=0; i<size/2; ++i)
16198 qSwap((*staticData)[i], (*staticData)[size-1-i]);
16200 if (croppedData->first().x() > croppedData->last().x())
16202 int size = croppedData->size();
16203 for (
int i=0; i<size/2; ++i)
16204 qSwap((*croppedData)[i], (*croppedData)[size-1-i]);
16207 if (staticData->first().x() < croppedData->first().x())
16208 qSwap(staticData, croppedData);
16209 int lowBound =
findIndexBelowX(croppedData, staticData->first().x());
16210 if (lowBound == -1)
return QPolygonF();
16211 croppedData->remove(0, lowBound);
16214 if (croppedData->size() < 2)
return QPolygonF();
16216 if (croppedData->at(1).x()-croppedData->at(0).x() != 0)
16217 slope = (croppedData->at(1).y()-croppedData->at(0).y())/(croppedData->at(1).x()-croppedData->at(0).x());
16220 (*croppedData)[0].setY(croppedData->at(0).y()+slope*(staticData->first().x()-croppedData->at(0).x()));
16221 (*croppedData)[0].setX(staticData->first().x());
16224 if (staticData->last().x() > croppedData->last().x())
16225 qSwap(staticData, croppedData);
16226 int highBound =
findIndexAboveX(croppedData, staticData->last().x());
16227 if (highBound == -1)
return QPolygonF();
16228 croppedData->remove(highBound+1, croppedData->size()-(highBound+1));
16231 if (croppedData->size() < 2)
return QPolygonF();
16232 int li = croppedData->size()-1;
16233 if (croppedData->at(li).x()-croppedData->at(li-1).x() != 0)
16234 slope = (croppedData->at(li).y()-croppedData->at(li-1).y())/(croppedData->at(li).x()-croppedData->at(li-1).x());
16237 (*croppedData)[li].setY(croppedData->at(li-1).y()+slope*(staticData->last().x()-croppedData->at(li-1).x()));
16238 (*croppedData)[li].setX(staticData->last().x());
16245 if (staticData->first().y() < staticData->last().y())
16247 int size = staticData->size();
16248 for (
int i=0; i<size/2; ++i)
16249 qSwap((*staticData)[i], (*staticData)[size-1-i]);
16251 if (croppedData->first().y() < croppedData->last().y())
16253 int size = croppedData->size();
16254 for (
int i=0; i<size/2; ++i)
16255 qSwap((*croppedData)[i], (*croppedData)[size-1-i]);
16258 if (staticData->first().y() > croppedData->first().y())
16259 qSwap(staticData, croppedData);
16260 int lowBound =
findIndexAboveY(croppedData, staticData->first().y());
16261 if (lowBound == -1)
return QPolygonF();
16262 croppedData->remove(0, lowBound);
16265 if (croppedData->size() < 2)
return QPolygonF();
16267 if (croppedData->at(1).y()-croppedData->at(0).y() != 0)
16268 slope = (croppedData->at(1).x()-croppedData->at(0).x())/(croppedData->at(1).y()-croppedData->at(0).y());
16271 (*croppedData)[0].setX(croppedData->at(0).x()+slope*(staticData->first().y()-croppedData->at(0).y()));
16272 (*croppedData)[0].setY(staticData->first().y());
16275 if (staticData->last().y() < croppedData->last().y())
16276 qSwap(staticData, croppedData);
16277 int highBound =
findIndexBelowY(croppedData, staticData->last().y());
16278 if (highBound == -1)
return QPolygonF();
16279 croppedData->remove(highBound+1, croppedData->size()-(highBound+1));
16282 if (croppedData->size() < 2)
return QPolygonF();
16283 int li = croppedData->size()-1;
16284 if (croppedData->at(li).y()-croppedData->at(li-1).y() != 0)
16285 slope = (croppedData->at(li).x()-croppedData->at(li-1).x())/(croppedData->at(li).y()-croppedData->at(li-1).y());
16288 (*croppedData)[li].setX(croppedData->at(li-1).x()+slope*(staticData->last().y()-croppedData->at(li-1).y()));
16289 (*croppedData)[li].setY(staticData->last().y());
16293 for (
int i=otherData.size()-1; i>=0; --i)
16294 thisData << otherData.at(i);
16295 return QPolygonF(thisData);
16307 for (
int i=
data->size()-1; i>=0; --i)
16309 if (
data->at(i).x() <
x)
16311 if (i<data->size()-1)
16314 return data->size()-1;
16329 for (
int i=0; i<
data->size(); ++i)
16331 if (
data->at(i).x() >
x)
16351 for (
int i=0; i<
data->size(); ++i)
16353 if (
data->at(i).y() <
y)
16376 if (
mData->isEmpty())
16378 qDebug() << Q_FUNC_INFO <<
"requested point distance on graph" <<
mName <<
"without data";
16381 if (
mData->size() == 1)
16384 return QVector2D(dataPoint-pixelPoint).length();
16394 QVector<QCPData> *scatterData =
new QVector<QCPData>;
16396 double minDistSqr = std::numeric_limits<double>::max();
16398 QPointF ptB =
coordsToPixels(scatterData->at(0).key, scatterData->at(0).value);
16399 for (
int i=1; i<scatterData->size(); ++i)
16402 ptB =
coordsToPixels(scatterData->at(i).key, scatterData->at(i).value);
16403 double currentDistSqr =
distSqrToLine(ptA, ptB, pixelPoint);
16404 if (currentDistSqr < minDistSqr)
16405 minDistSqr = currentDistSqr;
16407 delete scatterData;
16408 return sqrt(minDistSqr);
16412 QVector<QPointF> *lineData =
new QVector<QPointF>;
16414 double minDistSqr = std::numeric_limits<double>::max();
16418 for (
int i=0; i<lineData->size()-1; i+=2)
16420 double currentDistSqr =
distSqrToLine(lineData->at(i), lineData->at(i+1), pixelPoint);
16421 if (currentDistSqr < minDistSqr)
16422 minDistSqr = currentDistSqr;
16427 for (
int i=0; i<lineData->size()-1; ++i)
16429 double currentDistSqr =
distSqrToLine(lineData->at(i), lineData->at(i+1), pixelPoint);
16430 if (currentDistSqr < minDistSqr)
16431 minDistSqr = currentDistSqr;
16435 return sqrt(minDistSqr);
16449 for (
int i=
data->size()-1; i>=0; --i)
16451 if (
data->at(i).y() >
y)
16453 if (i<data->size()-1)
16456 return data->size()-1;
16467 return getKeyRange(foundRange, inSignDomain,
true);
16487 bool haveLower =
false;
16488 bool haveUpper =
false;
16490 double current, currentErrorMinus, currentErrorPlus;
16492 if (inSignDomain ==
sdBoth)
16494 QCPDataMap::const_iterator it =
mData->constBegin();
16495 while (it !=
mData->constEnd())
16497 current = it.value().key;
16498 currentErrorMinus = (includeErrors ? it.value().keyErrorMinus : 0);
16499 currentErrorPlus = (includeErrors ? it.value().keyErrorPlus : 0);
16500 if (current-currentErrorMinus < range.
lower || !haveLower)
16502 range.
lower = current-currentErrorMinus;
16505 if (current+currentErrorPlus > range.
upper || !haveUpper)
16507 range.
upper = current+currentErrorPlus;
16514 QCPDataMap::const_iterator it =
mData->constBegin();
16515 while (it !=
mData->constEnd())
16517 current = it.value().key;
16518 currentErrorMinus = (includeErrors ? it.value().keyErrorMinus : 0);
16519 currentErrorPlus = (includeErrors ? it.value().keyErrorPlus : 0);
16520 if ((current-currentErrorMinus < range.
lower || !haveLower) && current-currentErrorMinus < 0)
16522 range.
lower = current-currentErrorMinus;
16525 if ((current+currentErrorPlus > range.
upper || !haveUpper) && current+currentErrorPlus < 0)
16527 range.
upper = current+currentErrorPlus;
16532 if ((current < range.
lower || !haveLower) && current < 0)
16534 range.
lower = current;
16537 if ((current > range.
upper || !haveUpper) && current < 0)
16539 range.
upper = current;
16547 QCPDataMap::const_iterator it =
mData->constBegin();
16548 while (it !=
mData->constEnd())
16550 current = it.value().key;
16551 currentErrorMinus = (includeErrors ? it.value().keyErrorMinus : 0);
16552 currentErrorPlus = (includeErrors ? it.value().keyErrorPlus : 0);
16553 if ((current-currentErrorMinus < range.
lower || !haveLower) && current-currentErrorMinus > 0)
16555 range.
lower = current-currentErrorMinus;
16558 if ((current+currentErrorPlus > range.
upper || !haveUpper) && current+currentErrorPlus > 0)
16560 range.
upper = current+currentErrorPlus;
16565 if ((current < range.
lower || !haveLower) && current > 0)
16567 range.
lower = current;
16570 if ((current > range.
upper || !haveUpper) && current > 0)
16572 range.
upper = current;
16580 foundRange = haveLower && haveUpper;
16593 bool haveLower =
false;
16594 bool haveUpper =
false;
16596 double current, currentErrorMinus, currentErrorPlus;
16598 if (inSignDomain ==
sdBoth)
16600 QCPDataMap::const_iterator it =
mData->constBegin();
16601 while (it !=
mData->constEnd())
16603 current = it.value().value;
16604 currentErrorMinus = (includeErrors ? it.value().valueErrorMinus : 0);
16605 currentErrorPlus = (includeErrors ? it.value().valueErrorPlus : 0);
16606 if (current-currentErrorMinus < range.
lower || !haveLower)
16608 range.
lower = current-currentErrorMinus;
16611 if (current+currentErrorPlus > range.
upper || !haveUpper)
16613 range.
upper = current+currentErrorPlus;
16620 QCPDataMap::const_iterator it =
mData->constBegin();
16621 while (it !=
mData->constEnd())
16623 current = it.value().value;
16624 currentErrorMinus = (includeErrors ? it.value().valueErrorMinus : 0);
16625 currentErrorPlus = (includeErrors ? it.value().valueErrorPlus : 0);
16626 if ((current-currentErrorMinus < range.
lower || !haveLower) && current-currentErrorMinus < 0)
16628 range.
lower = current-currentErrorMinus;
16631 if ((current+currentErrorPlus > range.
upper || !haveUpper) && current+currentErrorPlus < 0)
16633 range.
upper = current+currentErrorPlus;
16638 if ((current < range.
lower || !haveLower) && current < 0)
16640 range.
lower = current;
16643 if ((current > range.
upper || !haveUpper) && current < 0)
16645 range.
upper = current;
16653 QCPDataMap::const_iterator it =
mData->constBegin();
16654 while (it !=
mData->constEnd())
16656 current = it.value().value;
16657 currentErrorMinus = (includeErrors ? it.value().valueErrorMinus : 0);
16658 currentErrorPlus = (includeErrors ? it.value().valueErrorPlus : 0);
16659 if ((current-currentErrorMinus < range.
lower || !haveLower) && current-currentErrorMinus > 0)
16661 range.
lower = current-currentErrorMinus;
16664 if ((current+currentErrorPlus > range.
upper || !haveUpper) && current+currentErrorPlus > 0)
16666 range.
upper = current+currentErrorPlus;
16671 if ((current < range.
lower || !haveLower) && current > 0)
16673 range.
lower = current;
16676 if ((current > range.
upper || !haveUpper) && current > 0)
16678 range.
upper = current;
16686 foundRange = haveLower && haveUpper;
16778 mPen.setColor(Qt::blue);
16779 mPen.setStyle(Qt::SolidLine);
16780 mBrush.setColor(Qt::blue);
16781 mBrush.setStyle(Qt::NoBrush);
16821void QCPCurve::setData(
const QVector<double> &t,
const QVector<double> &key,
const QVector<double> &value)
16825 n = qMin(
n, key.size());
16826 n = qMin(
n, value.size());
16828 for (
int i=0; i<
n; ++i)
16831 newData.
key = key[i];
16832 newData.
value = value[i];
16833 mData->insertMulti(newData.
t, newData);
16845 int n = key.size();
16846 n = qMin(
n, value.size());
16848 for (
int i=0; i<
n; ++i)
16851 newData.
key = key[i];
16852 newData.
value = value[i];
16853 mData->insertMulti(newData.
t, newData);
16887 mData->unite(dataMap);
16908 newData.
value = value;
16909 mData->insertMulti(newData.
t, newData);
16923 if (!
mData->isEmpty())
16924 newData.
t = (
mData->constEnd()-1).key()+1;
16928 newData.
value = value;
16929 mData->insertMulti(newData.
t, newData);
16936void QCPCurve::addData(
const QVector<double> &ts,
const QVector<double> &keys,
const QVector<double> &values)
16939 n = qMin(
n, keys.size());
16940 n = qMin(
n, values.size());
16942 for (
int i=0; i<
n; ++i)
16945 newData.
key = keys[i];
16946 newData.
value = values[i];
16947 mData->insertMulti(newData.
t, newData);
16957 QCPCurveDataMap::iterator it =
mData->begin();
16958 while (it !=
mData->end() && it.key() < t)
16959 it =
mData->erase(it);
16968 if (
mData->isEmpty())
return;
16969 QCPCurveDataMap::iterator it =
mData->upperBound(t);
16970 while (it !=
mData->end())
16971 it =
mData->erase(it);
16983 if (fromt >= tot ||
mData->isEmpty())
return;
16984 QCPCurveDataMap::iterator it =
mData->upperBound(fromt);
16985 QCPCurveDataMap::iterator itEnd =
mData->upperBound(tot);
16986 while (it != itEnd)
16987 it =
mData->erase(it);
17019 if (!
mKeyAxis || !
mValueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return -1; }
17021 if (
mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint()))
17030 if (
mData->isEmpty())
return;
17033 QVector<QPointF> *lineData =
new QVector<QPointF>;
17039#ifdef QCUSTOMPLOT_CHECK_DATA
17040 QCPCurveDataMap::const_iterator it;
17041 for (it =
mData->constBegin(); it !=
mData->constEnd(); ++it)
17045 qDebug() << Q_FUNC_INFO <<
"Data point at" << it.key() <<
"invalid." <<
"Plottable name:" <<
name();
17053 painter->
setPen(Qt::NoPen);
17055 painter->drawPolygon(QPolygonF(*lineData));
17063 painter->setBrush(Qt::NoBrush);
17066 painter->pen().style() == Qt::SolidLine &&
17070 for (
int i=1; i<lineData->size(); ++i)
17071 painter->
drawLine(lineData->at(i-1), lineData->at(i));
17074 painter->drawPolyline(QPolygonF(*lineData));
17090 if (
mBrush.style() != Qt::NoBrush)
17093 painter->fillRect(QRectF(rect.left(), rect.top()+rect.height()/2.0, rect.width(), rect.height()/3.0),
mBrush);
17100 painter->
drawLine(QLineF(rect.left(), rect.top()+rect.height()/2.0, rect.right()+5, rect.top()+rect.height()/2.0));
17110 scaledStyle.
setPixmap(scaledStyle.
pixmap().scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
17112 scaledStyle.
drawShape(painter, QRectF(rect).center());
17131 for (
int i=0; i<pointData->size(); ++i)
17154 if (!
keyAxis || !
valueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
17157 lineData->reserve(
mData->size());
17158 QCPCurveDataMap::const_iterator it;
17159 int lastRegion = 5;
17160 int currentRegion = 5;
17166 bool addedLastAlready =
true;
17167 bool firstPoint =
true;
17168 for (it =
mData->constBegin(); it !=
mData->constEnd(); ++it)
17170 x = it.value().key;
17171 y = it.value().value;
17177 else if (
y < RBottom)
17181 }
else if (
x > RRight)
17185 else if (
y < RBottom)
17193 else if (
y < RBottom)
17206 if (currentRegion == 5 || (firstPoint &&
mBrush.style() != Qt::NoBrush))
17208 if (!addedLastAlready)
17209 lineData->append(
coordsToPixels((it-1).value().key, (it-1).value().value));
17210 else if (lastRegion != 5)
17213 lineData->replace(lineData->size()-1,
coordsToPixels((it-1).value().key, (it-1).value().value));
17215 lineData->append(
coordsToPixels(it.value().key, it.value().value));
17216 addedLastAlready =
true;
17217 }
else if (currentRegion != lastRegion)
17222 if (lastRegion == 5 ||
17223 ((lastRegion==2 && currentRegion==4) || (lastRegion==4 && currentRegion==2)) ||
17224 ((lastRegion==4 && currentRegion==8) || (lastRegion==8 && currentRegion==4)) ||
17225 ((lastRegion==8 && currentRegion==6) || (lastRegion==6 && currentRegion==8)) ||
17226 ((lastRegion==6 && currentRegion==2) || (lastRegion==2 && currentRegion==6))
17230 if (!addedLastAlready)
17231 lineData->append(
coordsToPixels((it-1).value().key, (it-1).value().value));
17233 lineData->append(
coordsToPixels(it.value().key, it.value().value));
17237 if (!addedLastAlready)
17238 lineData->append(
outsideCoordsToPixels((it-1).value().key, (it-1).value().value, currentRegion, axisRect));
17240 lineData->append(
outsideCoordsToPixels(it.value().key, it.value().value, currentRegion, axisRect));
17242 addedLastAlready =
true;
17245 addedLastAlready =
false;
17247 lastRegion = currentRegion;
17248 firstPoint =
false;
17251 if (lastRegion != 5 &&
mBrush.style() != Qt::NoBrush && !
mData->isEmpty())
17263 if (
mData->isEmpty())
17265 qDebug() << Q_FUNC_INFO <<
"requested point distance on curve" <<
mName <<
"without data";
17268 if (
mData->size() == 1)
17271 return QVector2D(dataPoint-pixelPoint).length();
17275 QVector<QPointF> *lineData =
new QVector<QPointF>;
17277 double minDistSqr = std::numeric_limits<double>::max();
17278 for (
int i=0; i<lineData->size()-1; ++i)
17280 double currentDistSqr =
distSqrToLine(lineData->at(i), lineData->at(i+1), pixelPoint);
17281 if (currentDistSqr < minDistSqr)
17282 minDistSqr = currentDistSqr;
17285 return sqrt(minDistSqr);
17305 case 2: result.setX(axisRect.left()-margin);
break;
17306 case 8: result.setX(axisRect.right()+margin);
break;
17307 case 4: result.setY(axisRect.top()-margin);
break;
17308 case 6: result.setY(axisRect.bottom()+margin);
break;
17309 case 1: result.setX(axisRect.left()-margin);
17310 result.setY(axisRect.top()-margin);
break;
17311 case 7: result.setX(axisRect.right()+margin);
17312 result.setY(axisRect.top()-margin);
break;
17313 case 9: result.setX(axisRect.right()+margin);
17314 result.setY(axisRect.bottom()+margin);
break;
17315 case 3: result.setX(axisRect.left()-margin);
17316 result.setY(axisRect.bottom()+margin);
break;
17325 bool haveLower =
false;
17326 bool haveUpper =
false;
17330 QCPCurveDataMap::const_iterator it =
mData->constBegin();
17331 while (it !=
mData->constEnd())
17333 current = it.value().key;
17336 if (current < range.
lower || !haveLower)
17338 range.
lower = current;
17341 if (current > range.
upper || !haveUpper)
17343 range.
upper = current;
17350 foundRange = haveLower && haveUpper;
17358 bool haveLower =
false;
17359 bool haveUpper =
false;
17363 QCPCurveDataMap::const_iterator it =
mData->constBegin();
17364 while (it !=
mData->constEnd())
17366 current = it.value().value;
17369 if (current < range.
lower || !haveLower)
17371 range.
lower = current;
17374 if (current > range.
upper || !haveUpper)
17376 range.
upper = current;
17383 foundRange = haveLower && haveUpper;
17487 mPen.setColor(Qt::blue);
17488 mPen.setStyle(Qt::SolidLine);
17489 mBrush.setColor(QColor(40, 50, 255, 30));
17490 mBrush.setStyle(Qt::SolidPattern);
17542 int n = key.size();
17543 n = qMin(
n, value.size());
17545 for (
int i=0; i<
n; ++i)
17547 newData.
key = key[i];
17548 newData.
value = value[i];
17549 mData->insertMulti(newData.
key, newData);
17569 if (bars ==
this)
return;
17572 qDebug() << Q_FUNC_INFO <<
"passed QCPBars* doesn't have same key and value axis as this QCPBars";
17602 if (bars ==
this)
return;
17605 qDebug() << Q_FUNC_INFO <<
"passed QCPBars* doesn't have same key and value axis as this QCPBars";
17625 mData->unite(dataMap);
17645 newData.
value = value;
17646 mData->insertMulti(newData.
key, newData);
17655 int n = keys.size();
17656 n = qMin(
n, values.size());
17658 for (
int i=0; i<
n; ++i)
17660 newData.
key = keys[i];
17661 newData.
value = values[i];
17662 mData->insertMulti(newData.
key, newData);
17672 QCPBarDataMap::iterator it =
mData->begin();
17673 while (it !=
mData->end() && it.key() < key)
17674 it =
mData->erase(it);
17683 if (
mData->isEmpty())
return;
17684 QCPBarDataMap::iterator it =
mData->upperBound(key);
17685 while (it !=
mData->end())
17686 it =
mData->erase(it);
17698 if (fromKey >= toKey ||
mData->isEmpty())
return;
17699 QCPBarDataMap::iterator it =
mData->upperBound(fromKey);
17700 QCPBarDataMap::iterator itEnd =
mData->upperBound(toKey);
17701 while (it != itEnd)
17702 it =
mData->erase(it);
17715 mData->remove(key);
17733 if (!
mKeyAxis || !
mValueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return -1; }
17735 if (
mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint()))
17737 QCPBarDataMap::ConstIterator it;
17738 double posKey, posValue;
17740 for (it =
mData->constBegin(); it !=
mData->constEnd(); ++it)
17742 double baseValue =
getBaseValue(it.key(), it.value().value >=0);
17744 QCPRange valueRange(baseValue, baseValue+it.value().value);
17755 if (!
mKeyAxis || !
mValueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
17756 if (
mData->isEmpty())
return;
17758 QCPBarDataMap::const_iterator it;
17759 for (it =
mData->constBegin(); it !=
mData->constEnd(); ++it)
17765#ifdef QCUSTOMPLOT_CHECK_DATA
17767 qDebug() << Q_FUNC_INFO <<
"Data point at" << it.key() <<
"of drawn range invalid." <<
"Plottable name:" <<
name();
17769 QPolygonF barPolygon =
getBarPolygon(it.key(), it.value().value);
17774 painter->
setPen(Qt::NoPen);
17776 painter->drawPolygon(barPolygon);
17779 if (
mainPen().style() != Qt::NoPen &&
mainPen().color().alpha() != 0)
17783 painter->setBrush(Qt::NoBrush);
17784 painter->drawPolyline(barPolygon);
17794 painter->setBrush(
mBrush);
17796 QRectF r = QRectF(0, 0, rect.width()*0.67, rect.height()*0.67);
17797 r.moveCenter(rect.center());
17798 painter->drawRect(r);
17832 QCPBarDataMap::const_iterator it =
mBarBelow.data()->mData->lowerBound(key-
mWidth*0.1);
17833 QCPBarDataMap::const_iterator itEnd =
mBarBelow.data()->mData->upperBound(key+
mWidth*0.1);
17834 while (it != itEnd)
17836 if ((positive && it.value().value > max) ||
17837 (!positive && it.value().value < max))
17838 max = it.value().value;
17842 return max +
mBarBelow.data()->getBaseValue(key, positive);
17857 if (!lower && !upper)
return;
17863 upper->
mBarBelow.data()->mBarAbove = 0;
17868 if (lower->mBarAbove && lower->mBarAbove.data()->mBarBelow.data() == lower)
17869 lower->mBarAbove.data()->mBarBelow = 0;
17870 lower->mBarAbove = 0;
17874 if (lower->mBarAbove && lower->mBarAbove.data()->mBarBelow.data() == lower)
17875 lower->mBarAbove.data()->mBarBelow = 0;
17878 upper->
mBarBelow.data()->mBarAbove = 0;
17879 lower->mBarAbove = upper;
17888 bool haveLower =
false;
17889 bool haveUpper =
false;
17892 double barWidthHalf =
mWidth*0.5;
17893 QCPBarDataMap::const_iterator it =
mData->constBegin();
17894 while (it !=
mData->constEnd())
17896 current = it.value().key;
17897 if (inSignDomain ==
sdBoth || (inSignDomain ==
sdNegative && current+barWidthHalf < 0) || (inSignDomain ==
sdPositive && current-barWidthHalf > 0))
17899 if (current-barWidthHalf < range.
lower || !haveLower)
17901 range.
lower = current-barWidthHalf;
17904 if (current+barWidthHalf > range.
upper || !haveUpper)
17906 range.
upper = current+barWidthHalf;
17913 foundRange = haveLower && haveUpper;
17921 bool haveLower =
true;
17922 bool haveUpper =
true;
17926 QCPBarDataMap::const_iterator it =
mData->constBegin();
17927 while (it !=
mData->constEnd())
17929 current = it.value().value +
getBaseValue(it.value().key, it.value().value >= 0);
17932 if (current < range.
lower || !haveLower)
17934 range.
lower = current;
17937 if (current > range.
upper || !haveUpper)
17939 range.
upper = current;
18030 setPen(QPen(Qt::black));
18032 setMedianPen(QPen(Qt::black, 3, Qt::SolidLine, Qt::FlatCap));
18033 setWhiskerPen(QPen(Qt::black, 0, Qt::DashLine, Qt::FlatCap));
18212 if (!
mKeyAxis || !
mValueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return -1; }
18214 if (
mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint()))
18216 double posKey, posValue;
18234 if (!
mKeyAxis || !
mValueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return; }
18237#ifdef QCUSTOMPLOT_CHECK_DATA
18241 qDebug() << Q_FUNC_INFO <<
"Data point at" <<
mKey <<
"of drawn range has invalid data." <<
"Plottable name:" <<
name();
18244 qDebug() << Q_FUNC_INFO <<
"Data point outlier at" <<
mKey <<
"of drawn range invalid." <<
"Plottable name:" <<
name();
18247 QRectF quartileBox;
18251 painter->setClipRect(quartileBox, Qt::IntersectClip);
18265 painter->setBrush(
mBrush);
18266 QRectF r = QRectF(0, 0, rect.width()*0.67, rect.height()*0.67);
18267 r.moveCenter(rect.center());
18268 painter->drawRect(r);
18285 painter->drawRect(box);
18287 *quartileBox = box;
18310 QLineF backboneMin, backboneMax, barMin, barMax;
18340 if (inSignDomain ==
sdBoth)
18351 foundRange =
false;
18362 foundRange =
false;
18366 foundRange =
false;
18373 QVector<double> values;
18378 bool haveUpper =
false;
18379 bool haveLower =
false;
18382 for (
int i=0; i<values.size(); ++i)
18384 if ((inSignDomain ==
sdNegative && values.at(i) < 0) ||
18385 (inSignDomain ==
sdPositive && values.at(i) > 0) ||
18386 (inSignDomain ==
sdBoth))
18388 if (values.at(i) > upper || !haveUpper)
18390 upper = values.at(i);
18393 if (values.at(i) < lower || !haveLower)
18395 lower = values.at(i);
18401 if (haveLower && haveUpper)
18407 foundRange =
false;
18465 mKeyRange(keyRange),
18466 mValueRange(valueRange),
18469 mDataModified(true)
18489 mDataModified(true)
18499 if (&other !=
this)
18518 if (keyCell >= 0 && keyCell < mKeySize && valueCell >= 0 && valueCell <
mValueSize)
18527 if (keyIndex >= 0 && keyIndex < mKeySize && valueIndex >= 0 && valueIndex <
mValueSize)
18561 }
catch (...) {
mData = 0; }
18566 qDebug() << Q_FUNC_INFO <<
"out of memory for data dimensions "<<
mKeySize <<
"*" <<
mValueSize;
18659 if (keyCell >= 0 && keyCell < mKeySize && valueCell >= 0 && valueCell <
mValueSize)
18683 if (keyIndex >= 0 && keyIndex < mKeySize && valueIndex >= 0 && valueIndex <
mValueSize)
18711 double minHeight =
mData[0];
18712 double maxHeight =
mData[0];
18714 for (
int i=0; i<dataCount; ++i)
18716 if (
mData[i] > maxHeight)
18717 maxHeight =
mData[i];
18718 if (
mData[i] < minHeight)
18719 minHeight =
mData[i];
18742 for (
int i=0; i<dataCount; ++i)
18907 mDataScaleType(
QCPAxis::stLinear),
18909 mInterpolate(true),
18910 mTightBoundary(false),
18911 mMapImageInvalidated(true)
19089 if (recalculateDataBounds)
19117 mLegendIcon = QPixmap::fromImage(
mMapImage.mirrored(mirrorX, mirrorY)).scaled(thumbSize, Qt::KeepAspectRatio, transformMode);
19136 if (!
mKeyAxis || !
mValueAxis) { qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
return -1; }
19138 if (
mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint()))
19140 double posKey, posValue;
19174 const int lineCount = valueSize;
19175 const int rowCount = keySize;
19176 for (
int line=0; line<lineCount; ++line)
19178 QRgb* pixels =
reinterpret_cast<QRgb*
>(
mMapImage.scanLine(lineCount-1-line));
19183 const int lineCount = keySize;
19184 const int rowCount = valueSize;
19185 for (
int line=0; line<lineCount; ++line)
19187 QRgb* pixels =
reinterpret_cast<QRgb*
>(
mMapImage.scanLine(lineCount-1-line));
19206 double halfSampleKey = 0;
19207 double halfSampleValue = 0;
19214 imageRect = imageRect.normalized();
19217 bool smoothBackup = painter->renderHints().testFlag(QPainter::SmoothPixmapTransform);
19218 painter->setRenderHint(QPainter::SmoothPixmapTransform,
mInterpolate);
19219 QRegion clipBackup;
19222 clipBackup = painter->clipRegion();
19226 painter->drawImage(imageRect,
mMapImage.mirrored(mirrorX, mirrorY));
19228 painter->setClipRegion(clipBackup);
19229 painter->setRenderHint(QPainter::SmoothPixmapTransform, smoothBackup);
19239 QPixmap scaledIcon =
mLegendIcon.scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::FastTransformation);
19240 QRectF iconRect = QRectF(0, 0, scaledIcon.width(), scaledIcon.height());
19241 iconRect.moveCenter(rect.center());
19242 painter->drawPixmap(iconRect.topLeft(), scaledIcon);
19262 else if (result.
lower <= 0 && result.
upper <= 0)
19263 foundRange =
false;
19268 else if (result.
upper >= 0 && result.
lower >= 0)
19269 foundRange =
false;
19284 else if (result.
lower <= 0 && result.
upper <= 0)
19285 foundRange =
false;
19290 else if (result.
upper >= 0 && result.
lower >= 0)
19291 foundRange =
false;
19316 point1(createPosition(
"point1")),
19317 point2(createPosition(
"point2"))
19322 setPen(QPen(Qt::black));
19366 double clipPad =
mainPen().widthF();
19369 if (!line.isNull())
19385 return qAbs((base.y()-point.y())*vec.x()-(base.x()-point.x())*vec.y())/vec.length();
19400 if (vec.x() == 0 && vec.y() == 0)
19402 if (qFuzzyIsNull(vec.x()))
19407 gamma = base.x()-bx + (by-base.y())*vec.x()/vec.y();
19408 if (gamma >= 0 && gamma <= rect.width())
19409 result.setLine(bx+gamma, rect.top(), bx+gamma, rect.bottom());
19410 }
else if (qFuzzyIsNull(vec.y()))
19415 gamma = base.y()-by + (bx-base.x())*vec.y()/vec.x();
19416 if (gamma >= 0 && gamma <= rect.height())
19417 result.setLine(rect.left(), by+gamma, rect.right(), by+gamma);
19420 QList<QVector2D> pointVectors;
19424 gamma = base.x()-bx + (by-base.y())*vec.x()/vec.y();
19425 if (gamma >= 0 && gamma <= rect.width())
19426 pointVectors.append(QVector2D(bx+gamma, by));
19429 by = rect.bottom();
19430 gamma = base.x()-bx + (by-base.y())*vec.x()/vec.y();
19431 if (gamma >= 0 && gamma <= rect.width())
19432 pointVectors.append(QVector2D(bx+gamma, by));
19436 gamma = base.y()-by + (bx-base.x())*vec.y()/vec.x();
19437 if (gamma >= 0 && gamma <= rect.height())
19438 pointVectors.append(QVector2D(bx, by+gamma));
19442 gamma = base.y()-by + (bx-base.x())*vec.y()/vec.x();
19443 if (gamma >= 0 && gamma <= rect.height())
19444 pointVectors.append(QVector2D(bx, by+gamma));
19447 if (pointVectors.size() == 2)
19449 result.setPoints(pointVectors.at(0).toPointF(), pointVectors.at(1).toPointF());
19450 }
else if (pointVectors.size() > 2)
19453 double distSqrMax = 0;
19454 QVector2D pv1, pv2;
19455 for (
int i=0; i<pointVectors.size()-1; ++i)
19457 for (
int k=i+1; k<pointVectors.size(); ++k)
19459 double distSqr = (pointVectors.at(i)-pointVectors.at(k)).lengthSquared();
19460 if (distSqr > distSqrMax)
19462 pv1 = pointVectors.at(i);
19463 pv2 = pointVectors.at(k);
19464 distSqrMax = distSqr;
19468 result.setPoints(pv1.toPointF(), pv2.toPointF());
19506 start(createPosition(
"start")),
19507 end(createPosition(
"end"))
19512 setPen(QPen(Qt::black));
19581 if (startVec.toPoint() == endVec.toPoint())
19585 clipPad = qMax(clipPad, (
double)
mainPen().widthF());
19588 if (!line.isNull())
19592 painter->setBrush(Qt::SolidPattern);
19594 mTail.
draw(painter, startVec, startVec-endVec);
19596 mHead.
draw(painter, endVec, endVec-startVec);
19609 bool containsStart = rect.contains(
start.x(),
start.y());
19610 bool containsEnd = rect.contains(
end.x(),
end.y());
19611 if (containsStart && containsEnd)
19612 return QLineF(
start.toPointF(),
end.toPointF());
19614 QVector2D base =
start;
19619 QList<QVector2D> pointVectors;
19621 if (!qFuzzyIsNull(vec.y()))
19626 mu = (by-base.y())/vec.y();
19627 if (mu >= 0 && mu <= 1)
19629 gamma = base.x()-bx + mu*vec.x();
19630 if (gamma >= 0 && gamma <= rect.width())
19631 pointVectors.append(QVector2D(bx+gamma, by));
19635 by = rect.bottom();
19636 mu = (by-base.y())/vec.y();
19637 if (mu >= 0 && mu <= 1)
19639 gamma = base.x()-bx + mu*vec.x();
19640 if (gamma >= 0 && gamma <= rect.width())
19641 pointVectors.append(QVector2D(bx+gamma, by));
19644 if (!qFuzzyIsNull(vec.x()))
19649 mu = (bx-base.x())/vec.x();
19650 if (mu >= 0 && mu <= 1)
19652 gamma = base.y()-by + mu*vec.y();
19653 if (gamma >= 0 && gamma <= rect.height())
19654 pointVectors.append(QVector2D(bx, by+gamma));
19659 mu = (bx-base.x())/vec.x();
19660 if (mu >= 0 && mu <= 1)
19662 gamma = base.y()-by + mu*vec.y();
19663 if (gamma >= 0 && gamma <= rect.height())
19664 pointVectors.append(QVector2D(bx, by+gamma));
19669 pointVectors.append(
start);
19671 pointVectors.append(
end);
19674 if (pointVectors.size() == 2)
19676 result.setPoints(pointVectors.at(0).toPointF(), pointVectors.at(1).toPointF());
19677 }
else if (pointVectors.size() > 2)
19680 double distSqrMax = 0;
19681 QVector2D pv1, pv2;
19682 for (
int i=0; i<pointVectors.size()-1; ++i)
19684 for (
int k=i+1; k<pointVectors.size(); ++k)
19686 double distSqr = (pointVectors.at(i)-pointVectors.at(k)).lengthSquared();
19687 if (distSqr > distSqrMax)
19689 pv1 = pointVectors.at(i);
19690 pv2 = pointVectors.at(k);
19691 distSqrMax = distSqr;
19695 result.setPoints(pv1.toPointF(), pv2.toPointF());
19739 start(createPosition(
"start")),
19740 startDir(createPosition(
"startDir")),
19741 endDir(createPosition(
"endDir")),
19742 end(createPosition(
"end"))
19749 setPen(QPen(Qt::black));
19815 QPainterPath cubicPath(startVec);
19816 cubicPath.cubicTo(startDirVec, endDirVec, endVec);
19818 QPolygonF polygon = cubicPath.toSubpathPolygons().first();
19819 double minDistSqr = std::numeric_limits<double>::max();
19820 for (
int i=1; i<polygon.size(); ++i)
19822 double distSqr =
distSqrToLine(polygon.at(i-1), polygon.at(i), pos);
19823 if (distSqr < minDistSqr)
19824 minDistSqr = distSqr;
19826 return qSqrt(minDistSqr);
19836 if (QVector2D(endVec-startVec).length() > 1e10f)
19839 QPainterPath cubicPath(startVec);
19840 cubicPath.cubicTo(startDirVec, endDirVec, endVec);
19844 QRect cubicRect = cubicPath.controlPointRect().toRect();
19845 if (cubicRect.isEmpty())
19846 cubicRect.adjust(0, 0, 1, 1);
19847 if (clip.intersects(cubicRect))
19850 painter->drawPath(cubicPath);
19851 painter->setBrush(Qt::SolidPattern);
19853 mTail.
draw(painter, QVector2D(startVec),
M_PI-cubicPath.angleAtPercent(0)/180.0*
M_PI);
19855 mHead.
draw(painter, QVector2D(endVec), -cubicPath.angleAtPercent(1)/180.0*
M_PI);
19889 topLeft(createPosition(
"topLeft")),
19890 bottomRight(createPosition(
"bottomRight")),
19891 top(createAnchor(
"top", aiTop)),
19892 topRight(createAnchor(
"topRight", aiTopRight)),
19893 right(createAnchor(
"right", aiRight)),
19894 bottom(createAnchor(
"bottom", aiBottom)),
19895 bottomLeft(createAnchor(
"bottomLeft", aiBottomLeft)),
19896 left(createAnchor(
"left", aiLeft))
19901 setPen(QPen(Qt::black));
19961 bool filledRect =
mBrush.style() != Qt::NoBrush &&
mBrush.color().alpha() != 0;
19970 if (p1.toPoint() == p2.toPoint())
19972 QRectF rect = QRectF(p1, p2).normalized();
19973 double clipPad =
mainPen().widthF();
19974 QRectF boundingRect = rect.adjusted(-clipPad, -clipPad, clipPad, clipPad);
19975 if (boundingRect.intersects(
clipRect()))
19979 painter->drawRect(rect);
19989 case aiTop:
return (rect.topLeft()+rect.topRight())*0.5;
19991 case aiRight:
return (rect.topRight()+rect.bottomRight())*0.5;
19992 case aiBottom:
return (rect.bottomLeft()+rect.bottomRight())*0.5;
19994 case aiLeft:
return (rect.topLeft()+rect.bottomLeft())*0.5;
19997 qDebug() << Q_FUNC_INFO <<
"invalid anchorId" << anchorId;
20047 position(createPosition(
"position")),
20048 topLeft(createAnchor(
"topLeft", aiTopLeft)),
20049 top(createAnchor(
"top", aiTop)),
20050 topRight(createAnchor(
"topRight", aiTopRight)),
20051 right(createAnchor(
"right", aiRight)),
20052 bottomRight(createAnchor(
"bottomRight", aiBottomRight)),
20053 bottom(createAnchor(
"bottom", aiBottom)),
20054 bottomLeft(createAnchor(
"bottomLeft", aiBottomLeft)),
20055 left(createAnchor(
"left", aiLeft))
20220 QTransform inputTransform;
20221 inputTransform.translate(positionPixels.x(), positionPixels.y());
20223 inputTransform.translate(-positionPixels.x(), -positionPixels.y());
20224 QPointF rotatedPos = inputTransform.map(pos);
20225 QFontMetrics fontMetrics(
mFont);
20226 QRect textRect = fontMetrics.boundingRect(0, 0, 0, 0, Qt::TextDontClip|
mTextAlignment,
mText);
20229 textBoxRect.moveTopLeft(textPos.toPoint());
20238 QTransform transform = painter->transform();
20239 transform.translate(pos.x(), pos.y());
20243 QRect textRect = painter->fontMetrics().boundingRect(0, 0, 0, 0, Qt::TextDontClip|
mTextAlignment,
mText);
20246 textRect.moveTopLeft(textPos.toPoint()+QPoint(
mPadding.left(),
mPadding.top()));
20247 textBoxRect.moveTopLeft(textPos.toPoint());
20248 double clipPad =
mainPen().widthF();
20249 QRect boundingRect = textBoxRect.adjusted(-clipPad, -clipPad, clipPad, clipPad);
20250 if (transform.mapRect(boundingRect).intersects(painter->transform().mapRect(
clipRect())))
20252 painter->setTransform(transform);
20258 painter->drawRect(textBoxRect);
20260 painter->setBrush(Qt::NoBrush);
20271 QTransform transform;
20272 transform.translate(pos.x(), pos.y());
20275 QFontMetrics fontMetrics(
mainFont());
20276 QRect textRect = fontMetrics.boundingRect(0, 0, 0, 0, Qt::TextDontClip|
mTextAlignment,
mText);
20279 textBoxRect.moveTopLeft(textPos.toPoint());
20280 QPolygonF rectPoly = transform.map(QPolygonF(textBoxRect));
20285 case aiTop:
return (rectPoly.at(0)+rectPoly.at(1))*0.5;
20287 case aiRight:
return (rectPoly.at(1)+rectPoly.at(2))*0.5;
20289 case aiBottom:
return (rectPoly.at(2)+rectPoly.at(3))*0.5;
20291 case aiLeft:
return (rectPoly.at(3)+rectPoly.at(0))*0.5;
20294 qDebug() << Q_FUNC_INFO <<
"invalid anchorId" << anchorId;
20313 QPointF result = pos;
20315 result.rx() -= rect.width()/2.0;
20317 result.rx() -= rect.width();
20319 result.ry() -= rect.height()/2.0;
20321 result.ry() -= rect.height();
20385 topLeft(createPosition(
"topLeft")),
20386 bottomRight(createPosition(
"bottomRight")),
20387 topLeftRim(createAnchor(
"topLeftRim", aiTopLeftRim)),
20388 top(createAnchor(
"top", aiTop)),
20389 topRightRim(createAnchor(
"topRightRim", aiTopRightRim)),
20390 right(createAnchor(
"right", aiRight)),
20391 bottomRightRim(createAnchor(
"bottomRightRim", aiBottomRightRim)),
20392 bottom(createAnchor(
"bottom", aiBottom)),
20393 bottomLeftRim(createAnchor(
"bottomLeftRim", aiBottomLeftRim)),
20394 left(createAnchor(
"left", aiLeft)),
20395 center(createAnchor(
"center", aiCenter))
20400 setPen(QPen(Qt::black));
20459 double result = -1;
20462 QPointF
center((p1+p2)/2.0);
20463 double a = qAbs(p1.x()-p2.x())/2.0;
20464 double b = qAbs(p1.y()-p2.y())/2.0;
20465 double x = pos.x()-
center.x();
20466 double y = pos.y()-
center.y();
20469 double c = 1.0/qSqrt(
x*
x/(a*a)+
y*
y/(b*b));
20470 result = qAbs(c-1)*qSqrt(
x*
x+
y*
y);
20474 if (
x*
x/(a*a) +
y*
y/(b*b) <= 1)
20485 if (p1.toPoint() == p2.toPoint())
20487 QRectF ellipseRect = QRectF(p1, p2).normalized();
20489 if (ellipseRect.intersects(clip))
20497 painter->drawEllipse(ellipseRect);
20501 qDebug() << Q_FUNC_INFO <<
"Item too large for memory, setting invisible";
20514 case aiTopLeftRim:
return rect.center()+(rect.topLeft()-rect.center())*1/qSqrt(2);
20515 case aiTop:
return (rect.topLeft()+rect.topRight())*0.5;
20516 case aiTopRightRim:
return rect.center()+(rect.topRight()-rect.center())*1/qSqrt(2);
20517 case aiRight:
return (rect.topRight()+rect.bottomRight())*0.5;
20518 case aiBottomRightRim:
return rect.center()+(rect.bottomRight()-rect.center())*1/qSqrt(2);
20519 case aiBottom:
return (rect.bottomLeft()+rect.bottomRight())*0.5;
20520 case aiBottomLeftRim:
return rect.center()+(rect.bottomLeft()-rect.center())*1/qSqrt(2);
20521 case aiLeft:
return (rect.topLeft()+rect.bottomLeft())*0.5;
20522 case aiCenter:
return (rect.topLeft()+rect.bottomRight())*0.5;
20525 qDebug() << Q_FUNC_INFO <<
"invalid anchorId" << anchorId;
20575 topLeft(createPosition(
"topLeft")),
20576 bottomRight(createPosition(
"bottomRight")),
20577 top(createAnchor(
"top", aiTop)),
20578 topRight(createAnchor(
"topRight", aiTopRight)),
20579 right(createAnchor(
"right", aiRight)),
20580 bottom(createAnchor(
"bottom", aiBottom)),
20581 bottomLeft(createAnchor(
"bottomLeft", aiBottomLeft)),
20582 left(createAnchor(
"left", aiLeft))
20603 qDebug() << Q_FUNC_INFO <<
"pixmap is null";
20650 bool flipHorz =
false;
20651 bool flipVert =
false;
20653 double clipPad =
mainPen().style() == Qt::NoPen ? 0 :
mainPen().widthF();
20654 QRect boundingRect = rect.adjusted(-clipPad, -clipPad, clipPad, clipPad);
20655 if (boundingRect.intersects(
clipRect()))
20660 if (
pen.style() != Qt::NoPen)
20663 painter->setBrush(Qt::NoBrush);
20664 painter->drawRect(rect);
20678 rect.adjust(rect.width(), 0, -rect.width(), 0);
20680 rect.adjust(0, rect.height(), 0, -rect.height());
20684 case aiTop:
return (rect.topLeft()+rect.topRight())*0.5;
20686 case aiRight:
return (rect.topRight()+rect.bottomRight())*0.5;
20687 case aiBottom:
return (rect.bottomLeft()+rect.bottomRight())*0.5;
20689 case aiLeft:
return (rect.topLeft()+rect.bottomLeft())*0.5;;
20692 qDebug() << Q_FUNC_INFO <<
"invalid anchorId" << anchorId;
20716 if (finalRect.isNull())
20721 if (flipHorz || flipVert)
20745 bool flipHorz =
false;
20746 bool flipVert =
false;
20750 return QRect(p1, QSize(0, 0));
20753 QSize newSize = QSize(p2.x()-p1.x(), p2.y()-p1.y());
20755 if (newSize.width() < 0)
20758 newSize.rwidth() *= -1;
20761 if (newSize.height() < 0)
20764 newSize.rheight() *= -1;
20767 QSize scaledSize =
mPixmap.size();
20769 result = QRect(
topLeft, scaledSize);
20772 result = QRect(p1,
mPixmap.size());
20775 *flippedHorz = flipHorz;
20777 *flippedVert = flipVert;
20833 position(createPosition(
"position")),
20840 setPen(QPen(Qt::black));
20933 qDebug() << Q_FUNC_INFO <<
"graph isn't in same QCustomPlot instance as this item";
20978 double w =
mSize/2.0;
20985 if (
clipRect().intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))
20986 return qSqrt(qMin(
distSqrToLine(center+QPointF(-w, 0), center+QPointF(w, 0), pos),
20987 distSqrToLine(center+QPointF(0, -w), center+QPointF(0, w), pos)));
20992 return qSqrt(qMin(
distSqrToLine(QPointF(clip.left(), center.y()), QPointF(clip.right(), center.y()), pos),
20993 distSqrToLine(QPointF(center.x(), clip.top()), QPointF(center.x(), clip.bottom()), pos)));
20997 if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))
21000 double centerDist = QVector2D(center-pos).length();
21001 double circleLine = w;
21002 double result = qAbs(centerDist-circleLine);
21006 if (centerDist <= circleLine)
21015 if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))
21017 QRectF rect = QRectF(center-QPointF(w, w), center+QPointF(w, w));
21018 bool filledRect =
mBrush.style() != Qt::NoBrush &&
mBrush.color().alpha() != 0;
21037 double w =
mSize/2.0;
21044 if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))
21046 painter->
drawLine(QLineF(center+QPointF(-w, 0), center+QPointF(w, 0)));
21047 painter->
drawLine(QLineF(center+QPointF(0, -w), center+QPointF(0, w)));
21053 if (center.y() > clip.top() && center.y() < clip.bottom())
21054 painter->
drawLine(QLineF(clip.left(), center.y(), clip.right(), center.y()));
21055 if (center.x() > clip.left() && center.x() < clip.right())
21056 painter->
drawLine(QLineF(center.x(), clip.top(), center.x(), clip.bottom()));
21061 if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))
21062 painter->drawEllipse(center, w, w);
21067 if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))
21068 painter->drawRect(QRectF(center-QPointF(w, w), center+QPointF(w, w)));
21094 QCPDataMap::const_iterator first =
mGraph->
data()->constBegin();
21095 QCPDataMap::const_iterator last =
mGraph->
data()->constEnd()-1;
21105 QCPDataMap::const_iterator prevIt = it-1;
21110 if (!qFuzzyCompare((
double)it.key(), (
double)prevIt.key()))
21111 slope = (it.value().value-prevIt.value().value)/(it.key()-prevIt.key());
21116 if (
mGraphKey < (prevIt.key()+it.key())*0.5)
21125 QCPDataMap::const_iterator it =
mGraph->
data()->constBegin();
21128 qDebug() << Q_FUNC_INFO <<
"graph has no data";
21130 qDebug() << Q_FUNC_INFO <<
"graph not contained in QCustomPlot instance (anymore)";
21186 left(createPosition(
"left")),
21187 right(createPosition(
"right")),
21188 center(createAnchor(
"center", aiCenter))
21193 setPen(QPen(Qt::black));
21259 if (leftVec.toPoint() == rightVec.toPoint())
21262 QVector2D widthVec = (rightVec-leftVec)*0.5f;
21263 QVector2D lengthVec(-widthVec.y(), widthVec.x());
21264 lengthVec = lengthVec.normalized()*
mLength;
21265 QVector2D centerVec = (rightVec+leftVec)*0.5f-lengthVec;
21267 return qSqrt(
distSqrToLine((centerVec-widthVec).toPointF(), (centerVec+widthVec).toPointF(), pos));
21275 if (leftVec.toPoint() == rightVec.toPoint())
21278 QVector2D widthVec = (rightVec-leftVec)*0.5f;
21279 QVector2D lengthVec(-widthVec.y(), widthVec.x());
21280 lengthVec = lengthVec.normalized()*
mLength;
21281 QVector2D centerVec = (rightVec+leftVec)*0.5f-lengthVec;
21283 QPolygon boundingPoly;
21284 boundingPoly << leftVec.toPoint() << rightVec.toPoint()
21285 << (rightVec-lengthVec).toPoint() << (leftVec-lengthVec).toPoint();
21287 if (clip.intersects(boundingPoly.boundingRect()))
21294 painter->
drawLine((centerVec+widthVec).toPointF(), (centerVec-widthVec).toPointF());
21295 painter->
drawLine((centerVec+widthVec).toPointF(), (centerVec+widthVec+lengthVec).toPointF());
21296 painter->
drawLine((centerVec-widthVec).toPointF(), (centerVec-widthVec+lengthVec).toPointF());
21301 painter->setBrush(Qt::NoBrush);
21303 path.moveTo((centerVec+widthVec+lengthVec).toPointF());
21304 path.cubicTo((centerVec+widthVec).toPointF(), (centerVec+widthVec).toPointF(), centerVec.toPointF());
21305 path.cubicTo((centerVec-widthVec).toPointF(), (centerVec-widthVec).toPointF(), (centerVec-widthVec+lengthVec).toPointF());
21306 painter->drawPath(path);
21311 painter->setBrush(Qt::NoBrush);
21313 path.moveTo((centerVec+widthVec+lengthVec).toPointF());
21314 path.cubicTo((centerVec+widthVec-lengthVec*0.8f).toPointF(), (centerVec+0.4f*widthVec+lengthVec).toPointF(), centerVec.toPointF());
21315 path.cubicTo((centerVec-0.4f*widthVec+lengthVec).toPointF(), (centerVec-widthVec-lengthVec*0.8f).toPointF(), (centerVec-widthVec+lengthVec).toPointF());
21316 painter->drawPath(path);
21321 painter->
setPen(Qt::NoPen);
21322 painter->setBrush(QBrush(
mainPen().color()));
21324 path.moveTo((centerVec+widthVec+lengthVec).toPointF());
21326 path.cubicTo((centerVec+widthVec-lengthVec*0.8f).toPointF(), (centerVec+0.4f*widthVec+0.8f*lengthVec).toPointF(), centerVec.toPointF());
21327 path.cubicTo((centerVec-0.4f*widthVec+0.8f*lengthVec).toPointF(), (centerVec-widthVec-lengthVec*0.8f).toPointF(), (centerVec-widthVec+lengthVec).toPointF());
21329 path.cubicTo((centerVec-widthVec-lengthVec*0.5f).toPointF(), (centerVec-0.2f*widthVec+1.2f*lengthVec).toPointF(), (centerVec+lengthVec*0.2f).toPointF());
21330 path.cubicTo((centerVec+0.2f*widthVec+1.2f*lengthVec).toPointF(), (centerVec+widthVec-lengthVec*0.5f).toPointF(), (centerVec+widthVec+lengthVec).toPointF());
21332 painter->drawPath(path);
21344 if (leftVec.toPoint() == rightVec.toPoint())
21345 return leftVec.toPointF();
21347 QVector2D widthVec = (rightVec-leftVec)*0.5f;
21348 QVector2D lengthVec(-widthVec.y(), widthVec.x());
21349 lengthVec = lengthVec.normalized()*
mLength;
21350 QVector2D centerVec = (rightVec+leftVec)*0.5f-lengthVec;
21355 return centerVec.toPointF();
21357 qDebug() << Q_FUNC_INFO <<
"invalid anchorId" << anchorId;
The abstract base class for all items in a plot.
QCPItemAnchor * anchor(const QString &name) const
Returns the QCPItemAnchor with the specified name.
Q_SLOT void setSelected(bool selected)
Sets whether this item is selected or not.
QCPItemPosition * position(const QString &name) const
Returns the QCPItemPosition with the specified name.
double rectSelectTest(const QRectF &rect, const QPointF &pos, bool filledRect) const
virtual ~QCPAbstractItem()
void setClipToAxisRect(bool clip)
Sets whether the item shall be clipped to an axis rect or whether it shall be visible on the entire Q...
QPointer< QCPAxisRect > mClipAxisRect
bool clipToAxisRect() const
virtual QRect clipRect() const
virtual QPointF anchorPixelPoint(int anchorId) const
virtual QCP::Interaction selectionCategory() const
void selectableChanged(bool selectable)
friend class QCPItemAnchor
QCPItemPosition * createPosition(const QString &name)
void setClipAxisRect(QCPAxisRect *rect)
Sets the clip axis rect.
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
bool hasAnchor(const QString &name) const
Returns whether this item has an anchor with the specified name.
Q_SLOT void setSelectable(bool selectable)
Sets whether the user can (de-)select this item by clicking on the QCustomPlot surface.
double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const
QList< QCPItemAnchor * > mAnchors
virtual void deselectEvent(bool *selectionStateChanged)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
This function is used to decide whether a click hits a layerable object or not.
QCPAbstractItem(QCustomPlot *parentPlot)
Base class constructor which initializes base class members.
void selectionChanged(bool selected)
This signal is emitted when the selection state of this item has changed, either by user interaction ...
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
QCPAxisRect * clipAxisRect() const
QCPItemAnchor * createAnchor(const QString &name, int anchorId)
QList< QCPItemPosition * > mPositions
The abstract base class for all entries in a QCPLegend.
void setFont(const QFont &font)
Sets the default font of this specific legend item to font.
QColor mSelectedTextColor
void setSelectedTextColor(const QColor &color)
When this legend item is selected, color is used to draw generic text, instead of the normal color se...
void setTextColor(const QColor &color)
Sets the default text color of this specific legend item to color.
Q_SLOT void setSelected(bool selected)
Sets whether this specific legend item is selected.
void selectionChanged(bool selected)
This signal is emitted when the selection state of this legend item has changed, either by user inter...
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
void setSelectedFont(const QFont &font)
When this legend item is selected, font is used to draw generic text, instead of the normal font set ...
Q_SLOT void setSelectable(bool selectable)
Sets whether this specific legend item is selectable.
virtual QCP::Interaction selectionCategory() const
QCPLegend * mParentLegend
void selectableChanged(bool selectable)
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
virtual QRect clipRect() const
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Layout elements are sensitive to events inside their outer rect.
virtual void deselectEvent(bool *selectionStateChanged)
QCPAbstractLegendItem(QCPLegend *parent)
Constructs a QCPAbstractLegendItem and associates it with the QCPLegend parent.
The abstract base class for all data representing objects in a plot.
void selectableChanged(bool selectable)
This signal is emitted when the selectability of this plottable has changed.
void applyErrorBarsAntialiasingHint(QCPPainter *painter) const
void setAntialiasedFill(bool enabled)
Sets whether fills of this plottable is drawn antialiased or not.
friend class QCPPlottableLegendItem
void rescaleAxes(bool onlyEnlarge=false) const
Rescales the key and value axes associated with this plottable to contain all displayed data,...
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
Q_SLOT void setSelectable(bool selectable)
Sets whether the user can (de-)select this plottable by clicking on the QCustomPlot surface.
QPointer< QCPAxis > mValueAxis
void setAntialiasedScatters(bool enabled)
Sets whether the scatter symbols of this plottable are drawn antialiased or not.
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const =0
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
This function is used to decide whether a click hits a layerable object or not.
void pixelsToCoords(double x, double y, double &key, double &value) const
void selectionChanged(bool selected)
This signal is emitted when the selection state of this plottable has changed, either by user interac...
QPointer< QCPAxis > mKeyAxis
void applyDefaultAntialiasingHint(QCPPainter *painter) const
SignDomain
Represents negative and positive sign domain for passing to getKeyRange and getValueRange.
@ sdPositive
The positive sign domain, i.e. numbers greater than zero.
@ sdBoth
Both sign domains, including zero, i.e. all (rational) numbers.
@ sdNegative
The negative sign domain, i.e. numbers smaller than zero.
void setSelectedPen(const QPen &pen)
When the plottable is selected, this pen is used to draw basic lines instead of the normal pen set vi...
virtual void deselectEvent(bool *selectionStateChanged)
virtual bool addToLegend()
Adds this plottable to the legend of the parent QCustomPlot (QCustomPlot::legend).
void setValueAxis(QCPAxis *axis)
The value axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal to...
void setAntialiasedErrorBars(bool enabled)
Sets whether the error bars of this plottable are drawn antialiased or not.
void setBrush(const QBrush &brush)
The brush is used to draw basic fills of the plottable representation in the plot.
void coordsToPixels(double key, double value, double &x, double &y) const
QCPAxis * valueAxis() const
void setKeyAxis(QCPAxis *axis)
The key axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal to t...
void applyFillAntialiasingHint(QCPPainter *painter) const
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const =0
bool mAntialiasedScatters
void rescaleValueAxis(bool onlyEnlarge=false) const
Rescales the value axis of the plottable so the whole plottable is visible.
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const =0
QCPAxis * keyAxis() const
virtual QRect clipRect() const
void setPen(const QPen &pen)
The pen is used to draw basic lines that make up the plottable representation in the plot.
void setName(const QString &name)
The name is the textual representation of this plottable as it is displayed in the legend (QCPLegend)...
void applyScattersAntialiasingHint(QCPPainter *painter) const
virtual bool removeFromLegend() const
Removes the plottable from the legend of the parent QCustomPlot.
bool mAntialiasedErrorBars
void setSelectedBrush(const QBrush &brush)
When the plottable is selected, this brush is used to draw fills instead of the normal brush set via ...
void rescaleKeyAxis(bool onlyEnlarge=false) const
Rescales the key axis of the plottable so the whole plottable is visible.
QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis)
Constructs an abstract plottable which uses keyAxis as its key axis ("x") and valueAxis as its value ...
double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const
virtual QCP::Interaction selectionCategory() const
Q_SLOT void setSelected(bool selected)
Sets whether this plottable is selected or not.
virtual void draw(QCPPainter *painter)
QCPLineEnding lowerEnding
QCache< QString, CachedLabel > mLabelCache
QRect mTickLabelsSelectionBox
QCPAxisPainterPrivate(QCustomPlot *parentPlot)
Constructs a QCPAxisPainterPrivate instance.
virtual TickLabelData getTickLabelData(const QFont &font, const QString &text) const
virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const
bool abbreviateDecimalPowers
virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const
virtual ~QCPAxisPainterPrivate()
QCustomPlot * mParentPlot
virtual void drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const
QByteArray mLabelParameterHash
QRect axisSelectionBox() const
virtual QByteArray generateLabelParameterHash() const
QRect tickLabelsSelectionBox() const
QVector< QString > tickLabels
QVector< double > tickPositions
QRect labelSelectionBox() const
QCPLineEnding upperEnding
virtual void placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize)
QVector< double > subTickPositions
Holds multiple axes and arranges them in a rectangular shape.
QList< QCPAbstractItem * > items() const
Returns a list of all the items that are associated with this axis rect.
bool removeAxis(QCPAxis *axis)
Removes the specified axis from the axis rect and deletes it.
QList< QCPAxis * > axes() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QCPRange mDragStartVertRange
int width() const
Returns the pixel width of this axis rect.
Qt::Orientations mRangeZoom
virtual void update(UpdatePhase phase)
This method is called automatically upon replot and doesn't need to be called by users of QCPAxisRect...
QCPLayoutInset * mInsetLayout
QList< QCPGraph * > graphs() const
Returns a list of all the graphs that are associated with this axis rect.
double mRangeZoomFactorVert
QPixmap mBackgroundPixmap
QPointer< QCPAxis > mRangeDragVertAxis
int right() const
Returns the pixel position of the right border of this axis rect.
virtual QList< QCPLayoutElement * > elements(bool recursive) const
Returns a list of all child elements in this layout element.
QCPRange mDragStartHorzRange
int top() const
Returns the pixel position of the top border of this axis rect.
virtual void mouseMoveEvent(QMouseEvent *event)
This event is called, if the mouse is moved inside the outer rect of this layout element.
QCPAxis * axis(QCPAxis::AxisType type, int index=0) const
Returns the axis with the given index on the axis rect side specified with type.
QList< QCPAbstractPlottable * > plottables() const
Returns a list of all the plottables that are associated with this axis rect.
virtual void wheelEvent(QWheelEvent *event)
This event is called, if the mouse wheel is scrolled while the cursor is inside the rect of this layo...
void setBackgroundScaledMode(Qt::AspectRatioMode mode)
If scaling of the axis background pixmap is enabled (setBackgroundScaled), use this function to defin...
void setupFullAxesBox(bool connectRanges=false)
Convenience function to create an axis on each side that doesn't have any axes yet and set their visi...
void updateAxesOffset(QCPAxis::AxisType type)
void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical)
Sets the axes whose range will be dragged when setRangeDrag enables mouse range dragging on the QCust...
QCPAxis * rangeZoomAxis(Qt::Orientation orientation)
Returns the range zoom axis of the orientation provided.
QCPAxis * rangeDragAxis(Qt::Orientation orientation)
Returns the range drag axis of the orientation provided.
QCP::AntialiasedElements mNotAADragBackup
virtual void mousePressEvent(QMouseEvent *event)
This event is called, if the mouse was pressed while being inside the outer rect of this layout eleme...
QList< QCPAxis * > addAxes(QCPAxis::AxisTypes types)
Adds a new axis with addAxis to each axis rect side specified in types.
void setRangeZoom(Qt::Orientations orientations)
Sets which axis orientation may be zoomed by the user with the mouse wheel.
QSize size() const
Returns the pixel size of this axis rect.
Qt::AspectRatioMode mBackgroundScaledMode
int axisCount(QCPAxis::AxisType type) const
Returns the number of axes on the axis rect side specified with type.
void setRangeZoomFactor(double horizontalFactor, double verticalFactor)
Sets how strong one rotation step of the mouse wheel zooms, when range zoom was activated with setRan...
QPointer< QCPAxis > mRangeZoomVertAxis
QList< QCPAxis * > axes(QCPAxis::AxisTypes types) const
Returns all axes on the axis rect sides specified with types.
void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical)
Sets the axes whose range will be zoomed when setRangeZoom enables mouse wheel zooming on the QCustom...
QCPLayoutInset * insetLayout() const
Returns the inset layout of this axis rect.
QCP::AntialiasedElements mAADragBackup
QPixmap mScaledBackgroundPixmap
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
Qt::Orientations mRangeDrag
void drawBackground(QCPPainter *painter)
QCPAxis * addAxis(QCPAxis::AxisType type)
Adds a new axis to the axis rect side specified with type, and returns it.
int height() const
Returns the pixel height of this axis rect.
int bottom() const
Returns the pixel position of the bottom border of this axis rect.
double mRangeZoomFactorHorz
virtual void mouseReleaseEvent(QMouseEvent *event)
This event is called, if the mouse was previously pressed inside the outer rect of this layout elemen...
QPointer< QCPAxis > mRangeZoomHorzAxis
double rangeZoomFactor(Qt::Orientation orientation)
Returns the range zoom factor of the orientation provided.
void setRangeDrag(Qt::Orientations orientations)
Sets which axis orientation may be range dragged by the user with mouse interaction.
void setBackgroundScaled(bool scaled)
Sets whether the axis background pixmap shall be scaled to fit the axis rect or not.
virtual int calculateAutoMargin(QCP::MarginSide side)
QPointer< QCPAxis > mRangeDragHorzAxis
void setBackground(const QPixmap &pm)
Sets pm as the axis background pixmap.
virtual void draw(QCPPainter *painter)
int left() const
Returns the pixel position of the left border of this axis rect.
QHash< QCPAxis::AxisType, QList< QCPAxis * > > mAxes
Manages a single axis inside a QCustomPlot.
QCPAxisRect * axisRect() const
void setSelectedLabelFont(const QFont &font)
Sets the font that is used for the axis label when it is selected.
void setOffset(int offset)
Sets the offset the axis has to its axis rect side.
virtual QCP::Interaction selectionCategory() const
void setTickLabels(bool show)
Sets whether tick labels are displayed.
void rangeChanged(const QCPRange &newRange)
This signal is emitted when the range of this axis has changed.
void setLowerEnding(const QCPLineEnding &ending)
Sets the style for the lower axis ending.
LabelType tickLabelType() const
QCPLineEnding lowerEnding() const
bool autoTickStep() const
void moveRange(double diff)
If the scale type (setScaleType) is stLinear, diff is added to the lower and upper bounds of the rang...
void setTickLabelRotation(double degrees)
Sets the rotation of the tick labels.
QString numberFormat() const
void setRangeReversed(bool reversed)
Sets whether the axis range (direction) is displayed reversed.
void setNumberPrecision(int precision)
Sets the precision of the tick label numbers.
SelectablePart getPartAt(const QPointF &pos) const
Returns the part of the axis that is hit by pos (in pixels).
int numberPrecision() const
virtual void draw(QCPPainter *painter)
void setDateTimeSpec(const Qt::TimeSpec &timeSpec)
Sets the time spec that is used for the date time values when setTickLabelType is ltDateTime.
QVector< double > mSubTickVector
void setSelectedSubTickPen(const QPen &pen)
Sets the pen that is used to draw the subticks when selected.
void setTickLabelFont(const QFont &font)
Sets the font of the tick labels.
QString dateTimeFormat() const
void setDateTimeFormat(const QString &format)
Sets the format in which dates and times are displayed as tick labels, if setTickLabelType is ltDateT...
void setLabel(const QString &str)
Sets the text of the axis label that will be shown below/above or next to the axis,...
void scaleTypeChanged(QCPAxis::ScaleType scaleType)
This signal is emitted when the scale type changes, by calls to setScaleType.
ScaleType
Defines the scale of an axis.
@ stLogarithmic
Logarithmic scaling with correspondingly transformed plots and (major) tick marks at every base power...
@ stLinear
Linear scaling.
void setTickLabelColor(const QColor &color)
Sets the color of the tick labels.
void setTickLengthOut(int outside)
Sets the length of the outward ticks in pixels.
QColor mSelectedTickLabelColor
int autoTickCount() const
QList< QCPAbstractItem * > items() const
Returns a list of all the items that are associated with this axis.
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
void setLabelPadding(int padding)
Sets the distance between the tick labels and the axis label.
virtual int calculateMargin()
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
void rescale(bool onlyVisiblePlottables=false)
Changes the axis range such that all plottables associated with this axis are fully visible in that d...
LabelType
When automatic tick label generation is enabled (setAutoTickLabels), defines how the coordinate of th...
@ ltNumber
Tick coordinate is regarded as normal number and will be displayed as such. (see setNumberFormat)
@ ltDateTime
Tick coordinate is regarded as a date/time (seconds since 1970-01-01T00:00:00 UTC) and will be displa...
void setSubTickCount(int count)
Sets the number of sub ticks in one (major) tick step.
void setSubTickLengthOut(int outside)
Sets the length of the outward subticks in pixels.
QFont mSelectedTickLabelFont
Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts)
Sets whether the user can (de-)select the parts in selectable by clicking on the QCustomPlot surface.
virtual void deselectEvent(bool *selectionStateChanged)
double pixelToCoord(double value) const
Transforms value, in pixel coordinates of the QCustomPlot widget, to axis coordinates.
void setTickLabelType(LabelType type)
Sets whether the tick labels display numbers or dates/times.
void setPadding(int padding)
Sets the padding of the axis.
virtual void setupTickVectors()
double tickLabelRotation() const
void setSelectedLabelColor(const QColor &color)
Sets the color that is used for the axis label when it is selected.
virtual void generateAutoTicks()
void selectionChanged(const QCPAxis::SelectableParts &parts)
This signal is emitted when the selection state of this axis has changed, either by user interaction ...
void setTickLength(int inside, int outside=0)
Sets the length of the ticks in pixels.
QCPGrid * grid() const
Returns the QCPGrid instance belonging to this axis.
void setUpperEnding(const QCPLineEnding &ending)
Sets the style for the upper axis ending.
QFont getTickLabelFont() const
void setLabelColor(const QColor &color)
Sets the color of the axis label.
void scaleRange(double factor, double center)
Scales the range of this axis by factor around the coordinate center.
void setLabelFont(const QFont &font)
Sets the font of the axis label.
void setScaleLogBase(double base)
If setScaleType is set to stLogarithmic, base will be the logarithm base of the scaling.
void setBasePen(const QPen &pen)
Sets the pen, the axis base line is drawn with.
void setAutoTickCount(int approximateCount)
When setAutoTickStep is true, approximateCount determines how many ticks should be generated in the v...
void setSelectedTickPen(const QPen &pen)
Sets the pen that is used to draw the (major) ticks when selected.
void setSelectedTickLabelFont(const QFont &font)
Sets the font that is used for tick labels when they are selected.
void setTickVector(const QVector< double > &vec)
If you want full control over what ticks (and possibly labels) the axes show, this function is used t...
SelectableParts selectedParts() const
QColor getTickLabelColor() const
double scaleLogBase() const
SelectableParts mSelectedParts
void setTickVectorLabels(const QVector< QString > &vec)
If you want full control over what ticks and labels the axes show, this function is used to set a num...
double mScaleLogBaseLogInv
QColor mSelectedLabelColor
void setAutoTickStep(bool on)
Sets whether the tick step, i.e.
void setSelectedTickLabelColor(const QColor &color)
Sets the color that is used for tick labels when they are selected.
QCPLineEnding upperEnding() const
AxisType axisType() const
void selectableChanged(const QCPAxis::SelectableParts &parts)
This signal is emitted when the selectability changes, by calls to setSelectableParts.
static AxisType opposite(AxisType type)
Returns the axis type that describes the opposite axis of an axis with the specified type.
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
void setAutoTickLabels(bool on)
Sets whether the tick labels are generated automatically.
double basePow(double value) const
QPen getSubTickPen() const
QVector< double > mTickVector
void setSubTickLength(int inside, int outside=0)
Sets the length of the subticks in pixels.
SelectableParts mSelectableParts
bool rangeReversed() const
Qt::Orientation orientation() const
Returns the orientation of this axis.
Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts)
Sets the selected state of the respective axis parts described by SelectablePart.
SelectablePart
Defines the selectable parts of an axis.
@ spTickLabels
Tick labels (numbers) of this axis (as a whole, not individually)
@ spAxisLabel
The axis label.
@ spAxis
The axis backbone and tick marks.
@ spNone
None of the selectable parts.
static AxisType marginSideToAxisType(QCP::MarginSide side)
Transforms a margin side to the logically corresponding axis type.
const QCPRange range() const
void setSubTickLengthIn(int inside)
Sets the length of the inward subticks in pixels.
QList< QCPAbstractPlottable * > plottables() const
Returns a list of all the plottables that have this axis as key or value axis.
QCPAxis(QCPAxisRect *parent, AxisType type)
Constructs an Axis instance of Type type for the axis rect parent.
void setTicks(bool show)
Sets whether tick marks are displayed.
int subTickLengthOut() const
virtual int calculateAutoSubTickCount(double tickStep) const
void setRangeUpper(double upper)
Sets the upper bound of the axis range.
ScaleType scaleType() const
int tickLengthOut() const
QList< QCPGraph * > graphs() const
Returns a list of all the graphs that have this axis as key or value axis.
void setTickPen(const QPen &pen)
Sets the pen, tick marks will be drawn with.
void setAutoSubTicks(bool on)
Sets whether the number of sub ticks in one tick interval is determined automatically.
Q_SLOT void setScaleType(QCPAxis::ScaleType type)
Sets whether the axis uses a linear scale or a logarithmic scale.
AxisType
Defines at which side of the axis rect the axis will appear.
@ atBottom
0x08 Axis is horizontal and on the bottom side of the axis rect
@ atTop
0x04 Axis is horizontal and on the top side of the axis rect
@ atRight
0x02 Axis is vertical and on the right side of the axis rect
@ atLeft
0x01 Axis is vertical and on the left side of the axis rect
bool autoSubTicks() const
void setNumberFormat(const QString &formatCode)
Sets the number format for the numbers drawn as tick labels (if tick label type is ltNumber).
double baseLog(double value) const
void setAutoTicks(bool on)
Sets whether the tick positions should be calculated automatically (either from an automatically gene...
QColor getLabelColor() const
Qt::TimeSpec dateTimeSpec() const
QFont getLabelFont() const
void setSelectedBasePen(const QPen &pen)
Sets the pen that is used to draw the axis base line when selected.
Q_SLOT void setRange(const QCPRange &range)
Sets the range of the axis.
void visibleTickBounds(int &lowIndex, int &highIndex) const
void setSubTickPen(const QPen &pen)
Sets the pen, subtick marks will be drawn with.
QCPAxisPainterPrivate * mAxisPainter
QVector< QString > mTickVectorLabels
bool mNumberBeautifulPowers
double coordToPixel(double value) const
Transforms value, in coordinates of the axis, to pixel coordinates of the QCustomPlot widget.
void setTickLabelPadding(int padding)
Sets the distance between the axis base line (including any outward ticks) and the tick labels.
void ticksRequest()
This signal is emitted when setAutoTicks is false and the axis is about to generate tick labels for a...
void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0)
Scales the range of this axis to have a certain scale ratio to otherAxis.
void setTickStep(double step)
If setAutoTickStep is set to false, use this function to set the tick step manually.
Qt::TimeSpec mDateTimeSpec
int subTickLengthIn() const
int tickLabelPadding() const
void setTickLengthIn(int inside)
Sets the length of the inward ticks in pixels.
void setRangeLower(double lower)
Sets the lower bound of the axis range.
Holds the data of one single data point (one bar) for QCPBars.
QCPBarData()
Constructs a bar data point with key and value set to zero.
A plottable representing a bar chart in a plot.
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
QPointer< QCPBars > mBarAbove
virtual void clearData()
Removes all data points.
void addData(const QCPBarDataMap &dataMap)
Adds the provided data points in dataMap to the current data.
void removeData(double fromKey, double toKey)
Removes all data points with key between fromKey and toKey.
QCPBarDataMap * data() const
QPolygonF getBarPolygon(double key, double value) const
virtual void draw(QCPPainter *painter)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis)
Constructs a bar chart which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y")...
void moveBelow(QCPBars *bars)
Moves this bars plottable below bars.
static void connectBars(QCPBars *lower, QCPBars *upper)
void removeDataAfter(double key)
Removes all data points with key greater than key.
void removeDataBefore(double key)
Removes all data points with key smaller than key.
void setData(QCPBarDataMap *data, bool copy=false)
Replaces the current data with the provided data.
void moveAbove(QCPBars *bars)
Moves this bars plottable above bars.
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
QPointer< QCPBars > mBarBelow
double getBaseValue(double key, bool positive) const
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
void setWidth(double width)
Sets the width of the bars in plot (key) coordinates.
Defines a color gradient for use with e.g.
ColorInterpolation mColorInterpolation
QRgb color(double position, const QCPRange &range, bool logarithmic=false)
void setLevelCount(int n)
Sets the number of discretization levels of the color gradient to n.
void setPeriodic(bool enabled)
Sets whether data points that are outside the configured data range (e.g.
void setColorStopAt(double position, const QColor &color)
Sets the color the gradient will have at the specified position (from 0 to 1).
QCPColorGradient(GradientPreset preset=gpCold)
Constructs a new QCPColorGradient initialized with the colors and color interpolation according to pr...
QMap< double, QColor > colorStops() const
void setColorStops(const QMap< double, QColor > &colorStops)
Sets at which positions from 0 to 1 which color shall occur.
bool operator==(const QCPColorGradient &other) const
void clearColorStops()
Clears all color stops.
QMap< double, QColor > mColorStops
QCPColorGradient inverted() const
Returns an inverted gradient.
void loadPreset(GradientPreset preset)
Clears the current color stops and loads the specified preset.
void setColorInterpolation(ColorInterpolation interpolation)
Sets whether the colors in between the configured color stops (see setColorStopAt) shall be interpola...
void colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false)
This method is used to quickly convert a data array to colors.
bool mColorBufferInvalidated
ColorInterpolation
Defines the color spaces in which color interpolation between gradient stops can be performed.
@ ciRGB
Color channels red, green and blue are linearly interpolated.
@ ciHSV
Color channels hue, saturation and value are linearly interpolated (The hue is interpolated over the ...
GradientPreset
Defines the available presets that can be loaded with loadPreset.
@ gpNight
Continuous lightness from black over weak blueish colors to white (suited for non-biased data represe...
@ gpHues
Full hue cycle, with highest and lowest color red (suitable for periodic data, such as angles and pha...
@ gpGeography
Colors suitable to represent different elevations on geographical maps.
@ gpIon
Half hue spectrum from black over purple to blue and finally green (creates banding illusion but allo...
@ gpHot
Continuous lightness from black over firey colors to white (suited for non-biased data representation...
@ gpJet
Hue variation similar to a spectrum, often used in numerical visualization (creates banding illusion ...
@ gpCandy
Blue over pink to white.
@ gpPolar
Colors suitable to emphasize polarity around the center, with blue for negative, black in the middle ...
@ gpSpectrum
An approximation of the visible light spectrum (creates banding illusion but allows more precise magn...
@ gpGrayscale
Continuous lightness from black to white (suited for non-biased data representation)
@ gpCold
Continuous lightness from black over icey colors to white (suited for non-biased data representation)
@ gpThermal
Colors suitable for thermal imaging, ranging from dark blue over purple to orange,...
QVector< QRgb > mColorBuffer
Holds the two-dimensional data of a QCPColorMap plottable.
void setKeyRange(const QCPRange &keyRange)
Sets the coordinate range the data shall be distributed over in the key dimension.
void setValueSize(int valueSize)
Resizes the data array to have valueSize cells in the value dimension.
void setSize(int keySize, int valueSize)
Resizes the data array to have keySize cells in the key dimension and valueSize cells in the value di...
QCPRange keyRange() const
double data(double key, double value)
void fill(double z)
Sets all cells to the value z.
QCPRange valueRange() const
void setCell(int keyIndex, int valueIndex, double z)
Sets the data of the cell with indices keyIndex and valueIndex to z.
void clear()
Frees the internal data memory.
QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange)
Constructs a new QCPColorMapData instance.
void setRange(const QCPRange &keyRange, const QCPRange &valueRange)
Sets the coordinate ranges the data shall be distributed over.
void recalculateDataBounds()
Goes through the data and updates the buffered minimum and maximum data values.
QCPRange dataBounds() const
void setKeySize(int keySize)
Resizes the data array to have keySize cells in the key dimension.
void coordToCell(double key, double value, int *keyIndex, int *valueIndex) const
Transforms plot coordinates given by key and value to cell indices of this QCPColorMapData instance.
void setValueRange(const QCPRange &valueRange)
Sets the coordinate range the data shall be distributed over in the value dimension.
bool isEmpty() const
Returns whether this instance carries no data.
void cellToCoord(int keyIndex, int valueIndex, double *key, double *value) const
Transforms cell indices given by keyIndex and valueIndex to cell indices of this QCPColorMapData inst...
double cell(int keyIndex, int valueIndex)
void setData(double key, double value, double z)
Sets the data of the cell, which lies at the plot coordinates given by key and value,...
QCPColorMapData & operator=(const QCPColorMapData &other)
Overwrites this color map data instance with the data stored in other.
A plottable representing a two-dimensional color map in a plot.
QCPColorMapData * data() const
Returns a pointer to the internal data storage of type QCPColorMapData.
virtual void clearData()
Clears the colormap data by calling QCPColorMapData::clear() on the internal data.
QCPColorScale * colorScale() const
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
virtual void draw(QCPPainter *painter)
void dataRangeChanged(QCPRange newRange)
This signal is emitted when the data range changes.
void setInterpolate(bool enabled)
Sets whether the color map image shall use bicubic interpolation when displaying the color map shrink...
void setData(QCPColorMapData *data, bool copy=false)
Replaces the current data with the provided data.
Q_SLOT void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation, const QSize &thumbSize=QSize(32, 18))
Takes the current appearance of the color map and updates the legend icon, which is used to represent...
virtual void updateMapImage()
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
Q_SLOT void setGradient(const QCPColorGradient &gradient)
Sets the color gradient that is used to represent the data.
void rescaleDataRange(bool recalculateDataBounds=false)
Sets the data range (setDataRange) to span the minimum and maximum values that occur in the current d...
QCPColorMapData * mMapData
QPointer< QCPColorScale > mColorScale
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
This signal is emitted when the data scale type changes.
Q_SLOT void setDataRange(const QCPRange &dataRange)
Sets the data range of this color map to dataRange.
Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType)
Sets whether the data is correlated with the color gradient linearly or logarithmically.
QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis)
Constructs a color map with the specified keyAxis and valueAxis.
void setColorScale(QCPColorScale *colorScale)
Associates the color scale colorScale with this color map.
QCPColorGradient mGradient
QCPAxis::ScaleType mDataScaleType
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
void gradientChanged(QCPColorGradient newGradient)
This signal is emitted when the gradient changes.
bool mMapImageInvalidated
QCPColorGradient gradient() const
void setTightBoundary(bool enabled)
Sets whether the outer most data rows and columns are clipped to the specified key and value range (s...
QCPRange dataRange() const
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
bool mGradientImageInvalidated
QCPColorScale * mParentColorScale
Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts)
Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts)
void updateGradientImage()
QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale)
Creates a new instance, as a child of parentColorScale.
virtual void draw(QCPPainter *painter)
A color scale for use with color coding data such as QCPColorMap.
virtual void mouseReleaseEvent(QMouseEvent *event)
This event is called, if the mouse was previously pressed inside the outer rect of this layout elemen...
void setType(QCPAxis::AxisType type)
Sets at which side of the color scale the axis is placed, and thus also its orientation.
Q_SLOT void setGradient(const QCPColorGradient &gradient)
Sets the color gradient that will be used to represent data values.
void setRangeDrag(bool enabled)
Sets whether the user can drag the data range (setDataRange).
QCPAxis::ScaleType mDataScaleType
void dataRangeChanged(QCPRange newRange)
This signal is emitted when the data range changes.
QPointer< QCPAxis > mColorAxis
QCPColorGradient gradient() const
virtual void mouseMoveEvent(QMouseEvent *event)
This event is called, if the mouse is moved inside the outer rect of this layout element.
void rescaleDataRange(bool onlyVisibleMaps)
Changes the data range such that all color maps associated with this color scale are fully mapped to ...
QCPRange dataRange() const
QList< QCPColorMap * > colorMaps() const
Returns a list of all the color maps associated with this color scale.
virtual void mousePressEvent(QMouseEvent *event)
This event is called, if the mouse was pressed while being inside the outer rect of this layout eleme...
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
This signal is emitted when the data scale type changes.
void gradientChanged(QCPColorGradient newGradient)
This signal is emitted when the gradient changes.
QPointer< QCPColorScaleAxisRectPrivate > mAxisRect
QCPAxis::AxisType type() const
void setRangeZoom(bool enabled)
Sets whether the user can zoom the data range (setDataRange) by scrolling the mouse wheel.
QCPColorScale(QCustomPlot *parentPlot)
Constructs a new QCPColorScale.
virtual void wheelEvent(QWheelEvent *event)
This event is called, if the mouse wheel is scrolled while the cursor is inside the rect of this layo...
virtual void update(UpdatePhase phase)
Updates the layout element and sub-elements.
void setBarWidth(int width)
Sets the width (or height, for horizontal color scales) the bar where the gradient is displayed will ...
Q_SLOT void setDataRange(const QCPRange &dataRange)
Sets the range spanned by the color gradient and that is shown by the axis in the color scale.
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
QCPColorGradient mGradient
Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType)
Sets the scale type of the color scale, i.e.
void setLabel(const QString &str)
Sets the axis label of the color scale.
Holds the data of one single data point for QCPCurve.
QCPCurveData()
Constructs a curve data point with t, key and value set to zero.
virtual void drawScatterPlot(QCPPainter *painter, const QVector< QPointF > *pointData) const
void removeDataAfter(double t)
Removes all data points with curve parameter t greater than t.
QCPScatterStyle mScatterStyle
QCPCurveDataMap * data() const
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
virtual void draw(QCPPainter *painter)
LineStyle
Defines how the curve's line is represented visually in the plot.
@ lsLine
Data points are connected with a straight line.
@ lsNone
No line is drawn between data points (e.g. only scatters)
QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis)
Constructs a curve which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y").
void getCurveData(QVector< QPointF > *lineData) const
QPointF outsideCoordsToPixels(double key, double value, int region, QRect axisRect) const
void setLineStyle(LineStyle style)
Sets how the single data points are connected in the plot or how they are represented visually apart ...
void addData(const QCPCurveDataMap &dataMap)
Adds the provided data points in dataMap to the current data.
void setScatterStyle(const QCPScatterStyle &style)
Sets the visual appearance of single data points in the plot.
void setData(QCPCurveDataMap *data, bool copy=false)
Replaces the current data with the provided data.
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
void removeData(double fromt, double tot)
Removes all data points with curve parameter t between fromt and tot.
double pointDistance(const QPointF &pixelPoint) const
virtual void clearData()
Removes all data points.
void removeDataBefore(double t)
Removes all data points with curve parameter t smaller than t.
Holds the data of one single data point for QCPGraph.
QCPData()
Constructs a data point with key, value and all errors set to zero.
A plottable representing a graph in a plot.
QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis)
Constructs a graph which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y").
void rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setErrorBarSize(double size)
Sets the width of the handles at both ends of an error bar in pixels.
void setScatterStyle(const QCPScatterStyle &style)
Sets the visual appearance of single data points in the plot.
void setData(QCPDataMap *data, bool copy=false)
Replaces the current data with the provided data.
ErrorType errorType() const
void setChannelFillGraph(QCPGraph *targetGraph)
Sets the target graph for filling the area between this graph and targetGraph with the current brush ...
QPointer< QCPGraph > mChannelFillGraph
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
void removeData(double fromKey, double toKey)
Removes all data points with keys between fromKey and toKey.
QCPScatterStyle mScatterStyle
void setLineStyle(LineStyle ls)
Sets how the single data points are connected in the plot.
void getStepRightPlotData(QVector< QPointF > *linePixelData, QVector< QCPData > *scatterData) const
int findIndexBelowY(const QVector< QPointF > *data, double y) const
void getPlotData(QVector< QPointF > *lineData, QVector< QCPData > *scatterData) const
virtual void draw(QCPPainter *painter)
void getScatterPlotData(QVector< QCPData > *scatterData) const
void getLinePlotData(QVector< QPointF > *linePixelData, QVector< QCPData > *scatterData) const
QPointF upperFillBasePoint(double upperKey) const
void setDataBothError(const QVector< double > &key, const QVector< double > &value, const QVector< double > &keyError, const QVector< double > &valueError)
Replaces the current data with the provided points in key and value pairs.
int findIndexAboveY(const QVector< QPointF > *data, double y) const
int findIndexBelowX(const QVector< QPointF > *data, double x) const
void addFillBasePoints(QVector< QPointF > *lineData) const
void getStepLeftPlotData(QVector< QPointF > *linePixelData, QVector< QCPData > *scatterData) const
double pointDistance(const QPointF &pixelPoint) const
void rescaleAxes(bool onlyEnlarge, bool includeErrorBars) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual void drawFill(QCPPainter *painter, QVector< QPointF > *lineData) const
void removeDataBefore(double key)
Removes all data points with keys smaller than key.
void addData(const QCPDataMap &dataMap)
Adds the provided data points in dataMap to the current data.
int findIndexAboveX(const QVector< QPointF > *data, double x) const
void getImpulsePlotData(QVector< QPointF > *linePixelData, QVector< QCPData > *scatterData) const
void setErrorBarSkipSymbol(bool enabled)
If enabled is set to true, the error bar will not be drawn as a solid line under the scatter symbol b...
void setAdaptiveSampling(bool enabled)
Sets whether adaptive sampling shall be used when plotting this graph.
void drawError(QCPPainter *painter, double x, double y, const QCPData &data) const
void getStepCenterPlotData(QVector< QPointF > *linePixelData, QVector< QCPData > *scatterData) const
void setDataKeyError(const QVector< double > &key, const QVector< double > &value, const QVector< double > &keyError)
Replaces the current data with the provided points in key and value pairs.
void setErrorPen(const QPen &pen)
Sets the pen with which the error bars will be drawn.
void getVisibleDataBounds(QCPDataMap::const_iterator &lower, QCPDataMap::const_iterator &upper) const
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
void setErrorType(ErrorType errorType)
Sets which kind of error bars (Key Error, Value Error or both) should be drawn on each data point.
virtual void drawImpulsePlot(QCPPainter *painter, QVector< QPointF > *lineData) const
void setDataValueError(const QVector< double > &key, const QVector< double > &value, const QVector< double > &valueError)
Replaces the current data with the provided points in key and value pairs.
QCPDataMap * data() const
Returns a pointer to the internal data storage of type QCPDataMap.
QPointF lowerFillBasePoint(double lowerKey) const
ErrorType
Defines what kind of error bars are drawn for each data point.
@ etValue
Error bars for the value dimension of the data point are shown.
@ etKey
Error bars for the key dimension of the data point are shown.
@ etBoth
Error bars for both key and value dimensions of the data point are shown.
@ etNone
No error bars are shown.
virtual void clearData()
Removes all data points.
LineStyle
Defines how the graph's line is represented visually in the plot.
@ lsLine
data points are connected by a straight line
@ lsStepCenter
line is drawn as steps where the step is in between two data points
@ lsStepRight
line is drawn as steps where the step height is the value of the right data point
@ lsImpulse
each data point is represented by a line parallel to the value axis, which reaches from the data poin...
@ lsStepLeft
line is drawn as steps where the step height is the value of the left data point
@ lsNone
data points are not connected with any lines (e.g.
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
const QPolygonF getChannelFillPolygon(const QVector< QPointF > *lineData) const
virtual void drawScatterPlot(QCPPainter *painter, QVector< QCPData > *scatterData) const
int countDataInBounds(const QCPDataMap::const_iterator &lower, const QCPDataMap::const_iterator &upper, int maxCount) const
void removeDataAfter(double key)
Removes all data points with keys greater than key.
void getPreparedData(QVector< QCPData > *lineData, QVector< QCPData > *scatterData) const
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
virtual void drawLinePlot(QCPPainter *painter, QVector< QPointF > *lineData) const
void removeFillBasePoints(QVector< QPointF > *lineData) const
Responsible for drawing the grid of a QCPAxis.
void setZeroLinePen(const QPen &pen)
Sets the pen with which zero lines are drawn.
void setAntialiasedZeroLine(bool enabled)
Sets whether zero lines are drawn antialiased.
void setAntialiasedSubGrid(bool enabled)
Sets whether sub grid lines are drawn antialiased.
void drawSubGridLines(QCPPainter *painter) const
bool mAntialiasedZeroLine
void setSubGridPen(const QPen &pen)
Sets the pen with which sub grid lines are drawn.
void setPen(const QPen &pen)
Sets the pen with which (major) grid lines are drawn.
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
QCPGrid(QCPAxis *parentAxis)
Creates a QCPGrid instance and sets default values.
virtual void draw(QCPPainter *painter)
void setSubGridVisible(bool visible)
Sets whether grid lines at sub tick marks are drawn.
void drawGridLines(QCPPainter *painter) const
An anchor of an item to which positions can be attached to.
QCustomPlot * mParentPlot
QSet< QCPItemPosition * > mChildren
QCPAbstractItem * mParentItem
friend class QCPItemPosition
void removeChild(QCPItemPosition *pos)
virtual QCPItemPosition * toQCPItemPosition()
Returns 0 if this instance is merely a QCPItemAnchor, and a valid pointer of type QCPItemPosition* if...
void addChild(QCPItemPosition *pos)
virtual QPointF pixelPoint() const
Returns the final absolute pixel position of the QCPItemAnchor on the QCustomPlot surface.
QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name, int anchorId=-1)
Creates a new QCPItemAnchor.
void setSelectedPen(const QPen &pen)
Sets the pen that will be used to draw the bracket when selected.
QCPItemBracket(QCustomPlot *parentPlot)
Creates a bracket item and sets default values.
virtual QPointF anchorPixelPoint(int anchorId) const
BracketStyle style() const
void setStyle(BracketStyle style)
Sets the style of the bracket, i.e.
@ bsRound
A brace with round edges.
@ bsSquare
A brace with angled edges.
@ bsCalligraphic
A curly brace with varying stroke width giving a calligraphic impression.
virtual void draw(QCPPainter *painter)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
void setPen(const QPen &pen)
Sets the pen that will be used to draw the bracket.
void setLength(double length)
Sets the length in pixels how far the bracket extends in the direction towards the embraced span of t...
virtual ~QCPItemBracket()
QCPItemPosition *const left
QCPItemPosition *const right
void setPen(const QPen &pen)
Sets the pen that will be used to draw the line.
void setHead(const QCPLineEnding &head)
Sets the line ending style of the head.
QCPItemPosition *const start
QCPItemPosition *const end
QCPItemPosition *const endDir
void setSelectedPen(const QPen &pen)
Sets the pen that will be used to draw the line when selected.
virtual void draw(QCPPainter *painter)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
QCPLineEnding head() const
QCPItemPosition *const startDir
QCPLineEnding tail() const
void setTail(const QCPLineEnding &tail)
Sets the line ending style of the tail.
QCPItemCurve(QCustomPlot *parentPlot)
Creates a curve item and sets default values.
QCPItemPosition *const topLeft
virtual ~QCPItemEllipse()
void setBrush(const QBrush &brush)
Sets the brush that will be used to fill the ellipse.
void setSelectedPen(const QPen &pen)
Sets the pen that will be used to draw the line of the ellipse when selected.
QCPItemEllipse(QCustomPlot *parentPlot)
Creates an ellipse item and sets default values.
QCPItemAnchor *const center
void setSelectedBrush(const QBrush &brush)
Sets the brush that will be used to fill the ellipse when selected.
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
QCPItemPosition *const bottomRight
virtual QPointF anchorPixelPoint(int anchorId) const
void setPen(const QPen &pen)
Sets the pen that will be used to draw the line of the ellipse.
virtual void draw(QCPPainter *painter)
QCPItemPosition *const end
QCPItemLine(QCustomPlot *parentPlot)
Creates a line item and sets default values.
virtual void draw(QCPPainter *painter)
void setSelectedPen(const QPen &pen)
Sets the pen that will be used to draw the line when selected.
void setPen(const QPen &pen)
Sets the pen that will be used to draw the line.
QCPItemPosition *const start
QCPLineEnding head() const
QCPLineEnding tail() const
void setTail(const QCPLineEnding &tail)
Sets the line ending style of the tail.
QLineF getRectClippedLine(const QVector2D &start, const QVector2D &end, const QRect &rect) const
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
void setHead(const QCPLineEnding &head)
Sets the line ending style of the head.
virtual QPointF anchorPixelPoint(int anchorId) const
QCPItemPosition *const topLeft
QRect getFinalRect(bool *flippedHorz=0, bool *flippedVert=0) const
Qt::AspectRatioMode aspectRatioMode() const
void setPixmap(const QPixmap &pixmap)
Sets the pixmap that will be displayed.
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
virtual void draw(QCPPainter *painter)
void updateScaledPixmap(QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false)
Qt::AspectRatioMode mAspectRatioMode
QCPItemPixmap(QCustomPlot *parentPlot)
Creates a rectangle item and sets default values.
QCPItemPosition *const bottomRight
void setPen(const QPen &pen)
Sets the pen that will be used to draw a border around the pixmap.
void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio)
Sets whether the pixmap will be scaled to fit the rectangle defined by the topLeft and bottomRight po...
void setSelectedPen(const QPen &pen)
Sets the pen that will be used to draw a border around the pixmap when selected.
Manages the position of an item.
QCPItemAnchor * parentAnchor() const
void setAxisRect(QCPAxisRect *axisRect)
When setType is ptAxisRectRatio, this function may be used to specify the axis rect the coordinates s...
void setAxes(QCPAxis *keyAxis, QCPAxis *valueAxis)
When setType is ptPlotCoords, this function may be used to specify the axes the coordinates set with ...
QCPItemAnchor * mParentAnchor
QPointer< QCPAxis > mValueAxis
QPointer< QCPAxis > mKeyAxis
virtual QPointF pixelPoint() const
Returns the final absolute pixel position of the QCPItemPosition on the QCustomPlot surface.
void setType(PositionType type)
Sets the type of the position.
void setCoords(double key, double value)
Sets the coordinates of this QCPItemPosition.
QCPAxis * valueAxis() const
PositionType
Defines the ways an item position can be specified.
@ ptAxisRectRatio
Static positioning given by a fraction of the axis rect size (see setAxisRect).
@ ptAbsolute
Static positioning in pixels, starting from the top left corner of the viewport/widget.
@ ptViewportRatio
Static positioning given by a fraction of the viewport size.
@ ptPlotCoords
Dynamic positioning at a plot coordinate defined by two axes (see setAxes).
void setPixelPoint(const QPointF &pixelPoint)
Sets the apparent pixel position.
QCPAxis * keyAxis() const
PositionType type() const
bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
Sets the parent of this QCPItemPosition to parentAnchor.
PositionType mPositionType
virtual ~QCPItemPosition()
QPointer< QCPAxisRect > mAxisRect
QCPAxisRect * axisRect() const
virtual void draw(QCPPainter *painter)
QCPItemPosition *const bottomRight
QCPItemRect(QCustomPlot *parentPlot)
Creates a rectangle item and sets default values.
void setPen(const QPen &pen)
Sets the pen that will be used to draw the line of the rectangle.
void setSelectedPen(const QPen &pen)
Sets the pen that will be used to draw the line of the rectangle when selected.
QCPItemPosition *const topLeft
void setBrush(const QBrush &brush)
Sets the brush that will be used to fill the rectangle.
void setSelectedBrush(const QBrush &brush)
Sets the brush that will be used to fill the rectangle when selected.
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
virtual QPointF anchorPixelPoint(int anchorId) const
double distToStraightLine(const QVector2D &point1, const QVector2D &vec, const QVector2D &point) const
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
virtual ~QCPItemStraightLine()
virtual void draw(QCPPainter *painter)
QCPItemStraightLine(QCustomPlot *parentPlot)
Creates a straight line item and sets default values.
void setSelectedPen(const QPen &pen)
Sets the pen that will be used to draw the line when selected.
void setPen(const QPen &pen)
Sets the pen that will be used to draw the line.
QCPItemPosition *const point1
QCPItemPosition *const point2
QLineF getRectClippedStraightLine(const QVector2D &point1, const QVector2D &vec, const QRect &rect) const
void setSelectedFont(const QFont &font)
Sets the font of the text that will be used when the item is selected.
QCPItemPosition *const position
Qt::Alignment positionAlignment() const
void setBrush(const QBrush &brush)
Sets the brush that will be used do fill the background of the text.
void setSelectedPen(const QPen &pen)
Sets the pen that will be used do draw a rectangular border around the text, when the item is selecte...
void setText(const QString &text)
Sets the text that will be displayed.
virtual QPointF anchorPixelPoint(int anchorId) const
void setRotation(double degrees)
Sets the angle in degrees by which the text (and the text rectangle, if visible) will be rotated arou...
QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const
void setSelectedBrush(const QBrush &brush)
Sets the brush that will be used do fill the background of the text, when the item is selected.
Qt::Alignment mPositionAlignment
QCPItemText(QCustomPlot *parentPlot)
Creates a text item and sets default values.
void setPositionAlignment(Qt::Alignment alignment)
Sets which point of the text rect shall be aligned with position.
virtual void draw(QCPPainter *painter)
void setFont(const QFont &font)
Sets the font of the text.
void setPen(const QPen &pen)
Sets the pen that will be used do draw a rectangular border around the text.
void setColor(const QColor &color)
Sets the color of the text.
void setTextAlignment(Qt::Alignment alignment)
Controls how (multi-lined) text is aligned inside the text rect (typically Qt::AlignLeft,...
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
Qt::Alignment mTextAlignment
void setSelectedColor(const QColor &color)
Sets the color of the text that will be used when the item is selected.
void setPadding(const QMargins &padding)
Sets the distance between the border of the text rectangle and the text.
void setSelectedBrush(const QBrush &brush)
Sets the brush that will be used to draw any fills of the tracer, when selected.
void setBrush(const QBrush &brush)
Sets the brush that will be used to draw any fills of the tracer.
TracerStyle
The different visual appearances a tracer item can have.
@ tsPlus
A plus shaped crosshair with limited size.
@ tsNone
The tracer is not visible.
@ tsCrosshair
A plus shaped crosshair which spans the complete axis rect.
void setStyle(TracerStyle style)
Sets the style/visual appearance of the tracer.
void updatePosition()
If the tracer is connected with a graph (setGraph), this function updates the tracer's position to re...
void setGraphKey(double key)
Sets the key of the graph's data point the tracer will be positioned at.
QCPItemPosition *const position
void setInterpolating(bool enabled)
Sets whether the value of the graph's data points shall be interpolated, when positioning the tracer.
virtual void draw(QCPPainter *painter)
QCPItemTracer(QCustomPlot *parentPlot)
Creates a tracer item and sets default values.
void setSelectedPen(const QPen &pen)
Sets the pen that will be used to draw the line of the tracer when selected.
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
void setSize(double size)
Sets the size of the tracer in pixels, if the style supports setting a size (e.g.
void setGraph(QCPGraph *graph)
Sets the QCPGraph this tracer sticks to.
void setPen(const QPen &pen)
Sets the pen that will be used to draw the line of the tracer.
TracerStyle style() const
A layer that may contain objects, to control the rendering order.
QList< QCPLayerable * > children() const
Returns a list of all layerables on this layer.
QCustomPlot * mParentPlot
void addChild(QCPLayerable *layerable, bool prepend)
QCPLayer(QCustomPlot *parentPlot, const QString &layerName)
Creates a new QCPLayer instance.
QList< QCPLayerable * > mChildren
QCustomPlot * parentPlot() const
void setVisible(bool visible)
Sets whether this layer is visible or not.
void removeChild(QCPLayerable *layerable)
int index() const
Returns the index this layer has in the QCustomPlot.
Base class for all drawable objects.
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
QPointer< QCPLayerable > mParentLayerable
QCustomPlot * parentPlot() const
void setVisible(bool on)
Sets the visibility of this layerable object.
void setAntialiased(bool enabled)
Sets whether this object will be drawn antialiased or not.
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
QCPLayerable(QCustomPlot *plot, QString targetLayer="", QCPLayerable *parentLayerable=0)
Creates a new QCPLayerable instance.
void initializeParentPlot(QCustomPlot *parentPlot)
virtual QCP::Interaction selectionCategory() const
void setParentLayerable(QCPLayerable *parentLayerable)
QCustomPlot * mParentPlot
QCPLayerable * parentLayerable() const
Returns the parent layerable of this layerable.
bool realVisibility() const
Returns whether this layerable is visible, taking the visibility of the layerable parent and the visi...
Q_SLOT bool setLayer(QCPLayer *layer)
Sets the layer of this layerable object.
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
void layerChanged(QCPLayer *newLayer)
This signal is emitted when the layer of this layerable changes, i.e.
void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const
virtual QRect clipRect() const
virtual void deselectEvent(bool *selectionStateChanged)
virtual void draw(QCPPainter *painter)=0
bool moveToLayer(QCPLayer *layer, bool prepend)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const =0
The abstract base class for all objects that form the layout system.
virtual int calculateAutoMargin(QCP::MarginSide side)
void setMinimumMargins(const QMargins &margins)
If setAutoMargins is enabled on some or all margins, this function is used to provide minimum values ...
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Layout elements are sensitive to events inside their outer rect.
UpdatePhase
Defines the phases of the update process, that happens just before a replot.
@ upMargins
Phase in which the margins are calculated and set.
@ upLayout
Final phase in which the layout system places the rects of the elements.
@ upPreparation
Phase used for any type of preparation that needs to be done before margin calculation and layout.
virtual ~QCPLayoutElement()
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
QRect rect() const
Returns the inner rect of this layout element.
void setOuterRect(const QRect &rect)
Sets the outer rect of this layout element.
QCPLayout * layout() const
Returns the parent layout of this layout element.
void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group)
Sets the margin group of the specified margin sides.
void setMinimumSize(const QSize &size)
Sets the minimum size for the inner rect of this layout element.
void setMaximumSize(const QSize &size)
Sets the maximum size for the inner rect of this layout element.
virtual QList< QCPLayoutElement * > elements(bool recursive) const
Returns a list of all child elements in this layout element.
QCPLayoutElement(QCustomPlot *parentPlot=0)
Creates an instance of QCPLayoutElement and sets default values.
void setMargins(const QMargins &margins)
Sets the margins of this layout element.
virtual void update(UpdatePhase phase)
Updates the layout element and sub-elements.
QCPMarginGroup * marginGroup(QCP::MarginSide side) const
virtual QSize minimumSizeHint() const
Returns the minimum size this layout element (the inner rect) may be compressed to.
virtual QSize maximumSizeHint() const
Returns the maximum size this layout element (the inner rect) may be expanded to.
void setAutoMargins(QCP::MarginSides sides)
Sets on which sides the margin shall be calculated automatically.
QCPLayout * mParentLayout
QHash< QCP::MarginSide, QCPMarginGroup * > mMarginGroups
QCP::MarginSides mAutoMargins
A layout that arranges child elements in a grid.
virtual void updateLayout()
virtual void simplify()
Simplifies the layout by collapsing rows and columns which only contain empty cells.
int rowCount() const
Returns the number of rows in the layout.
int columnCount() const
Returns the number of columns in the layout.
void insertColumn(int newIndex)
Inserts a new column with empty cells at the column index newIndex.
void setRowStretchFactors(const QList< double > &factors)
Sets the stretch factors of all rows.
virtual QList< QCPLayoutElement * > elements(bool recursive) const
Returns a list of all child elements in this layout element.
QList< QList< QCPLayoutElement * > > mElements
QList< double > mRowStretchFactors
virtual QSize maximumSizeHint() const
Returns the maximum size this layout element (the inner rect) may be expanded to.
void setColumnSpacing(int pixels)
Sets the gap that is left blank between columns to pixels.
void insertRow(int newIndex)
Inserts a new row with empty cells at the row index newIndex.
void getMinimumRowColSizes(QVector< int > *minColWidths, QVector< int > *minRowHeights) const
QCPLayoutElement * element(int row, int column) const
Returns the element in the cell in row and column.
virtual bool take(QCPLayoutElement *element)
Removes the specified element from the layout and returns true on success.
void setColumnStretchFactors(const QList< double > &factors)
Sets the stretch factors of all columns.
virtual int elementCount() const
Returns the number of elements/cells in the layout.
void setRowStretchFactor(int row, double factor)
Sets the stretch factor of row.
void expandTo(int newRowCount, int newColumnCount)
Expands the layout to have newRowCount rows and newColumnCount columns.
virtual QCPLayoutElement * elementAt(int index) const
Returns the element in the cell with the given index.
void getMaximumRowColSizes(QVector< int > *maxColWidths, QVector< int > *maxRowHeights) const
virtual QSize minimumSizeHint() const
Returns the minimum size this layout element (the inner rect) may be compressed to.
void setRowSpacing(int pixels)
Sets the gap that is left blank between rows to pixels.
bool hasElement(int row, int column)
Returns whether the cell at row and column exists and contains a valid element, i....
QCPLayoutGrid()
Creates an instance of QCPLayoutGrid and sets default values.
QList< double > mColumnStretchFactors
virtual QCPLayoutElement * takeAt(int index)
Removes the element with the given index from the layout and returns it.
bool addElement(int row, int column, QCPLayoutElement *element)
Adds the element to cell with row and column.
void setColumnStretchFactor(int column, double factor)
Sets the stretch factor of column.
A layout that places child elements aligned to the border or arbitrarily positioned.
virtual int elementCount() const
Returns the number of elements/cells in the layout.
QCPLayoutInset()
Creates an instance of QCPLayoutInset and sets default values.
QList< Qt::Alignment > mInsetAlignment
QList< InsetPlacement > mInsetPlacement
Qt::Alignment insetAlignment(int index) const
Returns the alignment of the element with the specified index.
void setInsetAlignment(int index, Qt::Alignment alignment)
If the inset placement (setInsetPlacement) is ipBorderAligned, this function is used to set the align...
void setInsetPlacement(int index, InsetPlacement placement)
Sets the inset placement type of the element with the specified index to placement.
InsetPlacement insetPlacement(int index) const
Returns the placement type of the element with the specified index.
virtual void updateLayout()
virtual ~QCPLayoutInset()
virtual QCPLayoutElement * elementAt(int index) const
Returns the element in the cell with the given index.
InsetPlacement
Defines how the placement and sizing is handled for a certain element in a QCPLayoutInset.
@ ipFree
The element may be positioned/sized arbitrarily, see setInsetRect.
@ ipBorderAligned
The element is aligned to one of the layout sides, see setInsetAlignment.
QList< QCPLayoutElement * > mElements
virtual bool take(QCPLayoutElement *element)
Removes the specified element from the layout and returns true on success.
void setInsetRect(int index, const QRectF &rect)
If the inset placement (setInsetPlacement) is ipFree, this function is used to set the position and s...
QList< QRectF > mInsetRect
QRectF insetRect(int index) const
Returns the rect of the element with the specified index.
void addElement(QCPLayoutElement *element, Qt::Alignment alignment)
Adds the specified element to the layout as an inset aligned at the border (setInsetAlignment is init...
virtual QCPLayoutElement * takeAt(int index)
Removes the element with the given index from the layout and returns it.
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
The inset layout is sensitive to events only at areas where its (visible) child elements are sensitiv...
The abstract base class for layouts.
void clear()
Removes and deletes all layout elements in this layout.
QCPLayout()
Creates an instance of QCPLayout and sets default values.
virtual void updateLayout()
bool removeAt(int index)
Removes and deletes the element at the provided index.
virtual void update(UpdatePhase phase)
First calls the QCPLayoutElement::update base class implementation to update the margins on this layo...
virtual int elementCount() const =0
Returns the number of elements/cells in the layout.
QVector< int > getSectionSizes(QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const
virtual void simplify()
Simplifies the layout by collapsing empty cells.
void releaseElement(QCPLayoutElement *el)
virtual QCPLayoutElement * takeAt(int index)=0
Removes the element with the given index from the layout and returns it.
bool remove(QCPLayoutElement *element)
Removes and deletes the provided element.
virtual bool take(QCPLayoutElement *element)=0
Removes the specified element from the layout and returns true on success.
virtual QList< QCPLayoutElement * > elements(bool recursive) const
Returns a list of all child elements in this layout element.
void sizeConstraintsChanged() const
Subclasses call this method to report changed (minimum/maximum) size constraints.
void adoptElement(QCPLayoutElement *el)
virtual QCPLayoutElement * elementAt(int index) const =0
Returns the element in the cell with the given index.
Manages a legend inside a QCustomPlot.
QCPLegend()
Constructs a new QCPLegend instance with parentPlot as the containing plot and default values.
SelectableParts mSelectableParts
int iconTextPadding() const
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
QPen getBorderPen() const
void clearItems()
Removes all items from the legend.
Q_SLOT void setSelectedParts(const SelectableParts &selectedParts)
Sets the selected state of the respective legend parts described by SelectablePart.
void setSelectedBorderPen(const QPen &pen)
When the legend box is selected, this pen is used to draw the border instead of the normal pen set vi...
void setIconBorderPen(const QPen &pen)
Sets the pen used to draw a border around each legend icon.
bool addItem(QCPAbstractLegendItem *item)
Adds item to the legend, if it's not present already.
SelectableParts selectedParts() const
virtual void draw(QCPPainter *painter)
void setBrush(const QBrush &brush)
Sets the brush of the legend background.
bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const
Returns whether the legend contains a QCPPlottableLegendItem which is associated with plottable (e....
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
virtual void deselectEvent(bool *selectionStateChanged)
SelectablePart
Defines the selectable parts of a legend.
@ spLegendBox
0x001 The legend box (frame)
@ spItems
0x002 Legend items individually (see selectedItems)
int itemCount() const
Returns the number of items currently in the legend.
QPen iconBorderPen() const
void setIconTextPadding(int padding)
Sets the horizontal space in pixels between the legend icon and the text next to it.
QColor mSelectedTextColor
QPen mSelectedIconBorderPen
void setSelectedTextColor(const QColor &color)
Sets the default text color that is used by legend items when they are selected.
void selectionChanged(QCPLegend::SelectableParts parts)
This signal is emitted when the selection state of this legend has changed.
void setBorderPen(const QPen &pen)
Sets the pen, the border of the entire legend is drawn with.
void setSelectedBrush(const QBrush &brush)
When the legend box is selected, this brush is used to draw the legend background instead of the norm...
void selectableChanged(QCPLegend::SelectableParts parts)
void setIconSize(const QSize &size)
Sets the size of legend icons.
virtual QCP::Interaction selectionCategory() const
SelectableParts mSelectedParts
QCPPlottableLegendItem * itemWithPlottable(const QCPAbstractPlottable *plottable) const
Returns the QCPPlottableLegendItem which is associated with plottable (e.g.
Q_SLOT void setSelectableParts(const SelectableParts &selectableParts)
Sets whether the user can (de-)select the parts in selectable by clicking on the QCustomPlot surface.
void setFont(const QFont &font)
Sets the default font of legend text.
void setSelectedFont(const QFont &font)
Sets the default font that is used by legend items when they are selected.
QList< QCPAbstractLegendItem * > selectedItems() const
Returns the legend items that are currently selected.
bool removeItem(int index)
Removes the item with index index from the legend.
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Layout elements are sensitive to events inside their outer rect.
QCPAbstractLegendItem * item(int index) const
Returns the item with index i.
SelectableParts selectableParts() const
bool hasItem(QCPAbstractLegendItem *item) const
Returns whether the legend contains itm.
QPen selectedIconBorderPen() const
void setSelectedIconBorderPen(const QPen &pen)
Sets the pen legend items will use to draw their icon borders, when they are selected.
void setTextColor(const QColor &color)
Sets the default color of legend text.
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
Handles the different ending decorations for line-like items.
EndingStyle style() const
void draw(QCPPainter *painter, const QVector2D &pos, const QVector2D &dir) const
double boundingDistance() const
void setWidth(double width)
Sets the width of the ending decoration, if the style supports it.
void setStyle(EndingStyle style)
Sets the style of the ending decoration.
void setInverted(bool inverted)
Sets whether the ending decoration shall be inverted.
EndingStyle
Defines the type of ending decoration for line-like items, e.g.
@ esHalfBar
A bar perpendicular to the line, pointing out to only one side (to which side can be changed with set...
@ esSkewedBar
A bar that is skewed (skew controllable via setLength)
@ esBar
A bar perpendicular to the line.
@ esDiamond
A filled diamond (45° rotated square)
@ esFlatArrow
A filled arrow head with a straight/flat back (a triangle)
@ esLineArrow
A non-filled arrow head with open back.
@ esSpikeArrow
A filled arrow head with an indented back.
@ esNone
No ending decoration.
@ esSquare
A filled square.
double realLength() const
Starting from the origin of this line ending (which is style specific), returns the length covered by...
void setLength(double length)
Sets the length of the ending decoration, if the style supports it.
QCPLineEnding()
Creates a QCPLineEnding instance with default values (style esNone).
A margin group allows synchronization of margin sides if working with multiple layout elements.
void clear()
Clears this margin group.
void removeChild(QCP::MarginSide side, QCPLayoutElement *element)
QHash< QCP::MarginSide, QList< QCPLayoutElement * > > mChildren
QCPMarginGroup(QCustomPlot *parentPlot)
Creates a new QCPMarginGroup instance in parentPlot.
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Returns a list of all layout elements that have their margin side associated with this margin group.
void addChild(QCP::MarginSide side, QCPLayoutElement *element)
bool isEmpty() const
Returns whether this margin group is empty.
int commonMargin(QCP::MarginSide side) const
QPainter subclass used internally.
QStack< bool > mAntialiasingStack
bool begin(QPaintDevice *device)
Sets the QPainter::NonCosmeticDefaultPen in Qt versions before Qt5 after beginning painting on device...
void drawLine(const QLineF &line)
This is an overloaded member function, provided for convenience. It differs from the above function o...
PainterMode
Defines special modes the painter can operate in.
@ pmNonCosmetic
0x04 Turns pen widths 0 to 1, i.e. disables cosmetic pens. (A cosmetic pen is always drawn with width...
@ pmNoCaching
0x02 Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixma...
@ pmVectorized
0x01 Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fix...
QCPPainter()
Creates a new QCPPainter instance and sets default values.
bool antialiasing() const
void setModes(PainterModes modes)
Sets the mode of the painter.
void restore()
Restores the painter (see QPainter::restore).
void makeNonCosmetic()
Changes the pen width to 1 if it currently is 0.
void save()
Saves the painter (see QPainter::save).
void setAntialiasing(bool enabled)
Sets whether painting uses antialiasing or not.
PainterModes modes() const
void setMode(PainterMode mode, bool enabled=true)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setPen(const QPen &pen)
Sets the pen of the painter and applies certain fixes to it, depending on the mode of this QCPPainter...
A layout element displaying a plot title text.
void setSelectedTextColor(const QColor &color)
Sets the color of the title text that will be used if the plot title is selected (setSelected).
void setFont(const QFont &font)
Sets the font of the title text.
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
void selectionChanged(bool selected)
This signal is emitted when the selection state has changed to selected, either by user interaction o...
void setSelectedFont(const QFont &font)
Sets the font of the title text that will be used if the plot title is selected (setSelected).
void selectableChanged(bool selectable)
void setTextColor(const QColor &color)
Sets the color of the title text.
Q_SLOT void setSelectable(bool selectable)
Sets whether the user may select this plot title to selectable.
QColor mSelectedTextColor
Q_SLOT void setSelected(bool selected)
Sets the selection state of this plot title to selected.
QCPPlotTitle(QCustomPlot *parentPlot)
Creates a new QCPPlotTitle instance and sets default values.
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Layout elements are sensitive to events inside their outer rect.
void setText(const QString &text)
Sets the text that will be displayed to text.
QColor mainTextColor() const
virtual void deselectEvent(bool *selectionStateChanged)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
virtual QSize maximumSizeHint() const
Returns the maximum size this layout element (the inner rect) may be expanded to.
virtual void draw(QCPPainter *painter)
virtual QSize minimumSizeHint() const
Returns the minimum size this layout element (the inner rect) may be compressed to.
A legend item representing a plottable with an icon and the plottable name.
virtual QSize minimumSizeHint() const
Returns the minimum size this layout element (the inner rect) may be compressed to.
QColor getTextColor() const
virtual void draw(QCPPainter *painter)
QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable)
Creates a new legend item associated with plottable.
QCPAbstractPlottable * mPlottable
QPen getIconBorderPen() const
Represents the range an axis is encompassing.
void expand(const QCPRange &otherRange)
Expands this range such that otherRange is contained in the new range.
QCPRange sanitizedForLogScale() const
Returns a sanitized version of the range.
static const double maxRange
Maximum values (negative and positive) the range will accept in range-changing functions.
double size() const
Returns the size of the range, i.e.
QCPRange sanitizedForLinScale() const
Returns a sanitized version of the range.
QCPRange expanded(const QCPRange &otherRange) const
Returns an expanded range that contains this and otherRange.
static bool validRange(double lower, double upper)
Checks, whether the specified range is within valid bounds, which are defined as QCPRange::maxRange a...
static const double minRange
Minimum range size (upper - lower) the range changing functions will accept.
QCPRange()
Constructs a range with lower and upper set to zero.
bool contains(double value) const
Returns true when value lies within or exactly on the borders of the range.
double center() const
Returns the center of the range, i.e.
void normalize()
Makes sure lower is numerically smaller than upper.
Represents the visual appearance of scatter points.
void drawShape(QCPPainter *painter, QPointF pos) const
Draws the scatter shape with painter at position pos.
void setPixmap(const QPixmap &pixmap)
Sets the pixmap that will be drawn as scatter point to pixmap.
bool isNone() const
Returns whether the scatter shape is ssNone.
void setBrush(const QBrush &brush)
Sets the brush that will be used to fill scatter points to brush.
void setPen(const QPen &pen)
Sets the pen that will be used to draw scatter points to pen.
void setShape(ScatterShape shape)
Sets the shape to shape.
QCPScatterStyle()
Creates a new QCPScatterStyle instance with size set to 6.
void setCustomPath(const QPainterPath &customPath)
Sets the custom shape that will be drawn as scatter point to customPath.
void setSize(double size)
Sets the size (pixel diameter) of the drawn scatter points to size.
ScatterShape
Defines the shape used for scatter points.
@ ssDot
\enumimage{ssDot.png} a single pixel (use ssDisc or ssCircle if you want a round shape with a certain...
@ ssCustom
custom painter operations are performed per scatter (As QPainterPath, see setCustomPath)
@ ssSquare
\enumimage{ssSquare.png} a square
@ ssDisc
\enumimage{ssDisc.png} a circle which is filled with the pen's color (not the brush as with ssCircle)
@ ssPlus
\enumimage{ssPlus.png} a plus
@ ssDiamond
\enumimage{ssDiamond.png} a diamond
@ ssCrossCircle
\enumimage{ssCrossCircle.png} a circle with a cross inside
@ ssPlusSquare
\enumimage{ssPlusSquare.png} a square with a plus inside
@ ssStar
\enumimage{ssStar.png} a star with eight arms, i.e. a combination of cross and plus
@ ssTriangleInverted
\enumimage{ssTriangleInverted.png} an equilateral triangle, standing on corner
@ ssPlusCircle
\enumimage{ssPlusCircle.png} a circle with a plus inside
@ ssCrossSquare
\enumimage{ssCrossSquare.png} a square with a cross inside
@ ssTriangle
\enumimage{ssTriangle.png} an equilateral triangle, standing on baseline
@ ssCircle
\enumimage{ssCircle.png} a circle
@ ssPixmap
a custom pixmap specified by setPixmap, centered on the data point coordinates
@ ssCross
\enumimage{ssCross.png} a cross
@ ssNone
no scatter symbols are drawn (e.g. in QCPGraph, data only represented with lines)
@ ssPeace
\enumimage{ssPeace.png} a circle, with one vertical and two downward diagonal lines
QPainterPath customPath() const
ScatterShape shape() const
void applyTo(QCPPainter *painter, const QPen &defaultPen) const
Applies the pen and the brush of this scatter style to painter.
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
This function is used to decide whether a click hits a layerable object or not.
void setWidth(double width)
Sets the width of the box in key coordinates.
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
virtual void clearData()
Clears all data in the plottable.
QVector< double > mOutliers
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
void setWhiskerPen(const QPen &pen)
Sets the pen used for drawing the whisker backbone (That's the line parallel to the value axis).
virtual void drawMedian(QCPPainter *painter) const
void setMedian(double value)
Sets the parameter "median" of the statistical box plot.
void setUpperQuartile(double value)
Sets the parameter "upper Quartile" of the statistical box plot.
void setLowerQuartile(double value)
Sets the parameter "lower Quartile" of the statistical box plot.
virtual void drawQuartileBox(QCPPainter *painter, QRectF *quartileBox=0) const
void setMedianPen(const QPen &pen)
Sets the pen used for drawing the median indicator line inside the statistical box.
virtual void draw(QCPPainter *painter)
QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis)
Constructs a statistical box which uses keyAxis as its key axis ("x") and valueAxis as its value axis...
void setKey(double key)
Sets the key coordinate of the statistical box.
void setMinimum(double value)
Sets the parameter "minimum" of the statistical box plot.
virtual void drawOutliers(QCPPainter *painter) const
void setWhiskerBarPen(const QPen &pen)
Sets the pen used for drawing the whisker bars (Those are the lines parallel to the key axis at each ...
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
void setMaximum(double value)
Sets the parameter "maximum" of the statistical box plot.
void setOutlierStyle(const QCPScatterStyle &style)
Sets the appearance of the outlier data points.
void setWhiskerWidth(double width)
Sets the width of the whiskers (setMinimum, setMaximum) in key coordinates.
void setData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum)
Sets all parameters of the statistical box plot at once.
QCPScatterStyle mOutlierStyle
virtual void drawWhiskers(QCPPainter *painter) const
void setOutliers(const QVector< double > &values)
Sets a vector of outlier values that will be drawn as scatters.
double lowerQuartile() const
double upperQuartile() const
The central class of the library.
void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
This signal is emitted when a legend (item) is double clicked.
QCPLayer * currentLayer() const
Returns the layer that is set as current layer (see setCurrentLayer).
void drawBackground(QCPPainter *painter)
QPixmap mScaledBackgroundPixmap
QCPLayer * layer(const QString &name) const
Returns the layer with the specified name.
void beforeReplot()
This signal is emitted immediately before a replot takes place (caused by a call to the slot replot).
Qt::KeyboardModifier mMultiSelectModifier
virtual QSize minimumSizeHint() const
QCPLayerable * layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=0) const
QList< QCPAxisRect * > axisRects() const
Returns all axis rects in the plot.
QCPAbstractItem * item() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setBackground(const QPixmap &pm)
Sets pm as the viewport background pixmap (see setViewport).
virtual void resizeEvent(QResizeEvent *event)
int itemCount() const
Returns the number of currently existing items in the plot.
QRect viewport() const
Returns the viewport rect of this QCustomPlot instance.
void toPainter(QCPPainter *painter, int width=0, int height=0)
Renders the plot using the passed painter.
void titleClick(QMouseEvent *event, QCPPlotTitle *title)
This signal is emitted when a plot title is clicked.
QCP::AntialiasedElements mNotAntialiasedElements
virtual void paintEvent(QPaintEvent *event)
const QCP::Interactions interactions() const
QPointer< QCPLayoutElement > mMouseEventElement
QCPAbstractPlottable * plottable(int index)
Returns the plottable with index.
void setBackgroundScaled(bool scaled)
Sets whether the viewport background pixmap shall be scaled to fit the viewport.
void setPlottingHint(QCP::PlottingHint hint, bool enabled=true)
Sets the specified plotting hint to enabled.
void setViewport(const QRect &rect)
Sets the viewport of this QCustomPlot.
bool removeLayer(QCPLayer *layer)
Removes the specified layer and returns true on success.
void setInteraction(const QCP::Interaction &interaction, bool enabled=true)
Sets the single interaction of this QCustomPlot to enabled.
QCustomPlot(QWidget *parent=0)
Constructs a QCustomPlot and sets reasonable default values.
RefreshPriority
Defines with what timing the QCustomPlot surface is refreshed after a replot.
@ rpImmediate
The QCustomPlot surface is immediately refreshed, by calling QWidget::repaint() after the replot.
@ rpQueued
Queues the refresh such that it is performed at a slightly delayed point in time after the replot,...
@ rpHint
Whether to use immediate repaint or queued update depends on whether the plotting hint QCP::phForceRe...
bool saveJpg(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
Saves a JPG image file to fileName on disc.
void setBackgroundScaledMode(Qt::AspectRatioMode mode)
If scaling of the viewport background pixmap is enabled (setBackgroundScaled), use this function to d...
void setSelectionTolerance(int pixels)
Sets the tolerance that is used to decide whether a click selects an object (e.g.
QCPLegend * legend
A pointer to the default legend of the main axis rect.
void selectionChangedByUser()
This signal is emitted after the user has changed the selection in the QCustomPlot,...
virtual QSize sizeHint() const
int selectionTolerance() const
void plottableClick(QCPAbstractPlottable *plottable, QMouseEvent *event)
This signal is emitted when a plottable is clicked.
int graphCount() const
Returns the number of currently existing graphs in the plot.
void setInteractions(const QCP::Interactions &interactions)
Sets the possible interactions of this QCustomPlot as an or-combination of QCP::Interaction enums.
int plottableCount() const
Returns the number of currently existing plottables in the plot.
Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpHint)
Causes a complete replot into the internal buffer.
QList< QCPAbstractPlottable * > mPlottables
QCP::AntialiasedElements antialiasedElements() const
bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0)
Saves a BMP image file to fileName on disc.
QList< QCPAbstractItem * > mItems
void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
This signal is emitted when an axis is double clicked.
void afterReplot()
This signal is emitted immediately after a replot has taken place (caused by a call to the slot replo...
QCPGraph * addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0)
Creates a new graph inside the plot.
virtual void mouseReleaseEvent(QMouseEvent *event)
bool hasPlottable(QCPAbstractPlottable *plottable) const
Returns whether this QCustomPlot instance contains the plottable.
QList< QCPLayer * > mLayers
bool setCurrentLayer(const QString &name)
Sets the layer with the specified name to be the current layer.
void mouseMove(QMouseEvent *event)
This signal is emitted when the QCustomPlot receives a mouse move event.
QList< QCPAbstractPlottable * > selectedPlottables() const
Returns a list of the selected plottables.
QCP::AntialiasedElements notAntialiasedElements() const
LayerInsertMode
Defines how a layer should be inserted relative to an other layer.
@ limAbove
Layer is inserted above other layer.
bool savePng(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
Saves a PNG image file to fileName on disc.
virtual void mouseDoubleClickEvent(QMouseEvent *event)
void setNoAntialiasingOnDrag(bool enabled)
Sets whether antialiasing is disabled for this QCustomPlot while the user is dragging axes ranges.
void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
This signal is emitted when a legend (item) is clicked.
virtual void wheelEvent(QWheelEvent *event)
QList< QCPAxis * > selectedAxes() const
Returns the axes that currently have selected parts, i.e.
void updateLayerIndices() const
virtual void axisRemoved(QCPAxis *axis)
int axisRectCount() const
Returns the number of axis rects in the plot.
void setMultiSelectModifier(Qt::KeyboardModifier modifier)
Sets the keyboard modifier that will be recognized as multi-select-modifier.
bool removeGraph(QCPGraph *graph)
Removes the specified graph from the plot and, if necessary, from the QCustomPlot::legend.
void setPlottingHints(const QCP::PlottingHints &hints)
Sets the plotting hints for this QCustomPlot instance as an or combination of QCP::PlottingHint.
int clearPlottables()
Removes all plottables from the plot (and the QCustomPlot::legend, if necessary).
QCPAxis * xAxis
A pointer to the primary x Axis (bottom) of the main axis rect of the plot.
void mouseDoubleClick(QMouseEvent *event)
This signal is emitted when the QCustomPlot receives a mouse double click event.
virtual void legendRemoved(QCPLegend *legend)
Q_SLOT void deselectAll()
Deselects all layerables (plottables, items, axes, legends,...) of the QCustomPlot.
QCP::PlottingHints mPlottingHints
QCP::AntialiasedElements mAntialiasedElements
bool addItem(QCPAbstractItem *item)
Adds the specified item to the plot.
QPixmap toPixmap(int width=0, int height=0, double scale=1.0)
Renders the plot to a pixmap and returns it.
QCPGraph * graph() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool savePdf(const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0, const QString &pdfCreator="", const QString &pdfTitle="")
Saves a PDF with the vectorized plot to the file fileName.
bool mAutoAddPlottableToLegend
int clearGraphs()
Removes all graphs from the plot (and the QCustomPlot::legend, if necessary).
bool saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality=-1)
Saves the plot to a rastered image file fileName in the image format format.
bool addPlottable(QCPAbstractPlottable *plottable)
Adds the specified plottable to the plot and, if setAutoAddPlottableToLegend is enabled,...
Qt::AspectRatioMode mBackgroundScaledMode
virtual void mousePressEvent(QMouseEvent *event)
int clearItems()
Removes all items from the plot.
void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
This signal is emitted when an axis is clicked.
QCPAbstractItem * itemAt(const QPointF &pos, bool onlySelectable=false) const
Returns the item at the pixel position pos.
virtual void mouseMoveEvent(QMouseEvent *event)
QCP::PlottingHints plottingHints() const
void mouseWheel(QWheelEvent *event)
This signal is emitted when the QCustomPlot receives a mouse wheel event.
void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event)
This signal is emitted when an item is double clicked.
bool mNoAntialiasingOnDrag
QList< QCPLegend * > selectedLegends() const
Returns the legends that currently have selected parts, i.e.
void mouseRelease(QMouseEvent *event)
This signal is emitted when the QCustomPlot receives a mouse release event.
QCPLayoutGrid * mPlotLayout
bool noAntialiasingOnDrag() const
void mousePress(QMouseEvent *event)
This signal is emitted when the QCustomPlot receives a mouse press event.
QCPAbstractPlottable * plottableAt(const QPointF &pos, bool onlySelectable=false) const
Returns the plottable at the pixel position pos.
QList< QCPGraph * > selectedGraphs() const
Returns a list of the selected graphs.
void titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title)
This signal is emitted when a plot title is double clicked.
bool addLayer(const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove)
Adds a new layer to this QCustomPlot instance.
QCP::Interactions mInteractions
virtual void draw(QCPPainter *painter)
Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false)
Rescales the axes such that all plottables (like graphs) in the plot are fully visible.
void setAutoAddPlottableToLegend(bool on)
If set to true, adding a plottable (e.g.
QCPAxis * xAxis2
A pointer to the secondary x Axis (top) of the main axis rect of the plot.
QList< QCPGraph * > mGraphs
QCPAbstractPlottable * plottable()
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool removeItem(QCPAbstractItem *item)
Removes the specified item from the plot.
void setNotAntialiasedElements(const QCP::AntialiasedElements ¬AntialiasedElements)
Sets which elements are forcibly drawn not antialiased as an or combination of QCP::AntialiasedElemen...
void itemClick(QCPAbstractItem *item, QMouseEvent *event)
This signal is emitted when an item is clicked.
QCPAxisRect * axisRect(int index=0) const
Returns the axis rect with index.
bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove)
Moves the specified layer either above or below otherLayer.
QPixmap mBackgroundPixmap
void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled=true)
Sets whether the specified antialiasedElement is forcibly drawn antialiased.
bool hasItem(QCPAbstractItem *item) const
Returns whether this QCustomPlot contains the item.
QCPAxis * yAxis2
A pointer to the secondary y Axis (right) of the main axis rect of the plot.
void plottableDoubleClick(QCPAbstractPlottable *plottable, QMouseEvent *event)
This signal is emitted when a plottable is double clicked.
bool removePlottable(QCPAbstractPlottable *plottable)
Removes the specified plottable from the plot and, if necessary, from the legend (QCustomPlot::legend...
void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements)
Sets which elements are forcibly drawn antialiased as an or combination of QCP::AntialiasedElement.
QCPAxis * yAxis
A pointer to the primary y Axis (left) of the main axis rect of the plot.
int layerCount() const
Returns the number of currently existing layers in the plot.
QCPLayoutElement * layoutElementAt(const QPointF &pos) const
Returns the layout element at pixel position pos.
void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled=true)
Sets whether the specified notAntialiasedElement is forcibly drawn not antialiased.
QList< QCPAbstractItem * > selectedItems() const
Returns a list of the selected items.
The QCP Namespace contains general enums and QFlags used throughout the QCustomPlot library.
bool isInvalidData(double value)
int getMarginValue(const QMargins &margins, QCP::MarginSide side)
Interaction
Defines the mouse interactions possible with QCustomPlot.
@ iSelectLegend
0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts)
@ iRangeDrag
0x001 Axis ranges are draggable (see QCPAxisRect::setRangeDrag, QCPAxisRect::setRangeDragAxes)
@ iSelectPlottables
0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable)
@ iRangeZoom
0x002 Axis ranges are zoomable with the mouse wheel (see QCPAxisRect::setRangeZoom,...
@ iSelectAxes
0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)
@ iSelectItems
0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see QCPAbstractItem)
@ iMultiSelect
0x004 The user can select multiple objects by holding the modifier set by QCustomPlot::setMultiSelect...
@ iSelectOther
0x080 All other objects are selectable (e.g. your own derived layerables, the plot title,...
PlottingHint
Defines plotting hints that control various aspects of the quality and speed of plotting.
@ phCacheLabels
0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance.
@ phForceRepaint
0x002 causes an immediate repaint() instead of a soft update() when QCustomPlot::replot() is called w...
@ phFastPolylines
0x001 Graph/Curve lines are drawn with a faster method.
MarginSide
Defines the sides of a rectangular entity to which margins can be applied.
@ msBottom
0x08 bottom margin
@ msRight
0x02 right margin
AntialiasedElement
Defines what objects of a plot can be forcibly drawn antialiased/not antialiased.
@ aeLegendItems
0x0010 Legend items
@ aeZeroLine
0x0400 Zero-lines, see QCPGrid::setZeroLinePen
@ aePlottables
0x0020 Main lines of plottables (excluding error bars, see element aeErrorBars)
@ aeGrid
0x0002 Grid lines
@ aeFills
0x0200 Borders of fills (e.g. under or between graphs)
@ aeErrorBars
0x0100 Error bars
@ aeLegend
0x0008 Legend box
@ aeAll
0xFFFF All elements
@ aeNone
0x0000 No elements
@ aeSubGrid
0x0004 Sub grid lines
@ aeScatters
0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap)
@ aeAxes
0x0001 Axis base line and tick marks
@ aeItems
0x0040 Main lines of items
void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)
QMap< double, QCPCurveData > QCPCurveDataMap
Container for storing QCPCurveData items in a sorted fashion.
QMap< double, QCPData > QCPDataMap
Container for storing QCPData items in a sorted fashion.
QMap< double, QCPBarData > QCPBarDataMap
Container for storing QCPBarData items in a sorted fashion.