Model Index

Types By Namespace

cdo

def

pvc

pvc.data

pvc.options

pvc.options.axes

pvc.options.charts

pvc.options.ext

pvc.options.format

pvc.options.marks

pvc.options.panels

pvc.options.plots

pvc.options.varia

pvc.options.visualRoles

pvc.visual

Class pvc.options.format.FormatProvider

Class Summary
Constructor Attributes Constructor Name and Description
 
The options documentation of the format provider class.
Field Summary
Field Attributes Field Name and Description
 
any
The format function/object used to format values of other data types, like string, boolean and object.
 
The format function/object used to format date/time objects.
 
The format function/object used to format numbers in a general way.
 
The format function/object used to format percentage numbers.
Class Detail
pvc.options.format.FormatProvider
The options documentation of the format provider class.

A format provider contains formats for main value types and main modes in which these are formatted. Currently, it contains the following formats: FormatProvider#number , FormatProvider#percent, FormatProvider#date and FormatProvider#any.

Format providers exist in, and can be configured at, three levels, from most specific to least specific:

Dimension Type
Most formatting operations use a dimension type's format provider to obtain a format.

By default, the unconfigured properties of a dimension type's format provider inherit the corresponding value obtained from the chart's format provider.

A dimension type's format provider is configured through the option pvc.options.DimensionType#format.

Chart
The chart's format provides defaults for all formatting operations done in the chart.

The unconfigured properties of a chart's format provider inherit the corresponding value obtained from the global format provider (any format provider directly or indirectly inherits from the global format provider).

A chart's format provider is configured through the option pvc.options.charts.BasicChart#format.

Global
Allows changing the default formats used by all charts.

The global format provider exists in pvc.data.format.defaults. And can also be accessed by its alias cdo.format.defaults.

Using the auxiliary method def.configure, global defaults can be configured the following way:

def.configure(pvc.data.format.defaults, {
    number: {
        mask: "#,0.00",
        style: {
            decimal: ",",
            group: "."
        }
    },
    date: "%m %Y"
});
                        

Configuring global defaults can also be done by using the format provider and contained objects' accessor methods (which follow a similar structure to that of the here documented options):

pvc.data.format.defaults
    .number().mask("#,0.00");

pvc.data.format.defaults
    .style()
        .decimal(",")
        .group(".");

pvc.data.format.defaults
    .date("%m %Y");
                        

Internationalization

Get, set, create and configure different format providers arranged by language.

The default language is en-us but can also be accessed with an empty string. It's configuration is the same as the global defaults in cdo.

Warning: If you change cdo global defaults, the configuration for the default language en-us will also change, so changing them is not recommended.

Create or configure a format provider by specifying a language and the configuration object

cdo.format.language('fr-fr', {
    number: {
        mask:              '#,0.##',
        style: {
            integerPad:    '0',
            fractionPad:   '0',
            decimal:       ',',
            group:         ' ',
            groupSizes:    [3],
            abbreviations: ['k','m', 'b', 't'],
            negativeSign:  '-',
            currency:      '€'
        }
    },
    date: {
        mask:              '%d/%m/%Y'
    }
});
                        

Create or configure multiple format providers

cdo.format.language({
    'en-us': {
        number: {
            mask:              '0,0 Currency',
        },
        date: '%Y/%m/%d'
    },
    'en-gb': {
        number: {
            mask:              '0.00 Abbreviation',
            style: {
                abbreviations: ['k','m', 'b', 't']
            }
    }
});
                        

Get the format provider of a specific language

cdo.format.language('pt-pt');
                        

Field Detail
{function|object|pvc.options.format.CustomFormat} any
The format function/object used to format values of other data types, like string, boolean and object.

When a function is specified, it is the CustomFormat#formatter property of a new custom format that replaces the current format.

When an object is specified, it configures the current format object.

Alternatively, a direct instance of CustomFormat can be specified, replacing the existing format.

The global default custom formatter formats nully values as an empty string and other values by calling their #toString() method.


{string|function|object|pvc.options.format.DateFormat|pvc.options.format.CustomFormat} date
The format function/object used to format date/time objects.

When a string is specified, it is the DateFormat#mask property of a new date format that replaces the current format.

When a function is specified, it is the CustomFormat#formatter property of a new custom format that replaces the current format.

When an object is specified, it configures the current format object.

Alternatively, direct instances of DateFormat and CustomFormat can be specified, replacing the existing format.

The global default date mask id "%Y/%m/%d".


{string|function|object|pvc.options.format.NumberFormat|pvc.options.format.CustomFormat} number
The format function/object used to format numbers in a general way.

When a string is specified, it is the NumberFormat#mask property of a new number format that replaces the current format.

When a function is specified, it is the CustomFormat#formatter property of a new custom format that replaces the current format.

When an object is specified, it configures the current format object.

Alternatively, direct instances of NumberFormat and CustomFormat can be specified, replacing the existing format.

The global default of the number format mask is "#,0.##" — numbers are first rounded to decimal places. Then, they are formatted with a thousands group separator and only significant decimal places.

See the NumberFormatStyle for information on the global default number styles.

See also related information in pvc.options.charts.BasicChart#valueFormat.


{string|function|object|pvc.options.format.NumberFormat|pvc.options.format.CustomFormat} percent
The format function/object used to format percentage numbers.

The formatting function should multiply the numeric value by 100.

This function is used whenever a chart needs to show percentages, like in the tooltips of a stacked chart or the percentages shown in a Pie chart.

When a string is specified, it is the NumberFormat#mask property of a new number format that replaces the current format.

When a function is specified, it is the CustomFormat#formatter property of a new custom format that replaces the current format.

When an object is specified, it configures the current format object.

Alternatively, direct instances of NumberFormat and CustomFormat can be specified, replacing the existing format.

The global default percent mask is "#,0.#%" — numbers are first multiplied by 100 and then rounded to one decimal place. Then, they are formatted with a thousands group separator, with only significant decimal places, and by appending a "%" character.

See the NumberFormatStyle for information on the global default number styles.

See also related information in pvc.options.charts.Chart#percentValueFormat.


Documentation generated by JsDoc Toolkit 2.4.0 on Thu Dec 20 2018 15:47:43 GMT-0000 (WET)