Ride Plot Axis coloring

The legend wasted screen estate and was removed, this patch
colors the axis labels/ticks so no legend is required. This
approach could be adopted for other charts.

Also includes a fix to hide realtime view controls which
left a screen glitch because they should have been hidden.
This commit is contained in:
Mark Liversedge
2011-06-05 01:51:45 +01:00
parent 396e47ff8b
commit 2e15d74658
3 changed files with 22 additions and 0 deletions

View File

@@ -33,6 +33,7 @@
#include <qwt_plot_layout.h>
#include <qwt_plot_marker.h>
#include <qwt_scale_div.h>
#include <qwt_scale_widget.h>
#include <qwt_valuelist.h>
#include <qwt_text.h>
#include <qwt_legend.h>
@@ -314,22 +315,41 @@ AllPlot::configChanged()
gridPen.setStyle(Qt::DotLine);
grid->setPen(gridPen);
QPalette pal;
// tick draw
QwtScaleDraw *sd = new QwtScaleDraw;
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::xBottom, sd);
sd = new QwtScaleDraw;
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::yLeft, sd);
pal.setColor(QPalette::WindowText, GColor(CPOWER));
pal.setColor(QPalette::Text, GColor(CPOWER));
axisWidget(QwtPlot::yLeft)->setPalette(pal);
sd = new QwtScaleDraw;
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::yLeft2, sd);
pal.setColor(QPalette::WindowText, GColor(CHEARTRATE));
pal.setColor(QPalette::Text, GColor(CHEARTRATE));
axisWidget(QwtPlot::yLeft2)->setPalette(pal);
sd = new QwtScaleDraw;
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::yRight, sd);
pal.setColor(QPalette::WindowText, GColor(CSPEED));
pal.setColor(QPalette::Text, GColor(CSPEED));
axisWidget(QwtPlot::yRight)->setPalette(pal);
sd = new QwtScaleDraw;
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::yRight2, sd);
pal.setColor(QPalette::WindowText, GColor(CALTITUDE));
pal.setColor(QPalette::Text, GColor(CALTITUDE));
axisWidget(QwtPlot::yRight2)->setPalette(pal);
}
struct DataPoint {

View File

@@ -96,6 +96,7 @@ HomeWindow::HomeWindow(MainWindow *mainWindow, QString name, QString /* windowti
tabbed->setTabsClosable(false);
tabbed->setPalette(palette);
tabbed->setDocumentMode(true);
tabbed->setStyleSheet("QTabBar { alignment: center; }");
// styling commented out whilst work out the differences
// between mac and linux and windows

View File

@@ -388,6 +388,7 @@ MainWindow::MainWindow(const QDir &home) :
// TRAIN WINDOW & CONTROLS
trainWindow = new HomeWindow(this, "train", "Training");
trainWindow->controls()->hide();
trainControls->addWidget(new TrainTool(this, this->home));
// ANALYSIS WINDOW & CONTRAOLS