diff --git a/Code/Mantid/MantidPlot/src/Graph.cpp b/Code/Mantid/MantidPlot/src/Graph.cpp index fdb1a8138debeb95771c73d3703abbd9ca181021..56b98e6090eb43a35ef9b356b3f43e4f6c0cf18e 100644 --- a/Code/Mantid/MantidPlot/src/Graph.cpp +++ b/Code/Mantid/MantidPlot/src/Graph.cpp @@ -1152,7 +1152,8 @@ void Graph::setScale(int axis, double start, double end, double step, int majorTicks, int minorTicks, int type, bool inverted, double left_break, double right_break, int breakPos, double stepBeforeBreak, double stepAfterBreak, int minTicksBeforeBreak, - int minTicksAfterBreak, bool log10AfterBreak, int breakWidth, bool breakDecoration) + int minTicksAfterBreak, bool log10AfterBreak, int breakWidth, + bool breakDecoration, double nth_power) { if (ScaleEngine* se = dynamic_cast<ScaleEngine *>(d_plot->axisScaleEngine(axis))){ se->setBreakRegion(left_break, right_break); @@ -1165,6 +1166,7 @@ void Graph::setScale(int axis, double start, double end, double step, se->setMinTicksAfterBreak(minTicksAfterBreak); se->setLog10ScaleAfterBreak(log10AfterBreak); se->setAttribute(QwtScaleEngine::Inverted, inverted); + se->setNthPower(nth_power); } setAxisScale(axis, start, end, type, step, majorTicks, minorTicks); diff --git a/Code/Mantid/MantidPlot/src/Graph.h b/Code/Mantid/MantidPlot/src/Graph.h index 2f8cd4fed47779576f177f00a4d9bf104bd43c86..7f41d4c91326616128de85c2a73522ab19edadb4 100644 --- a/Code/Mantid/MantidPlot/src/Graph.h +++ b/Code/Mantid/MantidPlot/src/Graph.h @@ -365,7 +365,8 @@ public slots: int majorTicks = 5, int minorTicks = 5, int type = 0, bool inverted = false, double left_break = -DBL_MAX, double right_break = DBL_MAX, int pos = 50, double stepBeforeBreak = 0.0, double stepAfterBreak = 0.0, int minTicksBeforeBreak = 4, - int minTicksAfterBreak = 4, bool log10AfterBreak = false, int breakWidth = 4, bool breakDecoration = true); + int minTicksAfterBreak = 4, bool log10AfterBreak = false, int breakWidth = 4, + bool breakDecoration = true, double nth_power = 2.0); void setScale(QwtPlot::Axis axis, ScaleTransformation::Type scaleType); void setScale(QwtPlot::Axis axis, QString logOrLin); double axisStep(int axis){return d_user_step[axis];}; diff --git a/Code/Mantid/MantidPlot/src/ScaleDetails.cpp b/Code/Mantid/MantidPlot/src/ScaleDetails.cpp index 8fa96658a4634046d6f44707c18628a6c299c199..6fa78d4be4bd973cb9317e358ff6c8d52062bee3 100644 --- a/Code/Mantid/MantidPlot/src/ScaleDetails.cpp +++ b/Code/Mantid/MantidPlot/src/ScaleDetails.cpp @@ -573,7 +573,8 @@ void ScaleDetails::apply() m_graph->setScale(m_mappedaxis, start, end, step, m_spnMajorValue->value(), m_cmbMinorValue->currentText().toInt(), m_cmbScaleType->currentIndex(), m_chkInvert->isChecked(), breakLeft, breakRight, m_spnBreakPosition->value(), m_dspnStepBeforeBreak->value(),m_dspnStepAfterBreak->value(), m_cmbMinorTicksBeforeBreak->currentText().toInt(), - m_cmbMinorTicksAfterBreak->currentText().toInt(), m_chkLog10AfterBreak->isChecked(), m_spnBreakWidth->value(), m_chkBreakDecoration->isChecked()); + m_cmbMinorTicksAfterBreak->currentText().toInt(), m_chkLog10AfterBreak->isChecked(), m_spnBreakWidth->value(), + m_chkBreakDecoration->isChecked(), m_dspnN->value()); m_graph->changeIntensity(true); m_graph->notifyChanges(); m_modified = false; diff --git a/Code/Mantid/MantidPlot/src/plot2D/PowerScaleEngine.h b/Code/Mantid/MantidPlot/src/plot2D/PowerScaleEngine.h index 2361afd644d06bb3cd6e1f74d3e64ece34ddebac..6937c818556c63f4ec4e17ed630009dd18cf9c7a 100644 --- a/Code/Mantid/MantidPlot/src/plot2D/PowerScaleEngine.h +++ b/Code/Mantid/MantidPlot/src/plot2D/PowerScaleEngine.h @@ -37,7 +37,7 @@ class PowerScaleTransformation: public ScaleTransformation { public: - PowerScaleTransformation(const ScaleEngine *engine):ScaleTransformation(engine){nth_power = -1.0;}; + PowerScaleTransformation(const ScaleEngine *engine):ScaleTransformation(engine), nth_power(engine->nthPower()){}; virtual double xForm(double x, double, double, double p1, double p2) const; virtual double invXForm(double x, double s1, double s2, double p1, double p2) const; QwtScaleTransformation* copy() const; diff --git a/Code/Mantid/MantidPlot/src/plot2D/ScaleEngine.cpp b/Code/Mantid/MantidPlot/src/plot2D/ScaleEngine.cpp index 56fca1967d98501eaa0e9e30fe4690d79a83c175..3d83e0defafee7e312b0171c9f04484b4e971b7d 100644 --- a/Code/Mantid/MantidPlot/src/plot2D/ScaleEngine.cpp +++ b/Code/Mantid/MantidPlot/src/plot2D/ScaleEngine.cpp @@ -213,7 +213,8 @@ d_minor_ticks_before(1), d_minor_ticks_after(1), d_log10_scale_after(false), d_break_width(4), -d_break_decoration(true) +d_break_decoration(true), +d_nth_power(2.0) {} bool ScaleEngine::hasBreak() const @@ -276,6 +277,11 @@ bool ScaleEngine::hasBreakDecoration() const return d_break_decoration; } +double ScaleEngine::nthPower() const +{ + return d_nth_power; +} + void ScaleEngine::clone(const ScaleEngine *engine) { d_type = engine->type(); @@ -289,6 +295,7 @@ void ScaleEngine::clone(const ScaleEngine *engine) d_log10_scale_after = engine->log10ScaleAfterBreak(); d_break_width = engine->breakWidth(); d_break_decoration = engine->hasBreakDecoration(); + d_nth_power = engine->nthPower(); setAttributes(engine->attributes()); setMargins(engine->lowerMargin(), engine->upperMargin()); } diff --git a/Code/Mantid/MantidPlot/src/plot2D/ScaleEngine.h b/Code/Mantid/MantidPlot/src/plot2D/ScaleEngine.h index 831d3d9fc0ced5bfcb61f016a266b6194788fce0..2143777c9a05f455c83172b3a5b970cbdcc27bef 100644 --- a/Code/Mantid/MantidPlot/src/plot2D/ScaleEngine.h +++ b/Code/Mantid/MantidPlot/src/plot2D/ScaleEngine.h @@ -86,6 +86,9 @@ public: bool log10ScaleAfterBreak() const; void setLog10ScaleAfterBreak(bool on){d_log10_scale_after = on;}; + double nthPower() const; + void setNthPower(double nth_power){d_nth_power = nth_power;}; + ScaleTransformation::Type type() const; void setType(ScaleTransformation::Type type){d_type = type;}; @@ -113,6 +116,8 @@ private: int d_break_width; //! If true draw the break decoration bool d_break_decoration; + //! Nth Power for a power scale + double d_nth_power; }; #endif