#9202 Summary Multi Plot: add option for having the legend inside the plot

This commit is contained in:
Kristian Bendiksen
2022-09-15 08:19:41 +02:00
committed by Magne Sjaastad
parent 318f187635
commit f9f49e9f58
5 changed files with 48 additions and 11 deletions
@@ -169,14 +169,13 @@ void RiuMultiPlotPage::insertPlot( RiuPlotWidget* plotWidget, size_t index )
subTitle->setVisible( false );
m_subTitles.insert( static_cast<int>( index ), subTitle );
plotWidget->clearOverlayFrames();
RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast<RiuQwtPlotWidget*>( plotWidget );
RiuQwtPlotLegend* legend = new RiuQwtPlotLegend( this );
RiuDraggableOverlayFrame* legendFrame = nullptr;
if ( qwtPlotWidget )
{
legendFrame = new RiuDraggableOverlayFrame( qwtPlotWidget->qwtPlot()->canvas(), plotWidget->overlayMargins() );
}
RiuQwtPlotLegend* legend = new RiuQwtPlotLegend( this );
RiuDraggableOverlayFrame* legendFrame =
new RiuDraggableOverlayFrame( plotWidget->getParentForOverlay(), plotWidget->overlayMargins() );
if ( m_plotDefinition->legendsVisible() && plotWidget->plotDefinition()->legendsVisible() )
{
@@ -209,6 +208,8 @@ void RiuMultiPlotPage::insertPlot( RiuPlotWidget* plotWidget, size_t index )
legend->contentsWidget()->layout()->setAlignment( Qt::AlignBottom | Qt::AlignHCenter );
legend->setVisible( false );
legendFrame->setVisible( false );
plotWidget->updateLegend();
}
m_legends.insert( static_cast<int>( index ), legend );
@@ -677,7 +678,6 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
else
{
CAF_ASSERT( m_plotDefinition->legendPosition() == RimPlotWindow::LegendPosition::INSIDE );
auto overlayFrame = new RiuQwtLegendOverlayContentFrame;
overlayFrame->setLegend( legends[visibleIndex] );
legendFrames[visibleIndex]->setContentFrame( overlayFrame );