Barchart fixes

This commit is contained in:
Mark Watkins 2011-05-28 19:36:42 +10:00
parent 49751750b1
commit d90f2f03cb
5 changed files with 20 additions and 28 deletions

View File

@ -7866,11 +7866,11 @@
<map> <map>
"tinyxml/tinyxml.h" "tinyxml/tinyxml.h"
1306564125 /home/mark/projects/git/sleepyhead/graphs/graph.h 1306574943 /home/mark/projects/git/sleepyhead/graphs/graph.h
<sleeplib/machine.h> <sleeplib/machine.h>
<list> <list>
1306574097 /home/mark/projects/git/sleepyhead/version.h 1306575341 /home/mark/projects/git/sleepyhead/version.h
1306549105 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h 1306549105 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h
"machine.h" "machine.h"
@ -7887,7 +7887,7 @@
"preferences.h" "preferences.h"
"tinyxml/tinyxml.h" "tinyxml/tinyxml.h"
1306573671 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp 1306575003 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
"wx_pch.h" "wx_pch.h"
"version.h" "version.h"
<wx/app.h> <wx/app.h>
@ -7902,7 +7902,7 @@
"SleepyHeadMain.h" "SleepyHeadMain.h"
"sleeplib/profiles.h" "sleeplib/profiles.h"
1306574058 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp 1306574943 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp
<wx/settings.h> <wx/settings.h>
<wx/dcbuffer.h> <wx/dcbuffer.h>
<wx/log.h> <wx/log.h>

View File

