Pie Chart Labels

This commit is contained in:
Mark Watkins 2011-08-07 17:11:50 +10:00
parent c2507011e9
commit c0a7559a85
9 changed files with 29 additions and 14 deletions

View File

@ -88,7 +88,6 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
if (yy<=0) { if (yy<=0) {
if (miny==0) if (miny==0)
return; return;
int i=5;
} }
EventDataType lastpx,lastpy; EventDataType lastpx,lastpy;
@ -164,9 +163,6 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
if (maxx<x0) continue; if (maxx<x0) continue;
if (xL<minx) continue; if (xL<minx) continue;
if (siz==2) {
int i=0;
}
if (x0>xL) { if (x0>xL) {
if (siz==2) { // this happens on CPAP if (siz==2) { // this happens on CPAP
quint32 t=el.getTime()[0]; quint32 t=el.getTime()[0];

View File

@ -123,11 +123,24 @@ void gSegmentChart::Plot(gGraphWindow & w,float scrx,float scry)
py=start_py+yoffset+cos(q*2*M_PI)*radius; py=start_py+yoffset+cos(q*2*M_PI)*radius;
glVertex2f(px,py); glVertex2f(px,py);
} }
double tpx=start_px+xoffset+sin((sum+(j/2.0))*2*M_PI)*(radius/1.7);
double tpy=start_py+yoffset+cos((sum+(j/2.0))*2*M_PI)*(radius/1.7);
q=sum+j; q=sum+j;
px=start_px+xoffset+sin(q*2*M_PI)*radius; px=start_px+xoffset+sin(q*2*M_PI)*radius;
py=start_py+yoffset+cos(q*2*M_PI)*radius; py=start_py+yoffset+cos(q*2*M_PI)*radius;
glVertex2f(px,py); glVertex2f(px,py);
glEnd(); glEnd();
if (j>.09) {
//glBegin(GL_POINTS);
//glVertex2f(tpx,tpy);
//glEnd();
QString a=m_names[m]; //QString::number(floor(100.0/m_total*data),'f',0)+"%";
float x,y;
GetTextExtent(a,x,y);
w.renderText(tpx-(x/2.0),scry-(tpy-y/2.0),a);
}
sum=q; sum=q;
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////

View File

@ -20,7 +20,7 @@ void gTitle::Plot(gGraphWindow & w,float scrx,float scry)
float width,height; float width,height;
GetTextExtent(m_title,width,height); GetTextExtent(m_title,width,height);
int xp=(height/2)+15; int xp=(height/2)+17;
//if (m_alignment==wxALIGN_RIGHT) xp=scrx-4-height; //if (m_alignment==wxALIGN_RIGHT) xp=scrx-4-height;
int j=scry/2-w.GetTopMargin(); int j=scry/2-w.GetTopMargin();
DrawText(w,m_title,xp,j,90.0,m_color,&m_font); DrawText(w,m_title,xp,j,90.0,m_color,&m_font);

View File

@ -61,7 +61,7 @@ void gXAxis::Plot(gGraphWindow & w,float scrx,float scry)
int divmax,dividx; int divmax,dividx;
int fitmode; int fitmode;
if (xx>86400000L) { // Day if (xx>86400000L) { // Day
fd="00:00"; fd="MMM 00:00";
dividx=0; dividx=0;
divmax=10; divmax=10;
fitmode=0; fitmode=0;
@ -156,8 +156,9 @@ void gXAxis::Plot(gGraphWindow & w,float scrx,float scry)
int s=(j/1000L) % 60L; int s=(j/1000L) % 60L;
if (fitmode==0) { if (fitmode==0) {
int day=(j/86400000) % 7; static QString dow[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
tmpstr=QString("XXX %1:%2").arg(h,2,10,QChar('0')).arg(m,2,10,QChar('0')); int d=(j/86400000) % 7;
tmpstr=QString("%1 %2:%3").arg(dow[d]).arg(h,2,10,QChar('0')).arg(m,2,10,QChar('0'));
} else if (fitmode==1) { // minute } else if (fitmode==1) { // minute
tmpstr=QString("%1:%2").arg(h,2,10,QChar('0')).arg(m,2,10,QChar('0')); tmpstr=QString("%1:%2").arg(h,2,10,QChar('0')).arg(m,2,10,QChar('0'));
} else if (fitmode==2) { // second } else if (fitmode==2) { // second

View File

@ -337,7 +337,6 @@ Session *Machine::SessionExists(SessionID session)
Day *Machine::AddSession(Session *s,Profile *p) Day *Machine::AddSession(Session *s,Profile *p)
{ {
double span=0;
if (!s) { if (!s) {
qWarning() << "Empty Session in Machine::AddSession()"; qWarning() << "Empty Session in Machine::AddSession()";
return NULL; return NULL;

View File

@ -524,7 +524,7 @@ qint64 Session::last(ChannelID id)
m_lastchan[id]=max; m_lastchan[id]=max;
return max; return max;
} }
bool Session::hasChannel(ChannelID id) bool Session::channelExists(ChannelID id)
{ {
QHash<ChannelID,QVector<EventList *> >::iterator j=eventlist.find(id); QHash<ChannelID,QVector<EventList *> >::iterator j=eventlist.find(id);
if (j==eventlist.end()) if (j==eventlist.end())

View File

@ -111,7 +111,7 @@ public:
EventDataType percentile(ChannelID id,EventDataType percentile); EventDataType percentile(ChannelID id,EventDataType percentile);
bool hasChannel(ChannelID id); bool channelExists(ChannelID id);
bool IsLoneSession() { return s_lonesession; } bool IsLoneSession() { return s_lonesession; }
void SetLoneSession(bool b) { s_lonesession=b; } void SetLoneSession(bool b) { s_lonesession=b; }

View File

@ -20,6 +20,12 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item> <item>
<widget class="QSplitter" name="splitter_2"> <widget class="QSplitter" name="splitter_2">
<property name="orientation"> <property name="orientation">
@ -90,7 +96,7 @@
</font> </font>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>0</number>
</property> </property>
<property name="movable"> <property name="movable">
<bool>true</bool> <bool>true</bool>

View File

@ -44,11 +44,11 @@ int main(int argc, char *argv[])
a.setApplicationName("SleepyHead"); a.setApplicationName("SleepyHead");
/* int id=QFontDatabase::addApplicationFont(":/fonts/FreeSans.ttf"); int id=QFontDatabase::addApplicationFont(":/fonts/FreeSans.ttf");
QStringList ffam=QFontDatabase::applicationFontFamilies(id); QStringList ffam=QFontDatabase::applicationFontFamilies(id);
for (QStringList::iterator i=ffam.begin();i!=ffam.end();i++) { for (QStringList::iterator i=ffam.begin();i!=ffam.end();i++) {
qDebug() << "Loaded Font: " << (*i); qDebug() << "Loaded Font: " << (*i);
} */ }
a.setFont(QFont("Sans Serif",10)); a.setFont(QFont("Sans Serif",10));