===Assets and Properties Across A Single Page=== This [[code:reports|code sample]] of a line-graph report. It shows information from several different assets - every asset of a specific **type** - and shows two properties per asset. The different values are consolidated onto one page. {{line_manyassetssingle.png|400}} ==Customising== ^Element^Replace With^ |[TYPE]|The asset //type// you want to search for| |[PROPERTY1] etc|The names of the properties you want to report on| ==The Code== import os import sys sys.path.insert(0,os.path.dirname(os.path.dirname(__file__))) import mplreport import datetime @mplreport.ardireport("Sample Report") def CreateReport(report,args): #List of properties to show properties = ['[PROPERTY1]','[PROPERTY2]'] #Create a page containing a single plot. fig,axes = report.CreatePage(len(properties)) #Print a title block for the page. report.Title() #Format the list for the query... proplist = [] for prp in properties: proplist.append("'" + prp + "'") #Our AQL query goes here query = "'[ASSET]' OFTYPE (" + ",".join(prp) + ") PROPERTY VALUES" #Get the pandas data-frame with the results. df = report.GetHistory(query) for x in range(0,len(properties)): ax = axes[x] for k in df.columns: if properties[x] in k: cleanname = k for prp in properties: cleanname = cleanname.replace(" " + prp,"") ax.plot(df[k],label=cleanname) #Clean up and prettify ax.margins(x=0) ax.set_xlabel("Time") ax.set_ylabel(properties[x]) ax.legend(loc='lower right') report.TimeAxis(ax.xaxis) report.Grid(ax) #Save this report out. report.Save()