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.
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.
The following special methods are provided:
Example
Chart Component Script
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);
dataset = [["Date", "Quantity"], [date1,200], [date2,300]]; (1)
graph = new EGraph();
var elem = new IntervalElement("Date","Quantity");
var tscale = new TimeScale(); (2)
tscale.setFields(["Date"]);
tscale.setMax(maxDate);
graph.setScale("Date", tscale); (3)
graph.addElement(elem);
| 1 | See dataset to use a data block instead of an array literal. |
| 2 | Create the TimeScale object. |
| 3 | Use EGraph.setScale(field, scale) to add the Scale to the Chart. |

Script that modifies the graph or dataset properties should be placed on the Chart component itself. See Add Component Script for more information. This script has access to the Chart data and Chart API methods. Scripted Charts are not good candidates for user-modification, so you should deselect ‘Enable Ad Hoc Editing’ in the Chart Properties dialog box.
|