Historian and Data Logging > Customizing Getting Samples
  
Customizing Getting Samples
The trend chart object calls the Historian server to get the data to plot the charts. In some scenarios, you may want to override that configuration and define a .NET code to provide the values. This is used, for instance, to plot recipe calculated data, future data, data from other SQL tables or any custom scenario.
The custom GetSamples method should be defined at any Script Class and on Edit-Tags-Historian that method must be defined at the column GetSamplesMethod.
The prototype of the method is:
DataTable GetSamples(string[] tagNames, object startRange, object endRange)
When overing tables used on time charts the StartRange and EndRange are of type DateTimeOffset. When getting date to X-Y charts, the Range are double variables.
The Returned DataTable shall have the columns:
DateTime: Date time of the sample
TagName: The name of tag is used as FieldName to the column with Double values of the tag
_TagName_Q: Optional column with the quality of the data