@ -223,7 +223,7 @@ void SleepyHeadFrame::OnViewMenuSummary( wxCommandEvent& event )
Summary::Summary(wxWindow *win) Summary::Summary(wxWindow *win)
:SummaryPanel(win) :SummaryPanel(win)
{ {
const int days_shown=30; const int days_shown=60;
machine=NULL; machine=NULL;
AddData(ahidata=new HistoryData(machine,days_shown)); AddData(ahidata=new HistoryData(machine,days_shown));

View File

@ -672,8 +672,6 @@ void gCandleStick::Plot(wxDC & dc, gGraphWindow & w)
gBarChart::gBarChart(gPointData *d,const wxColor *col,wxOrientation o) gBarChart::gBarChart(gPointData *d,const wxColor *col,wxOrientation o)
:gLayer(d),m_direction(o) :gLayer(d),m_direction(o)
{ {
m_yminor_ticks=2;
m_ymajor_ticks=10;
m_show_grid=true; m_show_grid=true;
m_show_minor_grid=true; m_show_minor_grid=true;
if (col) { if (col) {
@ -761,6 +759,7 @@ void gBarChart::DrawYTicks(wxDC & dc,gGraphWindow &w)
dc.DrawRotatedText(w.Title(), start_px-8-labelW - y, start_py+((height + x)>>1), 90); dc.DrawRotatedText(w.Title(), start_px-8-labelW - y, start_py+((height + x)>>1), 90);
} }
void gBarChart::Plot(wxDC & dc, gGraphWindow & w) void gBarChart::Plot(wxDC & dc, gGraphWindow & w)
{ {
if (!m_visible) return; if (!m_visible) return;
@ -790,17 +789,16 @@ void gBarChart::Plot(wxDC & dc, gGraphWindow & w)
for (int i=0;i<data->np[0];i++) { for (int i=0;i<data->np[0];i++) {
if ((data->point[0][i].x > w.min_x) && (data->point[0][i].x<w.max_x)) days++; if ((data->point[0][i].x > w.min_x) && (data->point[0][i].x<w.max_x)) days++;
}*/ }*/
// == max_y
float barwidth,pxr; float barwidth,pxr;
int px,py; float px,py;
if (m_direction==wxVERTICAL) { if (m_direction==wxVERTICAL) {
barwidth=(height-days*2)/days; barwidth=(height-days)/float(days);
pxr=width/w.max_y; pxr=width/w.max_y;
px=start_py; px=start_py;
} else { } else {
barwidth=(width-days*2)/days; barwidth=(width-days)/float(days);
pxr=height/w.max_y; pxr=height/w.max_y;
px=start_px; px=start_px;
} }
@ -811,15 +809,14 @@ void gBarChart::Plot(wxDC & dc, gGraphWindow & w)
wxString str; wxString str;
//const wxColor *colors[6]={wxRED, wxBLUE, wxGREEN, wxCYAN , wxBLACK, wxLIGHT_GREY };
int cnt=0; int cnt=0;
for (int i=0;i<data->np[0];i++) { for (int i=0;i<data->np[0];i++) {
//if (data->point[0][i].x < w.min_x) continue; //if (data->point[0][i].x < w.min_x) continue;
//if (data->point[0][i].x > w.max_x) break; //if (data->point[0][i].x > w.max_x) break;
dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxTRANSPARENT_BRUSH);
t1=px+1; t1=px;
px+=barwidth+2; px+=barwidth+1;
t2=px-t1-1; t2=px-t1-1;
wxRect rect; wxRect rect;
@ -853,6 +850,7 @@ void gBarChart::Plot(wxDC & dc, gGraphWindow & w)
dc.DrawLine(start_px,start_py,start_px,start_py+height); dc.DrawLine(start_px,start_py,start_px,start_py+height);
dc.DrawLine(start_px,start_py+height,start_px+width,start_py+height); dc.DrawLine(start_px,start_py+height,start_px+width,start_py+height);
// DrawXTicks(dc,w);
} }
/*gBarChart::gBarChart(gGraphData *d,wxOrientation o) /*gBarChart::gBarChart(gGraphData *d,wxOrientation o)
@ -983,8 +981,6 @@ void gBarChart::Plot(wxDC & dc, gGraphWindow & w)
gLineChart::gLineChart(gPointData *d,const wxColor * col,int dlsize,bool a) gLineChart::gLineChart(gPointData *d,const wxColor * col,int dlsize,bool a)
:gLayer(d),m_accelerate(a),m_drawlist_size(dlsize) :gLayer(d),m_accelerate(a),m_drawlist_size(dlsize)
{ {
m_yminor_ticks=0.5;
m_ymajor_ticks=1;
m_drawlist=new wxPoint [dlsize]; m_drawlist=new wxPoint [dlsize];
color.clear(); color.clear();
color.push_back(col); color.push_back(col);
@ -1122,7 +1118,7 @@ void gLineChart::DrawXTicks(wxDC & dc,gGraphWindow &w)
show_time=false; show_time=false;
st=st2; st=st2;
min_tick=1; min_tick=1;
double mtiks=(y+10)/width; double mtiks=(y+20.0)/width;
double mt=mtiks*xx; double mt=mtiks*xx;
min_tick=mt; min_tick=mt;
if (min_tick<1) min_tick=1; if (min_tick<1) min_tick=1;

View File

@ -321,8 +321,6 @@ class gLineChart:public gLayer
virtual void DrawYTicks(wxDC & dc,gGraphWindow &w); virtual void DrawYTicks(wxDC & dc,gGraphWindow &w);
protected: protected:
float m_yminor_ticks;
float m_ymajor_ticks;
bool m_accelerate; bool m_accelerate;
int m_drawlist_size; int m_drawlist_size;
wxPoint *m_drawlist; wxPoint *m_drawlist;
@ -368,11 +366,9 @@ class gBarChart:public gLayer
virtual void Plot(wxDC & dc, gGraphWindow & w); virtual void Plot(wxDC & dc, gGraphWindow & w);
protected: protected:
void DrawYTicks(wxDC & dc,gGraphWindow &w); virtual void DrawYTicks(wxDC & dc,gGraphWindow &w);
wxOrientation m_direction; wxOrientation m_direction;
float m_yminor_ticks;
float m_ymajor_ticks;
// d.Set(i+2400000.5+.000001); // JDN vs MJD vs Rounding errors // d.Set(i+2400000.5+.000001); // JDN vs MJD vs Rounding errors

View File

@ -16,14 +16,14 @@ namespace AutoVersion{
//Standard Version Type //Standard Version Type
static const long MAJOR = 0; static const long MAJOR = 0;
static const long MINOR = 7; static const long MINOR = 7;
static const long BUILD = 1522; static const long BUILD = 1537;
static const long REVISION = 2809; static const long REVISION = 2908;
//Miscellaneous Version Types //Miscellaneous Version Types
static const long BUILDS_COUNT = 5452; static const long BUILDS_COUNT = 5486;
#define RC_FILEVERSION 0,7,1522,2809 #define RC_FILEVERSION 0,7,1537,2908
#define RC_FILEVERSION_STRING "0, 7, 1522, 2809\0" #define RC_FILEVERSION_STRING "0, 7, 1537, 2908\0"
static const char FULLVERSION_STRING[] = "0.7.1522.2809"; static const char FULLVERSION_STRING[] = "0.7.1537.2908";
//These values are to keep track of your versioning state, don't modify them. //These values are to keep track of your versioning state, don't modify them.
static const long BUILD_HISTORY = 62; static const long BUILD_HISTORY = 62;