From 7676a38ea8a06d3d31228cb7eb1be00f90de46d3 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Thu, 7 Jan 2016 15:10:20 +0100 Subject: Added a bar chart. * HistoryGraph replaced by BarChart * HistoryGraph not removed from code, might be useful in the future --- main.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index b9d7232..41d0ed0 100644 --- a/main.cpp +++ b/main.cpp @@ -14,6 +14,7 @@ #include "scatterplot.h" #include "voronoisplat.h" #include "historygraph.h" +#include "barchart.h" #include "interactionhandler.h" #include "selectionhandler.h" #include "effectivenessobserver.h" @@ -158,6 +159,7 @@ int main(int argc, char **argv) qmlRegisterType("PM", 1, 0, "Scatterplot"); qmlRegisterType("PM", 1, 0, "HistoryGraph"); + qmlRegisterType("PM", 1, 0, "BarChart"); qmlRegisterType("PM", 1, 0, "InteractionHandler"); qmlRegisterSingletonType
("PM", 1, 0, "Main", mainProvider); @@ -222,11 +224,14 @@ int main(int argc, char **argv) plot, SLOT(setSelection(const QSet &))); // Connections between history graph and subsample plot - HistoryGraph *history = engine.rootObjects()[0]->findChild("history"); - QObject::connect(subsamplePlot, SIGNAL(xyInteractivelyChanged(const arma::mat &)), - history, SLOT(addHistoryItem(const arma::mat &))); - QObject::connect(history, SIGNAL(currentItemChanged(const arma::mat &)), - subsamplePlot, SLOT(setXY(const arma::mat &))); + //HistoryGraph *history = engine.rootObjects()[0]->findChild("history"); + //QObject::connect(subsamplePlot, SIGNAL(xyInteractivelyChanged(const arma::mat &)), + // history, SLOT(addHistoryItem(const arma::mat &))); + //QObject::connect(history, SIGNAL(currentItemChanged(const arma::mat &)), + // subsamplePlot, SLOT(setXY(const arma::mat &))); + + BarChart *barChart = engine.rootObjects()[0]->findChild("barChart"); + barChart->setValues(arma::randn(100)); // Map distortion as the glyph color //DistortionObserver distortionObs(X, sampleIndices); @@ -245,8 +250,7 @@ int main(int argc, char **argv) //QObject::connect(&enforcer, SIGNAL(effectivenessChanged(const arma::vec &)), // subsamplePlot, SLOT(setColorData(const arma::vec &))); - - history->addHistoryItem(Ys); + //history->addHistoryItem(Ys); subsamplePlot->setXY(Ys); subsamplePlot->setColorData(labels(sampleIndices)); plot->setColorScale(&colorScale); -- cgit v1.2.3