mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Summary Plot: Add support for multiple plot axis.
This commit is contained in:
committed by
Magne Sjaastad
parent
a3ad9d2c1e
commit
e92e2e8764
@@ -278,7 +278,7 @@ RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot*
|
|||||||
newCurve->setSummaryCaseY( gridSummaryCase );
|
newCurve->setSummaryCaseY( gridSummaryCase );
|
||||||
newCurve->setSummaryAddressYAndApplyInterpolation( addr );
|
newCurve->setSummaryAddressYAndApplyInterpolation( addr );
|
||||||
newCurve->setColor( color );
|
newCurve->setColor( color );
|
||||||
newCurve->setLeftOrRightAxisY( plotAxis );
|
newCurve->setLeftOrRightAxisY( RiuPlotAxis( plotAxis ) );
|
||||||
newCurve->loadDataAndUpdate( true );
|
newCurve->loadDataAndUpdate( true );
|
||||||
|
|
||||||
return newCurve;
|
return newCurve;
|
||||||
|
|||||||
@@ -56,15 +56,15 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered( bool isChecked )
|
|||||||
|
|
||||||
for ( RimSummaryCurve* summaryCurve : summaryCurves )
|
for ( RimSummaryCurve* summaryCurve : summaryCurves )
|
||||||
{
|
{
|
||||||
RiaDefines::PlotAxis plotAxis = summaryCurve->axisY();
|
RiaDefines::PlotAxis plotAxis = summaryCurve->axisY().axis();
|
||||||
|
|
||||||
if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
||||||
{
|
{
|
||||||
summaryCurve->setLeftOrRightAxisY( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
summaryCurve->setLeftOrRightAxisY( RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
summaryCurve->setLeftOrRightAxisY( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
summaryCurve->setLeftOrRightAxisY( RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
summaryCurve->updatePlotAxis();
|
summaryCurve->updatePlotAxis();
|
||||||
@@ -77,9 +77,9 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered( bool isChecked )
|
|||||||
|
|
||||||
for ( RimAsciiDataCurve* asciiCurve : asciiDataCurves )
|
for ( RimAsciiDataCurve* asciiCurve : asciiDataCurves )
|
||||||
{
|
{
|
||||||
RiaDefines::PlotAxis plotAxis = asciiCurve->yAxis();
|
RiuPlotAxis plotAxis = asciiCurve->yAxis();
|
||||||
|
|
||||||
if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
if ( plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
||||||
{
|
{
|
||||||
asciiCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
asciiCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
||||||
}
|
}
|
||||||
@@ -98,9 +98,9 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered( bool isChecked )
|
|||||||
|
|
||||||
for ( RimGridTimeHistoryCurve* timeHistoryCurve : gridTimeHistoryCurves )
|
for ( RimGridTimeHistoryCurve* timeHistoryCurve : gridTimeHistoryCurves )
|
||||||
{
|
{
|
||||||
RiaDefines::PlotAxis plotAxis = timeHistoryCurve->yAxis();
|
RiuPlotAxis plotAxis = timeHistoryCurve->yAxis();
|
||||||
|
|
||||||
if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
if ( plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
||||||
{
|
{
|
||||||
timeHistoryCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
timeHistoryCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -713,7 +713,8 @@ void RicSummaryPlotEditorUi::copyCurveAndAddToPlot( const RimSummaryCurve* curve
|
|||||||
curveCopy->setCurveVisibility( true );
|
curveCopy->setCurveVisibility( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
plot->addCurveNoUpdate( curveCopy );
|
plot->addCurveNoUpdate( curveCopy, false );
|
||||||
|
curveCopy->setLeftOrRightAxisY( curve->axisY() );
|
||||||
|
|
||||||
// The curve creator is not a descendant of the project, and need to be set manually
|
// The curve creator is not a descendant of the project, and need to be set manually
|
||||||
curveCopy->setSummaryCaseY( curve->summaryCaseY() );
|
curveCopy->setSummaryCaseY( curve->summaryCaseY() );
|
||||||
|
|||||||
@@ -873,22 +873,22 @@ void RimAnalysisPlot::updateAxes()
|
|||||||
{
|
{
|
||||||
if ( !m_plotWidget ) return;
|
if ( !m_plotWidget ) return;
|
||||||
|
|
||||||
RiaDefines::PlotAxis axis = RiaDefines::PlotAxis::PLOT_AXIS_LEFT;
|
RiuPlotAxis axis = RiuPlotAxis::defaultLeft();
|
||||||
if ( m_barOrientation == BARS_HORIZONTAL )
|
if ( m_barOrientation == BARS_HORIZONTAL )
|
||||||
{
|
{
|
||||||
axis = RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM;
|
axis = RiuPlotAxis::defaultBottom();
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, false );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, false );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
RimPlotAxisProperties* valAxisProperties = m_valueAxisProperties();
|
RimPlotAxisProperties* valAxisProperties = m_valueAxisProperties();
|
||||||
if ( valAxisProperties->isActive() )
|
if ( valAxisProperties->isActive() )
|
||||||
{
|
{
|
||||||
m_plotWidget->enableAxis( axis, true );
|
m_plotWidget->enableAxis( axis, true );
|
||||||
m_valueAxisProperties->setNameAndAxis( "Value-Axis", axis );
|
m_valueAxisProperties->setNameAndAxis( "Value-Axis", axis.axis() );
|
||||||
|
|
||||||
RimSummaryPlotAxisFormatter calc( valAxisProperties, {}, curveDefinitions(), {}, {} );
|
RimSummaryPlotAxisFormatter calc( valAxisProperties, {}, curveDefinitions(), {}, {} );
|
||||||
calc.applyAxisPropertiesToPlot( m_plotWidget );
|
calc.applyAxisPropertiesToPlot( m_plotWidget );
|
||||||
|
|||||||
@@ -402,16 +402,16 @@ void RimCorrelationMatrixPlot::updateAxes()
|
|||||||
|
|
||||||
m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::yLeft, new TextScaleDraw( m_resultLabels ) );
|
m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::yLeft, new TextScaleDraw( m_resultLabels ) );
|
||||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine );
|
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine );
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "Result Vector" );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), "Result Vector" );
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true );
|
||||||
m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(),
|
||||||
axisTitleFontSize(),
|
axisTitleFontSize(),
|
||||||
axisValueFontSize(),
|
axisValueFontSize(),
|
||||||
false,
|
false,
|
||||||
Qt::AlignCenter );
|
Qt::AlignCenter );
|
||||||
m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true, false );
|
m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultLeft(), true, false );
|
||||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0.0, (double)m_resultLabels.size() + 1 );
|
m_plotWidget->setAxisRange( RiuPlotAxis::defaultLeft(), 0.0, (double)m_resultLabels.size() + 1 );
|
||||||
m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis::defaultLeft(),
|
||||||
1.0,
|
1.0,
|
||||||
0.0,
|
0.0,
|
||||||
0.5,
|
0.5,
|
||||||
@@ -423,16 +423,16 @@ void RimCorrelationMatrixPlot::updateAxes()
|
|||||||
scaleDraw->setLabelRotation( 30.0 );
|
scaleDraw->setLabelRotation( 30.0 );
|
||||||
m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::xBottom, scaleDraw );
|
m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::xBottom, scaleDraw );
|
||||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine );
|
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine );
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Ensemble Parameter" );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "Ensemble Parameter" );
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true );
|
||||||
m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM,
|
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(),
|
||||||
axisTitleFontSize(),
|
axisTitleFontSize(),
|
||||||
axisValueFontSize(),
|
axisValueFontSize(),
|
||||||
false,
|
false,
|
||||||
Qt::AlignCenter | Qt::AlignTop );
|
Qt::AlignCenter | Qt::AlignTop );
|
||||||
m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true, false );
|
m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultBottom(), true, false );
|
||||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0.0, (double)m_paramLabels.size() + 1 );
|
m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), 0.0, (double)m_paramLabels.size() + 1 );
|
||||||
m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM,
|
m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis::defaultBottom(),
|
||||||
1.0,
|
1.0,
|
||||||
0.0,
|
0.0,
|
||||||
0.5,
|
0.5,
|
||||||
|
|||||||
@@ -206,30 +206,30 @@ void RimCorrelationPlot::updateAxes()
|
|||||||
{
|
{
|
||||||
if ( !m_plotWidget ) return;
|
if ( !m_plotWidget ) return;
|
||||||
|
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "Parameter" );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), "Parameter" );
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true );
|
||||||
m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(),
|
||||||
axisTitleFontSize(),
|
axisTitleFontSize(),
|
||||||
axisValueFontSize(),
|
axisValueFontSize(),
|
||||||
false,
|
false,
|
||||||
Qt::AlignCenter );
|
Qt::AlignCenter );
|
||||||
|
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Pearson Correlation Coefficient" );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "Pearson Correlation Coefficient" );
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true );
|
||||||
m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM,
|
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(),
|
||||||
axisTitleFontSize(),
|
axisTitleFontSize(),
|
||||||
axisValueFontSize(),
|
axisValueFontSize(),
|
||||||
false,
|
false,
|
||||||
Qt::AlignCenter );
|
Qt::AlignCenter );
|
||||||
if ( m_showAbsoluteValues )
|
if ( m_showAbsoluteValues )
|
||||||
{
|
{
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Pearson Correlation Coefficient ABS" );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "Pearson Correlation Coefficient ABS" );
|
||||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0.0, 1.0 );
|
m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), 0.0, 1.0 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Pearson Correlation Coefficient" );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "Pearson Correlation Coefficient" );
|
||||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, -1.0, 1.0 );
|
m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), -1.0, 1.0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,29 +188,29 @@ void RimParameterResultCrossPlot::updateAxes()
|
|||||||
{
|
{
|
||||||
if ( !m_plotWidget ) return;
|
if ( !m_plotWidget ) return;
|
||||||
|
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, completeAddressText() );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), completeAddressText() );
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true );
|
||||||
m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(),
|
||||||
axisTitleFontSize(),
|
axisTitleFontSize(),
|
||||||
axisValueFontSize(),
|
axisValueFontSize(),
|
||||||
false,
|
false,
|
||||||
Qt::AlignCenter );
|
Qt::AlignCenter );
|
||||||
|
|
||||||
double yRangeWidth = m_yRange.second - m_yRange.first;
|
double yRangeWidth = m_yRange.second - m_yRange.first;
|
||||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
m_plotWidget->setAxisRange( RiuPlotAxis::defaultLeft(),
|
||||||
m_yRange.first - yRangeWidth * 0.1,
|
m_yRange.first - yRangeWidth * 0.1,
|
||||||
m_yRange.second + yRangeWidth * 0.1 );
|
m_yRange.second + yRangeWidth * 0.1 );
|
||||||
|
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_ensembleParameter );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), m_ensembleParameter );
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true );
|
||||||
m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM,
|
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(),
|
||||||
axisTitleFontSize(),
|
axisTitleFontSize(),
|
||||||
axisValueFontSize(),
|
axisValueFontSize(),
|
||||||
false,
|
false,
|
||||||
Qt::AlignCenter );
|
Qt::AlignCenter );
|
||||||
|
|
||||||
double xRangeWidth = m_xRange.second - m_xRange.first;
|
double xRangeWidth = m_xRange.second - m_xRange.first;
|
||||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM,
|
m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(),
|
||||||
m_xRange.first - xRangeWidth * 0.1,
|
m_xRange.first - xRangeWidth * 0.1,
|
||||||
m_xRange.second + xRangeWidth * 0.1 );
|
m_xRange.second + xRangeWidth * 0.1 );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -376,10 +376,10 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
|
|||||||
QString( "%1 Distribution: %2, %3" ).arg( phaseString ).arg( m_wellName ).arg( timeStepName );
|
QString( "%1 Distribution: %2, %3" ).arg( phaseString ).arg( m_wellName ).arg( timeStepName );
|
||||||
m_plotWidget->setPlotTitle( plotTitleStr );
|
m_plotWidget->setPlotTitle( plotTitleStr );
|
||||||
|
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "TOF [years]" );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "TOF [years]" );
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "Reservoir Volume [m3]" );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), "Reservoir Volume [m3]" );
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true );
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true );
|
||||||
|
|
||||||
m_plotWidget->scheduleReplot();
|
m_plotWidget->scheduleReplot();
|
||||||
}
|
}
|
||||||
@@ -398,10 +398,10 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD
|
|||||||
const double baseCurveZValue = 9.5;
|
const double baseCurveZValue = 9.5;
|
||||||
|
|
||||||
plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||||
plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0, 1 );
|
plotWidget->setAxisScale( RiuPlotAxis::defaultBottom(), 0, 1 );
|
||||||
plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0, 1 );
|
plotWidget->setAxisScale( RiuPlotAxis::defaultLeft(), 0, 1 );
|
||||||
plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
plotWidget->setAxisAutoScale( RiuPlotAxis::defaultBottom(), true );
|
||||||
plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
plotWidget->setAxisAutoScale( RiuPlotAxis::defaultLeft(), true );
|
||||||
|
|
||||||
const std::vector<double>& tofValuesDays = calculator.sortedUniqueTofValues();
|
const std::vector<double>& tofValuesDays = calculator.sortedUniqueTofValues();
|
||||||
if ( tofValuesDays.size() == 0 )
|
if ( tofValuesDays.size() == 0 )
|
||||||
|
|||||||
@@ -641,10 +641,10 @@ void RimGridCrossPlot::swapAxes()
|
|||||||
RimPlotAxisProperties* xAxisProperties = m_xAxisProperties();
|
RimPlotAxisProperties* xAxisProperties = m_xAxisProperties();
|
||||||
RimPlotAxisProperties* yAxisProperties = m_yAxisProperties();
|
RimPlotAxisProperties* yAxisProperties = m_yAxisProperties();
|
||||||
|
|
||||||
QString tmpName = xAxisProperties->name();
|
QString tmpName = xAxisProperties->name();
|
||||||
RiaDefines::PlotAxis tmpAxis = xAxisProperties->plotAxisType();
|
RiuPlotAxis tmpAxis = xAxisProperties->plotAxisType();
|
||||||
xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->plotAxisType() );
|
xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->plotAxisType().axis() );
|
||||||
yAxisProperties->setNameAndAxis( tmpName, tmpAxis );
|
yAxisProperties->setNameAndAxis( tmpName, tmpAxis.axis() );
|
||||||
|
|
||||||
m_xAxisProperties.removeChildObject( xAxisProperties );
|
m_xAxisProperties.removeChildObject( xAxisProperties );
|
||||||
m_yAxisProperties.removeChildObject( yAxisProperties );
|
m_yAxisProperties.removeChildObject( yAxisProperties );
|
||||||
@@ -851,7 +851,7 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
|
|||||||
axisParameterString = yAxisParameterString();
|
axisParameterString = yAxisParameterString();
|
||||||
}
|
}
|
||||||
|
|
||||||
RiaDefines::PlotAxis axis = axisProperties->plotAxisType();
|
RiuPlotAxis axis = axisProperties->plotAxisType();
|
||||||
if ( axisProperties->isActive() )
|
if ( axisProperties->isActive() )
|
||||||
{
|
{
|
||||||
m_plotWidget->enableAxis( axis, true );
|
m_plotWidget->enableAxis( axis, true );
|
||||||
@@ -869,7 +869,7 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
|
|||||||
m_plotWidget->setAxisTitleText( axis, axisParameterString );
|
m_plotWidget->setAxisTitleText( axis, axisParameterString );
|
||||||
m_plotWidget->setAxisTitleEnabled( axis, true );
|
m_plotWidget->setAxisTitleEnabled( axis, true );
|
||||||
|
|
||||||
if ( axisProperties->isLogarithmicScaleEnabled )
|
if ( axisProperties->isLogarithmicScaleEnabled() )
|
||||||
{
|
{
|
||||||
bool isLogScale = m_plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC;
|
bool isLogScale = m_plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC;
|
||||||
if ( !isLogScale )
|
if ( !isLogScale )
|
||||||
@@ -878,12 +878,12 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
|
|||||||
m_plotWidget->setAxisMaxMinor( axis, 5 );
|
m_plotWidget->setAxisMaxMinor( axis, 5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
double min = axisProperties->visibleRangeMin;
|
double min = axisProperties->visibleRangeMin();
|
||||||
double max = axisProperties->visibleRangeMax;
|
double max = axisProperties->visibleRangeMax();
|
||||||
if ( axisProperties->isAutoZoom() )
|
if ( axisProperties->isAutoZoom() )
|
||||||
{
|
{
|
||||||
std::vector<const RimPlotCurve*> plotCurves = visibleCurves();
|
std::vector<const RimPlotCurve*> plotCurves = visibleCurves();
|
||||||
RimPlotAxisLogRangeCalculator logRangeCalculator( axis, plotCurves );
|
RimPlotAxisLogRangeCalculator logRangeCalculator( axis.axis(), plotCurves );
|
||||||
logRangeCalculator.computeAxisRange( &min, &max );
|
logRangeCalculator.computeAxisRange( &min, &max );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -909,8 +909,8 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double min = axisProperties->visibleRangeMin;
|
double min = axisProperties->visibleRangeMin();
|
||||||
double max = axisProperties->visibleRangeMax;
|
double max = axisProperties->visibleRangeMax();
|
||||||
if ( axisProperties->isAxisInverted() )
|
if ( axisProperties->isAxisInverted() )
|
||||||
{
|
{
|
||||||
std::swap( min, max );
|
std::swap( min, max );
|
||||||
@@ -933,7 +933,7 @@ void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType )
|
|||||||
{
|
{
|
||||||
if ( !m_plotWidget ) return;
|
if ( !m_plotWidget ) return;
|
||||||
|
|
||||||
auto [xAxisRangeMin, xAxisRangeMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
|
auto [xAxisRangeMin, xAxisRangeMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultBottom() );
|
||||||
|
|
||||||
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
|
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
|
||||||
double axisRangeMin = xAxisRangeMin;
|
double axisRangeMin = xAxisRangeMin;
|
||||||
@@ -942,14 +942,14 @@ void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType )
|
|||||||
if ( axisType == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
if ( axisType == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
||||||
{
|
{
|
||||||
axisProperties = m_yAxisProperties();
|
axisProperties = m_yAxisProperties();
|
||||||
auto [yAxisRangeMin, yAxisRangeMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
auto [yAxisRangeMin, yAxisRangeMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultLeft() );
|
||||||
|
|
||||||
axisRangeMin = yAxisRangeMin;
|
axisRangeMin = yAxisRangeMin;
|
||||||
axisRangeMax = yAxisRangeMax;
|
axisRangeMax = yAxisRangeMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
axisProperties->visibleRangeMin = std::min( axisRangeMin, axisRangeMax );
|
axisProperties->setVisibleRangeMin( std::min( axisRangeMin, axisRangeMax ) );
|
||||||
axisProperties->visibleRangeMax = std::max( axisRangeMin, axisRangeMax );
|
axisProperties->setVisibleRangeMax( std::max( axisRangeMin, axisRangeMax ) );
|
||||||
|
|
||||||
axisProperties->updateConnectedEditors();
|
axisProperties->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ void RimSaturationPressurePlot::assignCaseAndEquilibriumRegion( RiaDefines::Poro
|
|||||||
}
|
}
|
||||||
|
|
||||||
RimPlotAxisProperties* yAxisProps = yAxisProperties();
|
RimPlotAxisProperties* yAxisProps = yAxisProperties();
|
||||||
yAxisProps->setInvertedAxis( true );
|
yAxisProps->setAxisInverted( true );
|
||||||
|
|
||||||
{
|
{
|
||||||
RimEquilibriumAxisAnnotation* annotation = new RimEquilibriumAxisAnnotation;
|
RimEquilibriumAxisAnnotation* annotation = new RimEquilibriumAxisAnnotation;
|
||||||
|
|||||||
@@ -189,9 +189,9 @@ RigGridCellResultAddress RimGridTimeHistoryCurve::resultAddress()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaDefines::PlotAxis RimGridTimeHistoryCurve::yAxis() const
|
RiuPlotAxis RimGridTimeHistoryCurve::yAxis() const
|
||||||
{
|
{
|
||||||
return m_plotAxis();
|
return RiuPlotAxis( m_plotAxis() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -408,7 +408,7 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
|||||||
|
|
||||||
RimSummaryPlot* plot = nullptr;
|
RimSummaryPlot* plot = nullptr;
|
||||||
firstAncestorOrThisOfType( plot );
|
firstAncestorOrThisOfType( plot );
|
||||||
bool isLogCurve = plot->isLogarithmicScaleEnabled( this->yAxis() );
|
bool isLogCurve = plot->isLogarithmicScaleEnabled( yAxis() );
|
||||||
|
|
||||||
if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE )
|
if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,15 +53,15 @@ public:
|
|||||||
RimGridTimeHistoryCurve();
|
RimGridTimeHistoryCurve();
|
||||||
~RimGridTimeHistoryCurve() override;
|
~RimGridTimeHistoryCurve() override;
|
||||||
|
|
||||||
void setFromSelectionItem( const RiuSelectionItem* selectionItem );
|
void setFromSelectionItem( const RiuSelectionItem* selectionItem );
|
||||||
void setFromEclipseCellAndResult( RimEclipseCase* eclCase,
|
void setFromEclipseCellAndResult( RimEclipseCase* eclCase,
|
||||||
size_t gridIdx,
|
size_t gridIdx,
|
||||||
size_t i,
|
size_t i,
|
||||||
size_t j,
|
size_t j,
|
||||||
size_t k,
|
size_t k,
|
||||||
const RigEclipseResultAddress& resAddr );
|
const RigEclipseResultAddress& resAddr );
|
||||||
RiaDefines::PlotAxis yAxis() const;
|
RiuPlotAxis yAxis() const;
|
||||||
void setYAxis( RiaDefines::PlotAxis plotAxis );
|
void setYAxis( RiaDefines::PlotAxis plotAxis );
|
||||||
|
|
||||||
std::vector<double> yValues() const;
|
std::vector<double> yValues() const;
|
||||||
std::vector<time_t> timeStepValues() const;
|
std::vector<time_t> timeStepValues() const;
|
||||||
|
|||||||
@@ -70,17 +70,21 @@ RimPlotAxisProperties::RimPlotAxisProperties()
|
|||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &customTitle, "CustomTitle", "Title" );
|
CAF_PDM_InitFieldNoDefault( &customTitle, "CustomTitle", "Title" );
|
||||||
|
|
||||||
CAF_PDM_InitField( &visibleRangeMax, "VisibleRangeMax", RiaDefines::maximumDefaultValuePlot(), "Max" );
|
CAF_PDM_InitField( &m_visibleRangeMax, "VisibleRangeMax", RiaDefines::maximumDefaultValuePlot(), "Max" );
|
||||||
CAF_PDM_InitField( &visibleRangeMin, "VisibleRangeMin", RiaDefines::minimumDefaultValuePlot(), "Min" );
|
CAF_PDM_InitField( &m_visibleRangeMin, "VisibleRangeMin", RiaDefines::minimumDefaultValuePlot(), "Min" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &numberFormat, "NumberFormat", "Number Format" );
|
CAF_PDM_InitFieldNoDefault( &numberFormat, "NumberFormat", "Number Format" );
|
||||||
CAF_PDM_InitField( &numberOfDecimals, "Decimals", 2, "Number of Decimals" );
|
CAF_PDM_InitField( &numberOfDecimals, "Decimals", 2, "Number of Decimals" );
|
||||||
CAF_PDM_InitField( &scaleFactor, "ScaleFactor", 1.0, "Scale Factor" );
|
CAF_PDM_InitField( &scaleFactor, "ScaleFactor", 1.0, "Scale Factor" );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_isAutoZoom, "AutoZoom", true, "Set Range Automatically" );
|
CAF_PDM_InitField( &m_isAutoZoom, "AutoZoom", true, "Set Range Automatically" );
|
||||||
CAF_PDM_InitField( &isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale" );
|
CAF_PDM_InitField( &m_isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale" );
|
||||||
CAF_PDM_InitField( &m_isAxisInverted, "AxisInverted", false, "Invert Axis" );
|
CAF_PDM_InitField( &m_isAxisInverted, "AxisInverted", false, "Invert Axis" );
|
||||||
|
|
||||||
|
auto defaultPlotAxis = caf::AppEnum<RiaDefines::PlotAxis>( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
||||||
|
CAF_PDM_InitField( &m_plotAxis, "PlotAxis", defaultPlotAxis, "Plot Axis" );
|
||||||
|
CAF_PDM_InitField( &m_plotAxisIndex, "PlotAxisIndex", 0, "Plot Axis Index" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_titlePositionEnum, "TitlePosition", "Title Position" );
|
CAF_PDM_InitFieldNoDefault( &m_titlePositionEnum, "TitlePosition", "Title Position" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_titleFontSize, "TitleDeltaFontSize", "Font Size" );
|
CAF_PDM_InitFieldNoDefault( &m_titleFontSize, "TitleDeltaFontSize", "Font Size" );
|
||||||
@@ -178,7 +182,7 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
|||||||
caf::PdmUiGroup& scaleGroup = *( uiOrdering.addNewGroup( "Axis Values" ) );
|
caf::PdmUiGroup& scaleGroup = *( uiOrdering.addNewGroup( "Axis Values" ) );
|
||||||
if ( m_isRangeSettingsEnabled )
|
if ( m_isRangeSettingsEnabled )
|
||||||
{
|
{
|
||||||
scaleGroup.add( &isLogarithmicScaleEnabled );
|
scaleGroup.add( &m_isLogarithmicScaleEnabled );
|
||||||
scaleGroup.add( &m_isAxisInverted );
|
scaleGroup.add( &m_isAxisInverted );
|
||||||
}
|
}
|
||||||
scaleGroup.add( &numberFormat );
|
scaleGroup.add( &numberFormat );
|
||||||
@@ -190,8 +194,8 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
|||||||
scaleGroup.add( &scaleFactor );
|
scaleGroup.add( &scaleFactor );
|
||||||
if ( m_isRangeSettingsEnabled )
|
if ( m_isRangeSettingsEnabled )
|
||||||
{
|
{
|
||||||
scaleGroup.add( &visibleRangeMin );
|
scaleGroup.add( &m_visibleRangeMin );
|
||||||
scaleGroup.add( &visibleRangeMax );
|
scaleGroup.add( &m_visibleRangeMax );
|
||||||
}
|
}
|
||||||
scaleGroup.add( &m_valuesFontSize );
|
scaleGroup.add( &m_valuesFontSize );
|
||||||
|
|
||||||
@@ -201,13 +205,16 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotAxisProperties::setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis )
|
void RimPlotAxisProperties::setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex )
|
||||||
{
|
{
|
||||||
m_name = name;
|
m_name = name;
|
||||||
m_axis = axis;
|
m_plotAxis = axis;
|
||||||
|
m_plotAxisIndex = axisIndex;
|
||||||
|
|
||||||
|
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) this->setUiIconFromResourceString( ":/LeftAxis16x16.png" );
|
||||||
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) this->setUiIconFromResourceString( ":/RightAxis16x16.png" );
|
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) this->setUiIconFromResourceString( ":/RightAxis16x16.png" );
|
||||||
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) this->setUiIconFromResourceString( ":/BottomAxis16x16.png" );
|
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) this->setUiIconFromResourceString( ":/BottomAxis16x16.png" );
|
||||||
|
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_TOP ) this->setUiIconFromResourceString( ":/TopAxis16x16.png" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -237,17 +244,17 @@ int RimPlotAxisProperties::valuesFontSize() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimPlotAxisProperties::name() const
|
const QString& RimPlotAxisProperties::name() const
|
||||||
{
|
{
|
||||||
return m_name;
|
return m_name();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaDefines::PlotAxis RimPlotAxisProperties::plotAxisType() const
|
RiuPlotAxis RimPlotAxisProperties::plotAxisType() const
|
||||||
{
|
{
|
||||||
return m_axis;
|
return RiuPlotAxis( m_plotAxis.value(), m_plotAxisIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -349,9 +356,33 @@ bool RimPlotAxisProperties::isActive() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotAxisProperties::setInvertedAxis( bool enable )
|
double RimPlotAxisProperties::visibleRangeMin() const
|
||||||
{
|
{
|
||||||
m_isAxisInverted = enable;
|
return m_visibleRangeMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
double RimPlotAxisProperties::visibleRangeMax() const
|
||||||
|
{
|
||||||
|
return m_visibleRangeMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotAxisProperties::setVisibleRangeMin( double value )
|
||||||
|
{
|
||||||
|
m_visibleRangeMin = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotAxisProperties::setVisibleRangeMax( double value )
|
||||||
|
{
|
||||||
|
m_visibleRangeMax = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -373,22 +404,22 @@ void RimPlotAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
|||||||
{
|
{
|
||||||
updateOptionSensitivity();
|
updateOptionSensitivity();
|
||||||
}
|
}
|
||||||
else if ( changedField == &visibleRangeMax )
|
else if ( changedField == &m_visibleRangeMax )
|
||||||
{
|
{
|
||||||
if ( visibleRangeMin > visibleRangeMax ) visibleRangeMax = oldValue.toDouble();
|
if ( m_visibleRangeMin > m_visibleRangeMax ) m_visibleRangeMax = oldValue.toDouble();
|
||||||
|
|
||||||
m_isAutoZoom = false;
|
m_isAutoZoom = false;
|
||||||
}
|
}
|
||||||
else if ( changedField == &visibleRangeMin )
|
else if ( changedField == &m_visibleRangeMin )
|
||||||
{
|
{
|
||||||
if ( visibleRangeMin > visibleRangeMax ) visibleRangeMin = oldValue.toDouble();
|
if ( m_visibleRangeMin > m_visibleRangeMax ) m_visibleRangeMin = oldValue.toDouble();
|
||||||
|
|
||||||
m_isAutoZoom = false;
|
m_isAutoZoom = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( changedField == &isLogarithmicScaleEnabled )
|
if ( changedField == &m_isLogarithmicScaleEnabled )
|
||||||
{
|
{
|
||||||
logarithmicChanged.send( isLogarithmicScaleEnabled() );
|
logarithmicChanged.send( m_isLogarithmicScaleEnabled() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -427,3 +458,11 @@ caf::PdmFieldHandle* RimPlotAxisProperties::objectToggleField()
|
|||||||
{
|
{
|
||||||
return &m_isActive;
|
return &m_isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimPlotAxisProperties::isLogarithmicScaleEnabled() const
|
||||||
|
{
|
||||||
|
return m_isLogarithmicScaleEnabled;
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
#include "RiaDefines.h"
|
#include "RiaDefines.h"
|
||||||
#include "RimPlotAxisPropertiesInterface.h"
|
#include "RimPlotAxisPropertiesInterface.h"
|
||||||
|
|
||||||
|
#include "RiuPlotAxis.h"
|
||||||
|
|
||||||
#include "cafAppEnum.h"
|
#include "cafAppEnum.h"
|
||||||
#include "cafFontTools.h"
|
#include "cafFontTools.h"
|
||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
@@ -36,7 +38,7 @@ class RimPlotAxisAnnotation;
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimPlotAxisProperties : public caf::PdmObject, public RimPlotAxisPropertiesInterface
|
class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface
|
||||||
{
|
{
|
||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
@@ -57,22 +59,22 @@ public:
|
|||||||
|
|
||||||
void setEnableTitleTextSettings( bool enable );
|
void setEnableTitleTextSettings( bool enable );
|
||||||
void enableRangeSettings( bool enable );
|
void enableRangeSettings( bool enable );
|
||||||
void setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis );
|
void setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex = 0 );
|
||||||
AxisTitlePositionType titlePosition() const override;
|
AxisTitlePositionType titlePosition() const override;
|
||||||
|
|
||||||
int titleFontSize() const override;
|
int titleFontSize() const override;
|
||||||
int valuesFontSize() const override;
|
int valuesFontSize() const override;
|
||||||
|
|
||||||
QString name() const;
|
const QString& name() const override;
|
||||||
RiaDefines::PlotAxis plotAxisType() const override;
|
RiuPlotAxis plotAxisType() const override;
|
||||||
bool useAutoTitle() const;
|
bool useAutoTitle() const;
|
||||||
bool showDescription() const;
|
bool showDescription() const;
|
||||||
bool showAcronym() const;
|
bool showAcronym() const;
|
||||||
bool showUnitText() const;
|
bool showUnitText() const;
|
||||||
bool isAutoZoom() const;
|
bool isAutoZoom() const override;
|
||||||
void setAutoZoom( bool enableAutoZoom );
|
void setAutoZoom( bool enableAutoZoom ) override;
|
||||||
bool isAxisInverted() const;
|
bool isAxisInverted() const override;
|
||||||
void setAxisInverted( bool inverted );
|
void setAxisInverted( bool inverted );
|
||||||
|
|
||||||
std::vector<RimPlotAxisAnnotation*> annotations() const override;
|
std::vector<RimPlotAxisAnnotation*> annotations() const override;
|
||||||
void appendAnnotation( RimPlotAxisAnnotation* annotation ) override;
|
void appendAnnotation( RimPlotAxisAnnotation* annotation ) override;
|
||||||
@@ -80,19 +82,21 @@ public:
|
|||||||
|
|
||||||
caf::PdmField<QString> customTitle;
|
caf::PdmField<QString> customTitle;
|
||||||
|
|
||||||
caf::PdmField<double> visibleRangeMin;
|
|
||||||
caf::PdmField<double> visibleRangeMax;
|
|
||||||
|
|
||||||
caf::PdmField<caf::AppEnum<NumberFormatType>> numberFormat;
|
caf::PdmField<caf::AppEnum<NumberFormatType>> numberFormat;
|
||||||
caf::PdmField<int> numberOfDecimals;
|
caf::PdmField<int> numberOfDecimals;
|
||||||
caf::PdmField<double> scaleFactor;
|
caf::PdmField<double> scaleFactor;
|
||||||
caf::PdmField<bool> isLogarithmicScaleEnabled;
|
|
||||||
|
|
||||||
bool isActive() const;
|
bool isLogarithmicScaleEnabled() const override;
|
||||||
|
bool isActive() const override;
|
||||||
|
|
||||||
void setInvertedAxis( bool enable );
|
|
||||||
void showAnnotationObjectsInProjectTree();
|
void showAnnotationObjectsInProjectTree();
|
||||||
|
|
||||||
|
double visibleRangeMin() const override;
|
||||||
|
double visibleRangeMax() const override;
|
||||||
|
|
||||||
|
void setVisibleRangeMin( double value ) override;
|
||||||
|
void setVisibleRangeMax( double value ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initAfterRead() override;
|
void initAfterRead() override;
|
||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
@@ -117,8 +121,14 @@ private:
|
|||||||
caf::PdmField<bool> m_isAutoZoom;
|
caf::PdmField<bool> m_isAutoZoom;
|
||||||
caf::PdmField<bool> m_isAxisInverted;
|
caf::PdmField<bool> m_isAxisInverted;
|
||||||
|
|
||||||
|
caf::PdmField<double> m_visibleRangeMin;
|
||||||
|
caf::PdmField<double> m_visibleRangeMax;
|
||||||
|
|
||||||
caf::PdmField<QString> m_name;
|
caf::PdmField<QString> m_name;
|
||||||
RiaDefines::PlotAxis m_axis;
|
caf::PdmField<caf::AppEnum<RiaDefines::PlotAxis>> m_plotAxis;
|
||||||
|
caf::PdmField<int> m_plotAxisIndex;
|
||||||
|
|
||||||
|
caf::PdmField<bool> m_isLogarithmicScaleEnabled;
|
||||||
|
|
||||||
bool m_enableTitleTextSettings;
|
bool m_enableTitleTextSettings;
|
||||||
bool m_isRangeSettingsEnabled;
|
bool m_isRangeSettingsEnabled;
|
||||||
|
|||||||
@@ -19,25 +19,44 @@
|
|||||||
|
|
||||||
#include "cafAppEnum.h"
|
#include "cafAppEnum.h"
|
||||||
|
|
||||||
// clang-format off
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotAxisPropertiesInterface,
|
||||||
|
"PlotAxisPropertiesInterface",
|
||||||
|
"RimPlotAxisPropertiesInterface" );
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
template<>
|
template <>
|
||||||
void caf::AppEnum<RimPlotAxisPropertiesInterface::AxisTitlePositionType>::setUp()
|
void caf::AppEnum<RimPlotAxisPropertiesInterface::AxisTitlePositionType>::setUp()
|
||||||
{
|
{
|
||||||
addItem(RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER, "AXIS_TITLE_CENTER", "Center");
|
addItem( RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER, "AXIS_TITLE_CENTER", "Center" );
|
||||||
addItem(RimPlotAxisPropertiesInterface::AXIS_TITLE_END, "AXIS_TITLE_END", "At End");
|
addItem( RimPlotAxisPropertiesInterface::AXIS_TITLE_END, "AXIS_TITLE_END", "At End" );
|
||||||
|
|
||||||
setDefault(RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER);
|
setDefault( RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum::setUp()
|
void RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum::setUp()
|
||||||
{
|
{
|
||||||
addItem(RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW, "VERY_FEW", "Very Few");
|
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW, "VERY_FEW", "Very Few" );
|
||||||
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW, "Few", "Few" );
|
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW, "Few", "Few" );
|
||||||
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT, "Default", "Default" );
|
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT, "Default", "Default" );
|
||||||
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_MANY, "Many", "Many" );
|
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_MANY, "Many", "Many" );
|
||||||
setDefault( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT );
|
setDefault( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT );
|
||||||
}
|
}
|
||||||
} // namespace caf
|
} // namespace caf
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimPlotAxisPropertiesInterface::isAxisInverted() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimPlotAxisPropertiesInterface::isLogarithmicScaleEnabled() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,12 +20,17 @@
|
|||||||
|
|
||||||
#include "RiaPlotDefines.h"
|
#include "RiaPlotDefines.h"
|
||||||
|
|
||||||
|
#include "RiuPlotAxis.h"
|
||||||
|
|
||||||
#include "cafAppEnum.h"
|
#include "cafAppEnum.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
class RimPlotAxisAnnotation;
|
class RimPlotAxisAnnotation;
|
||||||
|
|
||||||
class RimPlotAxisPropertiesInterface
|
class RimPlotAxisPropertiesInterface : public caf::PdmObject
|
||||||
{
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum AxisTitlePositionType
|
enum AxisTitlePositionType
|
||||||
{
|
{
|
||||||
@@ -45,7 +50,24 @@ public:
|
|||||||
virtual std::vector<RimPlotAxisAnnotation*> annotations() const = 0;
|
virtual std::vector<RimPlotAxisAnnotation*> annotations() const = 0;
|
||||||
virtual void appendAnnotation( RimPlotAxisAnnotation* annotation ) = 0;
|
virtual void appendAnnotation( RimPlotAxisAnnotation* annotation ) = 0;
|
||||||
virtual void removeAllAnnotations() = 0;
|
virtual void removeAllAnnotations() = 0;
|
||||||
virtual RiaDefines::PlotAxis plotAxisType() const = 0;
|
virtual RiuPlotAxis plotAxisType() const = 0;
|
||||||
|
|
||||||
|
virtual double visibleRangeMin() const = 0;
|
||||||
|
virtual double visibleRangeMax() const = 0;
|
||||||
|
|
||||||
|
virtual void setVisibleRangeMin( double value ) = 0;
|
||||||
|
virtual void setVisibleRangeMax( double value ) = 0;
|
||||||
|
|
||||||
|
virtual bool isAutoZoom() const = 0;
|
||||||
|
virtual void setAutoZoom( bool enableAutoZoom ) = 0;
|
||||||
|
|
||||||
|
virtual bool isActive() const = 0;
|
||||||
|
|
||||||
|
virtual const QString& name() const = 0;
|
||||||
|
|
||||||
|
virtual bool isAxisInverted() const;
|
||||||
|
|
||||||
|
virtual bool isLogarithmicScaleEnabled() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual AxisTitlePositionType titlePosition() const = 0;
|
virtual AxisTitlePositionType titlePosition() const = 0;
|
||||||
|
|||||||
@@ -736,7 +736,7 @@ void RimPlotCurve::setSamplesFromXYErrorValues( const std::vector<double>& xVa
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::updateAxisInPlot( RiaDefines::PlotAxis plotAxis )
|
void RimPlotCurve::updateAxisInPlot( RiuPlotAxis plotAxis )
|
||||||
{
|
{
|
||||||
if ( m_plotCurve ) m_plotCurve->setYAxis( plotAxis );
|
if ( m_plotCurve ) m_plotCurve->setYAxis( plotAxis );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "RiaCurveDataTools.h"
|
#include "RiaCurveDataTools.h"
|
||||||
#include "RiaPlotDefines.h"
|
#include "RiaPlotDefines.h"
|
||||||
|
|
||||||
|
#include "RiuPlotAxis.h"
|
||||||
#include "RiuQwtPlotCurveDefines.h"
|
#include "RiuQwtPlotCurveDefines.h"
|
||||||
#include "RiuQwtSymbol.h"
|
#include "RiuQwtSymbol.h"
|
||||||
|
|
||||||
@@ -170,7 +171,7 @@ protected:
|
|||||||
virtual void clearErrorBars();
|
virtual void clearErrorBars();
|
||||||
void checkAndApplyDefaultFillColor();
|
void checkAndApplyDefaultFillColor();
|
||||||
|
|
||||||
virtual void updateAxisInPlot( RiaDefines::PlotAxis plotAxis );
|
virtual void updateAxisInPlot( RiuPlotAxis plotAxis );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
caf::PdmField<bool> m_showCurve;
|
caf::PdmField<bool> m_showCurve;
|
||||||
|
|||||||
@@ -465,8 +465,8 @@ void RimVfpPlot::onLoadDataAndUpdate()
|
|||||||
m_primaryVariable(),
|
m_primaryVariable(),
|
||||||
m_familyVariable() ) );
|
m_familyVariable() ) );
|
||||||
|
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true );
|
||||||
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_plotWidget->scheduleReplot();
|
m_plotWidget->scheduleReplot();
|
||||||
@@ -551,12 +551,12 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuPlotWidget*
|
|||||||
void RimVfpPlot::populatePlotWidgetWithPlotData( RiuPlotWidget* plotWidget, const VfpPlotData& plotData )
|
void RimVfpPlot::populatePlotWidgetWithPlotData( RiuPlotWidget* plotWidget, const VfpPlotData& plotData )
|
||||||
{
|
{
|
||||||
plotWidget->detachItems( RiuPlotWidget::PlotItemType::CURVE );
|
plotWidget->detachItems( RiuPlotWidget::PlotItemType::CURVE );
|
||||||
plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0, 1 );
|
plotWidget->setAxisScale( RiuPlotAxis::defaultBottom(), 0, 1 );
|
||||||
plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0, 1 );
|
plotWidget->setAxisScale( RiuPlotAxis::defaultLeft(), 0, 1 );
|
||||||
plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
plotWidget->setAxisAutoScale( RiuPlotAxis::defaultBottom(), true );
|
||||||
plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
plotWidget->setAxisAutoScale( RiuPlotAxis::defaultLeft(), true );
|
||||||
plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, plotData.xAxisTitle() );
|
plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), plotData.xAxisTitle() );
|
||||||
plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotData.yAxisTitle() );
|
plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), plotData.yAxisTitle() );
|
||||||
|
|
||||||
for ( auto idx = 0u; idx < plotData.size(); idx++ )
|
for ( auto idx = 0u; idx < plotData.size(); idx++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -96,9 +96,9 @@ void RimAsciiDataCurve::setYAxis( RiaDefines::PlotAxis plotAxis )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaDefines::PlotAxis RimAsciiDataCurve::yAxis() const
|
RiuPlotAxis RimAsciiDataCurve::yAxis() const
|
||||||
{
|
{
|
||||||
return m_plotAxis();
|
return RiuPlotAxis( m_plotAxis() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ public:
|
|||||||
std::vector<double> yValues() const;
|
std::vector<double> yValues() const;
|
||||||
const std::vector<time_t>& timeSteps() const;
|
const std::vector<time_t>& timeSteps() const;
|
||||||
|
|
||||||
void setYAxis( RiaDefines::PlotAxis plotAxis );
|
void setYAxis( RiaDefines::PlotAxis plotAxis );
|
||||||
RiaDefines::PlotAxis yAxis() const;
|
RiuPlotAxis yAxis() const;
|
||||||
void updateQwtPlotAxis();
|
void updateQwtPlotAxis();
|
||||||
|
|
||||||
void setTimeSteps( const std::vector<QDateTime>& timeSteps );
|
void setTimeSteps( const std::vector<QDateTime>& timeSteps );
|
||||||
void setValues( const std::vector<double>& values );
|
void setValues( const std::vector<double>& values );
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "RimEnsembleStatisticsCase.h"
|
#include "RimEnsembleStatisticsCase.h"
|
||||||
#include "RimObjectiveFunction.h"
|
#include "RimObjectiveFunction.h"
|
||||||
#include "RimObjectiveFunctionTools.h"
|
#include "RimObjectiveFunctionTools.h"
|
||||||
|
#include "RimPlotAxisPropertiesInterface.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimRegularLegendConfig.h"
|
#include "RimRegularLegendConfig.h"
|
||||||
#include "RimSummaryAddress.h"
|
#include "RimSummaryAddress.h"
|
||||||
@@ -160,7 +161,10 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
|
|||||||
m_selectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
m_selectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||||
m_selectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
m_selectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis" );
|
CAF_PDM_InitFieldNoDefault( &m_plotAxis_OBSOLETE, "PlotAxis", "Axis" );
|
||||||
|
m_plotAxis_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_plotAxisProperties, "Axis", "Axis" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "" );
|
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "" );
|
||||||
m_legendConfig = new RimRegularLegendConfig();
|
m_legendConfig = new RimRegularLegendConfig();
|
||||||
@@ -619,7 +623,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
|||||||
|
|
||||||
if ( changedField == &m_showCurves )
|
if ( changedField == &m_showCurves )
|
||||||
{
|
{
|
||||||
if ( !m_showCurves() )
|
if ( !m_showCurves() && m_plotCurveForLegendText )
|
||||||
{
|
{
|
||||||
// Need to detach the legend since the plot type might change from Qwt to QtCharts.
|
// Need to detach the legend since the plot type might change from Qwt to QtCharts.
|
||||||
// The plot curve for legend text needs to be recreated when curves are shown next time.
|
// The plot curve for legend text needs to be recreated when curves are shown next time.
|
||||||
@@ -740,11 +744,11 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
|||||||
updateCurveColors();
|
updateCurveColors();
|
||||||
updateTimeAnnotations();
|
updateTimeAnnotations();
|
||||||
}
|
}
|
||||||
else if ( changedField == &m_plotAxis )
|
else if ( changedField == &m_plotAxisProperties )
|
||||||
{
|
{
|
||||||
for ( RimSummaryCurve* curve : curves() )
|
for ( RimSummaryCurve* curve : curves() )
|
||||||
{
|
{
|
||||||
curve->setLeftOrRightAxisY( m_plotAxis() );
|
curve->setLeftOrRightAxisY( axisY() );
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlotAxis();
|
updatePlotAxis();
|
||||||
@@ -865,7 +869,7 @@ void RimEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
|||||||
curveDataGroup->add( &m_yValuesSummaryAddressUiField );
|
curveDataGroup->add( &m_yValuesSummaryAddressUiField );
|
||||||
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
|
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
|
||||||
curveDataGroup->add( &m_resampling );
|
curveDataGroup->add( &m_resampling );
|
||||||
curveDataGroup->add( &m_plotAxis );
|
curveDataGroup->add( &m_plotAxisProperties );
|
||||||
}
|
}
|
||||||
|
|
||||||
appendColorGroup( uiOrdering );
|
appendColorGroup( uiOrdering );
|
||||||
@@ -1208,6 +1212,16 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveSet::calculateValueOptions( const
|
|||||||
options.push_back( caf::PdmOptionItemInfo( name, objFunc ) );
|
options.push_back( caf::PdmOptionItemInfo( name, objFunc ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( fieldNeedingOptions == &m_plotAxisProperties )
|
||||||
|
{
|
||||||
|
RimSummaryPlot* plot = nullptr;
|
||||||
|
firstAncestorOrThisOfTypeAsserted( plot );
|
||||||
|
|
||||||
|
for ( auto axis : plot->plotAxes() )
|
||||||
|
{
|
||||||
|
options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
@@ -1682,11 +1696,11 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase
|
|||||||
RimSummaryCurve* curve = new RimSummaryCurve();
|
RimSummaryCurve* curve = new RimSummaryCurve();
|
||||||
curve->setSummaryCaseY( sumCase );
|
curve->setSummaryCaseY( sumCase );
|
||||||
curve->setSummaryAddressYAndApplyInterpolation( addr->address() );
|
curve->setSummaryAddressYAndApplyInterpolation( addr->address() );
|
||||||
curve->setLeftOrRightAxisY( m_plotAxis() );
|
|
||||||
curve->setResampling( m_resampling() );
|
curve->setResampling( m_resampling() );
|
||||||
|
|
||||||
addCurve( curve );
|
addCurve( curve );
|
||||||
|
|
||||||
|
curve->setLeftOrRightAxisY( axisY() );
|
||||||
curve->updateCurveVisibility();
|
curve->updateCurveVisibility();
|
||||||
|
|
||||||
newSummaryCurves.push_back( curve );
|
newSummaryCurves.push_back( curve );
|
||||||
@@ -1793,7 +1807,7 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
|
|||||||
curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
|
curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
|
||||||
curve->setSummaryCaseY( m_ensembleStatCase.get() );
|
curve->setSummaryCaseY( m_ensembleStatCase.get() );
|
||||||
curve->setSummaryAddressYAndApplyInterpolation( address );
|
curve->setSummaryAddressYAndApplyInterpolation( address );
|
||||||
curve->setLeftOrRightAxisY( m_plotAxis() );
|
curve->setLeftOrRightAxisY( axisY() );
|
||||||
|
|
||||||
curve->updateCurveVisibility();
|
curve->updateCurveVisibility();
|
||||||
curve->loadDataAndUpdate( false );
|
curve->loadDataAndUpdate( false );
|
||||||
@@ -2065,3 +2079,27 @@ int statisticsCurveSymbolSize( RiuPlotCurveSymbol::PointSymbolEnum symbol )
|
|||||||
if ( symbol == RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE ) return 7;
|
if ( symbol == RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE ) return 7;
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis RimEnsembleCurveSet::axisY() const
|
||||||
|
{
|
||||||
|
if ( m_plotAxisProperties )
|
||||||
|
return m_plotAxisProperties->plotAxisType();
|
||||||
|
else
|
||||||
|
return RiuPlotAxis::defaultLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEnsembleCurveSet::initAfterRead()
|
||||||
|
{
|
||||||
|
if ( m_plotAxisProperties.value() == nullptr )
|
||||||
|
{
|
||||||
|
RimSummaryPlot* plot = nullptr;
|
||||||
|
firstAncestorOrThisOfTypeAsserted( plot );
|
||||||
|
m_plotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
#include "RigEnsembleParameter.h"
|
#include "RigEnsembleParameter.h"
|
||||||
|
|
||||||
|
#include "RiuPlotAxis.h"
|
||||||
|
|
||||||
#include "cafAppEnum.h"
|
#include "cafAppEnum.h"
|
||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafPdmChildField.h"
|
#include "cafPdmChildField.h"
|
||||||
@@ -63,6 +65,7 @@ class RiaSummaryCurveDefinition;
|
|||||||
class RiuSummaryVectorSelectionDialog;
|
class RiuSummaryVectorSelectionDialog;
|
||||||
class RiuPlotWidget;
|
class RiuPlotWidget;
|
||||||
class RiuPlotCurve;
|
class RiuPlotCurve;
|
||||||
|
class RimPlotAxisPropertiesInterface;
|
||||||
|
|
||||||
class QwtPlot;
|
class QwtPlot;
|
||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
@@ -164,6 +167,9 @@ public:
|
|||||||
|
|
||||||
std::vector<cvf::Color3f> generateColorsForCases( const std::vector<RimSummaryCase*>& summaryCases ) const;
|
std::vector<cvf::Color3f> generateColorsForCases( const std::vector<RimSummaryCase*>& summaryCases ) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void initAfterRead() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateEnsembleCurves( const std::vector<RimSummaryCase*>& sumCases );
|
void updateEnsembleCurves( const std::vector<RimSummaryCase*>& sumCases );
|
||||||
void updateStatisticsCurves( const std::vector<RimSummaryCase*>& sumCases );
|
void updateStatisticsCurves( const std::vector<RimSummaryCase*>& sumCases );
|
||||||
@@ -186,7 +192,8 @@ private:
|
|||||||
|
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
|
|
||||||
void updatePlotAxis();
|
void updatePlotAxis();
|
||||||
|
RiuPlotAxis axisY() const;
|
||||||
|
|
||||||
QString createAutoName() const;
|
QString createAutoName() const;
|
||||||
|
|
||||||
@@ -228,7 +235,8 @@ private:
|
|||||||
caf::PdmField<TimeStepFilterEnum> m_timeStepFilter;
|
caf::PdmField<TimeStepFilterEnum> m_timeStepFilter;
|
||||||
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
||||||
|
|
||||||
caf::PdmField<caf::AppEnum<RiaDefines::PlotAxis>> m_plotAxis;
|
caf::PdmField<caf::AppEnum<RiaDefines::PlotAxis>> m_plotAxis_OBSOLETE;
|
||||||
|
caf::PdmPtrField<RimPlotAxisPropertiesInterface*> m_plotAxisProperties;
|
||||||
|
|
||||||
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
|
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
|
||||||
caf::PdmChildField<RimEnsembleCurveFilterCollection*> m_curveFilters;
|
caf::PdmChildField<RimEnsembleCurveFilterCollection*> m_curveFilters;
|
||||||
|
|||||||
@@ -27,10 +27,9 @@ CAF_PDM_SOURCE_INIT( RimSummaryCrossPlot, "SummaryCrossPlot" );
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimSummaryCrossPlot::RimSummaryCrossPlot()
|
RimSummaryCrossPlot::RimSummaryCrossPlot()
|
||||||
|
: RimSummaryPlot( true )
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Summary Cross Plot", ":/SummaryXPlotLight16x16.png" );
|
CAF_PDM_InitObject( "Summary Cross Plot", ":/SummaryXPlotLight16x16.png" );
|
||||||
|
|
||||||
setAsCrossPlot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "RiaCurveMerger.h"
|
#include "RiaCurveMerger.h"
|
||||||
#include "RiaGuiApplication.h"
|
#include "RiaGuiApplication.h"
|
||||||
#include "RiaLogging.h"
|
#include "RiaLogging.h"
|
||||||
|
#include "RiaPlotDefines.h"
|
||||||
#include "RiaPreferencesSummary.h"
|
#include "RiaPreferencesSummary.h"
|
||||||
#include "RiaResultNames.h"
|
#include "RiaResultNames.h"
|
||||||
#include "RiaSummaryCurveDefinition.h"
|
#include "RiaSummaryCurveDefinition.h"
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
#include "RimEnsembleCurveSet.h"
|
#include "RimEnsembleCurveSet.h"
|
||||||
#include "RimEnsembleCurveSetCollection.h"
|
#include "RimEnsembleCurveSetCollection.h"
|
||||||
#include "RimMultipleSummaryPlotNameHelper.h"
|
#include "RimMultipleSummaryPlotNameHelper.h"
|
||||||
|
#include "RimPlotAxisProperties.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimSummaryAddress.h"
|
#include "RimSummaryAddress.h"
|
||||||
#include "RimSummaryCalculationCollection.h"
|
#include "RimSummaryCalculationCollection.h"
|
||||||
@@ -45,6 +47,7 @@
|
|||||||
#include "RimSummaryTimeAxisProperties.h"
|
#include "RimSummaryTimeAxisProperties.h"
|
||||||
#include "RimTools.h"
|
#include "RimTools.h"
|
||||||
|
|
||||||
|
#include "RiuPlotAxis.h"
|
||||||
#include "RiuPlotMainWindow.h"
|
#include "RiuPlotMainWindow.h"
|
||||||
#include "RiuQwtPlotCurve.h"
|
#include "RiuQwtPlotCurve.h"
|
||||||
#include "RiuSummaryVectorSelectionDialog.h"
|
#include "RiuSummaryVectorSelectionDialog.h"
|
||||||
@@ -111,7 +114,10 @@ RimSummaryCurve::RimSummaryCurve()
|
|||||||
CAF_PDM_InitFieldNoDefault( &m_isEnsembleCurve, "IsEnsembleCurve", "Ensemble Curve" );
|
CAF_PDM_InitFieldNoDefault( &m_isEnsembleCurve, "IsEnsembleCurve", "Ensemble Curve" );
|
||||||
m_isEnsembleCurve.v() = caf::Tristate::State::PartiallyTrue;
|
m_isEnsembleCurve.v() = caf::Tristate::State::PartiallyTrue;
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis" );
|
CAF_PDM_InitFieldNoDefault( &m_plotAxis_OBSOLETE, "PlotAxis", "Axis" );
|
||||||
|
m_plotAxis_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_plotAxisProperties, "Axis", "Axis" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig" );
|
CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig" );
|
||||||
m_curveNameConfig.uiCapability()->setUiTreeHidden( true );
|
m_curveNameConfig.uiCapability()->setUiTreeHidden( true );
|
||||||
@@ -424,17 +430,24 @@ RimSummaryCase* RimSummaryCurve::summaryCaseX() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryCurve::setLeftOrRightAxisY( RiaDefines::PlotAxis plotAxis )
|
void RimSummaryCurve::setLeftOrRightAxisY( RiuPlotAxis plotAxis )
|
||||||
{
|
{
|
||||||
m_plotAxis = plotAxis;
|
m_plotAxis_OBSOLETE = plotAxis.axis();
|
||||||
|
|
||||||
|
RimSummaryPlot* plot = nullptr;
|
||||||
|
firstAncestorOrThisOfTypeAsserted( plot );
|
||||||
|
m_plotAxisProperties = plot->axisPropertiesForPlotAxis( plotAxis );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaDefines::PlotAxis RimSummaryCurve::axisY() const
|
RiuPlotAxis RimSummaryCurve::axisY() const
|
||||||
{
|
{
|
||||||
return m_plotAxis();
|
if ( m_plotAxisProperties )
|
||||||
|
return m_plotAxisProperties->plotAxisType();
|
||||||
|
else
|
||||||
|
return RiuPlotAxis::defaultLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -489,6 +502,17 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions( const caf:
|
|||||||
{
|
{
|
||||||
appendOptionItemsForSummaryAddresses( &options, m_xValuesSummaryCase() );
|
appendOptionItemsForSummaryAddresses( &options, m_xValuesSummaryCase() );
|
||||||
}
|
}
|
||||||
|
else if ( fieldNeedingOptions == &m_plotAxisProperties )
|
||||||
|
{
|
||||||
|
RimSummaryPlot* plot = nullptr;
|
||||||
|
firstAncestorOrThisOfTypeAsserted( plot );
|
||||||
|
|
||||||
|
for ( auto axis : plot->plotAxes() )
|
||||||
|
{
|
||||||
|
options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -746,6 +770,13 @@ void RimSummaryCurve::initAfterRead()
|
|||||||
{
|
{
|
||||||
RimStackablePlotCurve::initAfterRead();
|
RimStackablePlotCurve::initAfterRead();
|
||||||
|
|
||||||
|
if ( m_plotAxisProperties.value() == nullptr )
|
||||||
|
{
|
||||||
|
RimSummaryPlot* plot = nullptr;
|
||||||
|
firstAncestorOrThisOfType( plot );
|
||||||
|
if ( plot ) m_plotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( m_isEnsembleCurve().isPartiallyTrue() )
|
if ( m_isEnsembleCurve().isPartiallyTrue() )
|
||||||
{
|
{
|
||||||
m_isEnsembleCurve.v() = ( summaryCaseY() && summaryCaseY()->ensemble() ) ? caf::Tristate::State::True
|
m_isEnsembleCurve.v() = ( summaryCaseY() && summaryCaseY()->ensemble() ) ? caf::Tristate::State::True
|
||||||
@@ -785,7 +816,7 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
|||||||
curveDataGroup->add( &m_yValuesSummaryAddressUiField, { true, 2, 1 } );
|
curveDataGroup->add( &m_yValuesSummaryAddressUiField, { true, 2, 1 } );
|
||||||
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
|
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
|
||||||
curveDataGroup->add( &m_resampling, { true, 3, 1 } );
|
curveDataGroup->add( &m_resampling, { true, 3, 1 } );
|
||||||
curveDataGroup->add( &m_plotAxis, { true, 3, 1 } );
|
curveDataGroup->add( &m_plotAxisProperties, { true, 3, 1 } );
|
||||||
|
|
||||||
if ( isCrossPlotCurve() )
|
if ( isCrossPlotCurve() )
|
||||||
m_showErrorBars = false;
|
m_showErrorBars = false;
|
||||||
@@ -1047,7 +1078,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|||||||
// Update the summary curve collection to make sure the curve names are updated in curve creator UI
|
// Update the summary curve collection to make sure the curve names are updated in curve creator UI
|
||||||
visibilityChanged.send( m_showCurve() );
|
visibilityChanged.send( m_showCurve() );
|
||||||
}
|
}
|
||||||
else if ( changedField == &m_plotAxis )
|
else if ( changedField == &m_plotAxisProperties )
|
||||||
{
|
{
|
||||||
updateAxisInPlot( axisY() );
|
updateAxisInPlot( axisY() );
|
||||||
plot->updateAxes();
|
plot->updateAxes();
|
||||||
|
|||||||
@@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
class RifSummaryReaderInterface;
|
class RifSummaryReaderInterface;
|
||||||
class RimSummaryCase;
|
class RimSummaryCase;
|
||||||
class RiuQwtPlotCurve;
|
|
||||||
class RimSummaryCurveAutoName;
|
class RimSummaryCurveAutoName;
|
||||||
class RimSummaryAddress;
|
class RimSummaryAddress;
|
||||||
class RiaSummaryCurveDefinition;
|
class RiaSummaryCurveDefinition;
|
||||||
|
class RimPlotAxisPropertiesInterface;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@@ -67,8 +67,8 @@ public:
|
|||||||
|
|
||||||
RifEclipseSummaryAddress errorSummaryAddressY() const;
|
RifEclipseSummaryAddress errorSummaryAddressY() const;
|
||||||
std::vector<double> errorValuesY() const;
|
std::vector<double> errorValuesY() const;
|
||||||
void setLeftOrRightAxisY( RiaDefines::PlotAxis plotAxis );
|
void setLeftOrRightAxisY( RiuPlotAxis plotAxis );
|
||||||
RiaDefines::PlotAxis axisY() const;
|
RiuPlotAxis axisY() const;
|
||||||
const std::vector<time_t>& timeStepsY() const;
|
const std::vector<time_t>& timeStepsY() const;
|
||||||
double yValueAtTimeT( time_t time ) const;
|
double yValueAtTimeT( time_t time ) const;
|
||||||
void setOverrideCurveDataY( const std::vector<time_t>& xValues, const std::vector<double>& yValues );
|
void setOverrideCurveDataY( const std::vector<time_t>& xValues, const std::vector<double>& yValues );
|
||||||
@@ -145,6 +145,7 @@ private:
|
|||||||
caf::PdmField<caf::Tristate> m_isEnsembleCurve;
|
caf::PdmField<caf::Tristate> m_isEnsembleCurve;
|
||||||
|
|
||||||
caf::PdmChildField<RimSummaryCurveAutoName*> m_curveNameConfig;
|
caf::PdmChildField<RimSummaryCurveAutoName*> m_curveNameConfig;
|
||||||
caf::PdmField<caf::AppEnum<RiaDefines::PlotAxis>> m_plotAxis;
|
caf::PdmField<caf::AppEnum<RiaDefines::PlotAxis>> m_plotAxis_OBSOLETE;
|
||||||
|
caf::PdmPtrField<RimPlotAxisPropertiesInterface*> m_plotAxisProperties;
|
||||||
caf::PdmField<bool> m_isTopZWithinCategory;
|
caf::PdmField<bool> m_isTopZWithinCategory;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
#include "RimSummaryPlotNameHelper.h"
|
#include "RimSummaryPlotNameHelper.h"
|
||||||
#include "RimSummaryTimeAxisProperties.h"
|
#include "RimSummaryTimeAxisProperties.h"
|
||||||
|
|
||||||
|
#include "RiuPlotAxis.h"
|
||||||
#include "RiuPlotMainWindowTools.h"
|
#include "RiuPlotMainWindowTools.h"
|
||||||
#include "RiuSummaryQwtPlot.h"
|
#include "RiuSummaryQwtPlot.h"
|
||||||
#include "RiuTreeViewEventFilter.h"
|
#include "RiuTreeViewEventFilter.h"
|
||||||
@@ -202,8 +203,9 @@ CurvesData concatCurvesData( const std::vector<CurvesData>& curvesData );
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimSummaryPlot::RimSummaryPlot()
|
RimSummaryPlot::RimSummaryPlot( bool isCrossPlot )
|
||||||
: RimPlot()
|
: RimPlot()
|
||||||
|
, m_isCrossPlot( isCrossPlot )
|
||||||
{
|
{
|
||||||
CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" );
|
CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" );
|
||||||
|
|
||||||
@@ -228,35 +230,34 @@ RimSummaryPlot::RimSummaryPlot()
|
|||||||
CAF_PDM_InitFieldNoDefault( &m_asciiDataCurves, "AsciiDataCurves", "" );
|
CAF_PDM_InitFieldNoDefault( &m_asciiDataCurves, "AsciiDataCurves", "" );
|
||||||
m_asciiDataCurves.uiCapability()->setUiTreeHidden( true );
|
m_asciiDataCurves.uiCapability()->setUiTreeHidden( true );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_leftYAxisProperties, "LeftYAxisProperties", "Left Y Axis" );
|
CAF_PDM_InitFieldNoDefault( &m_axisProperties, "AxisProperties", "Axes", ":/Axes16x16.png" );
|
||||||
m_leftYAxisProperties.uiCapability()->setUiTreeHidden( true );
|
|
||||||
m_leftYAxisProperties = new RimPlotAxisProperties;
|
|
||||||
m_leftYAxisProperties->setNameAndAxis( "Left Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_rightYAxisProperties, "RightYAxisProperties", "Right Y Axis" );
|
RimPlotAxisProperties* leftYAxisProperties = new RimPlotAxisProperties;
|
||||||
m_rightYAxisProperties.uiCapability()->setUiTreeHidden( true );
|
leftYAxisProperties->setNameAndAxis( "Left", RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0 );
|
||||||
m_rightYAxisProperties = new RimPlotAxisProperties;
|
m_axisProperties.push_back( leftYAxisProperties );
|
||||||
m_rightYAxisProperties->setNameAndAxis( "Right Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
connectAxisSignals( leftYAxisProperties );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_bottomAxisProperties, "BottomAxisProperties", "Bottom X Axis" );
|
RimPlotAxisProperties* rightYAxisProperties = new RimPlotAxisProperties;
|
||||||
m_bottomAxisProperties.uiCapability()->setUiTreeHidden( true );
|
rightYAxisProperties->setNameAndAxis( "Right", RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, 0 );
|
||||||
m_bottomAxisProperties = new RimPlotAxisProperties;
|
m_axisProperties.push_back( rightYAxisProperties );
|
||||||
m_bottomAxisProperties->setNameAndAxis( "Bottom X-Axis", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
|
connectAxisSignals( rightYAxisProperties );
|
||||||
|
|
||||||
connectAxisSignals( m_leftYAxisProperties() );
|
if ( m_isCrossPlot )
|
||||||
connectAxisSignals( m_rightYAxisProperties() );
|
{
|
||||||
connectAxisSignals( m_bottomAxisProperties() );
|
RimPlotAxisProperties* bottomAxisProperties = new RimPlotAxisProperties;
|
||||||
|
bottomAxisProperties->setNameAndAxis( "Bottom", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0 );
|
||||||
CAF_PDM_InitFieldNoDefault( &m_timeAxisProperties, "TimeAxisProperties", "Time Axis" );
|
m_axisProperties.push_back( bottomAxisProperties );
|
||||||
m_timeAxisProperties.uiCapability()->setUiTreeHidden( true );
|
}
|
||||||
m_timeAxisProperties = new RimSummaryTimeAxisProperties;
|
else
|
||||||
|
{
|
||||||
|
RimSummaryTimeAxisProperties* timeAxisProperties = new RimSummaryTimeAxisProperties;
|
||||||
|
m_axisProperties.push_back( timeAxisProperties );
|
||||||
|
}
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_textCurveSetEditor, "SummaryPlotFilterTextCurveSetEditor", "Text Filter Curve Creator" );
|
CAF_PDM_InitFieldNoDefault( &m_textCurveSetEditor, "SummaryPlotFilterTextCurveSetEditor", "Text Filter Curve Creator" );
|
||||||
m_textCurveSetEditor.uiCapability()->setUiTreeHidden( true );
|
m_textCurveSetEditor.uiCapability()->setUiTreeHidden( true );
|
||||||
m_textCurveSetEditor = new RimSummaryPlotFilterTextCurveSetEditor;
|
m_textCurveSetEditor = new RimSummaryPlotFilterTextCurveSetEditor;
|
||||||
|
|
||||||
m_isCrossPlot = false;
|
|
||||||
|
|
||||||
m_nameHelperAllCurves.reset( new RimSummaryPlotNameHelper );
|
m_nameHelperAllCurves.reset( new RimSummaryPlotNameHelper );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" );
|
CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" );
|
||||||
@@ -268,6 +269,27 @@ RimSummaryPlot::RimSummaryPlot()
|
|||||||
m_sourceStepping.xmlCapability()->disableIO();
|
m_sourceStepping.xmlCapability()->disableIO();
|
||||||
|
|
||||||
setPlotInfoLabel( "Filters Active" );
|
setPlotInfoLabel( "Filters Active" );
|
||||||
|
|
||||||
|
// Obsolete axis fields
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_leftYAxisProperties_OBSOLETE, "LeftYAxisProperties", "Left Y Axis" );
|
||||||
|
m_leftYAxisProperties_OBSOLETE.uiCapability()->setUiTreeHidden( true );
|
||||||
|
m_leftYAxisProperties_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
m_leftYAxisProperties_OBSOLETE = new RimPlotAxisProperties;
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_rightYAxisProperties_OBSOLETE, "RightYAxisProperties", "Right Y Axis" );
|
||||||
|
m_rightYAxisProperties_OBSOLETE.uiCapability()->setUiTreeHidden( true );
|
||||||
|
m_rightYAxisProperties_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
m_rightYAxisProperties_OBSOLETE = new RimPlotAxisProperties;
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_bottomAxisProperties_OBSOLETE, "BottomAxisProperties", "Bottom X Axis" );
|
||||||
|
m_bottomAxisProperties_OBSOLETE.uiCapability()->setUiTreeHidden( true );
|
||||||
|
m_bottomAxisProperties_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
m_bottomAxisProperties_OBSOLETE = new RimPlotAxisProperties;
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_timeAxisProperties_OBSOLETE, "TimeAxisProperties", "Time Axis" );
|
||||||
|
m_timeAxisProperties_OBSOLETE.uiCapability()->setUiTreeHidden( true );
|
||||||
|
m_timeAxisProperties_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
m_timeAxisProperties_OBSOLETE = new RimSummaryTimeAxisProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -288,25 +310,27 @@ RimSummaryPlot::~RimSummaryPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::updateAxes()
|
void RimSummaryPlot::updateAxes()
|
||||||
{
|
{
|
||||||
updateYAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
updateAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
||||||
updateYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
updateAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
||||||
|
|
||||||
if ( m_timeAxisProperties() && plotWidget() )
|
if ( timeAxisProperties() && plotWidget() )
|
||||||
{
|
{
|
||||||
m_summaryPlot->updateAnnotationObjects( m_timeAxisProperties() );
|
m_summaryPlot->updateAnnotationObjects( timeAxisProperties() );
|
||||||
}
|
}
|
||||||
if ( m_leftYAxisProperties() && plotWidget() )
|
|
||||||
|
RimPlotAxisPropertiesInterface* leftYAxisProperties = axisPropertiesForPlotAxis( RiuPlotAxis::defaultLeft() );
|
||||||
|
if ( leftYAxisProperties && plotWidget() )
|
||||||
{
|
{
|
||||||
m_summaryPlot->updateAnnotationObjects( m_leftYAxisProperties() );
|
m_summaryPlot->updateAnnotationObjects( leftYAxisProperties );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_isCrossPlot )
|
if ( m_isCrossPlot )
|
||||||
{
|
{
|
||||||
updateBottomXAxis();
|
updateAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updateTimeAxis();
|
updateTimeAxis( timeAxisProperties() );
|
||||||
}
|
}
|
||||||
|
|
||||||
plotWidget()->scheduleReplot();
|
plotWidget()->scheduleReplot();
|
||||||
@@ -317,9 +341,9 @@ void RimSummaryPlot::updateAxes()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimSummaryPlot::isLogarithmicScaleEnabled( RiaDefines::PlotAxis plotAxis ) const
|
bool RimSummaryPlot::isLogarithmicScaleEnabled( RiuPlotAxis plotAxis ) const
|
||||||
{
|
{
|
||||||
return yAxisPropertiesLeftOrRight( plotAxis )->isLogarithmicScaleEnabled();
|
return axisPropertiesForPlotAxis( plotAxis )->isLogarithmicScaleEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -327,7 +351,14 @@ bool RimSummaryPlot::isLogarithmicScaleEnabled( RiaDefines::PlotAxis plotAxis )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimSummaryTimeAxisProperties* RimSummaryPlot::timeAxisProperties()
|
RimSummaryTimeAxisProperties* RimSummaryPlot::timeAxisProperties()
|
||||||
{
|
{
|
||||||
return m_timeAxisProperties();
|
// Find the first time axis (which is correct since there is only one).
|
||||||
|
for ( auto ap : m_axisProperties )
|
||||||
|
{
|
||||||
|
RimSummaryTimeAxisProperties* timeAxis = dynamic_cast<RimSummaryTimeAxisProperties*>( ap.p() );
|
||||||
|
if ( timeAxis ) return timeAxis;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -484,21 +515,21 @@ void RimSummaryPlot::onAxisSelected( int axis, bool toggle )
|
|||||||
caf::PdmObject* itemToSelect = nullptr;
|
caf::PdmObject* itemToSelect = nullptr;
|
||||||
if ( axis == QwtPlot::yLeft )
|
if ( axis == QwtPlot::yLeft )
|
||||||
{
|
{
|
||||||
itemToSelect = m_leftYAxisProperties;
|
itemToSelect = m_leftYAxisProperties_OBSOLETE;
|
||||||
}
|
}
|
||||||
else if ( axis == QwtPlot::yRight )
|
else if ( axis == QwtPlot::yRight )
|
||||||
{
|
{
|
||||||
itemToSelect = m_rightYAxisProperties;
|
itemToSelect = m_rightYAxisProperties_OBSOLETE;
|
||||||
}
|
}
|
||||||
else if ( axis == QwtPlot::xBottom )
|
else if ( axis == QwtPlot::xBottom )
|
||||||
{
|
{
|
||||||
if ( m_isCrossPlot )
|
if ( m_isCrossPlot )
|
||||||
{
|
{
|
||||||
itemToSelect = m_bottomAxisProperties;
|
itemToSelect = m_bottomAxisProperties_OBSOLETE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itemToSelect = m_timeAxisProperties;
|
itemToSelect = m_timeAxisProperties_OBSOLETE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,7 +684,7 @@ RimSummaryCurveCollection* RimSummaryPlot::summaryCurveCollection() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimSummaryCurve*> RimSummaryPlot::visibleStackedSummaryCurvesForAxis( RiaDefines::PlotAxis plotAxis )
|
std::vector<RimSummaryCurve*> RimSummaryPlot::visibleStackedSummaryCurvesForAxis( RiuPlotAxis plotAxis )
|
||||||
{
|
{
|
||||||
auto visibleCurves = visibleSummaryCurvesForAxis( plotAxis );
|
auto visibleCurves = visibleSummaryCurvesForAxis( plotAxis );
|
||||||
|
|
||||||
@@ -727,17 +758,11 @@ QString RimSummaryPlot::generatedPlotTitleFromAllCurves() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot )
|
void RimSummaryPlot::copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot )
|
||||||
{
|
{
|
||||||
|
for ( auto ap : sourceSummaryPlot.plotAxes() )
|
||||||
{
|
{
|
||||||
QString data =
|
QString data = ap->writeObjectToXmlString();
|
||||||
sourceSummaryPlot.yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis::PLOT_AXIS_LEFT )->writeObjectToXmlString();
|
|
||||||
yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
|
||||||
->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
axisPropertiesForPlotAxis( ap->plotAxisType() )
|
||||||
QString data =
|
|
||||||
sourceSummaryPlot.yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )->writeObjectToXmlString();
|
|
||||||
yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
|
|
||||||
->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
|
->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -898,131 +923,105 @@ bool RimSummaryPlot::isNormalizationEnabled()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::updateYAxis( RiaDefines::PlotAxis plotAxis )
|
void RimSummaryPlot::updateAxis( RiaDefines::PlotAxis plotAxis )
|
||||||
{
|
{
|
||||||
if ( !plotWidget() ) return;
|
if ( !plotWidget() ) return;
|
||||||
|
|
||||||
RimPlotAxisProperties* yAxisProperties = yAxisPropertiesLeftOrRight( plotAxis );
|
for ( RimPlotAxisPropertiesInterface* yAxisProperties : m_axisProperties )
|
||||||
if ( yAxisProperties->isActive() && hasVisibleCurvesForAxis( plotAxis ) )
|
|
||||||
{
|
{
|
||||||
plotWidget()->enableAxis( plotAxis, true );
|
RiuPlotAxis riuPlotAxis = yAxisProperties->plotAxisType();
|
||||||
|
if ( riuPlotAxis.axis() == plotAxis )
|
||||||
std::set<QString> timeHistoryQuantities;
|
|
||||||
|
|
||||||
for ( auto c : visibleTimeHistoryCurvesForAxis( plotAxis ) )
|
|
||||||
{
|
{
|
||||||
timeHistoryQuantities.insert( c->quantityName() );
|
RimPlotAxisProperties* axisProperties = dynamic_cast<RimPlotAxisProperties*>( yAxisProperties );
|
||||||
}
|
if ( yAxisProperties->isActive() && hasVisibleCurvesForAxis( riuPlotAxis ) && axisProperties )
|
||||||
|
{
|
||||||
|
plotWidget()->enableAxis( riuPlotAxis, true );
|
||||||
|
|
||||||
RimSummaryPlotAxisFormatter calc( yAxisProperties,
|
std::set<QString> timeHistoryQuantities;
|
||||||
visibleSummaryCurvesForAxis( plotAxis ),
|
|
||||||
{},
|
for ( auto c : visibleTimeHistoryCurvesForAxis( riuPlotAxis ) )
|
||||||
visibleAsciiDataCurvesForAxis( plotAxis ),
|
{
|
||||||
timeHistoryQuantities );
|
timeHistoryQuantities.insert( c->quantityName() );
|
||||||
calc.applyAxisPropertiesToPlot( plotWidget() );
|
}
|
||||||
}
|
|
||||||
else
|
RimSummaryPlotAxisFormatter calc( axisProperties,
|
||||||
{
|
visibleSummaryCurvesForAxis( riuPlotAxis ),
|
||||||
plotWidget()->enableAxis( plotAxis, false );
|
{},
|
||||||
|
visibleAsciiDataCurvesForAxis( riuPlotAxis ),
|
||||||
|
timeHistoryQuantities );
|
||||||
|
calc.applyAxisPropertiesToPlot( plotWidget() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plotWidget()->enableAxis( riuPlotAxis, false );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::updateZoomForAxis( RiaDefines::PlotAxis plotAxis )
|
void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis )
|
||||||
{
|
{
|
||||||
if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
RimPlotAxisPropertiesInterface* yAxisProps = axisPropertiesForPlotAxis( plotAxis );
|
||||||
|
if ( yAxisProps->isAutoZoom() )
|
||||||
{
|
{
|
||||||
if ( m_isCrossPlot )
|
if ( yAxisProps->isLogarithmicScaleEnabled() )
|
||||||
{
|
{
|
||||||
if ( m_bottomAxisProperties->isAutoZoom() )
|
plotWidget()->setAxisScaleType( yAxisProps->plotAxisType(), RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC );
|
||||||
|
|
||||||
|
std::vector<const RimPlotCurve*> plotCurves;
|
||||||
|
|
||||||
|
for ( RimSummaryCurve* c : visibleSummaryCurvesForAxis( plotAxis ) )
|
||||||
{
|
{
|
||||||
plotWidget()->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
plotCurves.push_back( c );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for ( RimGridTimeHistoryCurve* c : visibleTimeHistoryCurvesForAxis( plotAxis ) )
|
||||||
{
|
{
|
||||||
plotWidget()->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM,
|
plotCurves.push_back( c );
|
||||||
m_bottomAxisProperties->visibleRangeMin(),
|
|
||||||
m_bottomAxisProperties->visibleRangeMax() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for ( RimAsciiDataCurve* c : visibleAsciiDataCurvesForAxis( plotAxis ) )
|
||||||
|
{
|
||||||
|
plotCurves.push_back( c );
|
||||||
|
}
|
||||||
|
|
||||||
|
double min, max;
|
||||||
|
RimPlotAxisLogRangeCalculator calc( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotCurves );
|
||||||
|
calc.computeAxisRange( &min, &max );
|
||||||
|
|
||||||
|
if ( yAxisProps->isAxisInverted() )
|
||||||
|
{
|
||||||
|
std::swap( min, max );
|
||||||
|
}
|
||||||
|
|
||||||
|
plotWidget()->setAxisScale( yAxisProps->plotAxisType(), min, max );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_timeAxisProperties->isAutoZoom() )
|
plotWidget()->setAxisAutoScale( yAxisProps->plotAxisType(), true );
|
||||||
{
|
|
||||||
plotWidget()->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plotWidget()->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM,
|
|
||||||
m_timeAxisProperties->visibleRangeMin(),
|
|
||||||
m_timeAxisProperties->visibleRangeMax() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RimPlotAxisProperties* yAxisProps = yAxisPropertiesLeftOrRight( plotAxis );
|
plotWidget()->setAxisScale( yAxisProps->plotAxisType(),
|
||||||
|
yAxisProps->visibleRangeMin(),
|
||||||
if ( yAxisProps->isAutoZoom() )
|
yAxisProps->visibleRangeMax() );
|
||||||
{
|
|
||||||
if ( yAxisProps->isLogarithmicScaleEnabled )
|
|
||||||
{
|
|
||||||
plotWidget()->setAxisScaleType( yAxisProps->plotAxisType(), RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC );
|
|
||||||
|
|
||||||
std::vector<const RimPlotCurve*> plotCurves;
|
|
||||||
|
|
||||||
for ( RimSummaryCurve* c : visibleSummaryCurvesForAxis( plotAxis ) )
|
|
||||||
{
|
|
||||||
plotCurves.push_back( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( RimGridTimeHistoryCurve* c : visibleTimeHistoryCurvesForAxis( plotAxis ) )
|
|
||||||
{
|
|
||||||
plotCurves.push_back( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( RimAsciiDataCurve* c : visibleAsciiDataCurvesForAxis( plotAxis ) )
|
|
||||||
{
|
|
||||||
plotCurves.push_back( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
double min, max;
|
|
||||||
RimPlotAxisLogRangeCalculator calc( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotCurves );
|
|
||||||
calc.computeAxisRange( &min, &max );
|
|
||||||
|
|
||||||
if ( yAxisProps->isAxisInverted() )
|
|
||||||
{
|
|
||||||
std::swap( min, max );
|
|
||||||
}
|
|
||||||
|
|
||||||
plotWidget()->setAxisScale( yAxisProps->plotAxisType(), min, max );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plotWidget()->setAxisAutoScale( yAxisProps->plotAxisType(), true );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plotWidget()->setAxisScale( yAxisProps->plotAxisType(),
|
|
||||||
yAxisProps->visibleRangeMin(),
|
|
||||||
yAxisProps->visibleRangeMax() );
|
|
||||||
}
|
|
||||||
|
|
||||||
plotWidget()->setAxisInverted( yAxisProps->plotAxisType(), yAxisProps->isAxisInverted() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plotWidget()->setAxisInverted( yAxisProps->plotAxisType(), yAxisProps->isAxisInverted() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimSummaryCurve*> RimSummaryPlot::visibleSummaryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const
|
std::vector<RimSummaryCurve*> RimSummaryPlot::visibleSummaryCurvesForAxis( RiuPlotAxis plotAxis ) const
|
||||||
{
|
{
|
||||||
std::vector<RimSummaryCurve*> curves;
|
std::vector<RimSummaryCurve*> curves;
|
||||||
|
|
||||||
if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
if ( plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
||||||
{
|
{
|
||||||
if ( m_summaryCurveCollection && m_summaryCurveCollection->isCurvesVisible() )
|
if ( m_summaryCurveCollection && m_summaryCurveCollection->isCurvesVisible() )
|
||||||
{
|
{
|
||||||
@@ -1069,7 +1068,7 @@ std::vector<RimSummaryCurve*> RimSummaryPlot::visibleSummaryCurvesForAxis( RiaDe
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimSummaryPlot::hasVisibleCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const
|
bool RimSummaryPlot::hasVisibleCurvesForAxis( RiuPlotAxis plotAxis ) const
|
||||||
{
|
{
|
||||||
if ( visibleSummaryCurvesForAxis( plotAxis ).size() > 0 )
|
if ( visibleSummaryCurvesForAxis( plotAxis ).size() > 0 )
|
||||||
{
|
{
|
||||||
@@ -1092,28 +1091,22 @@ bool RimSummaryPlot::hasVisibleCurvesForAxis( RiaDefines::PlotAxis plotAxis ) co
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimPlotAxisProperties* RimSummaryPlot::yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis leftOrRightPlotAxis ) const
|
RimPlotAxisPropertiesInterface* RimSummaryPlot::axisPropertiesForPlotAxis( RiuPlotAxis plotAxis ) const
|
||||||
{
|
{
|
||||||
RimPlotAxisProperties* yAxisProps = nullptr;
|
for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties )
|
||||||
|
|
||||||
if ( leftOrRightPlotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
|
||||||
{
|
{
|
||||||
yAxisProps = m_leftYAxisProperties();
|
if ( axisProperties->plotAxisType() == plotAxis ) return axisProperties;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yAxisProps = m_rightYAxisProperties();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CVF_ASSERT( yAxisProps );
|
CVF_ASSERT( false && "No axis properties found for axis" );
|
||||||
|
|
||||||
return yAxisProps;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimGridTimeHistoryCurve*> RimSummaryPlot::visibleTimeHistoryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const
|
std::vector<RimGridTimeHistoryCurve*> RimSummaryPlot::visibleTimeHistoryCurvesForAxis( RiuPlotAxis plotAxis ) const
|
||||||
{
|
{
|
||||||
std::vector<RimGridTimeHistoryCurve*> curves;
|
std::vector<RimGridTimeHistoryCurve*> curves;
|
||||||
|
|
||||||
@@ -1121,7 +1114,7 @@ std::vector<RimGridTimeHistoryCurve*> RimSummaryPlot::visibleTimeHistoryCurvesFo
|
|||||||
{
|
{
|
||||||
if ( c->isCurveVisible() )
|
if ( c->isCurveVisible() )
|
||||||
{
|
{
|
||||||
if ( c->yAxis() == plotAxis || plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
if ( c->yAxis() == plotAxis || plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
||||||
{
|
{
|
||||||
curves.push_back( c );
|
curves.push_back( c );
|
||||||
}
|
}
|
||||||
@@ -1134,7 +1127,7 @@ std::vector<RimGridTimeHistoryCurve*> RimSummaryPlot::visibleTimeHistoryCurvesFo
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimAsciiDataCurve*> RimSummaryPlot::visibleAsciiDataCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const
|
std::vector<RimAsciiDataCurve*> RimSummaryPlot::visibleAsciiDataCurvesForAxis( RiuPlotAxis plotAxis ) const
|
||||||
{
|
{
|
||||||
std::vector<RimAsciiDataCurve*> curves;
|
std::vector<RimAsciiDataCurve*> curves;
|
||||||
|
|
||||||
@@ -1142,7 +1135,7 @@ std::vector<RimAsciiDataCurve*> RimSummaryPlot::visibleAsciiDataCurvesForAxis( R
|
|||||||
{
|
{
|
||||||
if ( c->isCurveVisible() )
|
if ( c->isCurveVisible() )
|
||||||
{
|
{
|
||||||
if ( c->yAxis() == plotAxis || plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
if ( c->yAxis() == plotAxis || plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
||||||
{
|
{
|
||||||
curves.push_back( c );
|
curves.push_back( c );
|
||||||
}
|
}
|
||||||
@@ -1155,24 +1148,24 @@ std::vector<RimAsciiDataCurve*> RimSummaryPlot::visibleAsciiDataCurvesForAxis( R
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::updateTimeAxis()
|
void RimSummaryPlot::updateTimeAxis( RimSummaryTimeAxisProperties* timeAxisProperties )
|
||||||
{
|
{
|
||||||
if ( !plotWidget() ) return;
|
if ( !plotWidget() ) return;
|
||||||
|
|
||||||
if ( !m_timeAxisProperties->isActive() )
|
if ( !timeAxisProperties->isActive() )
|
||||||
{
|
{
|
||||||
plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, false );
|
plotWidget()->enableAxis( RiuPlotAxis::defaultBottom(), false );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_timeAxisProperties->timeMode() == RimSummaryTimeAxisProperties::DATE )
|
if ( timeAxisProperties->timeMode() == RimSummaryTimeAxisProperties::DATE )
|
||||||
{
|
{
|
||||||
RiaQDateTimeTools::DateFormatComponents dateComponents = m_timeAxisProperties->dateComponents();
|
RiaQDateTimeTools::DateFormatComponents dateComponents = timeAxisProperties->dateComponents();
|
||||||
RiaQDateTimeTools::TimeFormatComponents timeComponents = m_timeAxisProperties->timeComponents();
|
RiaQDateTimeTools::TimeFormatComponents timeComponents = timeAxisProperties->timeComponents();
|
||||||
|
|
||||||
QString dateFormat = m_timeAxisProperties->dateFormat();
|
QString dateFormat = timeAxisProperties->dateFormat();
|
||||||
QString timeFormat = m_timeAxisProperties->timeFormat();
|
QString timeFormat = timeAxisProperties->timeFormat();
|
||||||
|
|
||||||
m_summaryPlot->useDateBasedTimeAxis( dateFormat, timeFormat, dateComponents, timeComponents );
|
m_summaryPlot->useDateBasedTimeAxis( dateFormat, timeFormat, dateComponents, timeComponents );
|
||||||
}
|
}
|
||||||
@@ -1181,26 +1174,25 @@ void RimSummaryPlot::updateTimeAxis()
|
|||||||
m_summaryPlot->useTimeBasedTimeAxis();
|
m_summaryPlot->useTimeBasedTimeAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
plotWidget()->enableAxis( RiuPlotAxis::defaultBottom(), true );
|
||||||
|
|
||||||
{
|
{
|
||||||
Qt::AlignmentFlag alignment = Qt::AlignCenter;
|
Qt::AlignmentFlag alignment = Qt::AlignCenter;
|
||||||
if ( m_timeAxisProperties->titlePosition() == RimPlotAxisPropertiesInterface::AXIS_TITLE_END )
|
if ( timeAxisProperties->titlePosition() == RimPlotAxisPropertiesInterface::AXIS_TITLE_END )
|
||||||
{
|
{
|
||||||
alignment = Qt::AlignRight;
|
alignment = Qt::AlignRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
plotWidget()->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM,
|
plotWidget()->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(),
|
||||||
m_timeAxisProperties->titleFontSize(),
|
timeAxisProperties->titleFontSize(),
|
||||||
m_timeAxisProperties->valuesFontSize(),
|
timeAxisProperties->valuesFontSize(),
|
||||||
true,
|
true,
|
||||||
alignment );
|
alignment );
|
||||||
plotWidget()->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_timeAxisProperties->title() );
|
plotWidget()->setAxisTitleText( RiuPlotAxis::defaultBottom(), timeAxisProperties->title() );
|
||||||
plotWidget()->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_timeAxisProperties->showTitle );
|
plotWidget()->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), timeAxisProperties->showTitle );
|
||||||
|
|
||||||
{
|
{
|
||||||
RimSummaryTimeAxisProperties::LegendTickmarkCount tickmarkCountEnum =
|
RimSummaryTimeAxisProperties::LegendTickmarkCount tickmarkCountEnum = timeAxisProperties->majorTickmarkCount();
|
||||||
m_timeAxisProperties->majorTickmarkCount();
|
|
||||||
|
|
||||||
int maxTickmarkCount = 8;
|
int maxTickmarkCount = 8;
|
||||||
|
|
||||||
@@ -1222,39 +1214,11 @@ void RimSummaryPlot::updateTimeAxis()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
plotWidget()->setAxisMaxMajor( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, maxTickmarkCount );
|
plotWidget()->setAxisMaxMajor( RiuPlotAxis::defaultBottom(), maxTickmarkCount );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimSummaryPlot::updateBottomXAxis()
|
|
||||||
{
|
|
||||||
if ( !plotWidget() ) return;
|
|
||||||
|
|
||||||
RimPlotAxisProperties* bottomAxisProperties = m_bottomAxisProperties();
|
|
||||||
|
|
||||||
if ( bottomAxisProperties->isActive() )
|
|
||||||
{
|
|
||||||
plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
|
||||||
|
|
||||||
std::set<QString> timeHistoryQuantities;
|
|
||||||
|
|
||||||
RimSummaryPlotAxisFormatter calc( bottomAxisProperties,
|
|
||||||
visibleSummaryCurvesForAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ),
|
|
||||||
{},
|
|
||||||
visibleAsciiDataCurvesForAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ),
|
|
||||||
timeHistoryQuantities );
|
|
||||||
calc.applyAxisPropertiesToPlot( plotWidget() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1300,9 +1264,7 @@ void RimSummaryPlot::addTimeRangeAnnotation( time_t startTime, time_t endTime )
|
|||||||
void RimSummaryPlot::removeAllTimeAnnotations()
|
void RimSummaryPlot::removeAllTimeAnnotations()
|
||||||
{
|
{
|
||||||
RimSummaryTimeAxisProperties* axisProps = timeAxisProperties();
|
RimSummaryTimeAxisProperties* axisProps = timeAxisProperties();
|
||||||
{
|
axisProps->removeAllAnnotations();
|
||||||
axisProps->removeAllAnnotations();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1318,33 +1280,24 @@ void RimSummaryPlot::zoomAll()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::addCurveAndUpdate( RimSummaryCurve* curve )
|
void RimSummaryPlot::addCurveAndUpdate( RimSummaryCurve* curve, bool autoAssignPlotAxis )
|
||||||
{
|
{
|
||||||
if ( curve )
|
if ( curve )
|
||||||
{
|
{
|
||||||
m_summaryCurveCollection->addCurve( curve );
|
m_summaryCurveCollection->addCurve( curve );
|
||||||
connectCurveSignals( curve );
|
connectCurveToPlot( curve, true, autoAssignPlotAxis );
|
||||||
if ( plotWidget() )
|
|
||||||
{
|
|
||||||
curve->setParentPlotAndReplot( plotWidget() );
|
|
||||||
this->updateAxes();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::addCurveNoUpdate( RimSummaryCurve* curve )
|
void RimSummaryPlot::addCurveNoUpdate( RimSummaryCurve* curve, bool autoAssignPlotAxis )
|
||||||
{
|
{
|
||||||
if ( curve )
|
if ( curve )
|
||||||
{
|
{
|
||||||
m_summaryCurveCollection->addCurve( curve );
|
m_summaryCurveCollection->addCurve( curve );
|
||||||
connectCurveSignals( curve );
|
connectCurveToPlot( curve, false, autoAssignPlotAxis );
|
||||||
if ( plotWidget() )
|
|
||||||
{
|
|
||||||
curve->setParentPlotNoReplot( plotWidget() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1356,8 +1309,26 @@ void RimSummaryPlot::insertCurve( RimSummaryCurve* curve, size_t insertAtPositio
|
|||||||
if ( curve )
|
if ( curve )
|
||||||
{
|
{
|
||||||
m_summaryCurveCollection->insertCurve( curve, insertAtPosition );
|
m_summaryCurveCollection->insertCurve( curve, insertAtPosition );
|
||||||
connectCurveSignals( curve );
|
connectCurveToPlot( curve, false, true );
|
||||||
if ( plotWidget() )
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis )
|
||||||
|
{
|
||||||
|
if ( autoAssignPlotAxis ) assignPlotAxis( curve );
|
||||||
|
|
||||||
|
connectCurveSignals( curve );
|
||||||
|
if ( plotWidget() )
|
||||||
|
{
|
||||||
|
if ( update )
|
||||||
|
{
|
||||||
|
curve->setParentPlotAndReplot( plotWidget() );
|
||||||
|
this->updateAxes();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
curve->setParentPlotNoReplot( plotWidget() );
|
curve->setParentPlotNoReplot( plotWidget() );
|
||||||
}
|
}
|
||||||
@@ -1576,8 +1547,12 @@ void RimSummaryPlot::childFieldChangedByUi( const caf::PdmFieldHandle* changedCh
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::updateStackedCurveData()
|
void RimSummaryPlot::updateStackedCurveData()
|
||||||
{
|
{
|
||||||
updateStackedCurveDataForAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties )
|
||||||
updateStackedCurveDataForAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
{
|
||||||
|
if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ||
|
||||||
|
axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
|
||||||
|
updateStackedCurveDataForAxis( axisProperties->plotAxisType() );
|
||||||
|
}
|
||||||
|
|
||||||
if ( plotWidget() )
|
if ( plotWidget() )
|
||||||
{
|
{
|
||||||
@@ -1589,7 +1564,7 @@ void RimSummaryPlot::updateStackedCurveData()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxis )
|
void RimSummaryPlot::updateStackedCurveDataForAxis( RiuPlotAxis plotAxis )
|
||||||
{
|
{
|
||||||
std::map<RiaDefines::PhaseType, size_t> curvePhaseCount;
|
std::map<RiaDefines::PhaseType, size_t> curvePhaseCount;
|
||||||
|
|
||||||
@@ -1645,6 +1620,7 @@ void RimSummaryPlot::updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1676,18 +1652,7 @@ void RimSummaryPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
caf::PdmUiTreeOrdering* axisFolder = uiTreeOrdering.add( "Axes", ":/Axes16x16.png" );
|
uiTreeOrdering.add( &m_axisProperties );
|
||||||
|
|
||||||
if ( m_isCrossPlot )
|
|
||||||
{
|
|
||||||
axisFolder->add( &m_bottomAxisProperties );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
axisFolder->add( &m_timeAxisProperties );
|
|
||||||
}
|
|
||||||
axisFolder->add( &m_leftYAxisProperties );
|
|
||||||
axisFolder->add( &m_rightYAxisProperties );
|
|
||||||
|
|
||||||
uiTreeOrdering.add( &m_summaryCurveCollection );
|
uiTreeOrdering.add( &m_summaryCurveCollection );
|
||||||
if ( !m_isCrossPlot )
|
if ( !m_isCrossPlot )
|
||||||
@@ -1746,9 +1711,10 @@ void RimSummaryPlot::updateZoomInParentPlot()
|
|||||||
{
|
{
|
||||||
if ( plotWidget() )
|
if ( plotWidget() )
|
||||||
{
|
{
|
||||||
updateZoomForAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
|
for ( auto axisProperty : m_axisProperties )
|
||||||
updateZoomForAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
{
|
||||||
updateZoomForAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
updateZoomForAxis( axisProperty->plotAxisType() );
|
||||||
|
}
|
||||||
|
|
||||||
plotWidget()->updateAxes();
|
plotWidget()->updateAxes();
|
||||||
updateZoomFromParentPlot();
|
updateZoomFromParentPlot();
|
||||||
@@ -1763,38 +1729,13 @@ void RimSummaryPlot::updateZoomFromParentPlot()
|
|||||||
{
|
{
|
||||||
if ( !plotWidget() ) return;
|
if ( !plotWidget() ) return;
|
||||||
|
|
||||||
auto [leftAxisMin, leftAxisMax] = plotWidget()->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties )
|
||||||
auto [rightAxisMin, rightAxisMax] = plotWidget()->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
|
||||||
auto [timeAxisMin, timeAxisMax] = plotWidget()->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
|
|
||||||
|
|
||||||
m_leftYAxisProperties->visibleRangeMax = leftAxisMax;
|
|
||||||
m_leftYAxisProperties->visibleRangeMin = leftAxisMin;
|
|
||||||
m_leftYAxisProperties->updateConnectedEditors();
|
|
||||||
|
|
||||||
m_rightYAxisProperties->visibleRangeMax = rightAxisMax;
|
|
||||||
m_rightYAxisProperties->visibleRangeMin = rightAxisMin;
|
|
||||||
m_rightYAxisProperties->updateConnectedEditors();
|
|
||||||
|
|
||||||
if ( m_isCrossPlot )
|
|
||||||
{
|
{
|
||||||
m_bottomAxisProperties->visibleRangeMax = timeAxisMax;
|
auto [axisMin, axisMax] = plotWidget()->axisRange( axisProperties->plotAxisType() );
|
||||||
m_bottomAxisProperties->visibleRangeMin = timeAxisMin;
|
axisProperties->setVisibleRangeMax( axisMax );
|
||||||
m_bottomAxisProperties->updateConnectedEditors();
|
axisProperties->setVisibleRangeMin( axisMin );
|
||||||
|
axisProperties->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_timeAxisProperties->setVisibleRangeMin( timeAxisMin );
|
|
||||||
m_timeAxisProperties->setVisibleRangeMax( timeAxisMax );
|
|
||||||
m_timeAxisProperties->updateConnectedEditors();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::set<RimPlotAxisPropertiesInterface*> RimSummaryPlot::allPlotAxes() const
|
|
||||||
{
|
|
||||||
return { m_timeAxisProperties, m_bottomAxisProperties, m_leftYAxisProperties, m_rightYAxisProperties };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1950,14 +1891,6 @@ bool RimSummaryPlot::autoPlotTitle() const
|
|||||||
return m_useAutoPlotTitle;
|
return m_useAutoPlotTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimSummaryPlot::setAsCrossPlot()
|
|
||||||
{
|
|
||||||
m_isCrossPlot = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -2120,6 +2053,31 @@ void RimSummaryPlot::initAfterRead()
|
|||||||
{
|
{
|
||||||
RimViewWindow::initAfterRead();
|
RimViewWindow::initAfterRead();
|
||||||
|
|
||||||
|
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2021.10.2" ) )
|
||||||
|
{
|
||||||
|
auto copyAxis = [this]( RiuPlotAxis axis, auto axisProperties ) {
|
||||||
|
QString data = axisProperties->writeObjectToXmlString();
|
||||||
|
axisPropertiesForPlotAxis( axis )->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
|
||||||
|
};
|
||||||
|
|
||||||
|
copyAxis( RiuPlotAxis::defaultLeft(), m_leftYAxisProperties_OBSOLETE.v() );
|
||||||
|
copyAxis( RiuPlotAxis::defaultRight(), m_rightYAxisProperties_OBSOLETE.v() );
|
||||||
|
|
||||||
|
if ( m_isCrossPlot )
|
||||||
|
copyAxis( RiuPlotAxis::defaultBottom(), m_bottomAxisProperties_OBSOLETE.v() );
|
||||||
|
else
|
||||||
|
copyAxis( RiuPlotAxis::defaultBottom(), m_timeAxisProperties_OBSOLETE.v() );
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( auto axisProperties : m_axisProperties )
|
||||||
|
{
|
||||||
|
auto plotAxisProperties = dynamic_cast<RimPlotAxisProperties*>( axisProperties.p() );
|
||||||
|
if ( plotAxisProperties )
|
||||||
|
{
|
||||||
|
connectAxisSignals( plotAxisProperties );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for ( auto curve : summaryCurves() )
|
for ( auto curve : summaryCurves() )
|
||||||
{
|
{
|
||||||
connectCurveSignals( curve );
|
connectCurveSignals( curve );
|
||||||
@@ -2381,13 +2339,13 @@ std::vector<caf::PdmFieldHandle*> RimSummaryPlot::fieldsToShowInToolbar()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::setAutoScaleXEnabled( bool enabled )
|
void RimSummaryPlot::setAutoScaleXEnabled( bool enabled )
|
||||||
{
|
{
|
||||||
if ( m_isCrossPlot )
|
for ( auto ap : m_axisProperties )
|
||||||
{
|
{
|
||||||
m_bottomAxisProperties->setAutoZoom( enabled );
|
if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_TOP ||
|
||||||
}
|
ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
||||||
else
|
{
|
||||||
{
|
ap->setAutoZoom( enabled );
|
||||||
m_timeAxisProperties->setAutoZoom( enabled );
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2396,8 +2354,14 @@ void RimSummaryPlot::setAutoScaleXEnabled( bool enabled )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::setAutoScaleYEnabled( bool enabled )
|
void RimSummaryPlot::setAutoScaleYEnabled( bool enabled )
|
||||||
{
|
{
|
||||||
m_leftYAxisProperties->setAutoZoom( enabled );
|
for ( auto ap : m_axisProperties )
|
||||||
m_rightYAxisProperties->setAutoZoom( enabled );
|
{
|
||||||
|
if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ||
|
||||||
|
ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
|
||||||
|
{
|
||||||
|
ap->setAutoZoom( enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -2767,3 +2731,38 @@ CurvesData concatCurvesData( const std::vector<CurvesData>& curvesData )
|
|||||||
}
|
}
|
||||||
return resultCurvesData;
|
return resultCurvesData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RimPlotAxisPropertiesInterface*> RimSummaryPlot::plotAxes() const
|
||||||
|
{
|
||||||
|
std::vector<RimPlotAxisPropertiesInterface*> axisProps;
|
||||||
|
for ( auto ap : m_axisProperties )
|
||||||
|
{
|
||||||
|
axisProps.push_back( ap );
|
||||||
|
}
|
||||||
|
|
||||||
|
return axisProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* curve )
|
||||||
|
{
|
||||||
|
RiaDefines::PlotAxis plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_LEFT;
|
||||||
|
|
||||||
|
RiuPlotAxis newPlotAxis = RiuPlotAxis::defaultLeft();
|
||||||
|
if ( plotWidget() && plotWidget()->isMultiAxisSupported() )
|
||||||
|
{
|
||||||
|
newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis );
|
||||||
|
|
||||||
|
RimPlotAxisProperties* newAxisProperties = new RimPlotAxisProperties;
|
||||||
|
newAxisProperties->setNameAndAxis( "New Axis", newPlotAxis.axis(), newPlotAxis.index() );
|
||||||
|
m_axisProperties.push_back( newAxisProperties );
|
||||||
|
connectAxisSignals( newAxisProperties );
|
||||||
|
}
|
||||||
|
|
||||||
|
curve->setLeftOrRightAxisY( newPlotAxis );
|
||||||
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping
|
|||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RimSummaryPlot();
|
RimSummaryPlot( bool isCrossPlot = false );
|
||||||
~RimSummaryPlot() override;
|
~RimSummaryPlot() override;
|
||||||
|
|
||||||
void setDescription( const QString& description );
|
void setDescription( const QString& description );
|
||||||
@@ -83,8 +83,8 @@ public:
|
|||||||
void enableAutoPlotTitle( bool enable );
|
void enableAutoPlotTitle( bool enable );
|
||||||
bool autoPlotTitle() const;
|
bool autoPlotTitle() const;
|
||||||
|
|
||||||
void addCurveAndUpdate( RimSummaryCurve* curve );
|
void addCurveAndUpdate( RimSummaryCurve* curve, bool autoAssignPlotAxis = true );
|
||||||
void addCurveNoUpdate( RimSummaryCurve* curve );
|
void addCurveNoUpdate( RimSummaryCurve* curve, bool autoAssignPlotAxis = true );
|
||||||
|
|
||||||
void insertCurve( RimSummaryCurve* curve, size_t insertAtPosition );
|
void insertCurve( RimSummaryCurve* curve, size_t insertAtPosition );
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ public:
|
|||||||
|
|
||||||
void updateAxes() override;
|
void updateAxes() override;
|
||||||
|
|
||||||
bool isLogarithmicScaleEnabled( RiaDefines::PlotAxis plotAxis ) const;
|
bool isLogarithmicScaleEnabled( RiuPlotAxis plotAxis ) const;
|
||||||
|
|
||||||
RimSummaryTimeAxisProperties* timeAxisProperties();
|
RimSummaryTimeAxisProperties* timeAxisProperties();
|
||||||
time_t firstTimeStepOfFirstCurve();
|
time_t firstTimeStepOfFirstCurve();
|
||||||
@@ -185,6 +185,10 @@ public:
|
|||||||
std::vector<RimEnsembleCurveSet*> curveSets() const override;
|
std::vector<RimEnsembleCurveSet*> curveSets() const override;
|
||||||
std::vector<RimSummaryCurve*> allCurves( RimSummaryDataSourceStepping::Axis axis ) const override;
|
std::vector<RimSummaryCurve*> allCurves( RimSummaryDataSourceStepping::Axis axis ) const override;
|
||||||
|
|
||||||
|
std::vector<RimPlotAxisPropertiesInterface*> plotAxes() const;
|
||||||
|
|
||||||
|
RimPlotAxisPropertiesInterface* axisPropertiesForPlotAxis( RiuPlotAxis plotAxis ) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// RimViewWindow overrides
|
// RimViewWindow overrides
|
||||||
void deleteViewWidget() override;
|
void deleteViewWidget() override;
|
||||||
@@ -205,13 +209,15 @@ private:
|
|||||||
|
|
||||||
void onCurveCollectionChanged( const SignalEmitter* emitter );
|
void onCurveCollectionChanged( const SignalEmitter* emitter );
|
||||||
|
|
||||||
|
void connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
||||||
void updateStackedCurveData();
|
void updateStackedCurveData();
|
||||||
void updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxis );
|
void updateStackedCurveDataForAxis( RiuPlotAxis plotAxis );
|
||||||
|
|
||||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||||
@@ -220,27 +226,21 @@ protected:
|
|||||||
|
|
||||||
QImage snapshotWindowContent() override;
|
QImage snapshotWindowContent() override;
|
||||||
|
|
||||||
void setAsCrossPlot();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onPlotZoomed();
|
void onPlotZoomed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<RimSummaryCurve*> visibleSummaryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const;
|
std::vector<RimSummaryCurve*> visibleSummaryCurvesForAxis( RiuPlotAxis plotAxis ) const;
|
||||||
std::vector<RimGridTimeHistoryCurve*> visibleTimeHistoryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const;
|
std::vector<RimGridTimeHistoryCurve*> visibleTimeHistoryCurvesForAxis( RiuPlotAxis plotAxis ) const;
|
||||||
std::vector<RimAsciiDataCurve*> visibleAsciiDataCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const;
|
std::vector<RimAsciiDataCurve*> visibleAsciiDataCurvesForAxis( RiuPlotAxis plotAxis ) const;
|
||||||
bool hasVisibleCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const;
|
bool hasVisibleCurvesForAxis( RiuPlotAxis plotAxis ) const;
|
||||||
std::vector<RimSummaryCurve*> visibleStackedSummaryCurvesForAxis( RiaDefines::PlotAxis plotAxis );
|
std::vector<RimSummaryCurve*> visibleStackedSummaryCurvesForAxis( RiuPlotAxis plotAxis );
|
||||||
|
|
||||||
RimPlotAxisProperties* yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis leftOrRightPlotAxis ) const;
|
void updateAxis( RiaDefines::PlotAxis plotAxis );
|
||||||
void updateYAxis( RiaDefines::PlotAxis plotAxis );
|
|
||||||
|
|
||||||
void updateZoomForAxis( RiaDefines::PlotAxis plotAxis );
|
void updateZoomForAxis( RiuPlotAxis plotAxis );
|
||||||
|
|
||||||
void updateTimeAxis();
|
void updateTimeAxis( RimSummaryTimeAxisProperties* timeAxisProperties );
|
||||||
void updateBottomXAxis();
|
|
||||||
|
|
||||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
|
||||||
|
|
||||||
void cleanupBeforeClose();
|
void cleanupBeforeClose();
|
||||||
|
|
||||||
@@ -256,6 +256,7 @@ private:
|
|||||||
void connectAxisSignals( RimPlotAxisProperties* axis );
|
void connectAxisSignals( RimPlotAxisProperties* axis );
|
||||||
void axisSettingsChanged( const caf::SignalEmitter* emitter );
|
void axisSettingsChanged( const caf::SignalEmitter* emitter );
|
||||||
void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic );
|
void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic );
|
||||||
|
void assignPlotAxis( RimSummaryCurve* curve );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef USE_QTCHARTS
|
#ifdef USE_QTCHARTS
|
||||||
@@ -272,11 +273,13 @@ private:
|
|||||||
|
|
||||||
caf::PdmChildArrayField<RimAsciiDataCurve*> m_asciiDataCurves;
|
caf::PdmChildArrayField<RimAsciiDataCurve*> m_asciiDataCurves;
|
||||||
|
|
||||||
caf::PdmChildField<RimPlotAxisProperties*> m_leftYAxisProperties;
|
caf::PdmChildField<RimPlotAxisProperties*> m_leftYAxisProperties_OBSOLETE;
|
||||||
caf::PdmChildField<RimPlotAxisProperties*> m_rightYAxisProperties;
|
caf::PdmChildField<RimPlotAxisProperties*> m_rightYAxisProperties_OBSOLETE;
|
||||||
|
|
||||||
caf::PdmChildField<RimPlotAxisProperties*> m_bottomAxisProperties;
|
caf::PdmChildField<RimPlotAxisProperties*> m_bottomAxisProperties_OBSOLETE;
|
||||||
caf::PdmChildField<RimSummaryTimeAxisProperties*> m_timeAxisProperties;
|
caf::PdmChildField<RimSummaryTimeAxisProperties*> m_timeAxisProperties_OBSOLETE;
|
||||||
|
|
||||||
|
caf::PdmChildArrayField<RimPlotAxisPropertiesInterface*> m_axisProperties;
|
||||||
|
|
||||||
caf::PdmChildField<RimSummaryPlotFilterTextCurveSetEditor*> m_textCurveSetEditor;
|
caf::PdmChildField<RimSummaryPlotFilterTextCurveSetEditor*> m_textCurveSetEditor;
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot
|
|||||||
{
|
{
|
||||||
if ( !plotWidget ) return;
|
if ( !plotWidget ) return;
|
||||||
|
|
||||||
RiaDefines::PlotAxis axis = m_axisProperties->plotAxisType();
|
RiuPlotAxis axis = m_axisProperties->plotAxisType();
|
||||||
{
|
{
|
||||||
QString axisTitle = m_axisProperties->customTitle;
|
QString axisTitle = m_axisProperties->customTitle;
|
||||||
if ( m_axisProperties->useAutoTitle() ) axisTitle = autoAxisTitle();
|
if ( m_axisProperties->useAutoTitle() ) axisTitle = autoAxisTitle();
|
||||||
@@ -140,7 +140,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot
|
|||||||
auto qwtPlotWidget = dynamic_cast<RiuQwtPlotWidget*>( plotWidget );
|
auto qwtPlotWidget = dynamic_cast<RiuQwtPlotWidget*>( plotWidget );
|
||||||
if ( qwtPlotWidget )
|
if ( qwtPlotWidget )
|
||||||
{
|
{
|
||||||
QwtPlot::Axis qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
QwtPlot::Axis qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||||
|
|
||||||
if ( m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_AUTO &&
|
if ( m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_AUTO &&
|
||||||
m_axisProperties->scaleFactor() == 1.0 )
|
m_axisProperties->scaleFactor() == 1.0 )
|
||||||
@@ -178,7 +178,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
if ( m_axisProperties->isLogarithmicScaleEnabled )
|
if ( m_axisProperties->isLogarithmicScaleEnabled() )
|
||||||
{
|
{
|
||||||
bool isLogScale = plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC;
|
bool isLogScale = plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC;
|
||||||
if ( !isLogScale )
|
if ( !isLogScale )
|
||||||
@@ -254,7 +254,7 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
|||||||
RifEclipseSummaryAddress sumAddress;
|
RifEclipseSummaryAddress sumAddress;
|
||||||
std::string unitText;
|
std::string unitText;
|
||||||
|
|
||||||
if ( m_axisProperties->plotAxisType() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
if ( m_axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
||||||
{
|
{
|
||||||
sumAddress = rimCurve->summaryAddressX();
|
sumAddress = rimCurve->summaryAddressX();
|
||||||
unitText = rimCurve->unitNameX();
|
unitText = rimCurve->unitNameX();
|
||||||
|
|||||||
@@ -132,9 +132,9 @@ RimPlotAxisPropertiesInterface::AxisTitlePositionType RimSummaryTimeAxisProperti
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaDefines::PlotAxis RimSummaryTimeAxisProperties::plotAxisType() const
|
RiuPlotAxis RimSummaryTimeAxisProperties::plotAxisType() const
|
||||||
{
|
{
|
||||||
return RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM;
|
return RiuPlotAxis::defaultBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -698,3 +698,11 @@ void RimSummaryTimeAxisProperties::defineEditorAttribute( const caf::PdmFieldHan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const QString& RimSummaryTimeAxisProperties::name() const
|
||||||
|
{
|
||||||
|
return title();
|
||||||
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimSummaryTimeAxisProperties : public caf::PdmObject, public RimPlotAxisPropertiesInterface
|
class RimSummaryTimeAxisProperties : public RimPlotAxisPropertiesInterface
|
||||||
{
|
{
|
||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
caf::PdmField<QString> title;
|
caf::PdmField<QString> title;
|
||||||
caf::PdmField<bool> showTitle;
|
caf::PdmField<bool> showTitle;
|
||||||
|
|
||||||
RiaDefines::PlotAxis plotAxisType() const override;
|
RiuPlotAxis plotAxisType() const override;
|
||||||
AxisTitlePositionType titlePosition() const override;
|
AxisTitlePositionType titlePosition() const override;
|
||||||
int titleFontSize() const override;
|
int titleFontSize() const override;
|
||||||
int valuesFontSize() const override;
|
int valuesFontSize() const override;
|
||||||
@@ -88,16 +88,16 @@ public:
|
|||||||
const QString& dateFormat() const;
|
const QString& dateFormat() const;
|
||||||
const QString& timeFormat() const;
|
const QString& timeFormat() const;
|
||||||
|
|
||||||
double visibleRangeMin() const;
|
double visibleRangeMin() const override;
|
||||||
double visibleRangeMax() const;
|
double visibleRangeMax() const override;
|
||||||
|
|
||||||
void setVisibleRangeMin( double value );
|
void setVisibleRangeMin( double value ) override;
|
||||||
void setVisibleRangeMax( double value );
|
void setVisibleRangeMax( double value ) override;
|
||||||
|
|
||||||
bool isAutoZoom() const;
|
bool isAutoZoom() const override;
|
||||||
void setAutoZoom( bool enableAutoZoom );
|
void setAutoZoom( bool enableAutoZoom ) override;
|
||||||
|
|
||||||
bool isActive() const;
|
bool isActive() const override;
|
||||||
|
|
||||||
QDateTime visibleDateTimeMin() const;
|
QDateTime visibleDateTimeMin() const;
|
||||||
QDateTime visibleDateTimeMax() const;
|
QDateTime visibleDateTimeMax() const;
|
||||||
@@ -108,6 +108,8 @@ public:
|
|||||||
LegendTickmarkCount majorTickmarkCount() const;
|
LegendTickmarkCount majorTickmarkCount() const;
|
||||||
void setMajorTickmarkCount( LegendTickmarkCount count );
|
void setMajorTickmarkCount( LegendTickmarkCount count );
|
||||||
|
|
||||||
|
const QString& name() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||||
|
|||||||
@@ -179,8 +179,8 @@ void RimWellLogCurve::updateCurveAppearance()
|
|||||||
|
|
||||||
if ( m_plotCurve )
|
if ( m_plotCurve )
|
||||||
{
|
{
|
||||||
m_plotCurve->setXAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP );
|
m_plotCurve->setXAxis( RiuPlotAxis::defaultTop() );
|
||||||
m_plotCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
m_plotCurve->setYAxis( RiuPlotAxis::defaultLeft() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fillStyle() != Qt::BrushStyle::NoBrush )
|
if ( fillStyle() != Qt::BrushStyle::NoBrush )
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
|||||||
RiuQwtPlotWidget* viewer = wellLogTrack->viewer();
|
RiuQwtPlotWidget* viewer = wellLogTrack->viewer();
|
||||||
if ( viewer )
|
if ( viewer )
|
||||||
{
|
{
|
||||||
viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PL/" + wellLogPlot->depthAxisTitle() );
|
viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "PL/" + wellLogPlot->depthAxisTitle() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -496,18 +496,16 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
|||||||
{
|
{
|
||||||
if ( derivedMDSource == WELL_PATH )
|
if ( derivedMDSource == WELL_PATH )
|
||||||
{
|
{
|
||||||
viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "WELL/" + wellLogPlot->depthAxisTitle() );
|
||||||
"WELL/" + wellLogPlot->depthAxisTitle() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "OBS/" + wellLogPlot->depthAxisTitle() );
|
||||||
"OBS/" + wellLogPlot->depthAxisTitle() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Standard depth title set from plot
|
else // Standard depth title set from plot
|
||||||
{
|
{
|
||||||
viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, wellLogPlot->depthAxisTitle() );
|
viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), wellLogPlot->depthAxisTitle() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ void RimWellLogTrack::updateXZoom()
|
|||||||
componentRangeMax *= 1.5;
|
componentRangeMax *= 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, componentRangeMin, componentRangeMax );
|
m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), componentRangeMin, componentRangeMax );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -503,7 +503,7 @@ void RimWellLogTrack::updateYZoom()
|
|||||||
{
|
{
|
||||||
if ( !m_plotWidget ) return;
|
if ( !m_plotWidget ) return;
|
||||||
|
|
||||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, m_visibleDepthRangeMin(), m_visibleDepthRangeMax() );
|
m_plotWidget->setAxisRange( RiuPlotAxis::defaultLeft(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -540,8 +540,8 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|||||||
{
|
{
|
||||||
if ( m_plotWidget )
|
if ( m_plotWidget )
|
||||||
{
|
{
|
||||||
m_majorTickInterval = m_plotWidget->majorTickInterval( RiaDefines::PlotAxis::PLOT_AXIS_TOP );
|
m_majorTickInterval = m_plotWidget->majorTickInterval( RiuPlotAxis::defaultTop() );
|
||||||
m_minorTickInterval = m_plotWidget->minorTickInterval( RiaDefines::PlotAxis::PLOT_AXIS_TOP );
|
m_minorTickInterval = m_plotWidget->minorTickInterval( RiuPlotAxis::defaultTop() );
|
||||||
}
|
}
|
||||||
m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() );
|
m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() );
|
||||||
m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() );
|
m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() );
|
||||||
@@ -762,13 +762,13 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
|||||||
bool emptyRange = isEmptyVisibleXRange();
|
bool emptyRange = isEmptyVisibleXRange();
|
||||||
if ( emptyRange )
|
if ( emptyRange )
|
||||||
{
|
{
|
||||||
m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false, false );
|
m_plotWidget->enableGridLines( RiuPlotAxis::defaultTop(), false, false );
|
||||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP, 0.0, 1.0 );
|
m_plotWidget->setAxisRange( RiuPlotAxis::defaultTop(), 0.0, 1.0 );
|
||||||
m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false, false );
|
m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultTop(), false, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP, true, true );
|
m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultTop(), true, true );
|
||||||
if ( m_minAndMaxTicksOnly )
|
if ( m_minAndMaxTicksOnly )
|
||||||
{
|
{
|
||||||
auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) {
|
auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) {
|
||||||
@@ -807,7 +807,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
|||||||
}
|
}
|
||||||
else if ( m_explicitTickIntervals )
|
else if ( m_explicitTickIntervals )
|
||||||
{
|
{
|
||||||
m_plotWidget->setMajorAndMinorTickIntervals( RiaDefines::PlotAxis::PLOT_AXIS_TOP,
|
m_plotWidget->setMajorAndMinorTickIntervals( RiuPlotAxis::defaultTop(),
|
||||||
m_majorTickInterval(),
|
m_majorTickInterval(),
|
||||||
m_minorTickInterval(),
|
m_minorTickInterval(),
|
||||||
m_visibleXRangeMin(),
|
m_visibleXRangeMin(),
|
||||||
@@ -817,13 +817,11 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
|||||||
{
|
{
|
||||||
int majorTickIntervals = 5;
|
int majorTickIntervals = 5;
|
||||||
int minorTickIntervals = 10;
|
int minorTickIntervals = 10;
|
||||||
m_plotWidget->setAutoTickIntervalCounts( RiaDefines::PlotAxis::PLOT_AXIS_TOP,
|
m_plotWidget->setAutoTickIntervalCounts( RiuPlotAxis::defaultTop(), majorTickIntervals, minorTickIntervals );
|
||||||
majorTickIntervals,
|
m_plotWidget->setAxisRange( RiuPlotAxis::defaultTop(), m_visibleXRangeMin, m_visibleXRangeMax );
|
||||||
minorTickIntervals );
|
|
||||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP, m_visibleXRangeMin, m_visibleXRangeMax );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_TOP,
|
m_plotWidget->enableGridLines( RiuPlotAxis::defaultTop(),
|
||||||
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR,
|
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR,
|
||||||
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR );
|
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR );
|
||||||
}
|
}
|
||||||
@@ -832,7 +830,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
|||||||
this->firstAncestorOrThisOfType( wellLogPlot );
|
this->firstAncestorOrThisOfType( wellLogPlot );
|
||||||
if ( wellLogPlot )
|
if ( wellLogPlot )
|
||||||
{
|
{
|
||||||
m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
m_plotWidget->enableGridLines( RiuPlotAxis::defaultLeft(),
|
||||||
wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR,
|
wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR,
|
||||||
wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR );
|
wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR );
|
||||||
}
|
}
|
||||||
@@ -1008,8 +1006,8 @@ QString RimWellLogTrack::asciiDataForPlotExport() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogTrack::updateZoomFromParentPlot()
|
void RimWellLogTrack::updateZoomFromParentPlot()
|
||||||
{
|
{
|
||||||
auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP );
|
auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultTop() );
|
||||||
auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultLeft() );
|
||||||
|
|
||||||
m_visibleXRangeMin = xIntervalMin;
|
m_visibleXRangeMin = xIntervalMin;
|
||||||
m_visibleXRangeMax = xIntervalMax;
|
m_visibleXRangeMax = xIntervalMax;
|
||||||
@@ -1228,8 +1226,8 @@ void RimWellLogTrack::onLoadDataAndUpdate()
|
|||||||
|
|
||||||
if ( wellLogPlot && m_plotWidget )
|
if ( wellLogPlot && m_plotWidget )
|
||||||
{
|
{
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_TOP, m_xAxisTitle );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultTop(), m_xAxisTitle );
|
||||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, wellLogPlot->depthAxisTitle() );
|
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), wellLogPlot->depthAxisTitle() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
||||||
@@ -1507,7 +1505,7 @@ RiuPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParen
|
|||||||
if ( m_plotWidget == nullptr )
|
if ( m_plotWidget == nullptr )
|
||||||
{
|
{
|
||||||
m_plotWidget = new RiuWellLogTrack( this, mainWindowParent );
|
m_plotWidget = new RiuWellLogTrack( this, mainWindowParent );
|
||||||
m_plotWidget->setAxisInverted( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), true );
|
||||||
updateAxisScaleEngine();
|
updateAxisScaleEngine();
|
||||||
|
|
||||||
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RiuPlotAxis.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.h
|
${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.h
|
||||||
@@ -156,6 +157,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RiuPlotAxis.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.cpp
|
||||||
|
|||||||
@@ -620,10 +620,10 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
|
|||||||
subTitleFont.setPixelSize( m_subTitleFontPixelSize );
|
subTitleFont.setPixelSize( m_subTitleFontPixelSize );
|
||||||
subTitles[visibleIndex]->setFont( subTitleFont );
|
subTitles[visibleIndex]->setFont( subTitleFont );
|
||||||
|
|
||||||
plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultLeft(),
|
||||||
showYAxis( row, column ),
|
showYAxis( row, column ),
|
||||||
showYAxis( row, column ) );
|
showYAxis( row, column ) );
|
||||||
plotWidgets[visibleIndex]->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, showYAxis( row, column ) );
|
plotWidgets[visibleIndex]->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), showYAxis( row, column ) );
|
||||||
plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize );
|
plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize );
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -698,7 +698,7 @@ int RiuMultiPlotPage::alignCanvasTops()
|
|||||||
if ( qwtPlotWidget )
|
if ( qwtPlotWidget )
|
||||||
{
|
{
|
||||||
int row = visibleIndex / rowAndColumnCount.second;
|
int row = visibleIndex / rowAndColumnCount.second;
|
||||||
if ( plotWidgets[visibleIndex]->axisEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP ) )
|
if ( plotWidgets[visibleIndex]->axisEnabled( RiuPlotAxis::defaultTop() ) )
|
||||||
{
|
{
|
||||||
QFont font = qwtPlotWidget->qwtPlot()->axisFont( QwtPlot::xTop );
|
QFont font = qwtPlotWidget->qwtPlot()->axisFont( QwtPlot::xTop );
|
||||||
maxExtents[row] = std::max( maxExtents[row],
|
maxExtents[row] = std::max( maxExtents[row],
|
||||||
|
|||||||
120
ApplicationLibCode/UserInterface/RiuPlotAxis.cpp
Normal file
120
ApplicationLibCode/UserInterface/RiuPlotAxis.cpp
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2022- Equinor ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RiuPlotAxis.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis::RiuPlotAxis()
|
||||||
|
: m_axis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
||||||
|
, m_index( 0 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis::RiuPlotAxis( RiaDefines::PlotAxis axis )
|
||||||
|
: m_axis( axis )
|
||||||
|
, m_index( 0 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis::RiuPlotAxis( RiaDefines::PlotAxis axis, int index )
|
||||||
|
: m_axis( axis )
|
||||||
|
, m_index( index )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis::~RiuPlotAxis()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis RiuPlotAxis::defaultLeft()
|
||||||
|
{
|
||||||
|
return RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis RiuPlotAxis::defaultRight()
|
||||||
|
{
|
||||||
|
return RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis RiuPlotAxis::defaultTop()
|
||||||
|
{
|
||||||
|
return RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis RiuPlotAxis::defaultBottom()
|
||||||
|
{
|
||||||
|
return RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiaDefines::PlotAxis RiuPlotAxis::axis() const
|
||||||
|
{
|
||||||
|
return m_axis;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RiuPlotAxis::index() const
|
||||||
|
{
|
||||||
|
return m_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RiuPlotAxis::operator<( const RiuPlotAxis& rhs ) const
|
||||||
|
{
|
||||||
|
if ( m_axis != rhs.m_axis )
|
||||||
|
return m_axis < rhs.m_axis;
|
||||||
|
else
|
||||||
|
return m_index < rhs.m_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RiuPlotAxis::operator==( const RiuPlotAxis& rhs )
|
||||||
|
{
|
||||||
|
return m_axis == rhs.m_axis && m_index == rhs.m_index;
|
||||||
|
}
|
||||||
46
ApplicationLibCode/UserInterface/RiuPlotAxis.h
Normal file
46
ApplicationLibCode/UserInterface/RiuPlotAxis.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2022- Equinor ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "RiaPlotDefines.h"
|
||||||
|
|
||||||
|
class RiuPlotAxis
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit RiuPlotAxis();
|
||||||
|
explicit RiuPlotAxis( RiaDefines::PlotAxis axis );
|
||||||
|
explicit RiuPlotAxis( RiaDefines::PlotAxis axis, int index );
|
||||||
|
virtual ~RiuPlotAxis();
|
||||||
|
|
||||||
|
static RiuPlotAxis defaultLeft();
|
||||||
|
static RiuPlotAxis defaultRight();
|
||||||
|
static RiuPlotAxis defaultTop();
|
||||||
|
static RiuPlotAxis defaultBottom();
|
||||||
|
|
||||||
|
RiaDefines::PlotAxis axis() const;
|
||||||
|
|
||||||
|
int index() const;
|
||||||
|
|
||||||
|
bool operator<( const RiuPlotAxis& rhs ) const;
|
||||||
|
bool operator==( const RiuPlotAxis& rhs );
|
||||||
|
|
||||||
|
private:
|
||||||
|
RiaDefines::PlotAxis m_axis;
|
||||||
|
int m_index;
|
||||||
|
};
|
||||||
@@ -122,8 +122,8 @@ public:
|
|||||||
virtual std::pair<double, double> xDataRange() const = 0;
|
virtual std::pair<double, double> xDataRange() const = 0;
|
||||||
virtual std::pair<double, double> yDataRange() const = 0;
|
virtual std::pair<double, double> yDataRange() const = 0;
|
||||||
|
|
||||||
virtual void setXAxis( RiaDefines::PlotAxis axis ) = 0;
|
virtual void setXAxis( RiuPlotAxis axis ) = 0;
|
||||||
virtual void setYAxis( RiaDefines::PlotAxis axis ) = 0;
|
virtual void setYAxis( RiuPlotAxis axis ) = 0;
|
||||||
|
|
||||||
virtual void setSymbol( RiuPlotCurveSymbol* symbol ) = 0;
|
virtual void setSymbol( RiuPlotCurveSymbol* symbol ) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "RiaPlotDefines.h"
|
#include "RiaPlotDefines.h"
|
||||||
|
|
||||||
#include "RiuInterfaceToViewWindow.h"
|
#include "RiuInterfaceToViewWindow.h"
|
||||||
|
#include "RiuPlotAxis.h"
|
||||||
|
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmPointer.h"
|
#include "cafPdmPointer.h"
|
||||||
@@ -80,9 +80,9 @@ public:
|
|||||||
int colSpan() const;
|
int colSpan() const;
|
||||||
int rowSpan() const;
|
int rowSpan() const;
|
||||||
|
|
||||||
virtual int axisTitleFontSize( RiaDefines::PlotAxis axis ) const = 0;
|
virtual int axisTitleFontSize( RiuPlotAxis axis ) const = 0;
|
||||||
virtual int axisValueFontSize( RiaDefines::PlotAxis axis ) const = 0;
|
virtual int axisValueFontSize( RiuPlotAxis axis ) const = 0;
|
||||||
virtual void setAxisFontsAndAlignment( RiaDefines::PlotAxis,
|
virtual void setAxisFontsAndAlignment( RiuPlotAxis,
|
||||||
int titleFontSize,
|
int titleFontSize,
|
||||||
int valueFontSize,
|
int valueFontSize,
|
||||||
bool titleBold = false,
|
bool titleBold = false,
|
||||||
@@ -92,20 +92,23 @@ public:
|
|||||||
bool titleBold = false,
|
bool titleBold = false,
|
||||||
int alignment = (int)Qt::AlignCenter ) = 0;
|
int alignment = (int)Qt::AlignCenter ) = 0;
|
||||||
|
|
||||||
virtual void enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) = 0;
|
virtual void enableAxis( RiuPlotAxis axis, bool isEnabled ) = 0;
|
||||||
virtual bool axisEnabled( RiaDefines::PlotAxis axis ) const = 0;
|
virtual bool axisEnabled( RiuPlotAxis axis ) const = 0;
|
||||||
|
|
||||||
virtual void setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) = 0;
|
virtual void setAxisScale( RiuPlotAxis axis, double min, double max ) = 0;
|
||||||
virtual void setAxisAutoScale( RiaDefines::PlotAxis axis, bool enable ) = 0;
|
virtual void setAxisAutoScale( RiuPlotAxis axis, bool enable ) = 0;
|
||||||
|
|
||||||
virtual void setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) = 0;
|
virtual void setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) = 0;
|
||||||
virtual void setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) = 0;
|
virtual void setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) = 0;
|
||||||
|
|
||||||
virtual RiuPlotWidget::AxisScaleType axisScaleType( RiaDefines::PlotAxis axis ) const = 0;
|
virtual RiuPlotWidget::AxisScaleType axisScaleType( RiuPlotAxis axis ) const = 0;
|
||||||
virtual void setAxisScaleType( RiaDefines::PlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) = 0;
|
virtual void setAxisScaleType( RiuPlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) = 0;
|
||||||
|
|
||||||
virtual void setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) = 0;
|
virtual void setAxisTitleText( RiuPlotAxis axis, const QString& title ) = 0;
|
||||||
virtual void setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) = 0;
|
virtual void setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) = 0;
|
||||||
|
|
||||||
|
virtual bool isMultiAxisSupported() const = 0;
|
||||||
|
virtual RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) = 0;
|
||||||
|
|
||||||
virtual void setPlotTitle( const QString& plotTitle ) = 0;
|
virtual void setPlotTitle( const QString& plotTitle ) = 0;
|
||||||
const QString& plotTitle() const;
|
const QString& plotTitle() const;
|
||||||
@@ -121,34 +124,34 @@ public:
|
|||||||
|
|
||||||
virtual void detachItems( RiuPlotWidget::PlotItemType plotItemType ) = 0;
|
virtual void detachItems( RiuPlotWidget::PlotItemType plotItemType ) = 0;
|
||||||
|
|
||||||
virtual std::pair<double, double> axisRange( RiaDefines::PlotAxis axis ) const = 0;
|
virtual std::pair<double, double> axisRange( RiuPlotAxis axis ) const = 0;
|
||||||
virtual void setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) = 0;
|
virtual void setAxisRange( RiuPlotAxis axis, double min, double max ) = 0;
|
||||||
|
|
||||||
virtual void setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) = 0;
|
virtual void setAxisInverted( RiuPlotAxis axis, bool isInverted ) = 0;
|
||||||
virtual void setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) = 0;
|
virtual void setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks ) = 0;
|
||||||
|
|
||||||
virtual void enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) = 0;
|
virtual void enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) = 0;
|
||||||
|
|
||||||
virtual void setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis,
|
virtual void setMajorAndMinorTickIntervals( RiuPlotAxis axis,
|
||||||
double majorTickInterval,
|
double majorTickInterval,
|
||||||
double minorTickInterval,
|
double minorTickInterval,
|
||||||
double minValue,
|
double minValue,
|
||||||
double maxValue ) = 0;
|
double maxValue ) = 0;
|
||||||
virtual void setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis,
|
virtual void setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis,
|
||||||
double majorTickInterval,
|
double majorTickInterval,
|
||||||
double minorTickInterval,
|
double minorTickInterval,
|
||||||
double minTickValue,
|
double minTickValue,
|
||||||
double maxTickValue,
|
double maxTickValue,
|
||||||
double rangeMin,
|
double rangeMin,
|
||||||
double rangeMax ) = 0;
|
double rangeMax ) = 0;
|
||||||
|
|
||||||
virtual void setAutoTickIntervalCounts( RiaDefines::PlotAxis axis,
|
virtual void
|
||||||
int maxMajorTickIntervalCount,
|
setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) = 0;
|
||||||
int maxMinorTickIntervalCount ) = 0;
|
|
||||||
virtual double majorTickInterval( RiaDefines::PlotAxis axis ) const = 0;
|
|
||||||
virtual double minorTickInterval( RiaDefines::PlotAxis axis ) const = 0;
|
|
||||||
|
|
||||||
virtual int axisExtent( RiaDefines::PlotAxis axis ) const = 0;
|
virtual double majorTickInterval( RiuPlotAxis axis ) const = 0;
|
||||||
|
virtual double minorTickInterval( RiuPlotAxis axis ) const = 0;
|
||||||
|
|
||||||
|
virtual int axisExtent( RiuPlotAxis axis ) const = 0;
|
||||||
|
|
||||||
QPoint dragStartPosition() const;
|
QPoint dragStartPosition() const;
|
||||||
|
|
||||||
@@ -184,13 +187,13 @@ protected:
|
|||||||
|
|
||||||
static int defaultMinimumWidth();
|
static int defaultMinimumWidth();
|
||||||
|
|
||||||
caf::PdmPointer<RimPlot> m_plotDefinition;
|
caf::PdmPointer<RimPlot> m_plotDefinition;
|
||||||
QPoint m_clickPosition;
|
QPoint m_clickPosition;
|
||||||
std::map<RiaDefines::PlotAxis, QString> m_axisTitles;
|
std::map<RiuPlotAxis, QString> m_axisTitles;
|
||||||
std::map<RiaDefines::PlotAxis, bool> m_axisTitlesEnabled;
|
std::map<RiuPlotAxis, bool> m_axisTitlesEnabled;
|
||||||
const int m_overlayMargins;
|
const int m_overlayMargins;
|
||||||
QString m_plotTitle;
|
QString m_plotTitle;
|
||||||
bool m_plotTitleEnabled;
|
bool m_plotTitleEnabled;
|
||||||
|
|
||||||
QList<QPointer<RiuDraggableOverlayFrame>> m_overlayFrames;
|
QList<QPointer<RiuDraggableOverlayFrame>> m_overlayFrames;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ RiuQtChartsPlotCurve::RiuQtChartsPlotCurve( RimPlotCurve* ownerRimCurve, const Q
|
|||||||
m_scatterSeries = new QtCharts::QScatterSeries();
|
m_scatterSeries = new QtCharts::QScatterSeries();
|
||||||
m_scatterSeries->setName( title );
|
m_scatterSeries->setName( title );
|
||||||
|
|
||||||
m_axisX = RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM;
|
m_axisX = RiuPlotAxis::defaultBottom();
|
||||||
m_axisY = RiaDefines::PlotAxis::PLOT_AXIS_LEFT;
|
m_axisY = RiuPlotAxis::defaultLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -235,7 +235,7 @@ void RiuQtChartsPlotCurve::updateErrorBarsAppearance( bool showErrorBars, const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotCurve::setXAxis( RiaDefines::PlotAxis axis )
|
void RiuQtChartsPlotCurve::setXAxis( RiuPlotAxis axis )
|
||||||
{
|
{
|
||||||
m_axisX = axis;
|
m_axisX = axis;
|
||||||
if ( m_plotWidget )
|
if ( m_plotWidget )
|
||||||
@@ -248,7 +248,7 @@ void RiuQtChartsPlotCurve::setXAxis( RiaDefines::PlotAxis axis )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotCurve::setYAxis( RiaDefines::PlotAxis axis )
|
void RiuQtChartsPlotCurve::setYAxis( RiuPlotAxis axis )
|
||||||
{
|
{
|
||||||
m_axisY = axis;
|
m_axisY = axis;
|
||||||
if ( m_plotWidget )
|
if ( m_plotWidget )
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ public:
|
|||||||
|
|
||||||
void detach() override;
|
void detach() override;
|
||||||
|
|
||||||
void setXAxis( RiaDefines::PlotAxis axis ) override;
|
void setXAxis( RiuPlotAxis axis ) override;
|
||||||
void setYAxis( RiaDefines::PlotAxis axis ) override;
|
void setYAxis( RiuPlotAxis axis ) override;
|
||||||
|
|
||||||
void setVisibleInLegend( bool isVisibleInLegend ) override;
|
void setVisibleInLegend( bool isVisibleInLegend ) override;
|
||||||
|
|
||||||
@@ -91,6 +91,6 @@ private:
|
|||||||
QtCharts::QScatterSeries* m_scatterSeries;
|
QtCharts::QScatterSeries* m_scatterSeries;
|
||||||
std::shared_ptr<RiuPlotCurveSymbol> m_symbol;
|
std::shared_ptr<RiuPlotCurveSymbol> m_symbol;
|
||||||
RiuQtChartsPlotWidget* m_plotWidget;
|
RiuQtChartsPlotWidget* m_plotWidget;
|
||||||
RiaDefines::PlotAxis m_axisX;
|
RiuPlotAxis m_axisX;
|
||||||
RiaDefines::PlotAxis m_axisY;
|
RiuPlotAxis m_axisY;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,13 +60,13 @@ void RiuQtChartsPlotTools::setCommonPlotBehaviour( RiuQtChartsPlotWidget* plot )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotTools::setDefaultAxes( RiuQtChartsPlotWidget* plot )
|
void RiuQtChartsPlotTools::setDefaultAxes( RiuQtChartsPlotWidget* plot )
|
||||||
{
|
{
|
||||||
plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
plot->enableAxis( RiuPlotAxis::defaultBottom(), true );
|
||||||
plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
plot->enableAxis( RiuPlotAxis::defaultLeft(), true );
|
||||||
plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false );
|
plot->enableAxis( RiuPlotAxis::defaultTop(), false );
|
||||||
plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, false );
|
plot->enableAxis( RiuPlotAxis::defaultRight(), false );
|
||||||
|
|
||||||
plot->setAxisMaxMinor( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 2 );
|
plot->setAxisMaxMinor( RiuPlotAxis::defaultBottom(), 2 );
|
||||||
plot->setAxisMaxMinor( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 3 );
|
plot->setAxisMaxMinor( RiuPlotAxis::defaultLeft(), 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -79,7 +79,7 @@ void RiuQtChartsPlotTools::enableDateBasedBottomXAxis( RiuQtChartsPlotWidget*
|
|||||||
RiaQDateTimeTools::TimeFormatComponents timeComponents )
|
RiaQDateTimeTools::TimeFormatComponents timeComponents )
|
||||||
{
|
{
|
||||||
QString format = dateTimeFormatForInterval( dateFormat, timeFormat, dateComponents, timeComponents );
|
QString format = dateTimeFormatForInterval( dateFormat, timeFormat, dateComponents, timeComponents );
|
||||||
plot->setAxisFormat( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, format );
|
plot->setAxisFormat( RiuPlotAxis::defaultBottom(), format );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -71,31 +71,10 @@ RiuQtChartsPlotWidget::RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget*
|
|||||||
|
|
||||||
layout->addWidget( m_viewer );
|
layout->addWidget( m_viewer );
|
||||||
|
|
||||||
QValueAxis* axisBottom = new QValueAxis();
|
addAxis( RiuPlotAxis::defaultBottom(), true, true );
|
||||||
chart->addAxis( axisBottom, Qt::AlignBottom );
|
addAxis( RiuPlotAxis::defaultLeft(), true, true );
|
||||||
m_axes[RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM] = axisBottom;
|
addAxis( RiuPlotAxis::defaultRight(), true, true );
|
||||||
|
addAxis( RiuPlotAxis::defaultTop(), false, false );
|
||||||
QValueAxis* axisTop = new QValueAxis();
|
|
||||||
chart->addAxis( axisTop, Qt::AlignTop );
|
|
||||||
m_axes[RiaDefines::PlotAxis::PLOT_AXIS_TOP] = axisTop;
|
|
||||||
|
|
||||||
QValueAxis* axisLeft = new QValueAxis();
|
|
||||||
chart->addAxis( axisLeft, Qt::AlignLeft );
|
|
||||||
m_axes[RiaDefines::PlotAxis::PLOT_AXIS_LEFT] = axisLeft;
|
|
||||||
|
|
||||||
QValueAxis* axisRight = new QValueAxis();
|
|
||||||
chart->addAxis( axisRight, Qt::AlignRight );
|
|
||||||
m_axes[RiaDefines::PlotAxis::PLOT_AXIS_RIGHT] = axisRight;
|
|
||||||
|
|
||||||
enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
|
||||||
enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, false );
|
|
||||||
enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
|
||||||
enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false );
|
|
||||||
|
|
||||||
setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
|
||||||
setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, false );
|
|
||||||
setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
|
|
||||||
setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false );
|
|
||||||
|
|
||||||
m_viewer->setRubberBand( QChartView::RectangleRubberBand );
|
m_viewer->setRubberBand( QChartView::RectangleRubberBand );
|
||||||
|
|
||||||
@@ -124,7 +103,7 @@ void RiuQtChartsPlotWidget::axisRangeChanged()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RiuQtChartsPlotWidget::axisTitleFontSize( RiaDefines::PlotAxis axis ) const
|
int RiuQtChartsPlotWidget::axisTitleFontSize( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
if ( axisEnabled( axis ) )
|
if ( axisEnabled( axis ) )
|
||||||
{
|
{
|
||||||
@@ -137,7 +116,7 @@ int RiuQtChartsPlotWidget::axisTitleFontSize( RiaDefines::PlotAxis axis ) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RiuQtChartsPlotWidget::axisValueFontSize( RiaDefines::PlotAxis axis ) const
|
int RiuQtChartsPlotWidget::axisValueFontSize( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
if ( axisEnabled( axis ) )
|
if ( axisEnabled( axis ) )
|
||||||
{
|
{
|
||||||
@@ -150,11 +129,11 @@ int RiuQtChartsPlotWidget::axisValueFontSize( RiaDefines::PlotAxis axis ) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisFontsAndAlignment( RiaDefines::PlotAxis axis,
|
void RiuQtChartsPlotWidget::setAxisFontsAndAlignment( RiuPlotAxis axis,
|
||||||
int titleFontSize,
|
int titleFontSize,
|
||||||
int valueFontSize,
|
int valueFontSize,
|
||||||
bool titleBold,
|
bool titleBold,
|
||||||
int alignment )
|
int alignment )
|
||||||
{
|
{
|
||||||
int titleFontPixelSize = caf::FontTools::pointSizeToPixelSize( titleFontSize );
|
int titleFontPixelSize = caf::FontTools::pointSizeToPixelSize( titleFontSize );
|
||||||
int valueFontPixelSize = caf::FontTools::pointSizeToPixelSize( valueFontSize );
|
int valueFontPixelSize = caf::FontTools::pointSizeToPixelSize( valueFontSize );
|
||||||
@@ -188,7 +167,7 @@ void RiuQtChartsPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int val
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title )
|
void RiuQtChartsPlotWidget::setAxisTitleText( RiuPlotAxis axis, const QString& title )
|
||||||
{
|
{
|
||||||
m_axisTitles[axis] = title;
|
m_axisTitles[axis] = title;
|
||||||
applyAxisTitleToPlot( axis );
|
applyAxisTitleToPlot( axis );
|
||||||
@@ -197,7 +176,7 @@ void RiuQtChartsPlotWidget::setAxisTitleText( RiaDefines::PlotAxis axis, const Q
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable )
|
void RiuQtChartsPlotWidget::setAxisTitleEnabled( RiuPlotAxis axis, bool enable )
|
||||||
{
|
{
|
||||||
m_axisTitlesEnabled[axis] = enable;
|
m_axisTitlesEnabled[axis] = enable;
|
||||||
applyAxisTitleToPlot( axis );
|
applyAxisTitleToPlot( axis );
|
||||||
@@ -206,7 +185,7 @@ void RiuQtChartsPlotWidget::setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisFormat( RiaDefines::PlotAxis axis, const QString& format )
|
void RiuQtChartsPlotWidget::setAxisFormat( RiuPlotAxis axis, const QString& format )
|
||||||
{
|
{
|
||||||
auto ax = plotAxis( axis );
|
auto ax = plotAxis( axis );
|
||||||
|
|
||||||
@@ -330,7 +309,7 @@ void RiuQtChartsPlotWidget::clearLegend()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::pair<double, double> RiuQtChartsPlotWidget::axisRange( RiaDefines::PlotAxis axis ) const
|
std::pair<double, double> RiuQtChartsPlotWidget::axisRange( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
auto ax = plotAxis( axis );
|
auto ax = plotAxis( axis );
|
||||||
|
|
||||||
@@ -349,7 +328,7 @@ std::pair<double, double> RiuQtChartsPlotWidget::axisRange( RiaDefines::PlotAxis
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisRange( RiaDefines::PlotAxis axis, double min, double max )
|
void RiuQtChartsPlotWidget::setAxisRange( RiuPlotAxis axis, double min, double max )
|
||||||
{
|
{
|
||||||
// Note: Especially the Y-axis may be inverted
|
// Note: Especially the Y-axis may be inverted
|
||||||
if ( plotAxis( axis )->isReverse() )
|
if ( plotAxis( axis )->isReverse() )
|
||||||
@@ -365,7 +344,7 @@ void RiuQtChartsPlotWidget::setAxisRange( RiaDefines::PlotAxis axis, double min,
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted )
|
void RiuQtChartsPlotWidget::setAxisInverted( RiuPlotAxis axis, bool isInverted )
|
||||||
{
|
{
|
||||||
auto ax = plotAxis( axis );
|
auto ax = plotAxis( axis );
|
||||||
ax->setReverse( isInverted );
|
ax->setReverse( isInverted );
|
||||||
@@ -374,7 +353,7 @@ void RiuQtChartsPlotWidget::setAxisInverted( RiaDefines::PlotAxis axis, bool isI
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks )
|
void RiuQtChartsPlotWidget::setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks )
|
||||||
{
|
{
|
||||||
plotAxis( axis )->setLabelsVisible( enableLabels );
|
plotAxis( axis )->setLabelsVisible( enableLabels );
|
||||||
plotAxis( axis )->setGridLineVisible( enableTicks );
|
plotAxis( axis )->setGridLineVisible( enableTicks );
|
||||||
@@ -383,7 +362,7 @@ void RiuQtChartsPlotWidget::setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis a
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines )
|
void RiuQtChartsPlotWidget::enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines )
|
||||||
{
|
{
|
||||||
plotAxis( axis )->setGridLineVisible( majorGridLines );
|
plotAxis( axis )->setGridLineVisible( majorGridLines );
|
||||||
plotAxis( axis )->setMinorGridLineVisible( minorGridLines );
|
plotAxis( axis )->setMinorGridLineVisible( minorGridLines );
|
||||||
@@ -398,33 +377,33 @@ void RiuQtChartsPlotWidget::enableGridLines( RiaDefines::PlotAxis axis, bool maj
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis,
|
void RiuQtChartsPlotWidget::setMajorAndMinorTickIntervals( RiuPlotAxis axis,
|
||||||
double majorTickInterval,
|
double majorTickInterval,
|
||||||
double minorTickInterval,
|
double minorTickInterval,
|
||||||
double minValue,
|
double minValue,
|
||||||
double maxValue )
|
double maxValue )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis,
|
void RiuQtChartsPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis,
|
||||||
double majorTickInterval,
|
double majorTickInterval,
|
||||||
double minorTickInterval,
|
double minorTickInterval,
|
||||||
double minTickValue,
|
double minTickValue,
|
||||||
double maxTickValue,
|
double maxTickValue,
|
||||||
double rangeMin,
|
double rangeMin,
|
||||||
double rangeMax )
|
double rangeMax )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAutoTickIntervalCounts( RiaDefines::PlotAxis axis,
|
void RiuQtChartsPlotWidget::setAutoTickIntervalCounts( RiuPlotAxis axis,
|
||||||
int maxMajorTickIntervalCount,
|
int maxMajorTickIntervalCount,
|
||||||
int maxMinorTickIntervalCount )
|
int maxMinorTickIntervalCount )
|
||||||
{
|
{
|
||||||
setAxisMaxMajor( axis, maxMajorTickIntervalCount );
|
setAxisMaxMajor( axis, maxMajorTickIntervalCount );
|
||||||
setAxisMaxMinor( axis, maxMinorTickIntervalCount );
|
setAxisMaxMinor( axis, maxMinorTickIntervalCount );
|
||||||
@@ -433,7 +412,7 @@ void RiuQtChartsPlotWidget::setAutoTickIntervalCounts( RiaDefines::PlotAxis axis
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
double RiuQtChartsPlotWidget::majorTickInterval( RiaDefines::PlotAxis axis ) const
|
double RiuQtChartsPlotWidget::majorTickInterval( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 )
|
#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 )
|
||||||
// QValueAxis::tickInterval was introduced in 5.12
|
// QValueAxis::tickInterval was introduced in 5.12
|
||||||
@@ -447,7 +426,7 @@ double RiuQtChartsPlotWidget::majorTickInterval( RiaDefines::PlotAxis axis ) con
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
double RiuQtChartsPlotWidget::minorTickInterval( RiaDefines::PlotAxis axis ) const
|
double RiuQtChartsPlotWidget::minorTickInterval( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
@@ -455,7 +434,7 @@ double RiuQtChartsPlotWidget::minorTickInterval( RiaDefines::PlotAxis axis ) con
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RiuQtChartsPlotWidget::axisExtent( RiaDefines::PlotAxis axis ) const
|
int RiuQtChartsPlotWidget::axisExtent( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
CAF_ASSERT( false && "Not implemented" );
|
CAF_ASSERT( false && "Not implemented" );
|
||||||
return 100;
|
return 100;
|
||||||
@@ -535,7 +514,7 @@ void RiuQtChartsPlotWidget::applyPlotTitleToPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::applyAxisTitleToPlot( RiaDefines::PlotAxis axis )
|
void RiuQtChartsPlotWidget::applyAxisTitleToPlot( RiuPlotAxis axis )
|
||||||
{
|
{
|
||||||
QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" );
|
QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" );
|
||||||
plotAxis( axis )->setTitleText( titleToApply );
|
plotAxis( axis )->setTitleText( titleToApply );
|
||||||
@@ -636,7 +615,7 @@ void RiuQtChartsPlotWidget::replot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::enableAxis( RiaDefines::PlotAxis axis, bool isEnabled )
|
void RiuQtChartsPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled )
|
||||||
{
|
{
|
||||||
m_axesEnabled[axis] = isEnabled;
|
m_axesEnabled[axis] = isEnabled;
|
||||||
plotAxis( axis )->setVisible( isEnabled );
|
plotAxis( axis )->setVisible( isEnabled );
|
||||||
@@ -645,7 +624,7 @@ void RiuQtChartsPlotWidget::enableAxis( RiaDefines::PlotAxis axis, bool isEnable
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiuQtChartsPlotWidget::axisEnabled( RiaDefines::PlotAxis axis ) const
|
bool RiuQtChartsPlotWidget::axisEnabled( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
auto it = m_axesEnabled.find( axis );
|
auto it = m_axesEnabled.find( axis );
|
||||||
if ( it != m_axesEnabled.end() )
|
if ( it != m_axesEnabled.end() )
|
||||||
@@ -657,7 +636,7 @@ bool RiuQtChartsPlotWidget::axisEnabled( RiaDefines::PlotAxis axis ) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor )
|
void RiuQtChartsPlotWidget::setAxisMaxMinor( RiuPlotAxis axis, int maxMinor )
|
||||||
{
|
{
|
||||||
QAbstractAxis* ax = plotAxis( axis );
|
QAbstractAxis* ax = plotAxis( axis );
|
||||||
QValueAxis* valueAxis = dynamic_cast<QValueAxis*>( ax );
|
QValueAxis* valueAxis = dynamic_cast<QValueAxis*>( ax );
|
||||||
@@ -675,7 +654,7 @@ void RiuQtChartsPlotWidget::setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxM
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor )
|
void RiuQtChartsPlotWidget::setAxisMaxMajor( RiuPlotAxis axis, int maxMajor )
|
||||||
{
|
{
|
||||||
QAbstractAxis* ax = plotAxis( axis );
|
QAbstractAxis* ax = plotAxis( axis );
|
||||||
QValueAxis* valueAxis = dynamic_cast<QValueAxis*>( ax );
|
QValueAxis* valueAxis = dynamic_cast<QValueAxis*>( ax );
|
||||||
@@ -693,7 +672,7 @@ void RiuQtChartsPlotWidget::setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxM
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisAutoScale( RiaDefines::PlotAxis axis, bool autoScale )
|
void RiuQtChartsPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale )
|
||||||
{
|
{
|
||||||
m_axesAutoScale[axis] = autoScale;
|
m_axesAutoScale[axis] = autoScale;
|
||||||
|
|
||||||
@@ -706,7 +685,7 @@ void RiuQtChartsPlotWidget::setAxisAutoScale( RiaDefines::PlotAxis axis, bool au
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisScale( RiaDefines::PlotAxis axis, double min, double max )
|
void RiuQtChartsPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max )
|
||||||
{
|
{
|
||||||
plotAxis( axis )->setRange( min, max );
|
plotAxis( axis )->setRange( min, max );
|
||||||
}
|
}
|
||||||
@@ -714,7 +693,7 @@ void RiuQtChartsPlotWidget::setAxisScale( RiaDefines::PlotAxis axis, double min,
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuQtChartsPlotWidget::AxisScaleType RiuQtChartsPlotWidget::axisScaleType( RiaDefines::PlotAxis axis ) const
|
RiuQtChartsPlotWidget::AxisScaleType RiuQtChartsPlotWidget::axisScaleType( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
if ( plotAxis( axis )->type() == QAbstractAxis::AxisTypeLogValue ) return AxisScaleType::LOGARITHMIC;
|
if ( plotAxis( axis )->type() == QAbstractAxis::AxisTypeLogValue ) return AxisScaleType::LOGARITHMIC;
|
||||||
if ( plotAxis( axis )->type() == QAbstractAxis::AxisTypeDateTime ) return AxisScaleType::DATE;
|
if ( plotAxis( axis )->type() == QAbstractAxis::AxisTypeDateTime ) return AxisScaleType::DATE;
|
||||||
@@ -724,7 +703,7 @@ RiuQtChartsPlotWidget::AxisScaleType RiuQtChartsPlotWidget::axisScaleType( RiaDe
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisScaleType( RiaDefines::PlotAxis axis, RiuQtChartsPlotWidget::AxisScaleType axisScaleType )
|
void RiuQtChartsPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQtChartsPlotWidget::AxisScaleType axisScaleType )
|
||||||
{
|
{
|
||||||
QAbstractAxis* removeaxis = plotAxis( axis );
|
QAbstractAxis* removeaxis = plotAxis( axis );
|
||||||
QAbstractAxis* insertaxis = nullptr;
|
QAbstractAxis* insertaxis = nullptr;
|
||||||
@@ -742,16 +721,9 @@ void RiuQtChartsPlotWidget::setAxisScaleType( RiaDefines::PlotAxis axis, RiuQtCh
|
|||||||
insertaxis = new QValueAxis;
|
insertaxis = new QValueAxis;
|
||||||
}
|
}
|
||||||
|
|
||||||
QChart* chart = qtChart();
|
QChart* chart = qtChart();
|
||||||
auto mapToAlignment = []( auto axis ) {
|
|
||||||
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) return Qt::AlignBottom;
|
|
||||||
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_TOP ) return Qt::AlignTop;
|
|
||||||
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) return Qt::AlignLeft;
|
|
||||||
return Qt::AlignRight;
|
|
||||||
};
|
|
||||||
|
|
||||||
if ( chart->axes().contains( removeaxis ) ) chart->removeAxis( removeaxis );
|
if ( chart->axes().contains( removeaxis ) ) chart->removeAxis( removeaxis );
|
||||||
chart->addAxis( insertaxis, mapToAlignment( axis ) );
|
chart->addAxis( insertaxis, mapPlotAxisToQtAlignment( axis.axis() ) );
|
||||||
|
|
||||||
m_axes[axis] = insertaxis;
|
m_axes[axis] = insertaxis;
|
||||||
for ( auto serie : chart->series() )
|
for ( auto serie : chart->series() )
|
||||||
@@ -791,8 +763,8 @@ QtCharts::QChart* RiuQtChartsPlotWidget::qtChart()
|
|||||||
void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve,
|
void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve,
|
||||||
QtCharts::QAbstractSeries* lineSeries,
|
QtCharts::QAbstractSeries* lineSeries,
|
||||||
QtCharts::QAbstractSeries* scatterSeries,
|
QtCharts::QAbstractSeries* scatterSeries,
|
||||||
RiaDefines::PlotAxis xAxis,
|
RiuPlotAxis xAxis,
|
||||||
RiaDefines::PlotAxis yAxis )
|
RiuPlotAxis yAxis )
|
||||||
{
|
{
|
||||||
auto addToChart = [this]( std::map<const RiuPlotCurve*, QtCharts::QAbstractSeries*>& curveSeriesMap,
|
auto addToChart = [this]( std::map<const RiuPlotCurve*, QtCharts::QAbstractSeries*>& curveSeriesMap,
|
||||||
auto plotCurve,
|
auto plotCurve,
|
||||||
@@ -860,7 +832,7 @@ void RiuQtChartsPlotWidget::detachItems( RiuPlotWidget::PlotItemType plotItemTyp
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setXAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series )
|
void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series )
|
||||||
{
|
{
|
||||||
setAxis( axis, series );
|
setAxis( axis, series );
|
||||||
}
|
}
|
||||||
@@ -868,7 +840,7 @@ void RiuQtChartsPlotWidget::setXAxis( RiaDefines::PlotAxis axis, QtCharts::QAbst
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setYAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series )
|
void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series )
|
||||||
{
|
{
|
||||||
setAxis( axis, series );
|
setAxis( axis, series );
|
||||||
}
|
}
|
||||||
@@ -876,8 +848,14 @@ void RiuQtChartsPlotWidget::setYAxis( RiaDefines::PlotAxis axis, QtCharts::QAbst
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series )
|
void RiuQtChartsPlotWidget::setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series )
|
||||||
{
|
{
|
||||||
|
// Make sure the axis we are about to set exists.
|
||||||
|
if ( m_axes.find( axis ) == m_axes.end() )
|
||||||
|
{
|
||||||
|
addAxis( axis, true, true );
|
||||||
|
}
|
||||||
|
|
||||||
if ( qtChart()->series().contains( series ) && !series->attachedAxes().contains( plotAxis( axis ) ) )
|
if ( qtChart()->series().contains( series ) && !series->attachedAxes().contains( plotAxis( axis ) ) )
|
||||||
{
|
{
|
||||||
auto newAxis = plotAxis( axis );
|
auto newAxis = plotAxis( axis );
|
||||||
@@ -885,7 +863,7 @@ void RiuQtChartsPlotWidget::setAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstr
|
|||||||
// Detach any other axis for the same orientation
|
// Detach any other axis for the same orientation
|
||||||
for ( auto ax : series->attachedAxes() )
|
for ( auto ax : series->attachedAxes() )
|
||||||
{
|
{
|
||||||
if ( ax->orientation() == orientation( axis ) )
|
if ( ax->orientation() == orientation( axis.axis() ) )
|
||||||
{
|
{
|
||||||
series->detachAxis( ax );
|
series->detachAxis( ax );
|
||||||
}
|
}
|
||||||
@@ -907,12 +885,50 @@ void RiuQtChartsPlotWidget::setAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstr
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::rescaleAxis( RiaDefines::PlotAxis axis )
|
void RiuQtChartsPlotWidget::addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool isAutoScale )
|
||||||
|
{
|
||||||
|
QValueAxis* axis = new QValueAxis();
|
||||||
|
qtChart()->addAxis( axis, mapPlotAxisToQtAlignment( plotAxis.axis() ) );
|
||||||
|
m_axes[plotAxis] = axis;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis RiuQtChartsPlotWidget::createNextPlotAxis( RiaDefines::PlotAxis axis )
|
||||||
|
{
|
||||||
|
int minIdx = -1;
|
||||||
|
for ( auto a : m_axes )
|
||||||
|
{
|
||||||
|
if ( a.first.axis() == axis )
|
||||||
|
{
|
||||||
|
minIdx = std::max( a.first.index(), minIdx );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RiuPlotAxis plotAxis( axis, minIdx + 1 );
|
||||||
|
|
||||||
|
addAxis( plotAxis, true, true );
|
||||||
|
return plotAxis;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RiuQtChartsPlotWidget::isMultiAxisSupported() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuQtChartsPlotWidget::rescaleAxis( RiuPlotAxis axis )
|
||||||
{
|
{
|
||||||
if ( !m_axesAutoScale[axis] ) return;
|
if ( !m_axesAutoScale[axis] ) return;
|
||||||
|
|
||||||
QAbstractAxis* pAxis = plotAxis( axis );
|
QAbstractAxis* pAxis = plotAxis( axis );
|
||||||
Qt::Orientation orr = orientation( axis );
|
Qt::Orientation orr = orientation( axis.axis() );
|
||||||
|
|
||||||
double min = std::numeric_limits<double>::max();
|
double min = std::numeric_limits<double>::max();
|
||||||
double max = -std::numeric_limits<double>::max();
|
double max = -std::numeric_limits<double>::max();
|
||||||
@@ -966,7 +982,7 @@ void RiuQtChartsPlotWidget::rescaleAxis( RiaDefines::PlotAxis axis )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QAbstractAxis* RiuQtChartsPlotWidget::plotAxis( RiaDefines::PlotAxis axis ) const
|
QAbstractAxis* RiuQtChartsPlotWidget::plotAxis( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
const auto ax = m_axes.find( axis );
|
const auto ax = m_axes.find( axis );
|
||||||
if ( ax != m_axes.end() )
|
if ( ax != m_axes.end() )
|
||||||
@@ -1053,3 +1069,14 @@ std::pair<RiuPlotCurve*, int> RiuQtChartsPlotWidget::findClosestCurve( const QPo
|
|||||||
{
|
{
|
||||||
return std::make_pair( nullptr, -1 );
|
return std::make_pair( nullptr, -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Qt::Alignment RiuQtChartsPlotWidget::mapPlotAxisToQtAlignment( RiaDefines::PlotAxis axis )
|
||||||
|
{
|
||||||
|
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) return Qt::AlignBottom;
|
||||||
|
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_TOP ) return Qt::AlignTop;
|
||||||
|
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) return Qt::AlignLeft;
|
||||||
|
return Qt::AlignRight;
|
||||||
|
}
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ public:
|
|||||||
RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr );
|
RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr );
|
||||||
~RiuQtChartsPlotWidget() override;
|
~RiuQtChartsPlotWidget() override;
|
||||||
|
|
||||||
int axisTitleFontSize( RiaDefines::PlotAxis axis ) const override;
|
int axisTitleFontSize( RiuPlotAxis axis ) const override;
|
||||||
int axisValueFontSize( RiaDefines::PlotAxis axis ) const override;
|
int axisValueFontSize( RiuPlotAxis axis ) const override;
|
||||||
void setAxisFontsAndAlignment( RiaDefines::PlotAxis,
|
void setAxisFontsAndAlignment( RiuPlotAxis,
|
||||||
int titleFontSize,
|
int titleFontSize,
|
||||||
int valueFontSize,
|
int valueFontSize,
|
||||||
bool titleBold = false,
|
bool titleBold = false,
|
||||||
@@ -75,22 +75,25 @@ public:
|
|||||||
bool titleBold = false,
|
bool titleBold = false,
|
||||||
int alignment = (int)Qt::AlignCenter ) override;
|
int alignment = (int)Qt::AlignCenter ) override;
|
||||||
|
|
||||||
void enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) override;
|
void enableAxis( RiuPlotAxis axis, bool isEnabled ) override;
|
||||||
bool axisEnabled( RiaDefines::PlotAxis axis ) const override;
|
bool axisEnabled( RiuPlotAxis axis ) const override;
|
||||||
|
|
||||||
void setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) override;
|
void setAxisScale( RiuPlotAxis axis, double min, double max ) override;
|
||||||
void setAxisAutoScale( RiaDefines::PlotAxis axis, bool enable ) override;
|
void setAxisAutoScale( RiuPlotAxis axis, bool enable ) override;
|
||||||
|
|
||||||
void setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) override;
|
void setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) override;
|
||||||
void setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) override;
|
void setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) override;
|
||||||
|
|
||||||
RiuPlotWidget::AxisScaleType axisScaleType( RiaDefines::PlotAxis axis ) const override;
|
RiuPlotWidget::AxisScaleType axisScaleType( RiuPlotAxis axis ) const override;
|
||||||
void setAxisScaleType( RiaDefines::PlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) override;
|
void setAxisScaleType( RiuPlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) override;
|
||||||
|
|
||||||
void setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) override;
|
void setAxisTitleText( RiuPlotAxis axis, const QString& title ) override;
|
||||||
void setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) override;
|
void setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) override;
|
||||||
|
|
||||||
void setAxisFormat( RiaDefines::PlotAxis axis, const QString& format );
|
void setAxisFormat( RiuPlotAxis axis, const QString& format );
|
||||||
|
|
||||||
|
RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) override;
|
||||||
|
bool isMultiAxisSupported() const override;
|
||||||
|
|
||||||
void setPlotTitle( const QString& plotTitle ) override;
|
void setPlotTitle( const QString& plotTitle ) override;
|
||||||
const QString& plotTitle() const;
|
const QString& plotTitle() const;
|
||||||
@@ -103,35 +106,33 @@ public:
|
|||||||
void insertLegend( RiuPlotWidget::Legend ) override;
|
void insertLegend( RiuPlotWidget::Legend ) override;
|
||||||
void clearLegend() override;
|
void clearLegend() override;
|
||||||
|
|
||||||
std::pair<double, double> axisRange( RiaDefines::PlotAxis axis ) const override;
|
std::pair<double, double> axisRange( RiuPlotAxis axis ) const override;
|
||||||
void setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) override;
|
void setAxisRange( RiuPlotAxis axis, double min, double max ) override;
|
||||||
|
|
||||||
void setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) override;
|
void setAxisInverted( RiuPlotAxis axis, bool isInverted ) override;
|
||||||
void setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) override;
|
void setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks ) override;
|
||||||
|
|
||||||
void enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) override;
|
void enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) override;
|
||||||
|
|
||||||
void setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis,
|
void setMajorAndMinorTickIntervals( RiuPlotAxis axis,
|
||||||
double majorTickInterval,
|
double majorTickInterval,
|
||||||
double minorTickInterval,
|
double minorTickInterval,
|
||||||
double minValue,
|
double minValue,
|
||||||
double maxValue ) override;
|
double maxValue ) override;
|
||||||
void setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis,
|
void setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis,
|
||||||
double majorTickInterval,
|
double majorTickInterval,
|
||||||
double minorTickInterval,
|
double minorTickInterval,
|
||||||
double minTickValue,
|
double minTickValue,
|
||||||
double maxTickValue,
|
double maxTickValue,
|
||||||
double rangeMin,
|
double rangeMin,
|
||||||
double rangeMax ) override;
|
double rangeMax ) override;
|
||||||
void setAutoTickIntervalCounts( RiaDefines::PlotAxis axis,
|
void setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) override;
|
||||||
int maxMajorTickIntervalCount,
|
double majorTickInterval( RiuPlotAxis axis ) const override;
|
||||||
int maxMinorTickIntervalCount ) override;
|
double minorTickInterval( RiuPlotAxis axis ) const override;
|
||||||
double majorTickInterval( RiaDefines::PlotAxis axis ) const override;
|
|
||||||
double minorTickInterval( RiaDefines::PlotAxis axis ) const override;
|
|
||||||
|
|
||||||
void detachItems( RiuPlotWidget::PlotItemType plotItemType ) override;
|
void detachItems( RiuPlotWidget::PlotItemType plotItemType ) override;
|
||||||
|
|
||||||
int axisExtent( RiaDefines::PlotAxis axis ) const override;
|
int axisExtent( RiuPlotAxis axis ) const override;
|
||||||
|
|
||||||
QPoint dragStartPosition() const;
|
QPoint dragStartPosition() const;
|
||||||
|
|
||||||
@@ -155,14 +156,14 @@ public:
|
|||||||
void attach( RiuPlotCurve* plotCurve,
|
void attach( RiuPlotCurve* plotCurve,
|
||||||
QtCharts::QAbstractSeries* lineseries,
|
QtCharts::QAbstractSeries* lineseries,
|
||||||
QtCharts::QAbstractSeries* scatterSeries,
|
QtCharts::QAbstractSeries* scatterSeries,
|
||||||
RiaDefines::PlotAxis xAxis,
|
RiuPlotAxis xAxis,
|
||||||
RiaDefines::PlotAxis yAxis );
|
RiuPlotAxis yAxis );
|
||||||
|
|
||||||
QtCharts::QAbstractSeries* getLineSeries( const RiuPlotCurve* plotCurve ) const;
|
QtCharts::QAbstractSeries* getLineSeries( const RiuPlotCurve* plotCurve ) const;
|
||||||
QtCharts::QAbstractSeries* getScatterSeries( const RiuPlotCurve* plotCurve ) const;
|
QtCharts::QAbstractSeries* getScatterSeries( const RiuPlotCurve* plotCurve ) const;
|
||||||
|
|
||||||
void setXAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series );
|
void setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series );
|
||||||
void setYAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series );
|
void setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series );
|
||||||
|
|
||||||
const QColor& backgroundColor() const override;
|
const QColor& backgroundColor() const override;
|
||||||
|
|
||||||
@@ -171,7 +172,7 @@ public:
|
|||||||
std::pair<RiuPlotCurve*, int> findClosestCurve( const QPoint& pos, double& distanceToClick ) const override;
|
std::pair<RiuPlotCurve*, int> findClosestCurve( const QPoint& pos, double& distanceToClick ) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series );
|
void setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series );
|
||||||
|
|
||||||
void resizeEvent( QResizeEvent* event ) override;
|
void resizeEvent( QResizeEvent* event ) override;
|
||||||
void keyPressEvent( QKeyEvent* event ) override;
|
void keyPressEvent( QKeyEvent* event ) override;
|
||||||
@@ -179,7 +180,7 @@ protected:
|
|||||||
bool eventFilter( QObject* watched, QEvent* event ) override;
|
bool eventFilter( QObject* watched, QEvent* event ) override;
|
||||||
|
|
||||||
void applyPlotTitleToPlot();
|
void applyPlotTitleToPlot();
|
||||||
void applyAxisTitleToPlot( RiaDefines::PlotAxis axis );
|
void applyAxisTitleToPlot( RiuPlotAxis axis );
|
||||||
|
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
QSize minimumSizeHint() const override;
|
QSize minimumSizeHint() const override;
|
||||||
@@ -187,8 +188,8 @@ protected:
|
|||||||
virtual bool isZoomerActive() const;
|
virtual bool isZoomerActive() const;
|
||||||
virtual void endZoomOperations();
|
virtual void endZoomOperations();
|
||||||
|
|
||||||
void rescaleAxis( RiaDefines::PlotAxis axis );
|
void rescaleAxis( RiuPlotAxis axis );
|
||||||
QtCharts::QAbstractAxis* plotAxis( RiaDefines::PlotAxis axis ) const;
|
QtCharts::QAbstractAxis* plotAxis( RiuPlotAxis axis ) const;
|
||||||
Qt::Orientation orientation( RiaDefines::PlotAxis axis ) const;
|
Qt::Orientation orientation( RiaDefines::PlotAxis axis ) const;
|
||||||
|
|
||||||
void dragEnterEvent( QDragEnterEvent* event ) override;
|
void dragEnterEvent( QDragEnterEvent* event ) override;
|
||||||
@@ -201,14 +202,17 @@ private slots:
|
|||||||
void axisRangeChanged();
|
void axisRangeChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool isAutoScale );
|
||||||
|
static Qt::Alignment mapPlotAxisToQtAlignment( RiaDefines::PlotAxis axis );
|
||||||
|
|
||||||
static int defaultMinimumWidth();
|
static int defaultMinimumWidth();
|
||||||
void replot() override;
|
void replot() override;
|
||||||
|
|
||||||
QPointer<QtCharts::QChartView> m_viewer;
|
QPointer<QtCharts::QChartView> m_viewer;
|
||||||
|
|
||||||
std::map<RiaDefines::PlotAxis, QtCharts::QAbstractAxis*> m_axes;
|
std::map<RiuPlotAxis, QtCharts::QAbstractAxis*> m_axes;
|
||||||
std::map<RiaDefines::PlotAxis, bool> m_axesEnabled;
|
std::map<RiuPlotAxis, bool> m_axesEnabled;
|
||||||
std::map<RiaDefines::PlotAxis, bool> m_axesAutoScale;
|
std::map<RiuPlotAxis, bool> m_axesAutoScale;
|
||||||
|
|
||||||
std::map<const RiuPlotCurve*, QtCharts::QAbstractSeries*> m_lineSeriesMap;
|
std::map<const RiuPlotCurve*, QtCharts::QAbstractSeries*> m_lineSeriesMap;
|
||||||
std::map<const RiuPlotCurve*, QtCharts::QAbstractSeries*> m_scatterSeriesMap;
|
std::map<const RiuPlotCurve*, QtCharts::QAbstractSeries*> m_scatterSeriesMap;
|
||||||
|
|||||||
@@ -476,17 +476,17 @@ void RiuQwtPlotCurve::setSamplesFromXYErrorValues( const std::vector<double>&
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotCurve::setXAxis( RiaDefines::PlotAxis axis )
|
void RiuQwtPlotCurve::setXAxis( RiuPlotAxis axis )
|
||||||
{
|
{
|
||||||
QwtPlotCurve::setXAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ) );
|
QwtPlotCurve::setXAxis( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotCurve::setYAxis( RiaDefines::PlotAxis axis )
|
void RiuQwtPlotCurve::setYAxis( RiuPlotAxis axis )
|
||||||
{
|
{
|
||||||
QwtPlotCurve::setYAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ) );
|
QwtPlotCurve::setYAxis( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ public:
|
|||||||
bool keepOnlyPositiveValues,
|
bool keepOnlyPositiveValues,
|
||||||
RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ) override;
|
RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ) override;
|
||||||
|
|
||||||
void setXAxis( RiaDefines::PlotAxis axis ) override;
|
void setXAxis( RiuPlotAxis axis ) override;
|
||||||
void setYAxis( RiaDefines::PlotAxis axis ) override;
|
void setYAxis( RiuPlotAxis axis ) override;
|
||||||
|
|
||||||
void setSymbol( RiuPlotCurveSymbol* symbol ) override;
|
void setSymbol( RiuPlotCurveSymbol* symbol ) override;
|
||||||
RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override;
|
RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "RiuDraggableOverlayFrame.h"
|
#include "RiuDraggableOverlayFrame.h"
|
||||||
#include "RiuGuiTheme.h"
|
#include "RiuGuiTheme.h"
|
||||||
|
#include "RiuPlotAxis.h"
|
||||||
#include "RiuPlotMainWindowTools.h"
|
#include "RiuPlotMainWindowTools.h"
|
||||||
#include "RiuPlotWidget.h"
|
#include "RiuPlotWidget.h"
|
||||||
#include "RiuQwtCurvePointTracker.h"
|
#include "RiuQwtCurvePointTracker.h"
|
||||||
@@ -114,11 +115,11 @@ RiuQwtPlotWidget::~RiuQwtPlotWidget()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RiuQwtPlotWidget::axisTitleFontSize( RiaDefines::PlotAxis axis ) const
|
int RiuQwtPlotWidget::axisTitleFontSize( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
if ( axisEnabled( axis ) )
|
if ( axisEnabled( axis ) )
|
||||||
{
|
{
|
||||||
return m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).pointSize();
|
return m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ).pointSize();
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -126,11 +127,11 @@ int RiuQwtPlotWidget::axisTitleFontSize( RiaDefines::PlotAxis axis ) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RiuQwtPlotWidget::axisValueFontSize( RiaDefines::PlotAxis axis ) const
|
int RiuQwtPlotWidget::axisValueFontSize( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
if ( axisEnabled( axis ) )
|
if ( axisEnabled( axis ) )
|
||||||
{
|
{
|
||||||
return m_plot->axisTitle( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).font().pointSize();
|
return m_plot->axisTitle( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ).font().pointSize();
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -138,18 +139,14 @@ int RiuQwtPlotWidget::axisValueFontSize( RiaDefines::PlotAxis axis ) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisFontsAndAlignment( RiaDefines::PlotAxis axis,
|
void RiuQwtPlotWidget::setAxisFontsAndAlignment( RiuPlotAxis axis, int titleFontSize, int valueFontSize, bool titleBold, int alignment )
|
||||||
int titleFontSize,
|
|
||||||
int valueFontSize,
|
|
||||||
bool titleBold,
|
|
||||||
int alignment )
|
|
||||||
{
|
{
|
||||||
int titleFontPixelSize = caf::FontTools::pointSizeToPixelSize( titleFontSize );
|
int titleFontPixelSize = caf::FontTools::pointSizeToPixelSize( titleFontSize );
|
||||||
int valueFontPixelSize = caf::FontTools::pointSizeToPixelSize( valueFontSize );
|
int valueFontPixelSize = caf::FontTools::pointSizeToPixelSize( valueFontSize );
|
||||||
|
|
||||||
// Axis number font
|
// Axis number font
|
||||||
|
|
||||||
int qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
int qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||||
QFont axisFont = m_plot->axisFont( qwtAxis );
|
QFont axisFont = m_plot->axisFont( qwtAxis );
|
||||||
axisFont.setPixelSize( valueFontPixelSize );
|
axisFont.setPixelSize( valueFontPixelSize );
|
||||||
axisFont.setBold( false );
|
axisFont.setBold( false );
|
||||||
@@ -181,7 +178,7 @@ void RiuQwtPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int valueFon
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title )
|
void RiuQwtPlotWidget::setAxisTitleText( RiuPlotAxis axis, const QString& title )
|
||||||
{
|
{
|
||||||
m_axisTitles[axis] = title;
|
m_axisTitles[axis] = title;
|
||||||
applyAxisTitleToQwt( axis );
|
applyAxisTitleToQwt( axis );
|
||||||
@@ -190,7 +187,7 @@ void RiuQwtPlotWidget::setAxisTitleText( RiaDefines::PlotAxis axis, const QStrin
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable )
|
void RiuQwtPlotWidget::setAxisTitleEnabled( RiuPlotAxis axis, bool enable )
|
||||||
{
|
{
|
||||||
m_axisTitlesEnabled[axis] = enable;
|
m_axisTitlesEnabled[axis] = enable;
|
||||||
applyAxisTitleToQwt( axis );
|
applyAxisTitleToQwt( axis );
|
||||||
@@ -299,19 +296,19 @@ void RiuQwtPlotWidget::clearLegend()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::pair<double, double> RiuQwtPlotWidget::axisRange( RiaDefines::PlotAxis axis ) const
|
std::pair<double, double> RiuQwtPlotWidget::axisRange( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
QwtInterval interval = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).interval();
|
QwtInterval interval = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ).interval();
|
||||||
return std::make_pair( interval.minValue(), interval.maxValue() );
|
return std::make_pair( interval.minValue(), interval.maxValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisRange( RiaDefines::PlotAxis axis, double min, double max )
|
void RiuQwtPlotWidget::setAxisRange( RiuPlotAxis axis, double min, double max )
|
||||||
{
|
{
|
||||||
// Note: Especially the Y-axis may be inverted
|
// Note: Especially the Y-axis may be inverted
|
||||||
if ( m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->testAttribute( QwtScaleEngine::Inverted ) )
|
if ( m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) )->testAttribute( QwtScaleEngine::Inverted ) )
|
||||||
{
|
{
|
||||||
setAxisScale( axis, max, min );
|
setAxisScale( axis, max, min );
|
||||||
}
|
}
|
||||||
@@ -324,28 +321,30 @@ void RiuQwtPlotWidget::setAxisRange( RiaDefines::PlotAxis axis, double min, doub
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted )
|
void RiuQwtPlotWidget::setAxisInverted( RiuPlotAxis axis, bool isInverted )
|
||||||
{
|
{
|
||||||
m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->setAttribute( QwtScaleEngine::Inverted, isInverted );
|
m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) )->setAttribute( QwtScaleEngine::Inverted, isInverted );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks )
|
void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks )
|
||||||
{
|
{
|
||||||
m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Ticks, enableTicks );
|
m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) )
|
||||||
m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Labels, enableLabels );
|
->enableComponent( QwtAbstractScaleDraw::Ticks, enableTicks );
|
||||||
|
m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) )
|
||||||
|
->enableComponent( QwtAbstractScaleDraw::Labels, enableLabels );
|
||||||
recalculateAxisExtents( axis );
|
recalculateAxisExtents( axis );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines )
|
void RiuQwtPlotWidget::enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines )
|
||||||
{
|
{
|
||||||
QwtPlotItemList plotItems = m_plot->itemList( QwtPlotItem::Rtti_PlotGrid );
|
QwtPlotItemList plotItems = m_plot->itemList( QwtPlotItem::Rtti_PlotGrid );
|
||||||
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||||
for ( QwtPlotItem* plotItem : plotItems )
|
for ( QwtPlotItem* plotItem : plotItems )
|
||||||
{
|
{
|
||||||
QwtPlotGrid* grid = static_cast<QwtPlotGrid*>( plotItem );
|
QwtPlotGrid* grid = static_cast<QwtPlotGrid*>( plotItem );
|
||||||
@@ -369,13 +368,13 @@ void RiuQwtPlotWidget::enableGridLines( RiaDefines::PlotAxis axis, bool majorGri
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis,
|
void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiuPlotAxis axis,
|
||||||
double majorTickInterval,
|
double majorTickInterval,
|
||||||
double minorTickInterval,
|
double minorTickInterval,
|
||||||
double minValue,
|
double minValue,
|
||||||
double maxValue )
|
double maxValue )
|
||||||
{
|
{
|
||||||
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||||
RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast<RiuQwtLinearScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast<RiuQwtLinearScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||||
if ( scaleEngine )
|
if ( scaleEngine )
|
||||||
{
|
{
|
||||||
@@ -389,15 +388,15 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis,
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis,
|
void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis,
|
||||||
double majorTickInterval,
|
double majorTickInterval,
|
||||||
double minorTickInterval,
|
double minorTickInterval,
|
||||||
double minTickValue,
|
double minTickValue,
|
||||||
double maxTickValue,
|
double maxTickValue,
|
||||||
double rangeMin,
|
double rangeMin,
|
||||||
double rangeMax )
|
double rangeMax )
|
||||||
{
|
{
|
||||||
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||||
RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast<RiuQwtLinearScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast<RiuQwtLinearScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||||
if ( scaleEngine )
|
if ( scaleEngine )
|
||||||
{
|
{
|
||||||
@@ -415,23 +414,21 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAx
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAutoTickIntervalCounts( RiaDefines::PlotAxis axis,
|
void RiuQwtPlotWidget::setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount )
|
||||||
int maxMajorTickIntervalCount,
|
|
||||||
int maxMinorTickIntervalCount )
|
|
||||||
{
|
{
|
||||||
m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMajorTickIntervalCount );
|
m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMajorTickIntervalCount );
|
||||||
m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMinorTickIntervalCount );
|
m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMinorTickIntervalCount );
|
||||||
// Reapply axis limits to force Qwt to use the tick settings.
|
// Reapply axis limits to force Qwt to use the tick settings.
|
||||||
QwtInterval currentRange = m_plot->axisInterval( RiuQwtPlotTools::toQwtPlotAxis( axis ) );
|
QwtInterval currentRange = m_plot->axisInterval( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) );
|
||||||
setAxisScale( axis, currentRange.minValue(), currentRange.maxValue() );
|
setAxisScale( axis, currentRange.minValue(), currentRange.maxValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
double RiuQwtPlotWidget::majorTickInterval( RiaDefines::PlotAxis axis ) const
|
double RiuQwtPlotWidget::majorTickInterval( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis ) );
|
QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) );
|
||||||
QList<double> majorTicks = scaleDiv.ticks( QwtScaleDiv::MajorTick );
|
QList<double> majorTicks = scaleDiv.ticks( QwtScaleDiv::MajorTick );
|
||||||
if ( majorTicks.size() < 2 ) return 0.0;
|
if ( majorTicks.size() < 2 ) return 0.0;
|
||||||
|
|
||||||
@@ -441,7 +438,7 @@ double RiuQwtPlotWidget::majorTickInterval( RiaDefines::PlotAxis axis ) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
double RiuQwtPlotWidget::minorTickInterval( RiaDefines::PlotAxis axis ) const
|
double RiuQwtPlotWidget::minorTickInterval( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( QwtPlot::xTop );
|
QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( QwtPlot::xTop );
|
||||||
QList<double> minorTicks = scaleDiv.ticks( QwtScaleDiv::MinorTick );
|
QList<double> minorTicks = scaleDiv.ticks( QwtScaleDiv::MinorTick );
|
||||||
@@ -453,13 +450,13 @@ double RiuQwtPlotWidget::minorTickInterval( RiaDefines::PlotAxis axis ) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RiuQwtPlotWidget::axisExtent( RiaDefines::PlotAxis axis ) const
|
int RiuQwtPlotWidget::axisExtent( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
auto [rangeMin, rangeMax] = axisRange( axis );
|
auto [rangeMin, rangeMax] = axisRange( axis );
|
||||||
if ( std::abs( rangeMax - rangeMin ) < 1.0e-14 ) return 0;
|
if ( std::abs( rangeMax - rangeMin ) < 1.0e-14 ) return 0;
|
||||||
|
|
||||||
int lineExtent = 0;
|
int lineExtent = 0;
|
||||||
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||||
|
|
||||||
if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Ticks ) )
|
if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Ticks ) )
|
||||||
{
|
{
|
||||||
@@ -468,11 +465,11 @@ int RiuQwtPlotWidget::axisExtent( RiaDefines::PlotAxis axis ) const
|
|||||||
|
|
||||||
if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Labels ) )
|
if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Labels ) )
|
||||||
{
|
{
|
||||||
QFont tickLabelFont = m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis ) );
|
QFont tickLabelFont = m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) );
|
||||||
// Make space for a fairly long value label
|
// Make space for a fairly long value label
|
||||||
QSize labelSize = QFontMetrics( tickLabelFont ).boundingRect( QString( "9.9e-9" ) ).size();
|
QSize labelSize = QFontMetrics( tickLabelFont ).boundingRect( QString( "9.9e-9" ) ).size();
|
||||||
|
|
||||||
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
|
||||||
{
|
{
|
||||||
lineExtent = labelSize.width();
|
lineExtent = labelSize.width();
|
||||||
}
|
}
|
||||||
@@ -654,10 +651,10 @@ void RiuQwtPlotWidget::applyPlotTitleToQwt()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::applyAxisTitleToQwt( RiaDefines::PlotAxis axis )
|
void RiuQwtPlotWidget::applyAxisTitleToQwt( RiuPlotAxis axis )
|
||||||
{
|
{
|
||||||
QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" );
|
QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" );
|
||||||
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||||
QwtText axisTitle = m_plot->axisTitle( qwtAxis );
|
QwtText axisTitle = m_plot->axisTitle( qwtAxis );
|
||||||
if ( titleToApply != axisTitle.text() )
|
if ( titleToApply != axisTitle.text() )
|
||||||
{
|
{
|
||||||
@@ -794,9 +791,9 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::recalculateAxisExtents( RiaDefines::PlotAxis axis )
|
void RiuQwtPlotWidget::recalculateAxisExtents( RiuPlotAxis axis )
|
||||||
{
|
{
|
||||||
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||||
if ( qwtAxis == QwtPlot::yLeft || qwtAxis == QwtPlot::yRight )
|
if ( qwtAxis == QwtPlot::yLeft || qwtAxis == QwtPlot::yRight )
|
||||||
{
|
{
|
||||||
int extent = axisExtent( axis );
|
int extent = axisExtent( axis );
|
||||||
@@ -1054,33 +1051,33 @@ QwtPlot* RiuQwtPlotWidget::qwtPlot() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::enableAxis( RiaDefines::PlotAxis axis, bool isEnabled )
|
void RiuQwtPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled )
|
||||||
{
|
{
|
||||||
m_plot->enableAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ), isEnabled );
|
m_plot->enableAxis( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), isEnabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiuQwtPlotWidget::axisEnabled( RiaDefines::PlotAxis axis ) const
|
bool RiuQwtPlotWidget::axisEnabled( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
return m_plot->axisEnabled( RiuQwtPlotTools::toQwtPlotAxis( axis ) );
|
return m_plot->axisEnabled( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor )
|
void RiuQwtPlotWidget::setAxisMaxMinor( RiuPlotAxis axis, int maxMinor )
|
||||||
{
|
{
|
||||||
m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMinor );
|
m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMinor );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor )
|
void RiuQwtPlotWidget::setAxisMaxMajor( RiuPlotAxis axis, int maxMajor )
|
||||||
{
|
{
|
||||||
m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMajor );
|
m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMajor );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1095,25 +1092,25 @@ void RiuQwtPlotWidget::removeEventFilter()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisAutoScale( RiaDefines::PlotAxis axis, bool autoScale )
|
void RiuQwtPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale )
|
||||||
{
|
{
|
||||||
m_plot->setAxisAutoScale( RiuQwtPlotTools::toQwtPlotAxis( axis ), autoScale );
|
m_plot->setAxisAutoScale( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), autoScale );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisScale( RiaDefines::PlotAxis axis, double min, double max )
|
void RiuQwtPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max )
|
||||||
{
|
{
|
||||||
m_plot->setAxisScale( RiuQwtPlotTools::toQwtPlotAxis( axis ), min, max );
|
m_plot->setAxisScale( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), min, max );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiaDefines::PlotAxis axis ) const
|
RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiuPlotAxis axis ) const
|
||||||
{
|
{
|
||||||
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||||
|
|
||||||
QwtLogScaleEngine* logScaleEngine = dynamic_cast<QwtLogScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
QwtLogScaleEngine* logScaleEngine = dynamic_cast<QwtLogScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||||
QwtDateScaleEngine* dateScaleEngine = dynamic_cast<QwtDateScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
QwtDateScaleEngine* dateScaleEngine = dynamic_cast<QwtDateScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||||
@@ -1128,9 +1125,9 @@ RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiaDefines::Plo
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQwtPlotWidget::setAxisScaleType( RiaDefines::PlotAxis axis, RiuQwtPlotWidget::AxisScaleType axisScaleType )
|
void RiuQwtPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQwtPlotWidget::AxisScaleType axisScaleType )
|
||||||
{
|
{
|
||||||
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||||
|
|
||||||
if ( axisScaleType == AxisScaleType::LOGARITHMIC ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLogScaleEngine );
|
if ( axisScaleType == AxisScaleType::LOGARITHMIC ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLogScaleEngine );
|
||||||
if ( axisScaleType == AxisScaleType::LINEAR ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLinearScaleEngine );
|
if ( axisScaleType == AxisScaleType::LINEAR ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLinearScaleEngine );
|
||||||
@@ -1145,6 +1142,15 @@ void RiuQwtPlotWidget::updateAxes()
|
|||||||
m_plot->updateAxes();
|
m_plot->updateAxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuPlotAxis RiuQwtPlotWidget::createNextPlotAxis( RiaDefines::PlotAxis axis )
|
||||||
|
{
|
||||||
|
// Qwt does not support multiaxis. Just use the default on the given side.
|
||||||
|
return RiuPlotAxis( axis );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1169,3 +1175,11 @@ const QColor& RiuQwtPlotWidget::backgroundColor() const
|
|||||||
{
|
{
|
||||||
return m_plot->canvasBackground().color();
|
return m_plot->canvasBackground().color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RiuQwtPlotWidget::isMultiAxisSupported() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ public:
|
|||||||
RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr );
|
RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr );
|
||||||
~RiuQwtPlotWidget() override;
|
~RiuQwtPlotWidget() override;
|
||||||
|
|
||||||
int axisTitleFontSize( RiaDefines::PlotAxis axis ) const override;
|
int axisTitleFontSize( RiuPlotAxis axis ) const override;
|
||||||
int axisValueFontSize( RiaDefines::PlotAxis axis ) const override;
|
int axisValueFontSize( RiuPlotAxis axis ) const override;
|
||||||
void setAxisFontsAndAlignment( RiaDefines::PlotAxis,
|
void setAxisFontsAndAlignment( RiuPlotAxis,
|
||||||
int titleFontSize,
|
int titleFontSize,
|
||||||
int valueFontSize,
|
int valueFontSize,
|
||||||
bool titleBold = false,
|
bool titleBold = false,
|
||||||
@@ -76,20 +76,23 @@ public:
|
|||||||
bool titleBold = false,
|
bool titleBold = false,
|
||||||
int alignment = (int)Qt::AlignCenter ) override;
|
int alignment = (int)Qt::AlignCenter ) override;
|
||||||
|
|
||||||
void enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) override;
|
void enableAxis( RiuPlotAxis axis, bool isEnabled ) override;
|
||||||
bool axisEnabled( RiaDefines::PlotAxis axis ) const override;
|
bool axisEnabled( RiuPlotAxis axis ) const override;
|
||||||
|
|
||||||
void setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) override;
|
void setAxisScale( RiuPlotAxis axis, double min, double max ) override;
|
||||||
void setAxisAutoScale( RiaDefines::PlotAxis axis, bool enable ) override;
|
void setAxisAutoScale( RiuPlotAxis axis, bool enable ) override;
|
||||||
|
|
||||||
void setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) override;
|
void setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) override;
|
||||||
void setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) override;
|
void setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) override;
|
||||||
|
|
||||||
RiuPlotWidget::AxisScaleType axisScaleType( RiaDefines::PlotAxis axis ) const override;
|
RiuPlotWidget::AxisScaleType axisScaleType( RiuPlotAxis axis ) const override;
|
||||||
void setAxisScaleType( RiaDefines::PlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) override;
|
void setAxisScaleType( RiuPlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) override;
|
||||||
|
|
||||||
void setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) override;
|
void setAxisTitleText( RiuPlotAxis axis, const QString& title ) override;
|
||||||
void setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) override;
|
void setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) override;
|
||||||
|
|
||||||
|
RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) override;
|
||||||
|
bool isMultiAxisSupported() const override;
|
||||||
|
|
||||||
void setPlotTitle( const QString& plotTitle ) override;
|
void setPlotTitle( const QString& plotTitle ) override;
|
||||||
const QString& plotTitle() const;
|
const QString& plotTitle() const;
|
||||||
@@ -102,33 +105,31 @@ public:
|
|||||||
void insertLegend( RiuPlotWidget::Legend ) override;
|
void insertLegend( RiuPlotWidget::Legend ) override;
|
||||||
void clearLegend() override;
|
void clearLegend() override;
|
||||||
|
|
||||||
std::pair<double, double> axisRange( RiaDefines::PlotAxis axis ) const override;
|
std::pair<double, double> axisRange( RiuPlotAxis axis ) const override;
|
||||||
void setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) override;
|
void setAxisRange( RiuPlotAxis axis, double min, double max ) override;
|
||||||
|
|
||||||
void setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) override;
|
void setAxisInverted( RiuPlotAxis axis, bool isInverted ) override;
|
||||||
void setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) override;
|
void setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks ) override;
|
||||||
|
|
||||||
void enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) override;
|
void enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) override;
|
||||||
|
|
||||||
void setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis,
|
void setMajorAndMinorTickIntervals( RiuPlotAxis axis,
|
||||||
double majorTickInterval,
|
double majorTickInterval,
|
||||||
double minorTickInterval,
|
double minorTickInterval,
|
||||||
double minValue,
|
double minValue,
|
||||||
double maxValue ) override;
|
double maxValue ) override;
|
||||||
void setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis,
|
void setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis,
|
||||||
double majorTickInterval,
|
double majorTickInterval,
|
||||||
double minorTickInterval,
|
double minorTickInterval,
|
||||||
double minTickValue,
|
double minTickValue,
|
||||||
double maxTickValue,
|
double maxTickValue,
|
||||||
double rangeMin,
|
double rangeMin,
|
||||||
double rangeMax ) override;
|
double rangeMax ) override;
|
||||||
void setAutoTickIntervalCounts( RiaDefines::PlotAxis axis,
|
void setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) override;
|
||||||
int maxMajorTickIntervalCount,
|
double majorTickInterval( RiuPlotAxis axis ) const override;
|
||||||
int maxMinorTickIntervalCount ) override;
|
double minorTickInterval( RiuPlotAxis axis ) const override;
|
||||||
double majorTickInterval( RiaDefines::PlotAxis axis ) const override;
|
|
||||||
double minorTickInterval( RiaDefines::PlotAxis axis ) const override;
|
|
||||||
|
|
||||||
int axisExtent( RiaDefines::PlotAxis axis ) const override;
|
int axisExtent( RiuPlotAxis axis ) const override;
|
||||||
|
|
||||||
QPoint dragStartPosition() const;
|
QPoint dragStartPosition() const;
|
||||||
|
|
||||||
@@ -180,7 +181,7 @@ protected:
|
|||||||
void keyPressEvent( QKeyEvent* event ) override;
|
void keyPressEvent( QKeyEvent* event ) override;
|
||||||
|
|
||||||
void applyPlotTitleToQwt();
|
void applyPlotTitleToQwt();
|
||||||
void applyAxisTitleToQwt( RiaDefines::PlotAxis axis );
|
void applyAxisTitleToQwt( RiuPlotAxis axis );
|
||||||
|
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
QSize minimumSizeHint() const override;
|
QSize minimumSizeHint() const override;
|
||||||
@@ -196,7 +197,7 @@ private:
|
|||||||
void highlightPlotItem( const QwtPlotItem* closestItem );
|
void highlightPlotItem( const QwtPlotItem* closestItem );
|
||||||
void resetPlotItemHighlighting();
|
void resetPlotItemHighlighting();
|
||||||
void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection );
|
void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection );
|
||||||
void recalculateAxisExtents( RiaDefines::PlotAxis axis );
|
void recalculateAxisExtents( RiuPlotAxis axis );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CurveColors
|
struct CurveColors
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS
|
|||||||
|
|
||||||
if ( plotOnWhichYAxis == RIGHT_YAXIS )
|
if ( plotOnWhichYAxis == RIGHT_YAXIS )
|
||||||
{
|
{
|
||||||
qwtCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
|
qwtCurve->setYAxis( RiuPlotAxis::defaultRight() );
|
||||||
shouldEnableRightYAxis = true;
|
shouldEnableRightYAxis = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ void RiuSummaryQtChartsPlot::useDateBasedTimeAxis( const QString&
|
|||||||
RiaQDateTimeTools::DateFormatComponents dateComponents,
|
RiaQDateTimeTools::DateFormatComponents dateComponents,
|
||||||
RiaQDateTimeTools::TimeFormatComponents timeComponents )
|
RiaQDateTimeTools::TimeFormatComponents timeComponents )
|
||||||
{
|
{
|
||||||
m_plotWidget->setAxisScaleType( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, RiuPlotWidget::AxisScaleType::DATE );
|
m_plotWidget->setAxisScaleType( RiuPlotAxis::defaultBottom(), RiuPlotWidget::AxisScaleType::DATE );
|
||||||
RiuQtChartsPlotTools::enableDateBasedBottomXAxis( m_plotWidget, dateFormat, timeFormat, dateComponents, timeComponents );
|
RiuQtChartsPlotTools::enableDateBasedBottomXAxis( m_plotWidget, dateFormat, timeFormat, dateComponents, timeComponents );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ void RiuSummaryQtChartsPlot::useDateBasedTimeAxis( const QString&
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuSummaryQtChartsPlot::useTimeBasedTimeAxis()
|
void RiuSummaryQtChartsPlot::useTimeBasedTimeAxis()
|
||||||
{
|
{
|
||||||
m_plotWidget->setAxisScaleType( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, RiuPlotWidget::AxisScaleType::DATE );
|
m_plotWidget->setAxisScaleType( RiuPlotAxis::defaultBottom(), RiuPlotWidget::AxisScaleType::DATE );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ void RiuSummaryQwtPlot::useTimeBasedTimeAxis()
|
|||||||
void RiuSummaryQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties )
|
void RiuSummaryQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties )
|
||||||
{
|
{
|
||||||
RiuPlotAnnotationTool::Orientation orientation = RiuPlotAnnotationTool::Orientation::HORIZONTAL;
|
RiuPlotAnnotationTool::Orientation orientation = RiuPlotAnnotationTool::Orientation::HORIZONTAL;
|
||||||
if ( axisProperties->plotAxisType() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
||||||
{
|
{
|
||||||
orientation = RiuPlotAnnotationTool::Orientation::VERTICAL;
|
orientation = RiuPlotAnnotationTool::Orientation::VERTICAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ RiuWellLogTrack::~RiuWellLogTrack()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuWellLogTrack::setAxisEnabled( QwtPlot::Axis axis, bool enabled )
|
void RiuWellLogTrack::setAxisEnabled( QwtPlot::Axis axis, bool enabled )
|
||||||
{
|
{
|
||||||
RiaDefines::PlotAxis plotAxis = RiuQwtPlotTools::fromQwtPlotAxis( axis );
|
RiuPlotAxis plotAxis = RiuPlotAxis( RiuQwtPlotTools::fromQwtPlotAxis( axis ) );
|
||||||
RiuQwtPlotWidget::enableAxis( plotAxis, enabled );
|
RiuQwtPlotWidget::enableAxis( plotAxis, enabled );
|
||||||
|
|
||||||
if ( enabled )
|
if ( enabled )
|
||||||
|
|||||||
Reference in New Issue
Block a user