2011-08-30 08:46:24 +00:00
|
|
|
#include "SleepLib/day.h"
|
|
|
|
#include "gYAxis.h"
|
|
|
|
#include "gStatsLine.h"
|
|
|
|
|
|
|
|
gStatsLine::gStatsLine(ChannelID code,QString label,QColor textcolor)
|
|
|
|
:Layer(code),m_label(label),m_textcolor(textcolor)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void gStatsLine::paint(gGraph & w, int left, int top, int width, int height)
|
|
|
|
{
|
|
|
|
if (!m_visible) return;
|
|
|
|
//if (m_empty) return;
|
2011-08-31 05:24:48 +00:00
|
|
|
height=height;
|
2011-09-01 13:07:26 +00:00
|
|
|
|
2011-08-30 08:46:24 +00:00
|
|
|
int z=(width+gYAxis::Margin)/5;
|
|
|
|
int p=left-gYAxis::Margin;
|
|
|
|
|
|
|
|
|
2011-08-30 17:22:54 +00:00
|
|
|
top+=4;
|
2011-09-01 13:07:26 +00:00
|
|
|
w.renderText(m_label,p,top);
|
2011-08-30 08:46:24 +00:00
|
|
|
|
2011-08-30 17:22:54 +00:00
|
|
|
//w.renderText(m_text,p,top,0,m_textcolor);
|
2011-08-30 08:46:24 +00:00
|
|
|
|
|
|
|
p+=z;
|
2011-09-01 13:07:26 +00:00
|
|
|
w.renderText(st_min,p,top);
|
2011-08-30 08:46:24 +00:00
|
|
|
|
|
|
|
p+=z;
|
2011-09-01 13:07:26 +00:00
|
|
|
w.renderText(st_avg,p,top);
|
2011-08-30 08:46:24 +00:00
|
|
|
|
|
|
|
p+=z;
|
2011-09-01 13:07:26 +00:00
|
|
|
w.renderText(st_p90,p,top);
|
2011-08-30 08:46:24 +00:00
|
|
|
|
2011-08-30 17:22:54 +00:00
|
|
|
p+=z;
|
2011-09-01 13:07:26 +00:00
|
|
|
w.renderText(st_max,p,top);
|
2011-08-30 08:46:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void gStatsLine::SetDay(Day *d)
|
|
|
|
{
|
|
|
|
Layer::SetDay(d);
|
|
|
|
if (!m_day) return;
|
2011-12-17 14:38:15 +00:00
|
|
|
m_min=d->Min(m_code);
|
|
|
|
m_max=d->Max(m_code);
|
2011-08-30 08:46:24 +00:00
|
|
|
m_avg=d->wavg(m_code);
|
|
|
|
m_p90=d->p90(m_code);
|
|
|
|
|
2011-09-01 13:07:26 +00:00
|
|
|
st_min="Min="+QString::number(m_min,'f',2);
|
|
|
|
st_max="Max="+QString::number(m_max,'f',2);
|
|
|
|
st_avg="Avg="+QString::number(m_avg,'f',2);
|
|
|
|
st_p90="90%="+QString::number(m_p90,'f',2);
|
2011-08-30 08:46:24 +00:00
|
|
|
|
|
|
|
}
|