ChartDirector 6.2 (.NET Edition)

Date/Time Specification


Many functions in the ChartDirector API accept dates/times as parameters. ChartDirector represents dates/times as the number of seconds elapsed since 1-1-0001 00:00:00. The dates/times are numbers, so they can readily be used in ChartDirector APIs that expects numbers as arguments.

For example, in XY Charts, both the x values and y values are of "double" data type. You can use numeric values or ChartDirector dates/times as the x and y values, as both of them are numbers.

In .NET, there is a native type System.DateTime. Several ChartDirector APIs are overloaded to accept System.DateTime in addition to double precision numbers. These overloaded functions are provided to handle common date/time chart usages.

For example, in a typical time based chart, the independent variable (the x values) usually represents date/time, while the dependent variable (the y values) is numeric. So in ChartDirector, many x-values functions (eg. Layer.setXData, Layer.setXData2) and axis functions (eg. Axis.setLabels2, Axis.setDateScale) are overloaded to support System.DateTime as arguments.

ChartDirector also supports charts in which both x and y values are dates/times. However, because this type of chart is not common, ChartDirector does not provide overloaded functions to accept y values as System.DateTime. This is to avoid overcrowding the ChartDirector API with all possible combinations of date/time and numeric data types. For these cases, the y dates/times need to be supplied in ChartDirector's native format.

Chart.chartTime can be used to create a ChartDirector date/time given the year, month, day, hour, minutes and seconds. ChartDirector also provides several functions for converting to and from System.DateTime, including Chart.CTime, Chart.CTime2, Chart.NTime and Chart.NTime2.