Class pvc.options.DimensionType
Constructor Attributes | Constructor Name and Description |
---|---|
The options documentation class of a dimension type.
|
Field Attributes | Field Name and Description |
---|---|
Data | |
Indicates if a dimension type should be considered discrete
or continuous.
|
|
Specifies which dimension or a combination of dimensions
will make the row unique.
|
|
A protovis format string that is to parse the raw value.
|
|
The type of value that dimensions of this type will hold.
|
|
Presentation | |
The dimension type's format provider.
|
|
Indicates if values of this dimension type
should be hidden from the user.
|
|
The name of the dimension type as it is shown to the user.
|
Method Attributes | Method Name and Description |
---|---|
Data | |
comparer(a, b)
A function that compares two different and non-null values of the dimension's
pvc.options.DimensionType#valueType.
|
|
converter(sourceValue)
Converts a non-null raw value,
as read from the data source,
into a value of the dimension's #valueType.
|
|
key(value)
A function that converts a non-null value of the dimension's
pvc.options.DimensionType#valueType
into a string that (uniquely) identifies
the value in the dimension.
|
|
Presentation | |
formatter(value, sourceValue)
A function that formats a value,
possibly null,
of the dimension's
pvc.options.DimensionType#valueType.
|
Only dimension types whose #valueType is one of varia.DimensionValueType#Number or varia.DimensionValueType#Date can be continuous.
Some chart types support binding a continuous or a discrete dimension to a visual role, yielding different visual results. An example is the "color" visual role of the Metric Line/Dot charts. Another example is the Line/Dot/Area chart that supports both a continuous or a discrete dimension in its "category" visual role.
The default value dependends on the value of #valueType. If it can be continuous, then the default value is false. If it cannot, the default value is true.
Currently, this option is ignored unless the option #converter is unspecified and the value type is varia.DimensionValueType#Date.
When the chart option charts.Chart#timeSeriesFormat, is specified, and the value type is varia.DimensionValueType#Date, it is taken as the default value of this option.
A converter function is created to parse raw values with the specified format string.
- Default Value:
- null
When the option #formatter is specified, this one is ignored.
When a string, it is the mask of the format.FormatProvider#number or format.FormatProvider#date formats, depending on the dimension's the dimension's DimensionType#valueType, of a new format provider that replaces the current one.
When a function, it is the formatter of the format.FormatProvider#number or format.FormatProvider#date custom formats, depending on the dimension's the dimension's DimensionType#valueType, of a new format provider that replaces the current one. Note that specifying a function to this property is equivalent to specifying DimensionType#formatter.
When an object is specified, it configures the current format object.
Alternatively, a direct instance of format.FormatProvider, can be specified, replacing the existing format provider. Instead, specifying format.NumberFormat, format.DateFormat, or format.CustomFormat configures the existing format provider.
A protovis format string that is to format a value of the dimension's DimensionType#valueType.
When unspecified, and the dimension type's value type is varia.DimensionValueType#Date, and the property #rawFormat is specified, a format string is derived from the later by replacing the "-" character with a "/" character.
Otherwise, the dimension type's format provider inherits its property values from the chart's format provider.
This option is useful to hide auxiliar dimensions that are used to:
- hold extra data, required for drill-down purposes
- complete the minimal working information a chart needs to work, like, for example, a "series" dimension created automatically by a chart if its required "series" visual role was not unbound
The only place where the values of a dimension that is not bound to a visual role are shown to the user is the tooltip, as it is formatted by default. To prevent this, set the dimension type's isHidden option to true.
- Default Value:
- false
The label should be unique.
The default value is built from the dimension name, by converting the first character to upper case.
When unspecified, a default natural order comparer function is applied to the continuous value types: varia.DimensionValueType#Number and varia.DimensionValueType#Date.
Dimension types that do not have a comparer function "compare" their values by "input order" - order of first appearance, in the data source.
- Context:
- {null}
- Arguments:
- {any} a
- The first value to compare.
- {any} b
- The second value to compare.
- Returns:
- {number} The number 0 if the two values have the same order, a negative number if a is before b, and a positive number if a is after b.
The returned value need not have the type of the dimension's value type. Yet, it must be such that the associated value type's cast function can convert it to the dimension's value type. In this way, only "non-standard" conversions need to be handled with a converter function.
Values that are not convertible by the dimension's value type cast function become null.
Also, note that the only value type that does not have a cast function is the varia.DimensionValueType#Any.
When unspecified and the value type is varia.DimensionValueType#Date, and the option #rawFormat is specified a default converter is created for it.
- Context:
- {null}
- Arguments:
- {any} sourceValue
- The non-null source value to convert.
In the case where the raw value to convert is a Google-table-like cell, it is the value of its v property that is passed to this argument.
- Returns:
- {any} The converted value.
The default key function is the standard JavaScript String function, and is suitable for most value types.
If the dimension's value type is one of varia.DimensionValueType#Any or varia.DimensionValueType#Object the String function may not be suitable to identify the values.
If more than one value has a given key, only the first one will be stored in the dimension.
- Context:
- {null}
- Arguments:
- {any} value
- The non-null value to convert.
- Returns:
- {string} The corresponding key.
Note that, the chart option charts.BasicChart#valueFormat, is used to build a default formatter function for numeric dimensions of the "value" dimension group.
When unspecified and the value type is varia.DimensionValueType#Number, a default formatter is created that formats numbers with two decimal places.
When unspecified and the value type is varia.DimensionValueType#Date, and the option #format is specified (or implied) a default formatter is created for it.
Otherwise a value is formatted by calling the standard JavaScript String function on it.
- Context:
- {null}
- Arguments:
- {any} value
- The value to format.
- {any} sourceValue Optional
- The source (or raw) value,
when the value was read from a data source,
or
undefined, otherwise.
In the case where the raw value is a Google-table-like cell, it is the value of its v property that is passed to this argument.
- Returns:
- {string} The string that is the formatted value. Only the null value should have the empty string as the formatted value.