mirror of
https://github.com/OPM/ResInsight.git
synced 2026-07-31 00:38:14 -05:00
#9202 Summary Multi Plot: add option for having the legend inside the plot
This commit is contained in:
committed by
Magne Sjaastad
parent
318f187635
commit
f9f49e9f58
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user