Logarithmic curve support and renaming (#8546)

* Add test for both positive and negative numbers
* Remove redundant sample count from parameter list
* Propagate useLogarithmicScale
* Renaming
This commit is contained in:
Magne Sjaastad
2022-02-14 11:49:37 +01:00
committed by GitHub
parent a8a3d3332b
commit 477ae02382
50 changed files with 597 additions and 481 deletions

View File

@@ -49,7 +49,7 @@ RiuPlotCurve::~RiuPlotCurve()
//--------------------------------------------------------------------------------------------------
void RiuPlotCurve::setSamplesValues( const std::vector<double>& xValues, const std::vector<double>& yValues )
{
setSamplesInPlot( xValues, yValues, static_cast<int>( xValues.size() ) );
setSamplesInPlot( xValues, yValues );
}
//--------------------------------------------------------------------------------------------------
@@ -57,9 +57,9 @@ void RiuPlotCurve::setSamplesValues( const std::vector<double>& xValues, const s
//--------------------------------------------------------------------------------------------------
void RiuPlotCurve::setSamplesFromXValuesAndYValues( const std::vector<double>& xValues,
const std::vector<double>& yValues,
bool isLogCurve )
bool useLogarithmicScale )
{
computeValidIntervalsAndSetCurveData( xValues, yValues, isLogCurve );
computeValidIntervalsAndSetCurveData( xValues, yValues, useLogarithmicScale );
}
//--------------------------------------------------------------------------------------------------
@@ -67,11 +67,11 @@ void RiuPlotCurve::setSamplesFromXValuesAndYValues( const std::vector<double>& x
//--------------------------------------------------------------------------------------------------
void RiuPlotCurve::setSamplesFromDatesAndYValues( const std::vector<QDateTime>& dateTimes,
const std::vector<double>& yValues,
bool isLogCurve )
bool useLogarithmicScale )
{
auto xValues = RiuPlotCurve::fromQDateTime( dateTimes );
computeValidIntervalsAndSetCurveData( xValues, yValues, isLogCurve );
computeValidIntervalsAndSetCurveData( xValues, yValues, useLogarithmicScale );
}
//--------------------------------------------------------------------------------------------------
@@ -79,11 +79,11 @@ void RiuPlotCurve::setSamplesFromDatesAndYValues( const std::vector<QDateTime>&
//--------------------------------------------------------------------------------------------------
void RiuPlotCurve::setSamplesFromTimeTAndYValues( const std::vector<time_t>& dateTimes,
const std::vector<double>& yValues,
bool isLogCurve )
bool useLogarithmicScale )
{
auto xValues = RiuPlotCurve::fromTime_t( dateTimes );
computeValidIntervalsAndSetCurveData( xValues, yValues, isLogCurve );
computeValidIntervalsAndSetCurveData( xValues, yValues, useLogarithmicScale );
}
//--------------------------------------------------------------------------------------------------
@@ -123,9 +123,9 @@ void RiuPlotCurve::setBlackAndWhiteLegendIcon( bool blackAndWhite )
//--------------------------------------------------------------------------------------------------
void RiuPlotCurve::computeValidIntervalsAndSetCurveData( const std::vector<double>& xValues,
const std::vector<double>& yValues,
bool isLogCurve )
bool useLogarithmicScale )
{
auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, isLogCurve );
auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, useLogarithmicScale );
std::vector<double> validYValues;
std::vector<double> validXValues;
@@ -133,7 +133,7 @@ void RiuPlotCurve::computeValidIntervalsAndSetCurveData( const std::vector<doubl
RiaCurveDataTools::getValuesByIntervals( yValues, intervalsOfValidValues, &validYValues );
RiaCurveDataTools::getValuesByIntervals( xValues, intervalsOfValidValues, &validXValues );
setSamplesInPlot( validXValues, validYValues, static_cast<int>( validXValues.size() ) );
setSamplesInPlot( validXValues, validYValues );
setLineSegmentStartStopIndices( RiaCurveDataTools::computePolyLineStartStopIndices( intervalsOfValidValues ) );
}
@@ -184,7 +184,7 @@ std::vector<double> RiuPlotCurve::fromTime_t( const std::vector<time_t>& timeSte
void RiuPlotCurve::setSamplesFromXYErrorValues( const std::vector<double>& xValues,
const std::vector<double>& yValues,
const std::vector<double>& errorValues,
bool isLogCurve,
bool useLogarithmicScale,
RiaCurveDataTools::ErrorAxis errorAxis )
{
}