How to Base a Chart on a Custom Series
Description
An Xbasic function can be used to create a Custom data series that dynamically computes sub-series data from a SQL database.
Discussion
The data series used in a Chart control can be generated using a Custom data source. Custom data series are generated using Xbasic. The Xbasic function can return a static set of data or query a SQL database or Web service to generate the data in the data series.
The Xbasic function that defines the Custom data series must return a CR-LF delimited list of values. This list contains one or more sub-series. For example, the following Xbasic function returns two sub-series, defining 'sales'' for individual 'regions':
function getData() as c (e as p) ' return data for sub-series "sales" and "region" ' Data format: <sales>|<region> getData = <<%txt% 12|east 23|west 17|south 23|north %txt% end function
When returning a sub-series, the name of the each sub-series must be specified in the Subseries names property for the data source. The order that sub-series are defined is the order defines the order that they must appear in the data returned by your Xbasic function. Each sub-series value must be separated by the pipe "|" delimiter.
The data returned by the Xbasic function can be dynamically generated using data in a SQL database or web service. In addition, you can pass additional data to the Xbasic function with JavaScript. To learn more, watch the videos below:
See Also