#ifndef PLOTERRTIME_H #define PLOTERRTIME_H #include #include #include #include /** * plot error behaviour over time */ class PlotErrTime { private: K::Gnuplot gp; K::GnuplotPlot gpplot; K::GnuplotPlotElementLines lineErr[8]; K::GnuplotPlotElementLines lineB; K::GnuplotPlotElementLines lineC; public: /** ctor */ PlotErrTime(const std::string& xLabel, const std::string& yLabel, const std::string& y2Label) { gpplot.getAxisX().setLabel(xLabel); gpplot.getAxisY().setLabel(yLabel); gpplot.getAxisY2().setLabel(y2Label); gpplot.add(&lineErr[0]); lineErr[0].getStroke().setWidth(1.5); lineErr[0].getStroke().getColor().setHexStr("#000000"); gpplot.add(&lineErr[1]); lineErr[1].getStroke().setWidth(1.5); lineErr[1].getStroke().getColor().setHexStr("#FF0000"); gpplot.add(&lineErr[2]); lineErr[2].getStroke().setWidth(1.5); lineErr[2].getStroke().getColor().setHexStr("#00FF00"); gpplot.add(&lineErr[3]); lineErr[3].getStroke().setWidth(1.5); lineErr[3].getStroke().getColor().setHexStr("#0000FF"); gpplot.add(&lineB); lineB.getStroke().setWidth(1); lineB.getStroke().getColor().setHexStr("#0000ff"); gpplot.add(&lineC); gpplot.setGrid(true); } K::GnuplotPlot& getPlot() { return gpplot; } /** add the give error value to the idx-th error line */ void addErr(const Timestamp t, const float err, const int idx = 0) { K::GnuplotPoint2 pt(t.sec(), err); lineErr[idx].add(pt); } void addB(const Timestamp t, const float something) { K::GnuplotPoint2 pt(t.sec(), something); lineB.add(pt); } void addC(const Timestamp t, const float something) { K::GnuplotPoint2 pt(t.sec(), something); lineC.add(pt); } void plot() { gp.draw(gpplot); gp.flush(); } }; #endif // PLOTERRTIME_H