How do I programmatically get realtime and historical trend data?

Use the GetTrendDataTable method to return a DataTable object with all trend values.

The following code can be used to programmatically get history data and return the data to a DataTable.