OSCAR-code/Graphs/gBarChart.h

77 lines
2.0 KiB
C
Raw Normal View History

2011-07-12 07:10:34 +00:00
/*
2011-06-26 08:30:44 +00:00
gBarChart Header
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
License: GPL
2011-07-12 07:10:34 +00:00
*/
2011-06-26 08:30:44 +00:00
#ifndef GBARCHART_H
#define GBARCHART_H
2011-09-02 02:00:04 +00:00
#include <SleepLib/profiles.h>
2011-08-30 08:46:24 +00:00
#include "gGraphView.h"
2011-06-26 08:30:44 +00:00
#include "gXAxis.h"
2011-08-30 08:46:24 +00:00
enum GraphType { GT_BAR, GT_LINE };
class SummaryChart:public Layer
2011-06-26 08:30:44 +00:00
{
public:
SummaryChart(Profile *profile, QString label, GraphType type=GT_BAR);
virtual ~SummaryChart();
2011-06-26 08:30:44 +00:00
2011-09-02 05:13:07 +00:00
void setProfile(Profile *profile) { m_profile=profile; }
virtual void paint(gGraph & w,int left, int top, int width, int height);
virtual void SetDay(Day * day=NULL);
2011-09-02 05:13:07 +00:00
virtual bool isEmpty() { return m_empty; }
void addSlice(ChannelID code, QColor color, SummaryType type) { m_codes.push_back(code); m_colors.push_back(color); m_type.push_back(type); }
2011-06-26 08:30:44 +00:00
protected:
Qt::Orientation m_orientation;
2011-09-02 05:13:07 +00:00
QVector<QColor> m_colors;
QVector<ChannelID> m_codes;
QVector<SummaryType> m_type;
2011-09-03 04:38:12 +00:00
QHash<int,QHash<short,EventDataType> > m_values;
2011-09-02 02:00:04 +00:00
Profile * m_profile;
GLBuffer *quads,*lines;
2011-09-02 05:13:07 +00:00
bool m_empty;
int m_fday;
2011-09-03 04:38:12 +00:00
QString m_label;
float barw; // bar width from last draw
qint64 l_offset; // last offset
float offset; // in pixels;
int l_left,l_top,l_width,l_height;
2011-09-03 12:59:08 +00:00
int rtop;
qint64 l_minx,l_maxx;
int hl_day;
gGraph * graph;
GraphType m_graphtype;
virtual bool mouseMoveEvent(QMouseEvent * event);
virtual bool mousePressEvent(QMouseEvent * event);
virtual bool mouseReleaseEvent(QMouseEvent * event);
2011-09-03 04:38:12 +00:00
};
/*
2011-09-03 04:38:12 +00:00
class AHIChart:public gBarChart
{
public:
AHIChart(Profile *profile);
virtual void SetDay(Day * day);
};
class UsageChart:public gBarChart
{
public:
UsageChart(Profile *profile);
virtual void SetDay(Day * day);
2011-06-26 08:30:44 +00:00
};
class AvgChart:public gBarChart
{
public:
AvgChart(Profile *profile);
virtual void SetDay(Day * day);
};*/
2011-06-26 08:30:44 +00:00
#endif // GBARCHART_H