Generic Chart Slope Paint

.. full for scatter, in selection rect for line. Seems a compromise
   between providing useful context on a scatter and avoiding lots of
   noise on a line chart.
This commit is contained in:
Mark Liversedge
2020-03-09 21:03:56 +00:00
parent 35a37ff846
commit 495dff77ca
2 changed files with 5 additions and 4 deletions

View File

@@ -237,11 +237,14 @@ void GenericSelectTool::paint(QPainter*painter, const QStyleOptionGraphicsItem *
line.setStyle(Qt::SolidLine);
line.setWidthF(0.5 * dpiXFactor);
painter->setPen(line);
//painter->setClipRect(r);
painter->setClipRect(mapRectFromScene(host->qchart->plotArea()));
if (host->charttype == GC_CHART_LINE) painter->setClipRect(r); // too jarring on a line plot
else painter->setClipRect(mapRectFromScene(host->qchart->plotArea())); // need context for a scatter plot
painter->drawLine(startp, stopp);
}
// reset clip to the plot area
painter->setClipRect(mapRectFromScene(host->qchart->plotArea()));
// scene coordinate for min/max (remember we get clipped)
QPointF minxp = mapFromScene(host->qchart->mapToPosition(QPointF(calc.x.min,0),calc.series));
QPointF maxxp = mapFromScene(host->qchart->mapToPosition(QPointF(calc.x.max,0),calc.series));

View File

@@ -4119,8 +4119,6 @@ RTool::configureAxis(SEXP name, SEXP visible, SEXP align, SEXP min, SEXP max,
Q_UNUSED(align) // we always pass -1 for now
Q_UNUSED(categories) // XXX TODO
fprintf(stderr, "configure axis...\n"); fflush(stderr);
if (rtool == NULL || rtool->context == NULL || rtool->chart == NULL) return Rf_allocVector(INTSXP, 0);
GenericAxisInfo info;