/[H9]/trunk/tntnet/dynamic/temperaturegraph.ecpp
ViewVC logotype

Diff of /trunk/tntnet/dynamic/temperaturegraph.ecpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 120 by torben, Sun Dec 2 08:49:18 2007 UTC revision 177 by torben, Thu Dec 6 14:12:36 2007 UTC
# Line 17  dburl; Line 17  dburl;
17  int id;  int id;
18  </%args>  </%args>
19  <{  <{
20    reply.setHeader("Cache-Control", "no-cache, must-revalidate"); // Http/1.1
21    reply.setHeader("Expires",  "Mon, 26 Jul 1997 05:00:00 GMT"); //date in the past
22    
23  GD::Image image;  GD::Image image;
24  image.CreateTrueColor( GD::Size(600,350));  image.CreateTrueColor( GD::Size(600,360));
25    
26  //Black color scheme  //Black color scheme
27  //GD::TrueColor decoration(45,95,0);  //GD::TrueColor decoration(45,95,0);
# Line 34  GD::TrueColor line(255,0,0); Line 36  GD::TrueColor line(255,0,0);
36    
37    
38  image.String(gdFontSmall, 250,5, "Temperature graph", text.Int());  image.String(gdFontSmall, 250,5, "Temperature graph", text.Int());
39    image.String(gdFontSmall, 200,18, "Latest 20 samples, in degrees Celcius", text.Int());
40    
41  for (int i=0; i<11; ++i)  for (int i=0; i<11; ++i)
42  {  {
43          std::stringstream marker;          std::stringstream marker;
44          marker << (100- (i*10));          marker << (100- (i*10));
45          int y = (i*30) + 25;          int y = (i*30) + 40;
46          image.Line(     30, y, 590, y, decoration.Int());          image.Line(     30, y, 590, y, decoration.Int());
47    
48          image.String(gdFontSmall, 5, y-7, marker.str().c_str(), text.Int());          image.String(gdFontSmall, 5, y-7, marker.str().c_str(), text.Int());
# Line 61  query << "ORDER BY messagenr ASC"; Line 64  query << "ORDER BY messagenr ASC";
64  tntdb::Result res = conn.select(query.str());  tntdb::Result res = conn.select(query.str());
65    
66  GD::Point previous;  GD::Point previous;
67  for (int i=0; i<res.size(); ++i)  for (unsigned int i=0; i<res.size(); ++i)
68  {  {
69          int current = res[i].getInt(0);          int current = res[i].getInt(0);
70          int x = (i*28) + 40;          int x = (i*28) + 45;
71          int y = ((100-current) * 3) + 25;          int y = ((100-current) * 3) + 40;
72    
73          //image.FilledArc( GD::Point(x,y), GD::Size(3,3), 0, 360, line.Int(), gdPie);          //image.FilledArc( GD::Point(x,y), GD::Size(3,3), 0, 360, line.Int(), gdPie);
74          image.FilledRectangle( GD::Point(x-1,y-1), GD::Point(x+1,y+1), line.Int() );          image.FilledRectangle( GD::Point(x-1,y-1), GD::Point(x+1,y+1), line.Int() );

Legend:
Removed from v.120  
changed lines
  Added in v.177

  ViewVC Help
Powered by ViewVC 1.1.20