colorLegends.format

Sets the format for data values displayed within a color-key legend (on charts that have multiple color legends).

Type

StyleConstant.DATE_FORMAT

date display

StyleConstant.DECIMAL_FORMAT

number display

StyleConstant.MESSAGE_FORMAT

text display

StyleConstant.PERCENT_FORMAT

fraction display

StyleConstant.CURRENCY_FORMAT

locale-adapting currency display

For the Date, Decimal, and Message formats, use the formatSpec property to assign a format specification using the appropriate masks: [formatType, formatSpec]. See the examples below.

Examples

Chart1.colorLegends['Sum(Product:Quantity Purchased)'].format = [Chart.MESSAGE_FORMAT,"{0} Inc."];
Chart1.colorLegends['Sum(Product:Total)'].format = [Chart.DECIMAL_FORMAT,"$#,##0M"];

colorLegendsFormat

Either syntax below can be used in component script:

colorLegends['...'].format          // unqualified
Chart1.colorLegends['...'].format   // qualified

For onInit/onRefresh scripts, and for component and property scripts on other components, the second (qualified) form is required.