mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
added JKQTPCoordinateAxis::setRangeFixed() which disables changing the axis range (and thus the zoom)
add JKQTPCoordinateAxis::getMin() and JKQTPCoordinateAxis::getMax() getters
This commit is contained in:
parent
aa4ac4c58a
commit
2a23d27c60
@ -137,6 +137,8 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
|
||||
<li>NEW: stacked barcharts may have a small separation (default 1pt)</li>
|
||||
<li>NEW: autoscaling for barcharts works now, also when stacked and unstacked charts are combined in one plot</li>
|
||||
<li>NEW: JKQTPGeoBezierCurve for drawing bezier curves of degree 1-4 (+example \ref JKQTPlotterGeometricBezier)</li>
|
||||
<li>NEW: added JKQTPCoordinateAxis::setRangeFixed() which disables changing the axis range (and thus the zoom)</li>
|
||||
<li>NEW: add JKQTPCoordinateAxis::getMin() and JKQTPCoordinateAxis::getMax() getters</li>
|
||||
</ul></li>
|
||||
|
||||
<li>JKQTMathText:<ul>
|
||||
|
@ -97,10 +97,10 @@ This test results in the following numbers (on my AMD Ryzen5 8/16-core laptop):
|
||||
<b>VERSION:</b> 5.0.0
|
||||
<b>BUILD MODE:</b> Release
|
||||
|
||||
<u><b>SERIAL RESULTS:</b></u><br/>runtime, overall = 12130.5ms<br/>single runtimes = (505.3 +/- 1773.2) ms<br/>speedup = 1.00x<br/>threads / available = 1 / 16<br/><br/><br/>
|
||||
<u><b>SERIAL RESULTS:</b></u><br/>runtime, overall = 11182.4ms<br/>single runtimes = (465.8 +/- 1648.1) ms<br/>speedup = 1.00x<br/>threads / available = 1 / 16<br/><br/><br/>
|
||||
|
||||
<u><b>PARALLEL RESULTS:</b></u><br/>
|
||||
runtime, overall = 5495.3ms<br/>single runtimes = (1657.1 +/- 391.4) ms<br/>speedup = 7.24x<br/>threads / available = 8 / 16<br/>batch runs = 3<br/><br/><b>speedup vs. serial = 2.2x</b>
|
||||
runtime, overall = 5378.2ms<br/>single runtimes = (1639.8 +/- 416.7) ms<br/>speedup = 7.32x<br/>threads / available = 8 / 16<br/>batch runs = 3<br/><br/><b>speedup vs. serial = 2.1x</b>
|
||||
|
||||
[comment]:RESULTS_END
|
||||
|
||||
|
@ -45,6 +45,7 @@ JKQTPCoordinateAxis::JKQTPCoordinateAxis(JKQTBasePlotter* _parent):
|
||||
parent(_parent),
|
||||
axismin(-10),
|
||||
axismax(10),
|
||||
axisRangeFixed(false),
|
||||
axisabsoultemin(-DBL_MAX/100.),
|
||||
axisabsoultemax(DBL_MAX/100.0),
|
||||
axisStyle(),
|
||||
@ -671,6 +672,7 @@ void JKQTPCoordinateAxis::saveCurrentAxisStyle(QSettings &settings, const QStrin
|
||||
}
|
||||
|
||||
void JKQTPCoordinateAxis::setRange(double aamin, double aamax) {
|
||||
if (axisRangeFixed) return;
|
||||
const double oldamin=axismin;
|
||||
const double oldamax=axismax;
|
||||
double amin=std::min(aamin, aamax);
|
||||
@ -708,6 +710,21 @@ void JKQTPCoordinateAxis::setRange(double aamin, double aamax) {
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTPCoordinateAxis::setMin(double amin)
|
||||
{
|
||||
setRange(amin, axismax);
|
||||
}
|
||||
|
||||
void JKQTPCoordinateAxis::setMax(double amax)
|
||||
{
|
||||
setRange(axismin, amax);
|
||||
}
|
||||
|
||||
void JKQTPCoordinateAxis::setRangeFixed(bool fixed)
|
||||
{
|
||||
axisRangeFixed=fixed;
|
||||
}
|
||||
|
||||
void JKQTPCoordinateAxis::setNoAbsoluteRange() {
|
||||
axisabsoultemin=-DBL_MAX;
|
||||
axisabsoultemax=DBL_MAX;
|
||||
|
@ -431,6 +431,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
|
||||
/** \brief returns the current max */
|
||||
inline double getMax() const {return axismax; }
|
||||
|
||||
/** \brief returns whether the axis range is fixed, i.e. may not change! */
|
||||
inline bool isAxisRangeFixed() const {return axisRangeFixed; }
|
||||
|
||||
/** \brief returns the current absolute min */
|
||||
inline double getAbsoluteMin() const {return axisabsoultemin; }
|
||||
|
||||
@ -498,8 +501,36 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
|
||||
QString floattolabel(double data, int past_comma) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/** \brief set range of plot axis */
|
||||
/** \brief set range of plot axis
|
||||
*
|
||||
* \param amin new minimum
|
||||
* \param amax new maximum
|
||||
*
|
||||
* \note the actually set range may differ from [amin...amax] in order to fullfill requirements e.g. for logarithmic axes or an absolute axis range (see setAbsoluteRange() )
|
||||
* \note if setRangeFixed(true) was called before this call, the axis range is fixed and this function has NO EFFECT!
|
||||
*/
|
||||
void setRange(double amin, double amax);
|
||||
/** \brief set axis minimum range of plot axis
|
||||
*
|
||||
* \param amin new minimum
|
||||
*
|
||||
* \note the actually set range may differ from [amin...getMax()] in order to fullfill requirements e.g. for logarithmic axes or an absolute axis range (see setAbsoluteRange() )
|
||||
* \note if setRangeFixed(true) was called before this call, the axis range is fixed and this function has NO EFFECT!
|
||||
*/
|
||||
void setMin(double amin);
|
||||
/** \brief set axis minimum range of plot axis
|
||||
*
|
||||
* \param amax new maximum
|
||||
*
|
||||
* \note the actually set range may differ from [getMin()...amax] in order to fullfill requirements e.g. for logarithmic axes or an absolute axis range (see setAbsoluteRange() )
|
||||
* \note if setRangeFixed(true) was called before this call, the axis range is fixed and this function has NO EFFECT!
|
||||
*/
|
||||
void setMax(double amax);
|
||||
/** \brief fixes/ufixes the axis
|
||||
*
|
||||
* a fixed axis's range (minimum/maximum) may not be changed by the user!)
|
||||
*/
|
||||
void setRangeFixed(bool fixed);
|
||||
/** \brief sets absolutely limiting range of the plot
|
||||
*
|
||||
* The user (or programmer) cannot zoom to a viewport that is larger than the range given to this function.
|
||||
@ -753,6 +784,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
|
||||
double axismin;
|
||||
/** \brief current view: maximum of axis */
|
||||
double axismax;
|
||||
/** \brief indicates whether this axis is fixed, i.e. axismin and axismax are frozen to their current values */
|
||||
bool axisRangeFixed;
|
||||
|
||||
/** \brief absoulte minimum of axis (axismin/axismax xan not be set below this) */
|
||||
double axisabsoultemin;
|
||||
@ -904,7 +937,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
|
||||
/** \brief calculate the position of the zero-axis (and whether to draw it or not) */
|
||||
double getZeroAxisPos(bool* drawZeroAxis=nullptr);
|
||||
|
||||
/** \brief figures out (possibly by probing the parent JKQTBasePloter), whether this axis is a secondary axis */
|
||||
/** \brief figures out (possibly by probing the parent JKQTBasePlotter), whether this axis is a secondary axis */
|
||||
virtual bool isSecondaryAxis() const;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user