#14891: Add option to use a common legend across summary sub plots

This commit is contained in:
Magne Sjaastad committed 2026-10-22 13:39:05 +02:00
1 parent 6a15c84463
commit 7ed51e1fd5
11 files changed
+207 -5

No files matched your search

@@ -71,6 +71,14 @@ RimMultiPlot::RimMultiPlot()
CAF_PDM_InitField( &m_showIndividualPlotTitles, "ShowPlotTitles", true, "Show Sub Plot Titles" );
CAF_PDM_InitFieldNoDefault( &m_majorTickmarkCount, "MajorTickmarkCount", "Major Tickmark Count" );
CAF_PDM_InitField( &m_useCommonLegend,
"UseCommonLegend",
false,
"Use Common Legend",
"",
"Show one legend above the sub plots, merging identical entries. Useful when all sub plots share the same legend "
"entries." );
CAF_PDM_InitFieldNoDefault( &m_subTitleFontSize, "SubTitleFontSize", "Sub Plot Title Font Size" );
m_subTitleFontSize = caf::FontTools::RelativeSize::Large;
@@ -119,6 +127,7 @@ RimMultiPlot& RimMultiPlot::operator=( RimMultiPlot&& rhs )
m_rowsPerPage = rhs.m_rowsPerPage;
m_showIndividualPlotTitles = rhs.m_showIndividualPlotTitles;
m_subTitleFontSize = rhs.m_subTitleFontSize;
m_useCommonLegend = rhs.m_useCommonLegend;
m_pagePreviewMode = rhs.m_pagePreviewMode;
return *this;
@@ -527,6 +536,14 @@ bool RimMultiPlot::showPlotTitles() const
return m_showIndividualPlotTitles;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimMultiPlot::useCommonLegend() const
{
return m_useCommonLegend();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -706,7 +723,7 @@ void RimMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, co
{
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_showIndividualPlotTitles )
if ( changedField == &m_showIndividualPlotTitles || changedField == &m_useCommonLegend )
{
updateLayout();
}
@@ -100,6 +100,7 @@ public:
void setShowPlotTitles( bool enable );
bool showPlotTitles() const;
bool useCommonLegend() const;
void zoomAll() override;
void zoomAllYAxes();
@@ -166,6 +167,7 @@ protected:
caf::PdmField<ColumnCountEnum> m_columnCount;
caf::PdmField<RowCountEnum> m_rowsPerPage;
caf::PdmField<bool> m_showIndividualPlotTitles;
caf::PdmField<bool> m_useCommonLegend;
RimFontSizeField m_subTitleFontSize;
RimFontSizeField m_axisTitleFontSize;
RimFontSizeField m_axisValueFontSize;
@@ -447,6 +447,7 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
legendsGroup->add( &m_showPlotLegends );
legendsGroup->add( &m_plotLegendsHorizontal );
legendsGroup->add( &m_legendPosition );
legendsGroup->add( &m_useCommonLegend );
legendsGroup->add( &m_legendFontSize );
uiOrdering.skipRemainingFields( true );