Public Slots | Public Member Functions

Grapher Class Reference

Main window for drawing data. More...

#include <grapher.h>

Inheritance diagram for Grapher:
Inheritance graph
[legend]
Collaboration diagram for Grapher:
Collaboration graph
[legend]

List of all members.

Public Slots

void addCurve (PlotCurve *curve)
void removeCurve (PlotCurve *curve)
void removeCurve (int logicalIndex)

Public Member Functions

 Grapher (BaseQueryModel *base, QWidget *parent=0)

Detailed Description

Main window for drawing data.

grapher_sample.png

Each column you selected for graphing in the Builder is here plotted. Currently you can chose the color and axis for each plot. Other functions might be implemented on request.

You can zoom in/out and adjust the axis scopes and grid lines.

You can save the image as a BMP or JPEG image.


Constructor & Destructor Documentation

Grapher::Grapher ( BaseQueryModel base,
QWidget parent = 0 
)

                                                                : QWidget(parent) {
    setObjectName("Grapher");
    this->base = base;

    plotWidget = new PlotWidget(this);
    plotWidget->enableSelect(false);
    plotWidget->setAxisDateTime(Plot::xBottom, QDateTime::fromTime_t(0));
    plotWidget->plot()->setAutoReplot(true);

    //        plotWidget->setToolBarIconSize( QSize( 16, 16 ) );
    //        plotWidget->setContentsMargins( 2, 2, 2, 2 );

    //        QFont font = plotWidget->plot()->axisFont( QwtPlot::yLeft );
    //        font.setPointSize( 8 );
    //        plotWidget->plot()->setAxisFont( QwtPlot::yLeft, font );
    //        plotWidget->plot()->setAxisFont( QwtPlot::yRight, font );
    //        plotWidget->plot()->setAxisFont( QwtPlot::xBottom, font );
    //        plotWidget->plot()->setAxisFont( QwtPlot::xTop, font );
    //        plotWidget->plot()->tracker()->setTrackerFont( font );
    //        plotWidget->plot()->setMargin( 2 );

    setLayout(new QVBoxLayout());
    layout()->addWidget(plotWidget);

#ifdef DEBUG_MODELSPEED
    QPushButton *speedTest = new QPushButton("ModelSpeed", this);
    connect(speedTest, SIGNAL(clicked()), this, SLOT(testQuerySpeed()));
    layout()->addWidget(speedTest);
#endif //DEBUG_MODELSPEED
};


Member Function Documentation

void Grapher::addCurve ( PlotCurve curve  )  [slot]

{
    Q_ASSERT(curve);
    qDebug() << "APPENDING CURVE";
    curve->attach(plotWidget->plot());
}

void Grapher::removeCurve ( int  logicalIndex  )  [slot]

{
    plotWidget->plot()->itemList().at(logicalIndex)->detach();
}

void Grapher::removeCurve ( PlotCurve curve  )  [slot]

{
    Q_ASSERT(curve);
    curve->detach();
    plotWidget->plot()->replot(); //workaround because plotWidget doesn't update plot() while not visible and even on becomming visible.
}


The documentation for this class was generated from the following files: