diff --git a/src/Charts/GenericPlot.cpp b/src/Charts/GenericPlot.cpp index 66b694d28d..897bb8b09e 100644 --- a/src/Charts/GenericPlot.cpp +++ b/src/Charts/GenericPlot.cpp @@ -654,7 +654,9 @@ GenericPlot::finaliseChart() case GenericAxisInfo::TIME: // TODO case GenericAxisInfo::CONTINUOUS: { - QValueAxis *vaxis= new QValueAxis(qchart); + QAbstractAxis *vaxis=NULL; + if (axisinfo->log) vaxis= new QLogValueAxis(qchart); + else vaxis= new QValueAxis(qchart); add=vaxis; // gets added later vaxis->setMin(axisinfo->min()); @@ -745,8 +747,9 @@ GenericPlot::finaliseChart() // look for first series with a horizontal axis (we will use this later) foreach(QAbstractAxis *axis, series->attachedAxes()) { - if (axis->orientation() == Qt::Horizontal && axis->type()==QAbstractAxis::AxisTypeValue) { - legend->addX(static_cast(axis)->titleText()); + if (axis->orientation() == Qt::Horizontal) { + if (axis->type()==QAbstractAxis::AxisTypeValue) legend->addX(static_cast(axis)->titleText()); + else if (axis->type()==QAbstractAxis::AxisTypeLogValue) legend->addX(static_cast(axis)->titleText()); havexaxis=true; break; } diff --git a/src/Charts/GenericSelectTool.cpp b/src/Charts/GenericSelectTool.cpp index b11af56e00..34d25ab58b 100644 --- a/src/Charts/GenericSelectTool.cpp +++ b/src/Charts/GenericSelectTool.cpp @@ -213,19 +213,18 @@ void GenericSelectTool::paint(QPainter*painter, const QStyleOptionGraphicsItem * if (calc.series->isVisible() == false) continue; - // slope calcs way over the top for a line chart - // where there are multiple series being plotted - if (host->charttype == GC_CHART_SCATTER) { - QString lr=QString("y = %1 x + %2").arg(calc.m).arg(calc.b); - QPen line(calc.color); - painter->setPen(line); - painter->drawText(QPointF(0,0), lr); - } - - // slope if (calc.xaxis != NULL) { - if (calc.xaxis->type() == QAbstractAxis::AxisTypeValue) { //XXX todo for log date etc? + if (calc.xaxis->type() == QAbstractAxis::AxisTypeValue) { + + // slope calcs way over the top for a line chart + // where there are multiple series being plotted + if (host->charttype == GC_CHART_SCATTER) { + QString lr=QString("y = %1 x + %2").arg(calc.m).arg(calc.b); + QPen line(calc.color); + painter->setPen(line); + painter->drawText(QPointF(0,0), lr); + } double startx = static_cast(calc.xaxis)->min(); double stopx = static_cast(calc.xaxis)->max();