TimeScale
The TimeScale object contains a time scale, i.e., a scale that linearly maps date and time data values to physical attributes. To create a TimeScale object, call the TimeScale constructor with the fields for which the scale should be generated.
Parameter
var
qscale = new TimeScale('Date');
You can pass the names of the fields (e.g., 'Date') for which the scale should be generated to the constructor, or specify these later using the inherited Scale.setFields(field) property.
Example (Report or Viewsheet)
importPackage(inetsoft.graph)
importPackage(inetsoft.graph.data)
importPackage(inetsoft.graph.scale)
importPackage(inetsoft.graph.aesthetic)
importPackage(inetsoft.graph.element)
importPackage(inetsoft.graph.coord)
var date1 = new Date();
var date2 = new Date();
var maxDate = new Date();
date1.setFullYear(2008,0,1);
date2.setFullYear(2009,0,1);
maxDate.setFullYear(2011,0,1);
var arr = [["Date", "Quantity"], [date1,200], [date2,300]];
dataset = new DefaultDataSet(arr);
graph = new EGraph();
var elem = new IntervalElement("Date","Quantity")
var tscale = new TimeScale();
tscale.setFields(["Date"]);
tscale.setMax(maxDate);
graph.setScale("Date", tscale);
graph.addElement(elem);