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:
@@ -128,6 +128,7 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
, m_isValid( true )
|
||||
, axisChangedReloadRequired( this )
|
||||
, autoTitleChanged( this )
|
||||
, m_legendPosition( RiuPlotWidget::Legend::BOTTOM )
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" );
|
||||
|
||||
@@ -690,7 +691,14 @@ void RimSummaryPlot::updateLegend()
|
||||
{
|
||||
if ( plotWidget() )
|
||||
{
|
||||
plotWidget()->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() );
|
||||
if ( m_showPlotLegends && !isSubPlot() )
|
||||
{
|
||||
plotWidget()->insertLegend( m_legendPosition );
|
||||
}
|
||||
else
|
||||
{
|
||||
plotWidget()->clearLegend();
|
||||
}
|
||||
|
||||
for ( auto c : summaryCurves() )
|
||||
{
|
||||
@@ -705,6 +713,14 @@ void RimSummaryPlot::updateLegend()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::setLegendPosition( RiuPlotWidget::Legend position )
|
||||
{
|
||||
m_legendPosition = position;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1941,7 +1957,14 @@ void RimSummaryPlot::onLoadDataAndUpdate()
|
||||
|
||||
if ( plotWidget() )
|
||||
{
|
||||
plotWidget()->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() );
|
||||
if ( m_showPlotLegends && !isSubPlot() )
|
||||
{
|
||||
plotWidget()->insertLegend( m_legendPosition );
|
||||
}
|
||||
else
|
||||
{
|
||||
plotWidget()->clearLegend();
|
||||
}
|
||||
plotWidget()->setLegendFontSize( legendFontSize() );
|
||||
plotWidget()->updateLegend();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user