Multiranges
This issue describes the current state of multi ranges.
Multi ranges are possible, but at the moment actions are not applied to all ranges:
bool scaleAuto(int xIndex = -1, int yIndex = -1, bool fullRange = true);
bool CartesianPlot::scaleAuto(int xIndex, int yIndex, bool fullRange) {
DEBUG(Q_FUNC_INFO << ", x/y index = " << xIndex << ' ' << yIndex)
Q_D(CartesianPlot);
bool updateX = scaleAutoX(xIndex, fullRange, true);
....
bool CartesianPlot::scaleAutoX(int index, bool fullRange, bool suppressRetransform) {
if (index == -1) {
if (!defaultCoordinateSystem())
return false;
index = defaultCoordinateSystem()->xIndex();
DEBUG(Q_FUNC_INFO << ", set index")
}
....
So when doing an autoscale, only the default coordinate system is scaled, but not the others.
One possibility would be to iterate over all coordinate systems. The problem are curvesXMinMaxIsDirty
and curvesYMinMaxIsDirty
which must be set and on every iteration.
bool CartesianPlot::scaleAutoX(int index, bool fullRange, bool suppressRetransform) {
Q_D(CartesianPlot);
if (index == -1) {
if (!defaultCoordinateSystem())
return false;
auto initialXDirty = d->curvesXMinMaxIsDirty;
auto initialYDirty = d->curvesYMinMaxIsDirty;
bool scaled = false; // indicates if at least one was scaled
for (int i=0; i < m_coordinateSystems.count(); i++) {
d->curvesXMinMaxIsDirty = initialXDirty;
d->curvesYMinMaxIsDirty = initialYDirty;
if (scaleAutoX(i, fullRange, suppressRetransform))
scaled = true;
}
return scaled;
}
To think further to scale only a specific range, curvesXMinMaxIsDirty
and curvesYMinMaxIsDirty
must exist for every range.
So they must be somehow synched with the range.
Maybe a rename of these variables to rangeUpdate
...
Maybe instead of QVector<AbstractCoordinateSystem*> m_coordinateSystems;
using a struct in the vector
typedef struct {
AbstractCoordinateSystem* coordinateSystem;
bool xDirty;
bool yDirty;
} CoordinateSystem;
'QVector<CoordinateSystem> m_coordinateSystems`
How to scale only one range (just proposals)?
- Selecting an axis (lets take a horizontal). Only autoscale x is enabled. When activating autoscale x, only the x range of this axis is scaled. if the axis does not have a range, nothing happens
- selecting a curve and then the scale actions, so only the range assigned to that curve is changed.
- selecting a curve and mouse move --> the range assigned to the curve gets changed
- selecting the plot it self, all ranges get modified
Edited by Martin Marmsoler