#ifndef GRAPHVIEW_H
#define GRAPHVIEW_H

#include <QWidget>
#include <QMap>

class TableModel;

class GraphView : public QWidget
{
    Q_OBJECT
public:
    GraphView(QWidget *parent = 0);

    QSize sizeHint() const;

    void setModel(TableModel *m);

public slots:
    void setGrouping(bool on);

protected:
    void paintEvent(QPaintEvent *event);

private:
    double getMax(QList<QList<double> > table) const;
    double getMin(QList<QList<double> > table) const;
    int calcYCoord(double value, double yScale) const;
    QColor randomColor() const;

    TableModel *model;

    QList<QList<double> > contents;
    double range;
    double max;
    double min;
    bool shouldGroup;

    QStringList lineTitles;
    QMap<QString, QColor> colorMap;
};

#endif // GRAPHVIEW_H

