YAxis Tickers for Usage Graph

This commit is contained in:
Mark Watkins 2011-07-12 17:29:02 +10:00
parent ecbe448741
commit dad2dedbe9
3 changed files with 30 additions and 1 deletions

View File

@ -8,6 +8,25 @@
#include <SleepLib/profiles.h>
#include "gSessionTime.h"
gTimeYAxis::gTimeYAxis(QColor col)
:gYAxis(col)
{
}
gTimeYAxis::~gTimeYAxis()
{
}
const QString & gTimeYAxis::Format(double v)
{
static QString t;
int i=v;
if (i<0) i=24+i;
t.sprintf("%02i:00",i);
return t;
};
gSessionTime::gSessionTime(gPointData *d,QColor col,Qt::Orientation o)
:gLayer(d),m_orientation(o)
{

View File

@ -9,6 +9,16 @@
#include "graphlayer.h"
#include "gXAxis.h"
#include "gYAxis.h"
class gTimeYAxis:public gYAxis
{
public:
gTimeYAxis(QColor col=QColor("black"));
virtual ~gTimeYAxis();
virtual const QString & Format(double v);
};
class gSessionTime:public gLayer
{

View File

@ -92,7 +92,7 @@ Overview::Overview(QWidget *parent,QGLContext *context) :
AddGraph(SESSTIMES=new gGraphWindow(ui->SummaryGraphWindow,tr("Session Times"),AHI));
//SESSTIMES->SetMargins(10,15,65,80);
SESSTIMES->AddLayer(new gFooBar(7));
SESSTIMES->AddLayer(new gYAxis());
SESSTIMES->AddLayer(new gTimeYAxis());
SESSTIMES->AddLayer(new gSessionTime(session_times,QColor("green")));
SESSTIMES->SetBottomMargin(SESSTIMES->GetBottomMargin()+gXAxis::Margin+25);
//SESSTIMES->AddLayer(new gXAxis());