mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2092 Cross Plot : Update bottom axis based on cross plot values
This commit is contained in:
parent
d198ae44ba
commit
57d9ab83a2
@ -97,7 +97,8 @@ namespace RiaDefines
|
|||||||
enum PlotAxis
|
enum PlotAxis
|
||||||
{
|
{
|
||||||
PLOT_AXIS_LEFT,
|
PLOT_AXIS_LEFT,
|
||||||
PLOT_AXIS_RIGHT
|
PLOT_AXIS_RIGHT,
|
||||||
|
PLOT_AXIS_BOTTOM
|
||||||
};
|
};
|
||||||
|
|
||||||
double minimumDefaultValuePlot();
|
double minimumDefaultValuePlot();
|
||||||
|
@ -141,6 +141,7 @@ void RimSummaryAxisProperties::setNameAndAxis(const QString& name, QwtPlot::Axis
|
|||||||
m_axis = axis;
|
m_axis = axis;
|
||||||
|
|
||||||
if (axis == QwtPlot::yRight) this->setUiIcon(QIcon(":/RightAxis16x16.png"));
|
if (axis == QwtPlot::yRight) this->setUiIcon(QIcon(":/RightAxis16x16.png"));
|
||||||
|
if (axis == QwtPlot::xBottom) this->setUiIcon(QIcon(":/BottomAxis16x16.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -157,6 +158,7 @@ QwtPlot::Axis RimSummaryAxisProperties::qwtPlotAxisType() const
|
|||||||
RiaDefines::PlotAxis RimSummaryAxisProperties::plotAxisType() const
|
RiaDefines::PlotAxis RimSummaryAxisProperties::plotAxisType() const
|
||||||
{
|
{
|
||||||
if (m_axis == QwtPlot::yRight) return RiaDefines::PLOT_AXIS_RIGHT;
|
if (m_axis == QwtPlot::yRight) return RiaDefines::PLOT_AXIS_RIGHT;
|
||||||
|
if (m_axis == QwtPlot::xBottom) return RiaDefines::PLOT_AXIS_BOTTOM;
|
||||||
|
|
||||||
return RiaDefines::PLOT_AXIS_LEFT;
|
return RiaDefines::PLOT_AXIS_LEFT;
|
||||||
}
|
}
|
||||||
|
@ -134,8 +134,15 @@ void RimSummaryPlot::updateAxes()
|
|||||||
|
|
||||||
updateZoomInQwt();
|
updateZoomInQwt();
|
||||||
|
|
||||||
|
if (m_isCrossPlot)
|
||||||
|
{
|
||||||
|
updateBottomXAxis();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
updateTimeAxis();
|
updateTimeAxis();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -168,10 +175,17 @@ void RimSummaryPlot::selectAxisInPropertyEditor(int axis)
|
|||||||
plotwindow->selectAsCurrentItem(m_rightYAxisProperties);
|
plotwindow->selectAsCurrentItem(m_rightYAxisProperties);
|
||||||
}
|
}
|
||||||
else if (axis == QwtPlot::xBottom)
|
else if (axis == QwtPlot::xBottom)
|
||||||
|
{
|
||||||
|
if (m_isCrossPlot)
|
||||||
|
{
|
||||||
|
plotwindow->selectAsCurrentItem(m_bottomAxisProperties);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
plotwindow->selectAsCurrentItem(m_timeAxisProperties);
|
plotwindow->selectAsCurrentItem(m_timeAxisProperties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -576,6 +590,21 @@ std::vector<RimSummaryCurve*> RimSummaryPlot::visibleSummaryCurvesForAxis(RiaDef
|
|||||||
{
|
{
|
||||||
std::vector<RimSummaryCurve*> curves;
|
std::vector<RimSummaryCurve*> curves;
|
||||||
|
|
||||||
|
if (plotAxis == RiaDefines::PLOT_AXIS_BOTTOM)
|
||||||
|
{
|
||||||
|
if (m_summaryCurveCollection && m_summaryCurveCollection->isCurvesVisible())
|
||||||
|
{
|
||||||
|
for (RimSummaryCurve* curve : m_summaryCurveCollection->curves())
|
||||||
|
{
|
||||||
|
if (curve->isCurveVisible())
|
||||||
|
{
|
||||||
|
curves.push_back(curve);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for (RimSummaryCurve* curve : m_summaryCurves_OBSOLETE)
|
for (RimSummaryCurve* curve : m_summaryCurves_OBSOLETE)
|
||||||
{
|
{
|
||||||
if (curve->isCurveVisible() && curve->yAxis() == plotAxis)
|
if (curve->isCurveVisible() && curve->yAxis() == plotAxis)
|
||||||
@ -608,6 +637,7 @@ std::vector<RimSummaryCurve*> RimSummaryPlot::visibleSummaryCurvesForAxis(RiaDef
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return curves;
|
return curves;
|
||||||
}
|
}
|
||||||
@ -665,11 +695,14 @@ std::vector<RimGridTimeHistoryCurve*> RimSummaryPlot::visibleTimeHistoryCurvesFo
|
|||||||
|
|
||||||
for (auto c : m_gridTimeHistoryCurves)
|
for (auto c : m_gridTimeHistoryCurves)
|
||||||
{
|
{
|
||||||
if (c->isCurveVisible() && c->yAxis() == plotAxis)
|
if (c->isCurveVisible())
|
||||||
|
{
|
||||||
|
if (c->yAxis() == plotAxis || plotAxis == RiaDefines::PLOT_AXIS_BOTTOM)
|
||||||
{
|
{
|
||||||
curves.push_back(c);
|
curves.push_back(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return curves;
|
return curves;
|
||||||
}
|
}
|
||||||
@ -683,11 +716,14 @@ std::vector<RimAsciiDataCurve*> RimSummaryPlot::visibleAsciiDataCurvesForAxis(Ri
|
|||||||
|
|
||||||
for (auto c : m_asciiDataCurves)
|
for (auto c : m_asciiDataCurves)
|
||||||
{
|
{
|
||||||
if (c->isCurveVisible() && c->yAxis() == plotAxis)
|
if (c->isCurveVisible())
|
||||||
|
{
|
||||||
|
if (c->yAxis() == plotAxis || plotAxis == RiaDefines::PLOT_AXIS_BOTTOM)
|
||||||
{
|
{
|
||||||
curves.push_back(c);
|
curves.push_back(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return curves;
|
return curves;
|
||||||
}
|
}
|
||||||
@ -749,7 +785,35 @@ void RimSummaryPlot::updateTimeAxis()
|
|||||||
timeAxisFont.setPixelSize(m_timeAxisProperties->fontSize);
|
timeAxisFont.setPixelSize(m_timeAxisProperties->fontSize);
|
||||||
m_qwtPlot->setAxisFont(QwtPlot::xBottom, timeAxisFont);
|
m_qwtPlot->setAxisFont(QwtPlot::xBottom, timeAxisFont);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::updateBottomXAxis()
|
||||||
|
{
|
||||||
|
if (!m_qwtPlot) return;
|
||||||
|
|
||||||
|
QwtPlot::Axis qwtAxis = QwtPlot::xBottom;
|
||||||
|
|
||||||
|
RimSummaryAxisProperties* yAxisProperties = m_bottomAxisProperties();
|
||||||
|
|
||||||
|
if (yAxisProperties->isActive())
|
||||||
|
{
|
||||||
|
m_qwtPlot->enableAxis(qwtAxis, true);
|
||||||
|
|
||||||
|
std::set<QString> timeHistoryQuantities;
|
||||||
|
|
||||||
|
RimSummaryPlotYAxisFormatter calc(yAxisProperties,
|
||||||
|
visibleSummaryCurvesForAxis(RiaDefines::PLOT_AXIS_BOTTOM),
|
||||||
|
visibleAsciiDataCurvesForAxis(RiaDefines::PLOT_AXIS_BOTTOM),
|
||||||
|
timeHistoryQuantities);
|
||||||
|
calc.applyYAxisPropertiesToPlot(m_qwtPlot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_qwtPlot->enableAxis(qwtAxis, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -788,9 +852,18 @@ void RimSummaryPlot::setZoomWindow(const QwtInterval& leftAxis, const QwtInterva
|
|||||||
m_rightYAxisProperties->visibleRangeMin = rightAxis.minValue();
|
m_rightYAxisProperties->visibleRangeMin = rightAxis.minValue();
|
||||||
m_rightYAxisProperties->updateConnectedEditors();
|
m_rightYAxisProperties->updateConnectedEditors();
|
||||||
|
|
||||||
|
if (m_isCrossPlot)
|
||||||
|
{
|
||||||
|
m_bottomAxisProperties->visibleRangeMax = timeAxis.maxValue();
|
||||||
|
m_bottomAxisProperties->visibleRangeMin = timeAxis.minValue();
|
||||||
|
m_bottomAxisProperties->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_timeAxisProperties->setVisibleRangeMin(timeAxis.minValue());
|
m_timeAxisProperties->setVisibleRangeMin(timeAxis.minValue());
|
||||||
m_timeAxisProperties->setVisibleRangeMax(timeAxis.maxValue());
|
m_timeAxisProperties->setVisibleRangeMax(timeAxis.maxValue());
|
||||||
m_timeAxisProperties->updateConnectedEditors();
|
m_timeAxisProperties->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
disableAutoZoom();
|
disableAutoZoom();
|
||||||
}
|
}
|
||||||
@ -1017,13 +1090,13 @@ void RimSummaryPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
|||||||
{
|
{
|
||||||
caf::PdmUiTreeOrdering* axisFolder = uiTreeOrdering.add("Axes", ":/Axes16x16.png");
|
caf::PdmUiTreeOrdering* axisFolder = uiTreeOrdering.add("Axes", ":/Axes16x16.png");
|
||||||
|
|
||||||
if (!m_isCrossPlot)
|
if (m_isCrossPlot)
|
||||||
{
|
{
|
||||||
axisFolder->add(&m_timeAxisProperties);
|
axisFolder->add(&m_bottomAxisProperties);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
axisFolder->add(&m_bottomAxisProperties);
|
axisFolder->add(&m_timeAxisProperties);
|
||||||
}
|
}
|
||||||
axisFolder->add(&m_leftYAxisProperties);
|
axisFolder->add(&m_leftYAxisProperties);
|
||||||
axisFolder->add(&m_rightYAxisProperties);
|
axisFolder->add(&m_rightYAxisProperties);
|
||||||
@ -1102,8 +1175,17 @@ void RimSummaryPlot::setZoomIntervalsInQwtPlot()
|
|||||||
left.setMaxValue(m_leftYAxisProperties->visibleRangeMax());
|
left.setMaxValue(m_leftYAxisProperties->visibleRangeMax());
|
||||||
right.setMinValue(m_rightYAxisProperties->visibleRangeMin());
|
right.setMinValue(m_rightYAxisProperties->visibleRangeMin());
|
||||||
right.setMaxValue(m_rightYAxisProperties->visibleRangeMax());
|
right.setMaxValue(m_rightYAxisProperties->visibleRangeMax());
|
||||||
|
|
||||||
|
if (m_isCrossPlot)
|
||||||
|
{
|
||||||
|
time.setMinValue(m_bottomAxisProperties->visibleRangeMin());
|
||||||
|
time.setMaxValue(m_bottomAxisProperties->visibleRangeMax());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
time.setMinValue(m_timeAxisProperties->visibleRangeMin());
|
time.setMinValue(m_timeAxisProperties->visibleRangeMin());
|
||||||
time.setMaxValue(m_timeAxisProperties->visibleRangeMax());
|
time.setMaxValue(m_timeAxisProperties->visibleRangeMax());
|
||||||
|
}
|
||||||
|
|
||||||
m_qwtPlot->setZoomWindow(left, right, time);
|
m_qwtPlot->setZoomWindow(left, right, time);
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,7 @@ private:
|
|||||||
void updateZoomForAxis(RiaDefines::PlotAxis plotAxis);
|
void updateZoomForAxis(RiaDefines::PlotAxis plotAxis);
|
||||||
|
|
||||||
void updateTimeAxis();
|
void updateTimeAxis();
|
||||||
|
void updateBottomXAxis();
|
||||||
void setZoomIntervalsInQwtPlot();
|
void setZoomIntervalsInQwtPlot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user