ChartFactor handles the data based on specific structures and metadata that is usually provided by the user when the visualization is built (using Attributes, Metrics…) and also by the Data Provider itself. This metadata is mostly related with field types, names, and labels.
This metadata is standard, so it means that no matter what the provider is, a “translation” must be done from the provider metadata to ChartFactor metadata.
A field, as ChartFactor understands it, is an object containing the following attributes:
This is the field id, it is what ChartFactor uses to identify a field as unique. It matches with the field name used in the data source. Example: eventid, lastname, pricepaid, saletime, catname.
There are two major types of fields: Attributes and Metrics.
Attributes themselves are divided into two types: Normal and Time attributes. Within these types we find all varchar, datetime, date, string, boolean and other types that are different from one provider to another.
Metrics are basically numbers, and there are four main types: Integer, Money, Percent and Number. Integers represents non floating numbers. Money and Percent are floating number fields and their goal is to format (visualy) by adding a ($) or (%) to the value. Number is any other numeric field, commoly floating numbers. The purpose of these three types is to target almost all other types like long, int, double, float, etc.. used in different providers and give a way to format them when visualizing.
Labels are the “friendly” names for a field. It is meant to be displayed instead of the field name in the visualization. So instead of lastname / pricepaid, we could have Last Name / Price. If a field label is not specified in the metadata definition, ChartFactor capitalizes the first leter of the field name for display purposes.
ChartFactor allows to specify field labels using its custom metadata structure. Additionally, the Raw Data Table allows overwriting field labels using the cf.Field object.
This applies to time attributes and metrics in some cases. For time attributes, the function is the time unit or time granularity being used by the field. For each provider, a ‘translation’ must be done. So for example, for a date field, usually the lowest unit is DAY, and for datetimes can be MINUTE or SECOND.
Metrics use this function only when the data is queried to know what type of operation (sum, avg, min, max, unique) should be performed on the provider’s source.