TextSpec.setFormat(format)

Specifies how date or numeric data should be represented in string format for display.

Parameter

format a java.text.Format object

Note: Script that modifies 'graph' should be placed at the element level. See Adding Element-Level Script in Report Scripting and Adding Component Script in Dashboard Scripting for more information.

Example (Report or Viewsheet)

dataset = [["State","Quantity"],["NJ",20000],["NY",30000]];

graph = new EGraph();

var elem = new IntervalElement("State", "Quantity");

var qscale = new LinearScale("Quantity");

var aspec = new AxisSpec();

var tspec = new TextSpec();

tspec.setFormat(java.text.DecimalFormat("##,###.00"));

aspec.setTextSpec(tspec);

qscale.setAxisSpec(aspec);

graph.setScale("Quantity", qscale);

graph.addElement(elem);

 

Date masks follow the java.text.SimpleDate­Format format.

Date Format: For date formatting, use the following date masks:

M = Month

d = date

y = year

E = day of the week

Example:

For the date Nov 8, 2006:

 

M = 11; MM = 11; MMM = Nov; MMMM = November

d = 8; dd = 08;

yy = 06; yyyy = 2006

EEE = Wed

EEEE = Wednesday

Therefore, mask 'MMM-dd-yyyy' yields “Nov-08-2006.”

Numeric masks fol­low the java.text.Deci­malFormat format.

Number Format: For number formatting, use the following numeric masks:

# = number

0 = Number with zero padding

Example:

For the number 124521.63:

#,###.##  yields 124,521.63

#,###.000 yields 124,521.630

Text Format: For text formatting, use {0} as a placeholder for the string data.

Example:

For the string 'Susan':

“Salesperson: {0}”  yields: “Salesperson: Susan”

“--{0}--” yields: “--Susan--”

See Also

DataSet, to use a Data Block or query as the dataset source.

<< TextSpec.setFont(value) © 1996-2013 InetSoft Technology Corporation (v11.4) TextSpec.setRotation(value) >>