Search
DateTimeSeries Constructor (List<Date>, List<Number>, Date, Date)
See Also
 






Initializes a new instance of the DateTimeSeries class.

Namespace: MindFusion.Charting
File: DateTimeSeries.js

 Syntax

JavaScript  Copy Code

function DateTimeSeries (dates, values, minDate, maxDate)

 Parameters

dates

Type: List
A list of Date values.

values

Type: List
A list of number values.

minDate

Identifies the start of the time range.

maxDate

Identifies the end of the time range.

 Example

The following code creates a new DateTimeSeries that uses the last 10 years as Date values and a List with income data. The first and last Date in the list are used as min and max values.

JavaScript  Copy Code

// create sample series
var years = new Collections.List();
var dt = new Date(new Date().getFullYear() - 10, 11, 31);
for (; ;)
{
 if (dt.getFullYear() > new Date().getFullYear())
  break;
 years.add(new Date(dt.setFullYear(dt.getFullYear() + 1)));
}

var income = new Collections.List([12, 13.2, 15.6, 17.8, 39, 20, 29, 79, 101, 120, 122]);

var series = new DateTimeSeries(
 years, income, years.item(0), years.item(years.count() - 1));

 See Also