--- trunk/tntnet/dynamic/temperaturegraph.ecpp 2007/12/01 20:53:59 118 +++ trunk/tntnet/dynamic/temperaturegraph.ecpp 2007/12/08 16:47:03 195 @@ -17,23 +17,33 @@ int id; <{ +reply.setHeader("Cache-Control", "no-cache, must-revalidate"); // Http/1.1 +reply.setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); //date in the past GD::Image image; -image.CreateTrueColor( GD::Size(600,350)); +image.CreateTrueColor( GD::Size(600,360)); -GD::TrueColor green(45,95,0); -GD::TrueColor text(200,200,200); -GD::TrueColor red(255,0,0); +//Black color scheme +//GD::TrueColor decoration(45,95,0); +//GD::TrueColor text(200,200,200); +//GD::TrueColor line(255,0,0); + +//White color scheme +image.Fill( GD::Point(1,1), GD::TrueColor(255,255,255).Int() ); +GD::TrueColor decoration(60,60,60); +GD::TrueColor text(0,0,0); +GD::TrueColor line(255,0,0); image.String(gdFontSmall, 250,5, "Temperature graph", text.Int()); +image.String(gdFontSmall, 200,18, "Latest 20 samples, in degrees Celcius", text.Int()); for (int i=0; i<11; ++i) { std::stringstream marker; marker << (100- (i*10)); - int y = (i*30) + 25; - image.Line( 30, y, 590, y, green.Int()); + int y = (i*30) + 40; + image.Line( 30, y, 590, y, decoration.Int()); image.String(gdFontSmall, 5, y-7, marker.str().c_str(), text.Int()); @@ -41,7 +51,7 @@ ///////////////////////////////////////////////// -tntdb::Connection conn = tntdb::connect(dburl); +tntdb::Connection conn = tntdb::connectCached(dburl); std::stringstream query; query << "SELECT temperature FROM ( "; @@ -54,18 +64,18 @@ tntdb::Result res = conn.select(query.str()); GD::Point previous; -for (int i=0; i0) { - image.Line( GD::Point(x,y), previous, red.Int()); + image.Line( GD::Point(x,y), previous, line.Int()); } previous = GD::Point(x,y);