TimeScale.setMin(value)

Specifies the earliest date on the scale. The corresponding “getter” function is getMin().

Parameter

value

a Date object

Example

Chart Component Script
var date1 = new Date();
var date2 = new Date();
var minDate = new Date();
date1.setFullYear(2008,0,1);
date2.setFullYear(2009,0,1);
minDate.setFullYear(2005,0,1);
dataset = [["Date", "Quantity"], [date1,200], [date2,300]]; (1)
graph = new EGraph();
var elem = new IntervalElement("Date","Quantity");
var tscale = new TimeScale("Date"); (2)
tscale.setMin(minDate); (3)
graph.setScale("Date", tscale); (4)
graph.addElement(elem);
1 See dataset to use a data block instead of an array literal.
2 Create the TimeScale object.
3 Use setMin to set the desired minimum.
4 Use EGraph.setScale(field, scale) to assign the Scale to the Chart.

TimeScaleSetMin

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.

To change the property on a Chart that was previously created with the Chart Editor, use EGraph.getCoordinate() ① and RectCoord.getXScale() ② to obtain a handle to the desired Coordinate object and Scale object. For example:

var coord = graph.getCoordinate(); (1)
var scale = coord.getXScale(); (2)
// Compact syntax: var scale = graph.getCoordinate().getXScale();

scale.setMin(dateAdd('yyyy',-10,CALC.today()));