/[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 196 by torben, Sat Dec 8 19:19:07 2007 UTC revision 197 by torben, Sun Dec 9 08:03:54 2007 UTC
# Line 21  reply.setHeader("Cache-Control", "no-cac Line 21  reply.setHeader("Cache-Control", "no-cac
21  reply.setHeader("Expires",  "Mon, 26 Jul 1997 05:00:00 GMT"); //date in the past  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,360));  image.Create( 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 29  image.CreateTrueColor( GD::Size(600,360) Line 29  image.CreateTrueColor( GD::Size(600,360)
29  //GD::TrueColor line(255,0,0);  //GD::TrueColor line(255,0,0);
30    
31  //White color scheme  //White color scheme
32  image.Fill( GD::Point(1,1), GD::TrueColor(255,255,255).Int() );  int white = image.ColorAllocate(255,255,255);
33  GD::TrueColor decoration(60,60,60);  int decoration = image.ColorAllocate(60,60,60);
34  GD::TrueColor text(0,0,0);  int text = image.ColorAllocate(0,0,0);
35  GD::TrueColor line(255,0,0);  int line = image.ColorAllocate(255,0,0);
36    
37    image.Fill( GD::Point(1,1), white );
38    
39  image.String(gdFontSmall, 250,5, "Temperature graph", text.Int());  image.String(gdFontSmall, 250,5, "Temperature graph", text);
40  image.String(gdFontSmall, 200,18, "Latest 20 samples, in degrees Celcius", text.Int());  image.String(gdFontSmall, 200,18, "Latest 20 samples, in degrees Celcius", text);
41    
42  for (int i=0; i<11; ++i)  for (int i=0; i<11; ++i)
43  {  {
44          std::stringstream marker;          std::stringstream marker;
45          marker << (100- (i*10));          marker << (100- (i*10));
46          int y = (i*30) + 40;          int y = (i*30) + 40;
47          image.Line(     30, y, 590, y, decoration.Int());          image.Line(     30, y, 590, y, decoration);
48    
49          image.String(gdFontSmall, 5, y-7, marker.str().c_str(), text.Int());          image.String(gdFontSmall, 5, y-7, marker.str().c_str(), text);
50    
51  }  }
52  /////////////////////////////////////////////////  /////////////////////////////////////////////////
# Line 71  for (unsigned int i=0; i<res.size(); ++i Line 72  for (unsigned int i=0; i<res.size(); ++i
72          int y = ((100-current) * 3) + 40;          int y = ((100-current) * 3) + 40;
73    
74          //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);
75          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 );
76    
77          if (i>0)          if (i>0)
78          {          {
79                  image.Line( GD::Point(x,y), previous, line.Int());                  image.Line( GD::Point(x,y), previous, line);
80          }          }
81    
82          previous = GD::Point(x,y);          previous = GD::Point(x,y);

Legend:
Removed from v.196  
changed lines
  Added in v.197

  ViewVC Help
Powered by ViewVC 1.1.20