mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#8794 Multi Axes: Highlight relevant axes
This commit is contained in:
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include "cafAssert.h"
|
#include "cafAssert.h"
|
||||||
|
|
||||||
|
#include "qwt_axis.h"
|
||||||
#include "qwt_date_scale_engine.h"
|
#include "qwt_date_scale_engine.h"
|
||||||
#include "qwt_legend.h"
|
#include "qwt_legend.h"
|
||||||
#include "qwt_legend_label.h"
|
#include "qwt_legend_label.h"
|
||||||
@@ -986,6 +987,7 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set<const QwtPlotItem*>& c
|
|||||||
if ( closestItems.count( plotCurve ) > 0 )
|
if ( closestItems.count( plotCurve ) > 0 )
|
||||||
{
|
{
|
||||||
plotCurve->setZ( zValue + 100.0 );
|
plotCurve->setZ( zValue + 100.0 );
|
||||||
|
highlightPlotAxes( plotCurve->xAxis(), plotCurve->yAxis() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1057,6 +1059,36 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting()
|
|||||||
}
|
}
|
||||||
m_originalCurveColors.clear();
|
m_originalCurveColors.clear();
|
||||||
m_originalZValues.clear();
|
m_originalZValues.clear();
|
||||||
|
|
||||||
|
resetPlotAxisHighlighting();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuQwtPlotWidget::resetPlotAxisHighlighting()
|
||||||
|
{
|
||||||
|
// Reset axis widgets highlighting
|
||||||
|
std::vector<QwtAxis::Position> axisPositions = { QwtAxis::Position::YLeft,
|
||||||
|
QwtAxis::Position::YRight,
|
||||||
|
QwtAxis::Position::XTop,
|
||||||
|
QwtAxis::Position::XBottom };
|
||||||
|
|
||||||
|
// Use text color from theme
|
||||||
|
QColor textColor = RiuGuiTheme::getColorByVariableName( "text-color" );
|
||||||
|
QString style =
|
||||||
|
QString( "color: rgb(%1, %2, %3);" ).arg( textColor.red() ).arg( textColor.green() ).arg( textColor.blue() );
|
||||||
|
|
||||||
|
for ( auto pos : axisPositions )
|
||||||
|
{
|
||||||
|
int count = m_plot->axesCount( pos );
|
||||||
|
for ( int i = 0; i < count; i++ )
|
||||||
|
{
|
||||||
|
QwtAxisId axisId( pos, i );
|
||||||
|
auto axisWidget = m_plot->axisWidget( axisId );
|
||||||
|
axisWidget->setStyleSheet( style );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1083,6 +1115,33 @@ void RiuQwtPlotWidget::highlightPlotItemsForQwtAxis( QwtAxisId axisId )
|
|||||||
highlightPlotItems( plotItems );
|
highlightPlotItems( plotItems );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuQwtPlotWidget::highlightPlotAxes( QwtAxisId axisIdX, QwtAxisId axisIdY )
|
||||||
|
{
|
||||||
|
std::vector<QwtAxis::Position> axisPositions = { QwtAxis::Position::YLeft,
|
||||||
|
QwtAxis::Position::YRight,
|
||||||
|
QwtAxis::Position::XTop,
|
||||||
|
QwtAxis::Position::XBottom };
|
||||||
|
|
||||||
|
// Highlight selected axis by toning down the others in same dimension
|
||||||
|
for ( auto pos : axisPositions )
|
||||||
|
{
|
||||||
|
int count = m_plot->axesCount( pos );
|
||||||
|
for ( int i = 0; i < count; i++ )
|
||||||
|
{
|
||||||
|
QwtAxisId axisId( pos, i );
|
||||||
|
|
||||||
|
if ( axisId != axisIdX && axisId != axisIdY )
|
||||||
|
{
|
||||||
|
auto axisWidget = m_plot->axisWidget( axisId );
|
||||||
|
axisWidget->setStyleSheet( "color: gray" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -208,9 +208,11 @@ private:
|
|||||||
static int defaultMinimumWidth();
|
static int defaultMinimumWidth();
|
||||||
void replot() override;
|
void replot() override;
|
||||||
|
|
||||||
|
void highlightPlotAxes( QwtAxisId axisIdX, QwtAxisId axisIdY );
|
||||||
void highlightPlotItemsForQwtAxis( QwtAxisId axisId );
|
void highlightPlotItemsForQwtAxis( QwtAxisId axisId );
|
||||||
void highlightPlotItems( const std::set<const QwtPlotItem*>& closestItems );
|
void highlightPlotItems( const std::set<const QwtPlotItem*>& closestItems );
|
||||||
void resetPlotItemHighlighting();
|
void resetPlotItemHighlighting();
|
||||||
|
void resetPlotAxisHighlighting();
|
||||||
void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection );
|
void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection );
|
||||||
void recalculateAxisExtents( RiuPlotAxis axis );
|
void recalculateAxisExtents( RiuPlotAxis axis );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user