Download the Solution Example here: TrendCustomDataSource.dbsln
This example shows how to use TrendCharts, and solutions on basic archiving, creating and charting of Data.
When creating a TrendChart, you can associate a Historian Tag with a Historian Table to supply data points. This configuration is done through the Historian section. These tables can either receive data from databases accessed via FrameWorX or from a script within a script class, accessible under Scripts > Classes.
In this example, the GetSamples
method is applied in two different ways:
ServerMain
ScriptClass, the method is used to create a custom signal and send it to the historian for plotting.MyClass
ScriptClass, the method is used to retrieve data stored in a table within a database, which is then sent to the historian for plotting.When creating a TrendChart, if you have data logging set up in FactoryStudio (via Edit > Tags > Historian) or if you're using FactoryStudio with the OSIsoft PI System, the system will automatically search for archived data to plot.
If you want to use data other than what the system archives by default, you have two options:
GetSamples
method used by the TrendChart, as demonstrated in the ServerMain
and MyClass
ScriptClassesIn this section: