def make_google_motion_chart(self, directory): filename = "FGGoogleMotionChart.html" filepath = directory + "/" + filename Utility.ensure_dir(filepath) test = GoogleMotionChart() output = test.display(self.users, self.from_date) f = open(filepath, "w") f.write(output) f.close() print filepath + " created"
def make_index_html (self, output_dir, title): page_template = """ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <title> %(title)s </title> </head> <body> <img src="https://portal.futuregrid.org/sites/default/files/u30/fg-logo-md.gif" width="94" height="65" alt="FutureGrid" /> Eucalyptus Monitor <h1> %(title)s </h1> <table> <tr> <td> <img src="pie.png" alt="chart" /> </td> <td> <img src="bar.png" alt="chart" /> </td> </tr> <tr> <td> Figure 1. Running instances per user of eucalyptus in India (pie type) </td> <td> Figure 2. Running instances per user of eucalyptus in India (bar type) </td> </tr> <tr> <td colspan="2"> %(motion_chart)s </td> </tr> <tr> <td colspan="2"> <br><br><br><br> Figure 3. Running instances per user of eucalyptus in India (motion chart) </td> </tr> </table> <hr> <address>Author Gregor von Laszewski, [email protected]</address> <!-- hhmts start -->Last modified: %(now)s <!-- hhmts end --> </body> </html> """ print "========" now = datetime.now() now = "%s-%s-%s %s:%s:%s" % (now.year, now.month, now.day, now.hour, now.minute, now.second) gmc = GoogleMotionChart() motion_chart = gmc.display(self.users, self.from_date) filename = output_dir+"/index.html" Utility.ensure_dir(filename) f = open(filename, "w") f.write(page_template % vars()) f.close()