mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add support for placing legend at several positions
Show legends on top of preview plot
This commit is contained in:
@@ -117,11 +117,10 @@ public:
|
||||
virtual bool plotTitleEnabled() const = 0;
|
||||
virtual void setPlotTitleFontSize( int titleFontSize ) = 0;
|
||||
|
||||
virtual void setLegendFontSize( int fontSize ) = 0;
|
||||
virtual void setInternalLegendVisible( bool visible ) = 0;
|
||||
virtual void insertLegend( RiuPlotWidget::Legend ) = 0;
|
||||
virtual void clearLegend() = 0;
|
||||
virtual void updateLegend() = 0;
|
||||
virtual void setLegendFontSize( int fontSize ) = 0;
|
||||
virtual void insertLegend( RiuPlotWidget::Legend ) = 0;
|
||||
virtual void clearLegend() = 0;
|
||||
virtual void updateLegend() = 0;
|
||||
|
||||
virtual void detachItems( RiuPlotWidget::PlotItemType plotItemType ) = 0;
|
||||
|
||||
|
||||
@@ -287,21 +287,6 @@ void RiuQtChartsPlotWidget::setLegendFontSize( int fontSize )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQtChartsPlotWidget::setInternalLegendVisible( bool visible )
|
||||
{
|
||||
if ( visible )
|
||||
{
|
||||
insertLegend( RiuPlotWidget::Legend::BOTTOM );
|
||||
}
|
||||
else
|
||||
{
|
||||
clearLegend();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -112,7 +112,6 @@ public:
|
||||
void setPlotTitleFontSize( int titleFontSize ) override;
|
||||
|
||||
void setLegendFontSize( int fontSize ) override;
|
||||
void setInternalLegendVisible( bool visible ) override;
|
||||
void insertLegend( RiuPlotWidget::Legend ) override;
|
||||
void clearLegend() override;
|
||||
|
||||
|
||||
@@ -270,22 +270,6 @@ void RiuQwtPlotWidget::setLegendFontSize( int fontSize )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::setInternalLegendVisible( bool visible )
|
||||
{
|
||||
if ( visible )
|
||||
{
|
||||
auto* legend = new QwtLegend( this );
|
||||
m_plot->insertLegend( legend, QwtPlot::BottomLegend );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plot->insertLegend( nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -103,7 +103,6 @@ public:
|
||||
void setPlotTitleFontSize( int titleFontSize ) override;
|
||||
|
||||
void setLegendFontSize( int fontSize ) override;
|
||||
void setInternalLegendVisible( bool visible ) override;
|
||||
void insertLegend( RiuPlotWidget::Legend ) override;
|
||||
void clearLegend() override;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot, QWidget* p
|
||||
RiuQtChartsPlotTools::setCommonPlotBehaviour( m_plotWidget );
|
||||
RiuQtChartsPlotTools::setDefaultAxes( m_plotWidget );
|
||||
|
||||
m_plotWidget->setInternalLegendVisible( true );
|
||||
m_plotWidget->insertLegend( RiuPlotWidget::Legend::BOTTOM );
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
||||
@@ -103,7 +103,7 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*=
|
||||
|
||||
// PERFORMANCE NOTE
|
||||
// Do not set internal legends visible, as this will cause a performance hit.
|
||||
m_plotWidget->setInternalLegendVisible( false );
|
||||
m_plotWidget->clearLegend();
|
||||
|
||||
m_annotationTool = std::unique_ptr<RiuPlotAnnotationTool>( new RiuPlotAnnotationTool() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user