diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2016-01-21 14:50:39 +0100 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2016-01-21 14:50:39 +0100 |
commit | e9d14f93498832687cbdbeb79748f9030e49fb2f (patch) | |
tree | d74e54789518e422cfcfe55347038991fbab7645 | |
parent | 664dc43127bf0dc5791423898ffab6748f016dd7 (diff) |
Added second bar chart.
Bar charts are now exclusive to the type of points they are assigned
to (either CPs or RPs).
-rw-r--r-- | main.cpp | 20 | ||||
-rw-r--r-- | main.h | 13 | ||||
-rw-r--r-- | main_view.qml | 46 |
3 files changed, 64 insertions, 15 deletions
@@ -173,9 +173,19 @@ int main(int argc, char **argv) QObject::connect(m->splat, SIGNAL(colorScaleChanged(const ColorScale &)), m->colormap, SLOT(setColorScale(const ColorScale &))); - m->barChart = engine.rootObjects()[0]->findChild<BarChart *>("barChart"); - m->barChart->setAcceptedMouseButtons(Qt::LeftButton); - m->setBarChartColorScale(Main::ColorScaleContinuous); + m->cpBarChart = engine.rootObjects()[0]->findChild<BarChart *>("cpBarChart"); + m->cpBarChart->setAcceptedMouseButtons(Qt::LeftButton); + m->setCPBarChartColorScale(Main::ColorScaleContinuous); + + m->rpBarChart = engine.rootObjects()[0]->findChild<BarChart *>("rpBarChart"); + m->rpBarChart->setAcceptedMouseButtons(Qt::LeftButton); + m->setRPBarChartColorScale(Main::ColorScaleContinuous); + + QObject::connect(m->cpBarChart, SIGNAL(selectionChanged(const QSet<int> &)), + m->cpPlot, SLOT(setSelection(const QSet<int> &))); + + QObject::connect(m->rpBarChart, SIGNAL(selectionChanged(const QSet<int> &)), + m->rpPlot, SLOT(setSelection(const QSet<int> &))); ProjectionObserver projectionObserver(X, cpIndices); m->projectionObserver = &projectionObserver; @@ -186,7 +196,9 @@ int main(int argc, char **argv) QObject::connect(m->projectionObserver, SIGNAL(valuesChanged(const arma::vec &)), m->splat, SLOT(setValues(const arma::vec &))); QObject::connect(m->projectionObserver, SIGNAL(valuesChanged(const arma::vec &)), - m->barChart, SLOT(setValues(const arma::vec &))); + m->cpBarChart, SLOT(setValues(const arma::vec &))); + QObject::connect(m->projectionObserver, SIGNAL(valuesChanged(const arma::vec &)), + m->rpBarChart, SLOT(setValues(const arma::vec &))); //history->addHistoryItem(Ys); m->setColormapColorScale(Main::ColorScaleContinuous); @@ -93,8 +93,12 @@ public: colormap->setColorScale(getColorScale(colorScaleType)); } - Q_INVOKABLE void setBarChartColorScale(ColorScaleType colorScaleType) { - barChart->setColorScale(getColorScale(colorScaleType)); + Q_INVOKABLE void setCPBarChartColorScale(ColorScaleType colorScaleType) { + cpBarChart->setColorScale(getColorScale(colorScaleType)); + } + + Q_INVOKABLE void setRPBarChartColorScale(ColorScaleType colorScaleType) { + rpBarChart->setColorScale(getColorScale(colorScaleType)); } Q_INVOKABLE void setSplatColorScale(ColorScaleType colorScaleType) { @@ -103,7 +107,7 @@ public: // Pointer to visual components whose values are set in the main() function // after components are instantiated by the QtQuick engine - BarChart *barChart; + BarChart *cpBarChart, *rpBarChart; Colormap *colormap; Scatterplot *cpPlot, *rpPlot; VoronoiSplat *splat; @@ -132,7 +136,8 @@ private: , COLOR_SCALE_CONTINUOUS{ContinuousColorScale::builtin(ContinuousColorScale::HEATED_OBJECTS)} , COLOR_SCALE_DIVERGENT{ContinuousColorScale::builtin(ContinuousColorScale::RED_GRAY_BLUE)} , COLOR_SCALE_RAINBOW{ContinuousColorScale::builtin(ContinuousColorScale::RAINBOW)} - , barChart(0) + , cpBarChart(0) + , rpBarChart(0) , cpPlot(0) , rpPlot(0) , splat(0) diff --git a/main_view.qml b/main_view.qml index 561c07d..4c5c7a7 100644 --- a/main_view.qml +++ b/main_view.qml @@ -111,19 +111,50 @@ ApplicationWindow { } } - Rectangle { id: secret - Layout.minimumHeight: 80 + Rectangle { + Layout.minimumHeight: 60 Layout.fillHeight: true width: mainView.width color: "#ffffff" Item { - id: bottomView + id: bottomViewCP anchors.fill: parent BarChart { - id: barChart - objectName: "barChart" + id: cpBarChart + objectName: "cpBarChart" + anchors.fill: parent + } + + //HistoryGraph { + // id: history + // objectName: "history" + // anchors.fill: parent + //} + } + + Rectangle { + anchors.fill: parent + border.width: 1 + border.color: "#cccccc" + color: "transparent" + } + } + + Rectangle { + Layout.minimumHeight: 60 + Layout.fillHeight: true + width: mainView.width + color: "#ffffff" + + Item { + id: bottomViewRP + anchors.fill: parent + + BarChart { + id: rpBarChart + objectName: "rpBarChart" anchors.fill: parent } @@ -257,7 +288,7 @@ ApplicationWindow { SpinBox { id: rpGlyphSizeSpinBox maximumValue: 100 - minimumValue: 6 + minimumValue: 2 value: rpPlot.glyphSize() decimals: 1 stepSize: 1 @@ -367,7 +398,8 @@ ApplicationWindow { id: barChartColormapCombo model: colormapModel onActivated: { - Main.setBarChartColorScale(model.get(index).value); + Main.setCPBarChartColorScale(model.get(index).value); + Main.setRPBarChartColorScale(model.get(index).value); } } } |