Changeset View
Changeset View
Standalone View
Standalone View
src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
Context not available. | |||||
522 | 522 | | |||
---|---|---|---|---|---|
523 | addNewMenu = new QMenu(i18n("Add new")); | 523 | addNewMenu = new QMenu(i18n("Add new")); | ||
524 | addNewMenu->addAction(addCurveAction); | 524 | addNewMenu->addAction(addCurveAction); | ||
525 | // addNewMenu->addAction(addHistogramPlot); | 525 | addNewMenu->addAction(addHistogramPlot); | ||
526 | addNewMenu->addAction(addEquationCurveAction); | 526 | addNewMenu->addAction(addEquationCurveAction); | ||
527 | addNewMenu->addSeparator(); | 527 | addNewMenu->addSeparator(); | ||
528 | addNewMenu->addAction(addDataReductionCurveAction); | 528 | addNewMenu->addAction(addDataReductionCurveAction); | ||
Context not available. | |||||
1276 | } else { | 1276 | } else { | ||
1277 | const Histogram* histo = qobject_cast<const Histogram*>(child); | 1277 | const Histogram* histo = qobject_cast<const Histogram*>(child); | ||
1278 | if (histo) { | 1278 | if (histo) { | ||
1279 | connect(histo, SIGNAL(HistogramdataChanged()), this, SLOT(HistogramdataChanged())); | 1279 | connect(histo, SIGNAL(HistogramDataChanged()), this, SLOT(HistogramDataChanged())); | ||
1280 | connect(histo, SIGNAL(xHistogramDataChanged()), this, SLOT(xHistogramDataChanged())); | 1280 | connect(histo, SIGNAL(xHistogramDataChanged()), this, SLOT(xHistogramDataChanged())); | ||
1281 | connect(histo, SIGNAL(yHistogramDataChanged()), this, SLOT(yHistogramDataChanged())); | 1281 | connect(histo, SIGNAL(yHistogramDataChanged()), this, SLOT(yHistogramDataChanged())); | ||
1282 | connect(histo, SIGNAL(visibilityChanged(bool)), this, SLOT(curveVisibilityChanged())); | 1282 | connect(histo, SIGNAL(visibilityChanged(bool)), this, SLOT(curveVisibilityChanged())); | ||
Context not available. | |||||
1383 | } | 1383 | } | ||
1384 | } | 1384 | } | ||
1385 | 1385 | | |||
1386 | void CartesianPlot::HistogramdataChanged() { | 1386 | void CartesianPlot::HistogramDataChanged() { | ||
1387 | Q_D(CartesianPlot); | 1387 | Q_D(CartesianPlot); | ||
1388 | d->curvesXMinMaxIsDirty = true; | 1388 | d->curvesXMinMaxIsDirty = true; | ||
1389 | d->curvesYMinMaxIsDirty = true; | 1389 | d->curvesYMinMaxIsDirty = true; | ||
Context not available. | |||||
1393 | this->scaleAutoY(); | 1393 | this->scaleAutoY(); | ||
1394 | else if (d->autoScaleY) | 1394 | else if (d->autoScaleY) | ||
1395 | this->scaleAutoY(); | 1395 | this->scaleAutoY(); | ||
1396 | Histogram* curve = dynamic_cast<Histogram*>(QObject::sender()); | ||||
1397 | if (curve) | ||||
1398 | curve->retransform(); | ||||
1396 | else { | 1399 | else { | ||
1397 | Histogram* curve = dynamic_cast<Histogram*>(QObject::sender()); | 1400 | //no sender available, the function was called in CartesianPlot::dataChanged() (live data source got new data) | ||
1398 | if (curve) | 1401 | //-> retransform all available curves since we don't know which curves are affected. | ||
1399 | curve->retransform(); | 1402 | //TODO: this logic can be very expensive | ||
1400 | else { | 1403 | for (auto c : children<Histogram>()) | ||
1401 | //no sender available, the function was called in CartesianPlot::dataChanged() (live data source got new data) | 1404 | c->retransform(); | ||
1402 | //-> retransform all available curves since we don't know which curves are affected. | | |||
1403 | //TODO: this logic can be very expensive | | |||
1404 | for (auto c : children<Histogram>()) | | |||
1405 | c->retransform(); | | |||
1406 | } | | |||
1407 | } | 1405 | } | ||
1408 | } | 1406 | } | ||
1409 | 1407 | | |||
Context not available. | |||||
1437 | return; | 1435 | return; | ||
1438 | 1436 | | |||
1439 | d->curvesXMinMaxIsDirty = true; | 1437 | d->curvesXMinMaxIsDirty = true; | ||
1440 | if (d->autoScaleX) | 1438 | if (d->autoScaleX) { | ||
1441 | this->scaleAutoX(); | 1439 | this->scaleAutoX(); | ||
1442 | else { | 1440 | } else { | ||
1443 | Histogram* curve = dynamic_cast<Histogram*>(QObject::sender()); | 1441 | Histogram* curve = dynamic_cast<Histogram*>(QObject::sender()); | ||
1444 | curve->retransform(); | 1442 | curve->retransform(); | ||
1445 | } | 1443 | } | ||
Context not available. | |||||
1669 | d->yMax = d->curvesYMax; | 1667 | d->yMax = d->curvesYMax; | ||
1670 | update = true; | 1668 | update = true; | ||
1671 | } | 1669 | } | ||
1672 | | ||||
1673 | if (update) { | 1670 | if (update) { | ||
1674 | if (d->yMax == d->yMin) { | 1671 | if (d->yMax == d->yMin) { | ||
1675 | //in case min and max are equal (e.g. if we plot a single point), subtract/add 10% of the value | 1672 | //in case min and max are equal (e.g. if we plot a single point), subtract/add 10% of the value | ||
Context not available. |