fixed issue #73: Symbol thickness differs in actual plot and legend
@ -24,6 +24,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
|
||||
<li>FIXED issue <a href="https://github.com/jkriege2/JKQtPlotter/pull/70">#70: Typo in jkqtplotter/CMakeLists.txt</a>, thanks to <a href="https://github.com/tedlinlab">user:tedlinlab</a></li>
|
||||
<li>FIXED issue <a href="https://github.com/jkriege2/JKQtPlotter/pull/80">#80: Bug with multiple inheritance with Q_GDAGET with CLANG</a>, thanks to <a href="https://github.com/igormironchik">user:igormironchik</a>, caused by <a href="https://bugreports.qt.io/browse/QTBUG-104874">QTBUG-104874</a></li>
|
||||
<li>FIXED: styling was not properly applied to coordinate axes of colorbars outside the plot</li>
|
||||
<li>FIXED issue <a href="https://github.com/jkriege2/JKQtPlotter/pull/73">#73: Symbol thickness differs in actual plot and legend</a>, thanks to <a href="https://github.com/sim186">user:sim186</a></li>
|
||||
<li>REORGANIZED: separated line-graphs from jkqtpscatter.h/.cpp into jkqtplines.h/.cpp</li>
|
||||
<li>IMPROVED: QT6-compatibility by removing deprecated warnings</li>
|
||||
<li>NEW: JKQTPFilledCurveXGraph and JKQTPFilledCurveYGraph can now plot wiggle plots with different fill styles above and below the baseline (feature request <a href="https://github.com/jkriege2/JKQtPlotter/issues/68">#68 Wiggle Plots</a> from <a href="https://github.com/xichaoqiang">user:xichaoqiang</a> </li>
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@ -96,6 +96,7 @@ void createErrorScatterGraph(JKQTPlotter&plot) {
|
||||
graph1->setYColumn(columnY);
|
||||
graph1->setYErrorColumn(columnEY);
|
||||
graph1->setYErrorStyle(JKQTPErrorSimpleBars);
|
||||
graph1->setSymbolType(JKQTPCross);
|
||||
graph1->setTitle(QObject::tr("y-errorlines"));
|
||||
plot.addGraph(graph1);
|
||||
|
||||
@ -107,6 +108,7 @@ void createErrorScatterGraph(JKQTPlotter&plot) {
|
||||
graph2->setXErrorStyle(JKQTPErrorBars);
|
||||
graph2->setYErrorStyle(JKQTPErrorBars);
|
||||
graph2->setTitle(QObject::tr("xy-errorbars"));
|
||||
graph2->setSymbolLineWidth(3);
|
||||
plot.addGraph(graph2);
|
||||
|
||||
// 6. autoscale the plot so the graph is contained
|
||||
@ -114,6 +116,7 @@ void createErrorScatterGraph(JKQTPlotter&plot) {
|
||||
|
||||
// show plotter and make it a decent size
|
||||
plot.getPlotter()->setPlotLabel(QObject::tr("Error Scatter Example"));
|
||||
plot.setGrid(false);
|
||||
plot.show();
|
||||
plot.resize(600/plot.devicePixelRatioF(),400/plot.devicePixelRatioF());
|
||||
}
|
||||
|
@ -503,6 +503,8 @@ inline void JKQTPPlotSymbol(TPainter& painter, double x, double y, JKQTPGraphSym
|
||||
}
|
||||
}
|
||||
|
||||
painter.setBrush(QColor(Qt::transparent));
|
||||
painter.setPen(p);
|
||||
switch(symbol) {
|
||||
case JKQTPDot:
|
||||
painter.drawPoint(QPointF(x,y));
|
||||
@ -576,6 +578,7 @@ inline void JKQTPPlotSymbol(TPainter& painter, double x, double y, JKQTPGraphSym
|
||||
}
|
||||
break;
|
||||
case JKQTPFemale:{
|
||||
painter.setBrush(QColor(Qt::transparent));
|
||||
QPainterPath path;
|
||||
QRectF rectangle3(x-w2/2.0, y-w2, w2, w2);
|
||||
path.addEllipse(rectangle3);
|
||||
@ -587,6 +590,7 @@ inline void JKQTPPlotSymbol(TPainter& painter, double x, double y, JKQTPGraphSym
|
||||
}
|
||||
break;
|
||||
case JKQTPMale:{
|
||||
painter.setBrush(QColor(Qt::transparent));
|
||||
QPainterPath path;
|
||||
QRectF rectangle3(x-w2/2.0, y-w2/2.0, w2, w2);
|
||||
path.addEllipse(rectangle3);
|
||||
|
@ -76,6 +76,7 @@ void JKQTPEvaluatedFunctionWithErrorsGraphDrawingBase::drawKeyMarker(JKQTPEnhanc
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
p.setWidthF(getKeyLineWidthPx(painter, rect, parent));
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
const double y=rect.top()+rect.height()/2.0;
|
||||
|
@ -72,6 +72,7 @@ void JKQTPXYFunctionLineGraphBase::drawKeyMarker(JKQTPEnhancedPainter& painter,
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
p.setWidthF(getKeyLineWidthPx(painter, rect, parent));
|
||||
QPen np(Qt::NoPen);
|
||||
const double y=rect.top()+rect.height()/2.0;
|
||||
painter.setPen(np);
|
||||
|
@ -52,6 +52,7 @@ void JKQTPFilledCurveGraphBase::drawKeyMarker(JKQTPEnhancedPainter &painter, QRe
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setWidthF(getKeyLineWidthPx(painter, rect, parent));
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
const double y=rect.top()+rect.height()/2.0;
|
||||
@ -488,7 +489,7 @@ void JKQTPFilledVerticalRangeGraph::drawKeyMarker(JKQTPEnhancedPainter &painter,
|
||||
r.moveTo(r.x(), r.y()+r.height()-1);
|
||||
painter.fillRect(r, getFillBrush(painter, parent));
|
||||
if (getDrawLine()) {
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.setPen(getKeyLinePen(painter, rect, parent));
|
||||
painter.drawLine(QLineF(r.topLeft(), r.topRight()));
|
||||
}
|
||||
|
||||
@ -603,7 +604,7 @@ void JKQTPFilledHorizontalRangeGraph::drawKeyMarker(JKQTPEnhancedPainter &painte
|
||||
r.moveTo(r.x(), r.y()+r.height()-1);
|
||||
painter.fillRect(r, getFillBrush(painter, parent));
|
||||
if (getDrawLine()) {
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.setPen(getKeyLinePen(painter, rect, parent));
|
||||
painter.drawLine(QLineF(r.topLeft(), r.topRight()));
|
||||
}
|
||||
|
||||
|
@ -283,15 +283,8 @@ void JKQTPGeoSymbol::draw(JKQTPEnhancedPainter &painter)
|
||||
|
||||
void JKQTPGeoSymbol::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
|
||||
{
|
||||
const double minSize=qMin(rect.width(), rect.height());
|
||||
double symbolSize=parent->pt2px(painter, this->getSymbolSize());
|
||||
if (symbolSize>minSize*0.9) symbolSize=minSize*0.9;
|
||||
double symbolWidth=parent->pt2px(painter, this->getSymbolLineWidth()*parent->getLineWidthMultiplier());
|
||||
if (symbolWidth>0.3*symbolSize) symbolWidth=0.3*symbolSize;
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), symbolSize, symbolWidth, getSymbolColor(), getSymbolFillColor());
|
||||
|
||||
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor());
|
||||
}
|
||||
|
||||
QColor JKQTPGeoSymbol::getKeyLabelColor() const
|
||||
|
@ -66,9 +66,9 @@ void JKQTPGeoBaseLine::setColor(QColor c)
|
||||
|
||||
void JKQTPGeoBaseLine::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
double y=rect.top()+rect.height()/2.0;
|
||||
if (rect.width()>0) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
|
||||
painter.setPen(getKeyLinePen(painter, rect, parent));
|
||||
const double y=rect.top()+rect.height()/2.0;
|
||||
painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
|
||||
|
||||
}
|
||||
|
||||
@ -175,10 +175,9 @@ void JKQTPGeoBaseFilled::setStyleTransparentFill(QColor color)
|
||||
|
||||
void JKQTPGeoBaseFilled::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.setPen(getKeyLinePen(painter, rect, parent));
|
||||
painter.setBrush(getFillBrush(painter, parent));
|
||||
painter.drawRect(rect);
|
||||
|
||||
painter.drawRect(rect-QMarginsF(1,1,1,1));
|
||||
}
|
||||
|
||||
|
||||
@ -231,8 +230,8 @@ void JKQTPGeoBaseDecoratedHeadLine::drawKeyMarker(JKQTPEnhancedPainter &painter,
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
double y=rect.top()+rect.height()/2.0;
|
||||
if (rect.width()>0) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
|
||||
const double y=rect.top()+rect.height()/2.0;
|
||||
painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
|
||||
}
|
||||
|
||||
QColor JKQTPGeoBaseDecoratedHeadLine::getKeyLabelColor() const
|
||||
@ -291,9 +290,12 @@ void JKQTPGeoBaseDecoratedLine::setColor(QColor c)
|
||||
void JKQTPGeoBaseDecoratedLine::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
double y=rect.top()+rect.height()/2.0;
|
||||
if (rect.width()>0) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setColor(getKeyLabelColor());
|
||||
p.setWidthF(getKeyLineWidthPx(painter,rect,parent));
|
||||
painter.setPen(p);
|
||||
const double y=rect.top()+rect.height()/2.0;
|
||||
painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
|
||||
}
|
||||
|
||||
QColor JKQTPGeoBaseDecoratedLine::getKeyLabelColor() const
|
||||
|
@ -126,8 +126,6 @@ void JKQTPOverlayImage::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rec
|
||||
painter.fillRect(r1, QBrush(trueColor));
|
||||
painter.setBrush(QBrush(falseColor));
|
||||
painter.fillRect(r2, QBrush(falseColor));
|
||||
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPOverlayImage::getKeyLabelColor() const {
|
||||
|
@ -136,7 +136,7 @@ void JKQTPImpulsesHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter,
|
||||
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen p=getKeyLinePen(painter, rect, parent);
|
||||
p.setCapStyle(Qt::FlatCap);
|
||||
painter.setPen(p);
|
||||
|
||||
@ -170,7 +170,7 @@ void JKQTPImpulsesVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QR
|
||||
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen p=getKeyLinePen(painter, rect, parent);
|
||||
p.setCapStyle(Qt::FlatCap);
|
||||
painter.setPen(p);
|
||||
const int x=rect.left()+rect.width()/2.0;
|
||||
|
@ -150,25 +150,13 @@ void JKQTPXYLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
}
|
||||
|
||||
void JKQTPXYLineGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
const double minSize=qMin(rect.width(), rect.height());
|
||||
const double maxSize=qMax(rect.width(), rect.height());
|
||||
double symbolSize=parent->pt2px(painter, this->getSymbolSize());
|
||||
if (symbolSize>minSize*0.9) symbolSize=minSize*0.9;
|
||||
double symbolWidth=parent->pt2px(painter, this->getSymbolLineWidth()*parent->getLineWidthMultiplier());
|
||||
if (symbolWidth>0.3*symbolSize) symbolWidth=0.3*symbolSize;
|
||||
double lineWidth=parent->pt2px(painter, this->getLineWidth()*parent->getLineWidthMultiplier());
|
||||
if (lineWidth>0.5*maxSize) lineWidth=0.5*maxSize;
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setColor(getKeyLabelColor());
|
||||
p.setStyle(getLineStyle());
|
||||
p.setWidthF(lineWidth);
|
||||
p.setWidthF(getKeyLineWidthPx(painter,rect,parent));
|
||||
painter.setPen(p);
|
||||
double y=rect.top()+rect.height()/2.0;
|
||||
if (drawLine) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
|
||||
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), symbolSize, symbolWidth, getKeyLabelColor(), getSymbolFillColor());
|
||||
|
||||
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor());
|
||||
}
|
||||
|
||||
QColor JKQTPXYLineGraph::getKeyLabelColor() const {
|
||||
|
@ -144,10 +144,10 @@ void JKQTPPeakStreamGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
void JKQTPPeakStreamGraph::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen p=getKeyLinePen(painter, rect, parent);
|
||||
painter.setPen(p);
|
||||
if (yPeaks) {
|
||||
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH,qMin(parent->pt2px(painter, p.widthF()), rect.width()/10.0)));
|
||||
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH,qMin(p.widthF(), rect.width()/10.0)));
|
||||
if (drawBaseline) {
|
||||
if (peakHeight>=0) painter.drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
else painter.drawLine(rect.topLeft(), rect.topRight());
|
||||
@ -157,7 +157,7 @@ void JKQTPPeakStreamGraph::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &
|
||||
painter.drawLine(QPointF(rect.left()+rect.width()*0.75, rect.top()), QPointF(rect.left()+rect.width()*0.75, rect.bottom()));
|
||||
painter.drawLine(QPointF(rect.left()+rect.width()*0.9, rect.top()), QPointF(rect.left()+rect.width()*0.9, rect.bottom()));
|
||||
} else {
|
||||
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH,qMin(parent->pt2px(painter, p.widthF()), rect.height()/15.0)));
|
||||
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH,qMin(p.widthF(), rect.height()/15.0)));
|
||||
if (drawBaseline) {
|
||||
if (peakHeight>=0) painter.drawLine(rect.bottomLeft(), rect.topLeft());
|
||||
else painter.drawLine(rect.bottomRight(), rect.topRight());
|
||||
|
@ -311,7 +311,7 @@ void JKQTPHorizontalRange::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
void JKQTPHorizontalRange::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen p=getKeyLinePen(painter, rect, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush nb(Qt::NoBrush);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
@ -430,7 +430,7 @@ void JKQTPVerticalRange::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
void JKQTPVerticalRange::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen p=getKeyLinePen(painter, rect, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush nb(Qt::NoBrush);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
|
@ -116,17 +116,8 @@ void JKQTPXYScatterGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
}
|
||||
|
||||
void JKQTPXYScatterGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
const double minSize=qMin(rect.width(), rect.height());
|
||||
const double maxSize=qMax(rect.width(), rect.height());
|
||||
double symbolSize=parent->pt2px(painter, this->getSymbolSize());
|
||||
if (symbolSize>minSize*0.9) symbolSize=minSize*0.9;
|
||||
double symbolWidth=parent->pt2px(painter, this->getSymbolLineWidth()*parent->getLineWidthMultiplier());
|
||||
if (symbolWidth>0.3*symbolSize) symbolWidth=0.3*symbolSize;
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
double y=rect.top()+rect.height()/2.0;
|
||||
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), symbolSize, symbolWidth, getKeyLabelColor(), getSymbolFillColor());
|
||||
|
||||
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor());
|
||||
}
|
||||
|
||||
QColor JKQTPXYScatterGraph::getKeyLabelColor() const {
|
||||
@ -427,14 +418,8 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
|
||||
void JKQTPXYParametrizedScatterGraph::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
|
||||
{
|
||||
const double minSize=qMin(rect.width(), rect.height());
|
||||
const double maxSize=qMax(rect.width(), rect.height());
|
||||
double symbolSize1=parent->pt2px(painter, this->getSymbolSize());
|
||||
if (symbolSize1>minSize*0.9) symbolSize1=minSize*0.9;
|
||||
if (symbolSize1<minSize*0.6) symbolSize1=minSize*0.6;
|
||||
double symbolSize2=parent->pt2px(painter, this->getSymbolSize()*0.75);
|
||||
if (symbolSize2>minSize*0.6) symbolSize2=minSize*0.5;
|
||||
if (symbolSize2<minSize*0.5) symbolSize2=minSize*0.5;
|
||||
double symbolSize1=getKeySymbolSizePx(painter, rect, parent, 0.75);
|
||||
double symbolSize2=symbolSize1*0.8;
|
||||
|
||||
if (sizeColumn<0) {
|
||||
symbolSize2=symbolSize1;
|
||||
@ -464,10 +449,7 @@ void JKQTPXYParametrizedScatterGraph::drawKeyMarker(JKQTPEnhancedPainter &painte
|
||||
symbol2=JKQTPFilledRect;
|
||||
}
|
||||
|
||||
double symbolWidth=parent->pt2px(painter, this->getSymbolLineWidth()*0.7*parent->getLineWidthMultiplier());
|
||||
if (symbolWidth>0.2*getSymbolLineWidth()) symbolWidth=0.3*getSymbolLineWidth();
|
||||
double lineWidth=parent->pt2px(painter, this->getSymbolLineWidth()*0.7*parent->getLineWidthMultiplier());
|
||||
if (lineWidth>0.1*maxSize) lineWidth=0.1*maxSize;
|
||||
double lineWidth=getKeyLineWidthPx(painter, rect, parent)*0.75;
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=painter.pen();
|
||||
@ -475,12 +457,12 @@ void JKQTPXYParametrizedScatterGraph::drawKeyMarker(JKQTPEnhancedPainter &painte
|
||||
p.setStyle(getLineStyle());
|
||||
p.setWidthF(lineWidth);
|
||||
painter.setPen(p);
|
||||
double x1=rect.left()+symbolSize1/2.0;
|
||||
double y1=rect.top()+symbolSize1/2.0;
|
||||
double x2=rect.right()-symbolSize2/2.0;
|
||||
double y2=rect.bottom()-symbolSize2/2.0;
|
||||
JKQTPPlotSymbol(painter, x1, y1, symbol1, symbolSize1, symbolWidth, color1, JKQTPGetDerivedColor(symbolFillDerivationMode, color1));
|
||||
JKQTPPlotSymbol(painter, x2, y2, symbol2, symbolSize2, symbolWidth, color2, JKQTPGetDerivedColor(symbolFillDerivationMode, color2));
|
||||
const double x1=rect.left()+symbolSize1/2.0;
|
||||
const double y1=rect.top()+symbolSize1/2.0;
|
||||
const double x2=rect.right()-symbolSize2/2.0;
|
||||
const double y2=rect.bottom()-symbolSize2/2.0;
|
||||
JKQTPPlotSymbol(painter, x1, y1, symbol1, symbolSize1, getKeySymbolLineWidthPx(painter, rect, parent,0.5), color1, JKQTPGetDerivedColor(symbolFillDerivationMode, color1));
|
||||
JKQTPPlotSymbol(painter, x2, y2, symbol2, symbolSize2, getKeySymbolLineWidthPx(painter, rect, parent,0.5), color2, JKQTPGetDerivedColor(symbolFillDerivationMode, color2));
|
||||
if (drawLine) painter.drawLine(QLineF(x1,y1, x2,y2));
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ JKQTPSpecialLineGraphBase::JKQTPSpecialLineGraphBase(JKQTBasePlotter* parent):
|
||||
|
||||
void JKQTPSpecialLineGraphBase::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen p=getKeyLinePen(painter, rect, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
const double y=rect.top()+rect.height()/2.0;
|
||||
@ -56,7 +56,7 @@ void JKQTPSpecialLineGraphBase::drawKeyMarker(JKQTPEnhancedPainter& painter, QRe
|
||||
if (getFillCurve()) painter.drawRect(rect);
|
||||
if (!getFillCurve() && getDrawLine()) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
|
||||
if (m_drawSymbols) {
|
||||
plotStyledSymbol(parent, painter, rect.center().x(), rect.center().y(), rect.width()*0.5);
|
||||
JKQTPPlotSymbol(painter, rect.center().x(), rect.center().y(), getSymbolType(), getKeySymbolSizePx(painter, rect, parent), getKeySymbolLineWidthPx(painter, rect, parent), getKeyLabelColor(), getSymbolFillColor());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -140,6 +140,13 @@ QPen JKQTPGraphLineStyleMixin::getLinePen(JKQTPEnhancedPainter& painter, JKQTBas
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
QPen JKQTPGraphLineStyleMixin::getKeyLinePen(JKQTPEnhancedPainter& painter, const QRectF& rect, JKQTBasePlotter* parent) const {
|
||||
QPen p=m_linePen;
|
||||
p.setWidthF(getKeyLineWidthPx(painter, rect, parent));
|
||||
return p;
|
||||
}
|
||||
|
||||
QPen JKQTPGraphLineStyleMixin::getLinePenForRects(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
|
||||
{
|
||||
QPen p=getLinePen(painter, parent);
|
||||
@ -270,6 +277,23 @@ double JKQTPGraphSymbolStyleMixin::getSymbolLineWidth() const
|
||||
return m_symbolLineWidth;
|
||||
}
|
||||
|
||||
double JKQTPGraphSymbolStyleMixin::getKeySymbolLineWidthPx(JKQTPEnhancedPainter& painter, const QRectF& keyRect, const JKQTBasePlotter *parent, double maxSymbolSizeFracton) const
|
||||
{
|
||||
const double minSize=qMin(keyRect.width(), keyRect.height());
|
||||
double symbolWidth=parent->pt2px(painter, this->getSymbolLineWidth()*parent->getLineWidthMultiplier());
|
||||
double symbolSize=getKeySymbolSizePx(painter, keyRect, parent, maxSymbolSizeFracton);
|
||||
if (symbolWidth>0.3*symbolSize) symbolWidth=0.3*symbolSize;
|
||||
return symbolWidth;
|
||||
}
|
||||
|
||||
double JKQTPGraphSymbolStyleMixin::getKeySymbolSizePx(JKQTPEnhancedPainter& painter, const QRectF& keyRect, const JKQTBasePlotter *parent, double maxSymbolSizeFracton) const
|
||||
{
|
||||
const double minSize=qMin(keyRect.width(), keyRect.height());
|
||||
double symbolSize=parent->pt2px(painter, this->getSymbolSize());
|
||||
if (symbolSize>minSize*maxSymbolSizeFracton) symbolSize=minSize*maxSymbolSizeFracton;
|
||||
return symbolSize;
|
||||
}
|
||||
|
||||
QPen JKQTPGraphSymbolStyleMixin::getSymbolPen(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent) const {
|
||||
QPen p;
|
||||
p.setColor(m_symbolColor);
|
||||
@ -438,6 +462,14 @@ QColor JKQTPGraphLineStyleMixin::getHighlightingLineColor() const
|
||||
return m_highlightingLineColor;
|
||||
}
|
||||
|
||||
double JKQTPGraphLineStyleMixin::getKeyLineWidthPx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent) const
|
||||
{
|
||||
const double minSize=qMin(keyRect.width(), keyRect.height());
|
||||
double lineWidth=parent->pt2px(painter, this->getLineWidth()*parent->getLineWidthMultiplier());
|
||||
if (lineWidth>0.4*minSize) lineWidth=0.4*minSize;
|
||||
return lineWidth;
|
||||
}
|
||||
|
||||
QPen JKQTPGraphLineStyleMixin::getHighlightingLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
|
||||
{
|
||||
QPen p=getLinePen(painter, parent);
|
||||
|
@ -135,6 +135,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphLineStyleMixin {
|
||||
/** \brief line pen for the highlighted look */
|
||||
QColor m_highlightingLineColor;
|
||||
protected:
|
||||
/** \brief returns the linewidth for drawing lines in a key entry with \a keyRect for the symbol, using \a painter and \a parent . */
|
||||
double getKeyLineWidthPx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent) const;
|
||||
|
||||
/** \brief constructs a QPen from the line styling properties */
|
||||
QPen getLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
||||
/** \brief constructs a QPen from the line styling properties, suitable for drawing rectangles with sharp edges */
|
||||
@ -143,6 +146,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphLineStyleMixin {
|
||||
QPen getHighlightingLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
||||
/** \brief constructs a QPen from the line styling properties, suitable for drawing rectangle with sharp corners */
|
||||
QPen getHighlightingLinePenForRects(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
||||
/** \brief constructs a QPen from the line styling properties, but uses getKeyLineWidthPx() for the width, i.e. constructs a pen for drawing lines in key-symbols */
|
||||
QPen getKeyLinePen(JKQTPEnhancedPainter &painter, const QRectF &rect, JKQTBasePlotter *parent) const;
|
||||
};
|
||||
|
||||
|
||||
@ -406,7 +411,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphSymbolStyleMixin {
|
||||
Q_PROPERTY(double symbolSize MEMBER m_symbolSize READ getSymbolSize WRITE setSymbolSize)
|
||||
Q_PROPERTY(double symbolLineWidth MEMBER m_symbolLineWidth READ getSymbolLineWidth WRITE setSymbolLineWidth)
|
||||
#endif
|
||||
private:
|
||||
private:
|
||||
/** \brief which symbol to use for the datapoints */
|
||||
JKQTPGraphSymbols m_symbolType;
|
||||
/** \brief size (diameter in pt) of the symbol for the data points, given in pt */
|
||||
@ -458,8 +463,10 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphSymbolStyleMixin {
|
||||
\param fillColor fill color of the symbol
|
||||
*/
|
||||
void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, QColor color, QColor fillColor) const;
|
||||
|
||||
|
||||
/** \brief returns the symbol linewidth for drawing symbols in a key entry with \a keyRect for the symbol, using \a painter and \a parent . \a maxSymbolSizeFracton specifies the maximum fraction of \a keyRect to be used for the symbol. */
|
||||
double getKeySymbolLineWidthPx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent, double maxSymbolSizeFracton=0.9) const;
|
||||
/** \brief returns the symbol size for drawing symbols in a key entry with \a keyRect for the symbol, using \a painter and \a parent . \a maxSymbolSizeFracton specifies the maximum fraction of \a keyRect to be used for the symbol. */
|
||||
double getKeySymbolSizePx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent, double maxSymbolSizeFracton=0.9) const;
|
||||
};
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 154 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |