Fix some issues related to legends in Grid Cross Plots

This commit is contained in:
Gaute Lindkvist 2019-02-26 15:42:58 +01:00
parent 7fa174807e
commit aa5935d5db
3 changed files with 27 additions and 15 deletions

View File

@ -136,8 +136,10 @@ void RimGridCrossPlot::zoomAll()
setAutoZoomForAllAxes(true);
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT);
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM);
updateZoomWindowFromQwt();
m_qwtPlot->replot();
updateZoomWindowFromQwt();
}
//--------------------------------------------------------------------------------------------------
@ -238,8 +240,7 @@ void RimGridCrossPlot::updateZoomWindowFromQwt()
updateAxisFromQwt(RiaDefines::PLOT_AXIS_LEFT);
updateAxisFromQwt(RiaDefines::PLOT_AXIS_BOTTOM);
setAutoZoomForAllAxes(false);
this->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
@ -513,15 +514,6 @@ void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
if (axisProperties->isActive())
{
m_qwtPlot->enableAxis(qwtAxisId, true);
if (axisProperties->isAutoZoom())
{
m_qwtPlot->setAxisAutoScale(qwtAxisId);
}
else
{
m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax);
}
QwtText axisTitle(axisParameterString);
QFont font = m_qwtPlot->axisFont(qwtAxisId);
@ -562,6 +554,16 @@ void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
}
}
if (axisProperties->isAutoZoom())
{
m_qwtPlot->setAxisAutoScale(qwtAxisId);
}
else
{
m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax);
}
}
else
{

View File

@ -92,7 +92,7 @@ protected:
void updateAxisInQwt(RiaDefines::PlotAxis axisType);
void updateAxisFromQwt(RiaDefines::PlotAxis axisType);
std::pair<double, double> getAxisRangeFromData(RiaDefines::PlotAxis axisType);
private:
caf::PdmField<bool> m_showLegend;
caf::PdmField<int> m_legendFontSize;
@ -104,7 +104,7 @@ private:
caf::PdmChildArrayField<RimGridCrossPlotCurveSet*> m_crossPlotCurveSets;
QPointer<RiuQwtPlot> m_qwtPlot;
};

View File

@ -106,7 +106,13 @@ void RimGridCrossPlotCurve::updateZoomInParentPlot()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurve::updateLegendsInPlot()
{
RimGridCrossPlot* plot = nullptr;
this->firstAncestorOrThisOfType(plot);
if (plot)
{
plot->reattachCurvesToQwtAndReplot();
}
RimPlotCurve::updateLegendsInPlot();
}
//--------------------------------------------------------------------------------------------------
@ -137,4 +143,8 @@ void RimGridCrossPlotCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
{
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
RimPlotCurve::appearanceUiOrdering(*appearanceGroup);
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->add(&m_curveName);
nameGroup->add(&m_showLegend);
uiOrdering.skipRemainingFields(true);
}