304
357
QColor brush_color = GColor(CALTITUDEBRUSH);
305
358
brush_color.setAlpha(200);
306
359
altCurve->setBrush(brush_color); // fill below the line
360
QPen tempPen = QPen(GColor(CTEMP));
361
tempPen.setWidth(width);
362
tempCurve->setPen(tempPen);
364
tempCurve->setStyle(QwtPlotCurve::Dots);
366
tempCurve->setStyle(QwtPlotCurve::Lines);
367
//QPen windPen = QPen(GColor(CWINDSPEED));
368
//windPen.setWidth(width);
369
windCurve->setPen(Qt::NoPen);
370
QColor wbrush_color = GColor(CWINDSPEED);
371
wbrush_color.setAlpha(200);
372
windCurve->setBrush(wbrush_color); // fill below the line
373
QPen torquePen = QPen(GColor(CTORQUE));
374
torquePen.setWidth(width);
375
torqueCurve->setPen(torquePen);
376
QPen balanceLPen = QPen(GColor(CBALANCERIGHT));
377
balanceLPen.setWidth(width);
378
balanceLCurve->setPen(balanceLPen);
379
QColor brbrush_color = GColor(CBALANCERIGHT);
380
brbrush_color.setAlpha(200);
381
balanceLCurve->setBrush(brbrush_color); // fill below the line
382
QPen balanceRPen = QPen(GColor(CBALANCELEFT));
383
balanceRPen.setWidth(width);
384
balanceRCurve->setPen(balanceRPen);
385
QColor blbrush_color = GColor(CBALANCELEFT);
386
blbrush_color.setAlpha(200);
387
balanceRCurve->setBrush(blbrush_color); // fill below the line
307
389
QPen ihlPen = QPen(GColor(CINTERVALHIGHLIGHTER));
308
390
ihlPen.setWidth(width);
309
391
intervalHighlighterCurve->setPen(ihlPen);
310
392
QColor ihlbrush = QColor(GColor(CINTERVALHIGHLIGHTER));
311
ihlbrush.setAlpha(64);
393
ihlbrush.setAlpha(128);
312
394
intervalHighlighterCurve->setBrush(ihlbrush); // fill below the line
313
this->legend()->remove(intervalHighlighterCurve); // don't show in legend
395
//this->legend()->remove(intervalHighlighterCurve); // don't show in legend
314
396
QPen gridPen(GColor(CPLOTGRID));
315
397
gridPen.setStyle(Qt::DotLine);
316
398
grid->setPen(gridPen);
401
if (parent->isPaintBrush()) {
403
p = wattsCurve->pen().color();
405
wattsCurve->setBrush(QBrush(p));
407
p = hrCurve->pen().color();
409
hrCurve->setBrush(QBrush(p));
411
p = speedCurve->pen().color();
413
speedCurve->setBrush(QBrush(p));
415
p = cadCurve->pen().color();
417
cadCurve->setBrush(QBrush(p));
419
p = torqueCurve->pen().color();
421
torqueCurve->setBrush(QBrush(p));
423
/*p = balanceLCurve->pen().color();
425
balanceLCurve->setBrush(QBrush(p));
427
p = balanceRCurve->pen().color();
429
balanceRCurve->setBrush(QBrush(p));*/
431
wattsCurve->setBrush(Qt::NoBrush);
432
hrCurve->setBrush(Qt::NoBrush);
433
speedCurve->setBrush(Qt::NoBrush);
434
cadCurve->setBrush(Qt::NoBrush);
435
torqueCurve->setBrush(Qt::NoBrush);
436
//balanceLCurve->setBrush(Qt::NoBrush);
437
//balanceRCurve->setBrush(Qt::NoBrush);
443
TimeScaleDraw *tsd = new TimeScaleDraw(&this->bydist) ;
444
tsd->setTickLength(QwtScaleDiv::MajorTick, 3);
445
setAxisScaleDraw(QwtPlot::xBottom, tsd);
447
QwtScaleDraw *sd = new QwtScaleDraw;
448
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
449
setAxisScaleDraw(QwtPlot::yLeft, sd);
450
pal.setColor(QPalette::WindowText, GColor(CPOWER));
451
pal.setColor(QPalette::Text, GColor(CPOWER));
452
axisWidget(QwtPlot::yLeft)->setPalette(pal);
454
sd = new QwtScaleDraw;
455
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
456
setAxisScaleDraw(QwtPlot::yLeft2, sd);
457
pal.setColor(QPalette::WindowText, GColor(CHEARTRATE));
458
pal.setColor(QPalette::Text, GColor(CHEARTRATE));
459
axisWidget(QwtPlot::yLeft2)->setPalette(pal);
461
sd = new QwtScaleDraw;
462
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
463
setAxisScaleDraw(QwtPlot::yRight, sd);
464
pal.setColor(QPalette::WindowText, GColor(CSPEED));
465
pal.setColor(QPalette::Text, GColor(CSPEED));
466
axisWidget(QwtPlot::yRight)->setPalette(pal);
468
sd = new QwtScaleDraw;
469
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
470
setAxisScaleDraw(QwtPlot::yRight2, sd);
471
pal.setColor(QPalette::WindowText, GColor(CALTITUDE));
472
pal.setColor(QPalette::Text, GColor(CALTITUDE));
473
axisWidget(QwtPlot::yRight2)->setPalette(pal);
319
477
struct DataPoint {
320
double time, hr, watts, speed, cad, alt;
321
DataPoint(double t, double h, double w, double s, double c, double a) :
322
time(t), hr(h), watts(w), speed(s), cad(c), alt(a) {}
478
double time, hr, watts, speed, cad, alt, temp, wind, torque, lrbalance;
479
DataPoint(double t, double h, double w, double s, double c, double a, double te, double wi, double tq, double lrb) :
480
time(t), hr(h), watts(w), speed(s), cad(c), alt(a), temp(te), wind(wi), torque(tq), lrbalance(lrb) {}
325
483
bool AllPlot::shadeZones() const
375
549
cadCurve->setData(data, data);
376
550
if (!altArray.empty())
377
551
altCurve->setData(data, data);
552
if (!tempArray.empty())
553
tempCurve->setData(data, data);
554
if (!windArray.empty())
555
windCurve->setData(new QwtIntervalSeriesData(intData));
556
if (!torqueArray.empty())
557
torqueCurve->setData(data, data);
558
if (!balanceArray.empty())
559
balanceLCurve->setData(data, data);
560
if (!balanceArray.empty())
561
balanceRCurve->setData(data, data);
380
double totalWatts = 0.0;
381
double totalHr = 0.0;
382
double totalSpeed = 0.0;
383
double totalCad = 0.0;
384
double totalDist = 0.0;
385
double totalAlt = 0.0;
387
QList<DataPoint> list;
389
smoothWatts.resize(rideTimeSecs + 1); //(rideTimeSecs + 1);
390
smoothHr.resize(rideTimeSecs + 1);
391
smoothSpeed.resize(rideTimeSecs + 1);
392
smoothCad.resize(rideTimeSecs + 1);
393
smoothTime.resize(rideTimeSecs + 1);
394
smoothDistance.resize(rideTimeSecs + 1);
395
smoothAltitude.resize(rideTimeSecs + 1);
397
for (int secs = 0; ((secs < smooth)
398
&& (secs < rideTimeSecs)); ++secs) {
399
smoothWatts[secs] = 0.0;
400
smoothHr[secs] = 0.0;
401
smoothSpeed[secs] = 0.0;
402
smoothCad[secs] = 0.0;
403
smoothTime[secs] = secs / 60.0;
404
smoothDistance[secs] = 0.0;
405
smoothAltitude[secs] = 0.0;
409
for (int secs = smooth; secs <= rideTimeSecs; ++secs) {
410
while ((i < arrayLength) && (timeArray[i] <= secs)) {
411
DataPoint dp(timeArray[i],
412
(!hrArray.empty() ? hrArray[i] : 0),
413
(!wattsArray.empty() ? wattsArray[i] : 0),
414
(!speedArray.empty() ? speedArray[i] : 0),
415
(!cadArray.empty() ? cadArray[i] : 0),
416
(!altArray.empty() ? altArray[i] : 0));
417
if (!wattsArray.empty())
418
totalWatts += wattsArray[i];
419
if (!hrArray.empty())
420
totalHr += hrArray[i];
421
if (!speedArray.empty())
422
totalSpeed += speedArray[i];
423
if (!cadArray.empty())
424
totalCad += cadArray[i];
425
if (!altArray.empty())
426
totalAlt += altArray[i];
427
totalDist = distanceArray[i];
431
while (!list.empty() && (list.front().time < secs - smooth)) {
432
DataPoint &dp = list.front();
433
totalWatts -= dp.watts;
435
totalSpeed -= dp.speed;
440
// TODO: this is wrong. We should do a weighted average over the
441
// seconds represented by each point...
565
// we should only smooth the curves if smoothed rate is greater than sample rate
566
if (smooth > rideItem->ride()->recIntSecs()) {
568
double totalWatts = 0.0;
569
double totalHr = 0.0;
570
double totalSpeed = 0.0;
571
double totalCad = 0.0;
572
double totalDist = 0.0;
573
double totalAlt = 0.0;
574
double totalTemp = 0.0;
575
double totalWind = 0.0;
576
double totalTorque = 0.0;
577
double totalBalance = 0.0;
579
QList<DataPoint> list;
581
smoothWatts.resize(rideTimeSecs + 1); //(rideTimeSecs + 1);
582
smoothHr.resize(rideTimeSecs + 1);
583
smoothSpeed.resize(rideTimeSecs + 1);
584
smoothCad.resize(rideTimeSecs + 1);
585
smoothTime.resize(rideTimeSecs + 1);
586
smoothDistance.resize(rideTimeSecs + 1);
587
smoothAltitude.resize(rideTimeSecs + 1);
588
smoothTemp.resize(rideTimeSecs + 1);
589
smoothWind.resize(rideTimeSecs + 1);
590
smoothRelSpeed.resize(rideTimeSecs + 1);
591
smoothTorque.resize(rideTimeSecs + 1);
592
smoothBalanceL.resize(rideTimeSecs + 1);
593
smoothBalanceR.resize(rideTimeSecs + 1);
595
for (int secs = 0; ((secs < smooth)
596
&& (secs < rideTimeSecs)); ++secs) {
443
597
smoothWatts[secs] = 0.0;
444
598
smoothHr[secs] = 0.0;
445
599
smoothSpeed[secs] = 0.0;
446
600
smoothCad[secs] = 0.0;
447
smoothAltitude[secs] = smoothAltitude[secs - 1];
450
smoothWatts[secs] = totalWatts / list.size();
451
smoothHr[secs] = totalHr / list.size();
452
smoothSpeed[secs] = totalSpeed / list.size();
453
smoothCad[secs] = totalCad / list.size();
454
smoothAltitude[secs] = totalAlt / list.size();
456
smoothDistance[secs] = totalDist;
457
smoothTime[secs] = secs / 60.0;
601
smoothTime[secs] = secs / 60.0;
602
smoothDistance[secs] = 0.0;
603
smoothAltitude[secs] = 0.0;
604
smoothTemp[secs] = 0.0;
605
smoothWind[secs] = 0.0;
606
smoothRelSpeed[secs] = QwtIntervalSample();
607
smoothTorque[secs] = 0.0;
608
smoothBalanceL[secs] = 50;
609
smoothBalanceR[secs] = 50;
613
for (int secs = smooth; secs <= rideTimeSecs; ++secs) {
614
while ((i < arrayLength) && (timeArray[i] <= secs)) {
615
DataPoint dp(timeArray[i],
616
(!hrArray.empty() ? hrArray[i] : 0),
617
(!wattsArray.empty() ? wattsArray[i] : 0),
618
(!speedArray.empty() ? speedArray[i] : 0),
619
(!cadArray.empty() ? cadArray[i] : 0),
620
(!altArray.empty() ? altArray[i] : 0),
621
(!tempArray.empty() ? tempArray[i] : 0),
622
(!windArray.empty() ? windArray[i] : 0),
623
(!torqueArray.empty() ? torqueArray[i] : 0),
624
(!balanceArray.empty() ? balanceArray[i] : 0));
625
if (!wattsArray.empty())
626
totalWatts += wattsArray[i];
627
if (!hrArray.empty())
628
totalHr += hrArray[i];
629
if (!speedArray.empty())
630
totalSpeed += speedArray[i];
631
if (!cadArray.empty())
632
totalCad += cadArray[i];
633
if (!altArray.empty())
634
totalAlt += altArray[i];
635
if (!tempArray.empty() ) {
636
if (tempArray[i] == RideFile::noTemp) {
637
dp.temp = (i>0 && !list.empty()?list.back().temp:0.0);
638
totalTemp += dp.temp;
641
totalTemp += tempArray[i];
644
if (!windArray.empty())
645
totalWind += windArray[i];
646
if (!torqueArray.empty())
647
totalTorque += torqueArray[i];
648
if (!balanceArray.empty())
649
totalBalance += (balanceArray[i]>0?balanceArray[i]:50);
651
totalDist = distanceArray[i];
655
while (!list.empty() && (list.front().time < secs - smooth)) {
656
DataPoint &dp = list.front();
657
totalWatts -= dp.watts;
659
totalSpeed -= dp.speed;
662
totalTemp -= dp.temp;
663
totalWind -= dp.wind;
664
totalTorque -= dp.torque;
665
totalBalance -= (dp.lrbalance>0?dp.lrbalance:50);
668
// TODO: this is wrong. We should do a weighted average over the
669
// seconds represented by each point...
671
smoothWatts[secs] = 0.0;
672
smoothHr[secs] = 0.0;
673
smoothSpeed[secs] = 0.0;
674
smoothCad[secs] = 0.0;
675
smoothAltitude[secs] = smoothAltitude[secs - 1];
676
smoothTemp[secs] = 0.0;
677
smoothWind[secs] = 0.0;
678
smoothRelSpeed[secs] = QwtIntervalSample();
679
smoothTorque[secs] = 0.0;
680
smoothBalanceL[secs] = 50;
681
smoothBalanceR[secs] = 50;
684
smoothWatts[secs] = totalWatts / list.size();
685
smoothHr[secs] = totalHr / list.size();
686
smoothSpeed[secs] = totalSpeed / list.size();
687
smoothCad[secs] = totalCad / list.size();
688
smoothAltitude[secs] = totalAlt / list.size();
689
smoothTemp[secs] = totalTemp / list.size();
690
smoothWind[secs] = totalWind / list.size();
691
smoothRelSpeed[secs] = QwtIntervalSample( bydist ? totalDist : secs / 60.0, QwtInterval(qMin(totalWind / list.size(), totalSpeed / list.size()), qMax(totalWind / list.size(), totalSpeed / list.size()) ) );
692
smoothTorque[secs] = totalTorque / list.size();
694
double balance = totalBalance / list.size();
696
smoothBalanceL[secs] = 50;
697
smoothBalanceR[secs] = 50;
698
} else if (balance >= 50) {
699
smoothBalanceL[secs] = balance;
700
smoothBalanceR[secs] = 50;
703
smoothBalanceL[secs] = 50;
704
smoothBalanceR[secs] = balance;
707
smoothDistance[secs] = totalDist;
708
smoothTime[secs] = secs / 60.0;
713
// no smoothing .. just raw data
714
smoothWatts.resize(0);
716
smoothSpeed.resize(0);
718
smoothTime.resize(0);
719
smoothDistance.resize(0);
720
smoothAltitude.resize(0);
721
smoothTemp.resize(0);
722
smoothWind.resize(0);
723
smoothRelSpeed.resize(0);
724
smoothTorque.resize(0);
725
smoothBalanceL.resize(0);
726
smoothBalanceR.resize(0);
728
foreach (RideFilePoint *dp, rideItem->ride()->dataPoints()) {
729
smoothWatts.append(dp->watts);
730
smoothHr.append(dp->hr);
731
smoothSpeed.append(useMetricUnits ? dp->kph : dp->kph * MILES_PER_KM);
732
smoothCad.append(dp->cad);
733
smoothTime.append(dp->secs/60);
734
smoothDistance.append(useMetricUnits ? dp->km : dp->km * MILES_PER_KM);
735
smoothAltitude.append(useMetricUnits ? dp->alt : dp->alt * FEET_PER_METER);
736
smoothTemp.append(useMetricUnits ? dp->temp : dp->temp * FAHRENHEIT_PER_CENTIGRADE + FAHRENHEIT_ADD_CENTIGRADE);
737
smoothWind.append(useMetricUnits ? dp->headwind : dp->headwind * MILES_PER_KM);
738
smoothTorque.append(dp->nm);
740
if (dp->lrbalance == 0) {
741
smoothBalanceL.append(50);
742
smoothBalanceR.append(50);
744
else if (dp->lrbalance >= 50) {
745
smoothBalanceL.append(dp->lrbalance);
746
smoothBalanceR.append(50);
749
smoothBalanceL.append(50);
750
smoothBalanceR.append(dp->lrbalance);
753
double head = dp->headwind * (useMetricUnits ? 1.0f : MILES_PER_KM);
754
double speed = dp->kph * (useMetricUnits ? 1.0f : MILES_PER_KM);
755
smoothRelSpeed.append(QwtIntervalSample( bydist ? smoothDistance.last() : smoothTime.last(), QwtInterval(qMin(head, speed) , qMax(head, speed) ) ));
460
760
QVector<double> &xaxis = bydist ? smoothDistance : smoothTime;
461
int startingIndex = qMin(smooth, rideTimeSecs);
462
int totalPoints = rideTimeSecs + 1 - startingIndex;
464
if (!wattsArray.empty())
761
int startingIndex = qMin(smooth, xaxis.count());
762
int totalPoints = xaxis.count() - startingIndex;
764
// set curves - we set the intervalHighlighter to whichver is available
765
if (!wattsArray.empty()) {
465
766
wattsCurve->setData(xaxis.data() + startingIndex, smoothWatts.data() + startingIndex, totalPoints);
466
if (!hrArray.empty())
767
intervalHighlighterCurve->setYAxis(yLeft);
769
} if (!hrArray.empty()) {
467
770
hrCurve->setData(xaxis.data() + startingIndex, smoothHr.data() + startingIndex, totalPoints);
468
if (!speedArray.empty())
771
intervalHighlighterCurve->setYAxis(yLeft2);
773
} if (!speedArray.empty()) {
469
774
speedCurve->setData(xaxis.data() + startingIndex, smoothSpeed.data() + startingIndex, totalPoints);
470
if (!cadArray.empty())
775
intervalHighlighterCurve->setYAxis(yRight);
777
} if (!cadArray.empty()) {
471
778
cadCurve->setData(xaxis.data() + startingIndex, smoothCad.data() + startingIndex, totalPoints);
472
if (!altArray.empty())
779
intervalHighlighterCurve->setYAxis(yLeft2);
781
} if (!altArray.empty()) {
473
782
altCurve->setData(xaxis.data() + startingIndex, smoothAltitude.data() + startingIndex, totalPoints);
783
intervalHighlighterCurve->setYAxis(yRight2);
785
} if (!tempArray.empty()) {
786
tempCurve->setData(xaxis.data() + startingIndex, smoothTemp.data() + startingIndex, totalPoints);
788
intervalHighlighterCurve->setYAxis(yRight);
790
intervalHighlighterCurve->setYAxis(yLeft2);
793
} if (!windArray.empty()) {
794
windCurve->setData(new QwtIntervalSeriesData(smoothRelSpeed));
795
intervalHighlighterCurve->setYAxis(yRight);
797
} if (!torqueArray.empty()) {
798
torqueCurve->setData(xaxis.data() + startingIndex, smoothTorque.data() + startingIndex, totalPoints);
799
intervalHighlighterCurve->setYAxis(yRight);
801
} if (!balanceArray.empty()) {
802
balanceLCurve->setData(xaxis.data() + startingIndex, smoothBalanceL.data() + startingIndex, totalPoints);
803
intervalHighlighterCurve->setYAxis(yLeft2);
804
balanceRCurve->setData(xaxis.data() + startingIndex, smoothBalanceR.data() + startingIndex, totalPoints);
805
intervalHighlighterCurve->setYAxis(yLeft2);
476
809
refreshIntervalMarkers();
542
891
ymax = qMax(ymax, referencePlot->cadCurve->maxYValue());
893
if (tempCurve->isVisible() && !useMetricUnits) {
895
labels << QString::fromUtf8("°F");
897
if (referencePlot == NULL) {
898
ymin = qMin(ymin, tempCurve->minYValue());
899
ymax = qMax(ymax, tempCurve->maxYValue());
902
ymin = qMin(ymin, referencePlot->tempCurve->minYValue());
903
ymax = qMax(ymax, referencePlot->tempCurve->maxYValue());
906
if (balanceLCurve->isVisible()) {
907
labels << tr("% left");
908
if (referencePlot == NULL)
909
ymax = qMax(ymax, balanceLCurve->maxYValue());
911
ymax = qMax(ymax, referencePlot->balanceLCurve->maxYValue());
913
balanceLCurve->setBaseline(50);
914
balanceRCurve->setBaseline(50);
917
int axisHeight = qRound( plotLayout()->canvasRect().height() );
918
QFontMetrics labelWidthMetric = QFontMetrics( QwtPlot::axisFont(yLeft) );
919
int labelWidth = labelWidthMetric.width( "888 " );
923
while( ( qCeil(ymax / step) * labelWidth ) > axisHeight )
928
QwtValueList xytick[QwtScaleDiv::NTickTypes];
929
for (int i=0;i<ymax;i+=step)
930
xytick[QwtScaleDiv::MajorTick]<<i;
544
932
setAxisTitle(yLeft2, labels.join(" / "));
545
setAxisScale(yLeft2, 0.0, 1.05 * ymax);
933
setAxisScaleDiv(yLeft2,QwtScaleDiv(ymin, ymax, xytick));
546
934
setAxisLabelRotation(yLeft2,270);
547
935
setAxisLabelAlignment(yLeft2,Qt::AlignVCenter);
549
if (speedCurve->isVisible()) {
550
setAxisTitle(yRight, (useMetricUnits ? tr("km/h") : tr("MPH")));
551
if (referencePlot == NULL)
552
setAxisScale(yRight, 0.0, 1.05 * speedCurve->maxYValue());
554
setAxisScale(yRight, 0.0, 1.05 * referencePlot->speedCurve->maxYValue());
937
if (speedCurve->isVisible() || (useMetricUnits && tempCurve->isVisible()) || torqueCurve->isVisible()) {
943
if (speedCurve->isVisible()) {
944
labels << (useMetricUnits ? tr("KPH") : tr("MPH"));
946
if (referencePlot == NULL)
947
ymax = speedCurve->maxYValue();
949
ymax = referencePlot->speedCurve->maxYValue();
951
if (tempCurve->isVisible() && useMetricUnits) {
953
labels << QString::fromUtf8("°C");
955
if (referencePlot == NULL) {
956
ymin = qMin(ymin, tempCurve->minYValue());
957
ymax = qMax(ymax, tempCurve->maxYValue());
960
ymin = qMin(ymin, referencePlot->tempCurve->minYValue());
961
ymax = qMax(ymax, referencePlot->tempCurve->maxYValue());
964
if (torqueCurve->isVisible()) {
965
labels << (useMetricUnits ? tr("Nm") : tr("ftLb"));
967
if (referencePlot == NULL)
968
ymax = qMax(ymax, torqueCurve->maxYValue());
970
ymax = qMax(ymax, referencePlot->torqueCurve->maxYValue());
972
setAxisTitle(yRight, labels.join(" / "));
973
setAxisScale(yRight, ymin, 1.05 * ymax);
555
974
setAxisLabelRotation(yRight,90);
556
975
setAxisLabelAlignment(yRight,Qt::AlignVCenter);
621
1060
double *smoothC = &plot->smoothCad[startidx];
622
1061
double *smoothA = &plot->smoothAltitude[startidx];
623
1062
double *smoothD = &plot->smoothDistance[startidx];
1063
double *smoothTE = &plot->smoothTemp[startidx];
1064
//double *smoothWND = &plot->smoothWind[startidx];
1065
double *smoothNM = &plot->smoothTorque[startidx];
1066
double *smoothBALL = &plot->smoothBalanceL[startidx];
1067
double *smoothBALR = &plot->smoothBalanceR[startidx];
1069
QwtIntervalSample *smoothRS = &plot->smoothRelSpeed[startidx];
625
1071
double *xaxis = bydist ? smoothD : smoothT;
627
1073
// attach appropriate curves
628
if (this->legend()) this->legend()->hide();
1074
//if (this->legend()) this->legend()->hide();
630
1076
wattsCurve->detach();
631
1077
hrCurve->detach();
632
1078
speedCurve->detach();
633
1079
cadCurve->detach();
634
1080
altCurve->detach();
1081
tempCurve->detach();
1082
windCurve->detach();
1083
torqueCurve->detach();
1084
balanceLCurve->detach();
1085
balanceRCurve->detach();
1087
wattsCurve->setVisible(rideItem->ride()->areDataPresent()->watts && showPowerState < 2);
1088
hrCurve->setVisible(rideItem->ride()->areDataPresent()->hr && showHr);
1089
speedCurve->setVisible(rideItem->ride()->areDataPresent()->kph && showSpeed);
1090
cadCurve->setVisible(rideItem->ride()->areDataPresent()->cad && showCad);
1091
altCurve->setVisible(rideItem->ride()->areDataPresent()->alt && showAlt);
1092
tempCurve->setVisible(rideItem->ride()->areDataPresent()->temp && showTemp);
1093
windCurve->setVisible(rideItem->ride()->areDataPresent()->headwind && showWind);
1094
torqueCurve->setVisible(rideItem->ride()->areDataPresent()->nm && showTorque);
1095
balanceLCurve->setVisible(rideItem->ride()->areDataPresent()->lrbalance && showBalance);
1096
balanceRCurve->setVisible(rideItem->ride()->areDataPresent()->lrbalance && showBalance);
636
1098
wattsCurve->setData(xaxis,smoothW,stopidx-startidx);
637
1099
hrCurve->setData(xaxis, smoothHR,stopidx-startidx);
638
1100
speedCurve->setData(xaxis, smoothS, stopidx-startidx);
639
1101
cadCurve->setData(xaxis, smoothC, stopidx-startidx);
640
1102
altCurve->setData(xaxis, smoothA, stopidx-startidx);
1103
tempCurve->setData(xaxis, smoothTE, stopidx-startidx);
1105
QVector<QwtIntervalSample> tmpWND(stopidx-startidx);
1106
qMemCopy( tmpWND.data(), smoothRS, (stopidx-startidx) * sizeof( QwtIntervalSample ) );
1107
windCurve->setData(new QwtIntervalSeriesData(tmpWND));
1108
torqueCurve->setData(xaxis, smoothNM, stopidx-startidx);
1109
balanceLCurve->setData(xaxis, smoothBALL, stopidx-startidx);
1110
balanceRCurve->setData(xaxis, smoothBALR, stopidx-startidx);
1112
/*QVector<double> _time(stopidx-startidx);
1113
qMemCopy( _time.data(), xaxis, (stopidx-startidx) * sizeof( double ) );
1115
QVector<QwtIntervalSample> tmpWND(stopidx-startidx);
1116
for (int i=0;i<_time.count();i++) {
1117
QwtIntervalSample inter = QwtIntervalSample(_time.at(i), 20,50);
1118
tmpWND.append(inter); // plot->smoothRelSpeed.at(i)
1122
sym.setPen(QPen(GColor(CPLOTMARKER)));
1123
if (stopidx-startidx < 150) {
1124
sym.setStyle(QwtSymbol::Ellipse);
1127
sym.setStyle(QwtSymbol::NoSymbol);
1131
wattsCurve->setSymbol(new QwtSymbol(sym));
1132
hrCurve->setSymbol(new QwtSymbol(sym));
1133
speedCurve->setSymbol(new QwtSymbol(sym));
1134
cadCurve->setSymbol(new QwtSymbol(sym));
1135
altCurve->setSymbol(new QwtSymbol(sym));
1136
tempCurve->setSymbol(new QwtSymbol(sym));
1137
torqueCurve->setSymbol(new QwtSymbol(sym));
1138
balanceLCurve->setSymbol(new QwtSymbol(sym));
1139
balanceRCurve->setSymbol(new QwtSymbol(sym));
643
setAxisMaxMajor(yLeft, 5);
644
setAxisMaxMajor(yLeft2, 5);
645
setAxisMaxMajor(yRight, 5);
646
setAxisMaxMajor(yRight2, 5);
648
1143
setAxisScale(xBottom, xaxis[0], xaxis[stopidx-startidx-1]);
650
if (!plot->smoothAltitude.empty()) altCurve->attach(this);
651
if (!plot->smoothWatts.empty()) wattsCurve->attach(this);
652
if (!plot->smoothHr.empty()) hrCurve->attach(this);
653
if (!plot->smoothSpeed.empty()) speedCurve->attach(this);
654
if (!plot->smoothCad.empty()) cadCurve->attach(this);
1145
if (!plot->smoothAltitude.empty()) {
1146
altCurve->attach(this);
1147
intervalHighlighterCurve->setYAxis(yRight2);
1149
if (!plot->smoothWatts.empty()) {
1150
wattsCurve->attach(this);
1151
intervalHighlighterCurve->setYAxis(yLeft);
1153
if (!plot->smoothHr.empty()) {
1154
hrCurve->attach(this);
1155
intervalHighlighterCurve->setYAxis(yLeft2);
1157
if (!plot->smoothSpeed.empty()) {
1158
speedCurve->attach(this);
1159
intervalHighlighterCurve->setYAxis(yRight);
1161
if (!plot->smoothCad.empty()) {
1162
cadCurve->attach(this);
1163
intervalHighlighterCurve->setYAxis(yLeft2);
1165
if (!plot->smoothTemp.empty()) {
1166
tempCurve->attach(this);
1167
intervalHighlighterCurve->setYAxis(yRight);
1169
if (!plot->smoothWind.empty()) {
1170
windCurve->attach(this);
1171
intervalHighlighterCurve->setYAxis(yRight);
1173
if (!plot->smoothTorque.empty()) {
1174
torqueCurve->attach(this);
1175
intervalHighlighterCurve->setYAxis(yRight);
1177
if (!plot->smoothBalanceL.empty()) {
1178
balanceLCurve->attach(this);
1179
balanceRCurve->attach(this);
1180
intervalHighlighterCurve->setYAxis(yLeft2);
656
1184
refreshIntervalMarkers();
657
1185
refreshZoneLabels();
659
if (this->legend()) this->legend()->show();
1187
//if (this->legend()) this->legend()->show();
773
AllPlot::showHr(int state)
776
assert(state != Qt::PartiallyChecked);
777
hrCurve->setVisible(state == Qt::Checked);
783
AllPlot::showSpeed(int state)
785
showSpeedState = state;
786
assert(state != Qt::PartiallyChecked);
787
speedCurve->setVisible(state == Qt::Checked);
793
AllPlot::showCad(int state)
795
showCadState = state;
796
assert(state != Qt::PartiallyChecked);
797
cadCurve->setVisible(state == Qt::Checked);
803
AllPlot::showAlt(int state)
805
showAltState = state;
806
assert(state != Qt::PartiallyChecked);
807
altCurve->setVisible(state == Qt::Checked);
813
AllPlot::showGrid(int state)
815
assert(state != Qt::PartiallyChecked);
816
grid->setVisible(state == Qt::Checked);
1346
AllPlot::setShowHr(bool show)
1349
hrCurve->setVisible(show);
1355
AllPlot::setShowSpeed(bool show)
1358
speedCurve->setVisible(show);
1364
AllPlot::setShowCad(bool show)
1367
cadCurve->setVisible(show);
1373
AllPlot::setShowAlt(bool show)
1376
altCurve->setVisible(show);
1382
AllPlot::setShowTemp(bool show)
1385
tempCurve->setVisible(show);
1391
AllPlot::setShowWind(bool show)
1394
windCurve->setVisible(show);
1400
AllPlot::setShowTorque(bool show)
1403
torqueCurve->setVisible(show);
1409
AllPlot::setShowBalance(bool show)
1412
balanceLCurve->setVisible(show);
1413
balanceRCurve->setVisible(show);
1419
AllPlot::setShowGrid(bool show)
1421
grid->setVisible(show);
1426
AllPlot::setPaintBrush(int state)
1431
p = wattsCurve->pen().color();
1433
wattsCurve->setBrush(QBrush(p));
1435
p = hrCurve->pen().color();
1437
hrCurve->setBrush(QBrush(p));
1439
p = speedCurve->pen().color();
1441
speedCurve->setBrush(QBrush(p));
1443
p = cadCurve->pen().color();
1445
cadCurve->setBrush(QBrush(p));
1447
p = tempCurve->pen().color();
1449
tempCurve->setBrush(QBrush(p));
1451
p = torqueCurve->pen().color();
1453
torqueCurve->setBrush(QBrush(p));
1455
/*p = balanceLCurve->pen().color();
1457
balanceLCurve->setBrush(QBrush(p));
1459
p = balanceRCurve->pen().color();
1461
balanceRCurve->setBrush(QBrush(p));*/
1463
wattsCurve->setBrush(Qt::NoBrush);
1464
hrCurve->setBrush(Qt::NoBrush);
1465
speedCurve->setBrush(Qt::NoBrush);
1466
cadCurve->setBrush(Qt::NoBrush);
1467
tempCurve->setBrush(Qt::NoBrush);
1468
torqueCurve->setBrush(Qt::NoBrush);
1469
//balanceLCurve->setBrush(Qt::NoBrush);
1470
//balanceRCurve->setBrush(Qt::NoBrush);