This is an old revision of the document!


A Simple Report

import ardi.util.mplreport

@mplreport.ardireport("Sample Report")
def CreateReport(report,args):    

   #Set up the report page
   fig,ax = report.CreatePage(1)
   report.Title()

   #Fetch the report data
   thedata = report.FetchHistory("'Temperature' PROPERTYEX ALLPOINTS")   

   #Check for incomplete data
   if report.FetchFailure():
      report.Failed("\n".join(report.errors))

   frame = thedata.data

   #Draw the lines
   for colname in frame.columns:
        ax.plot(frame[colname],label=colname)

   #Setup the axes
   ax.margins(x=0)
   ax.grid()
   ax.legend()
   ax.set_xlabel("Time")
   ax.set_ylabel("Temperature (Deg C)")
   report.TimeAxis(ax.xaxis)

   report.Save()

See the mplreport reference to learn more.

Notes

Note that scheduling transmission of the report is not set up using the reporting addon and is instead done using the report bundles.