#8522 Summary Plot: ensure plot axis are restore when creating plots.

This commit is contained in:
Kristian Bendiksen 2022-02-18 14:59:35 +01:00
parent 2e6795bd1d
commit bd22336ba8
6 changed files with 28 additions and 2 deletions

View File

@ -2006,6 +2006,11 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
m_summaryPlot = std::make_unique<RiuSummaryQwtPlot>( this, mainWindowParent );
#endif
for ( auto axisProperties : m_axisProperties )
{
plotWidget()->ensureAxis( axisProperties->plotAxisType() );
}
for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves )
{
curve->setParentPlotNoReplot( plotWidget() );

View File

@ -153,6 +153,8 @@ public:
virtual int axisExtent( RiuPlotAxis axis ) const = 0;
virtual void ensureAxis( RiuPlotAxis axis ) = 0;
QPoint dragStartPosition() const;
void scheduleReplot();

View File

@ -860,13 +860,21 @@ void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSerie
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series )
void RiuQtChartsPlotWidget::ensureAxis( RiuPlotAxis axis )
{
// Make sure the axis we are about to set exists.
if ( m_axes.find( axis ) == m_axes.end() )
{
addAxis( axis, true, true );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series )
{
// Make sure the axis we are about to set exists.
ensureAxis( axis );
if ( qtChart()->series().contains( series ) && !series->attachedAxes().contains( plotAxis( axis ) ) )
{

View File

@ -134,6 +134,8 @@ public:
int axisExtent( RiuPlotAxis axis ) const override;
void ensureAxis( RiuPlotAxis axis ) override;
QPoint dragStartPosition() const;
void scheduleReplot();

View File

@ -1048,6 +1048,13 @@ QwtPlot* RiuQwtPlotWidget::qwtPlot() const
return m_plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::ensureAxis( RiuPlotAxis axis )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -131,6 +131,8 @@ public:
int axisExtent( RiuPlotAxis axis ) const override;
void ensureAxis( RiuPlotAxis axis ) override;
QPoint dragStartPosition() const;
void scheduleReplot();