Meta

4 min read

Through meta, you can configure the data metadata information of the chart globally, and the configuration is carried out by the unit of field. The configuration on 'meta' affects the text information of all components at the same time.

Configuration mode

Pass in a configuration with field name key, MetaOption as value, and set meta information for multiple fields at the same time.

{
  meta: {
    [field: string]: MetaOption
  }
}

Example:

{
  meta: {
    sale: {
      min: 0,
      max: 100,
    },
  }
}

Detail configuration item

MetaOption The configuration is as follows:

MetaOption.type

string optional

Declare the measurement type:

Measure typeDescription
Classification measurement- cat: Classification measurement
- timeCat: Time classification measurement
Continuous measurement- linear: Linear measurement
- time:Continuous time measurement
- log: Log measurement
- pow: Pow measurement
- quantize:Segmentation measurement, where users can specify non-uniform segments
- quantile: Equal measurement, according to the distribution of data automatically calculate segmentation
Constant measurement- identity: Constant measurement

MetaOption.alias

string optional

Data field display alias, scale is not internal awareness, external injection.

MetaOption.values

any[] optional

Input field, definition field.

MetaOption.formatter

(value: any, index?: number) => any optional

The tick formatting function affects the display of data on Axis, Legend, and Tooltip.

MetaOption.range

[number, number] optional default: [0, 1]

Output field and value field represent the range available for drawing within the drawing range.

MetaOption.sync

boolean | string optional
{
  meta: {
    {
      x: { sync: true },
      y: { sync: true },
      x1: { sync: 'x1' },
      x2: { sync: 'x1' },
    }
  }
}

Synchronous scale. sync: boolean is sync: [key], The above case x: { sync: true } is equivalent to x: { sync: 'x' }y: { sync: true } is equivalent to y: { sync: 'y' },Therefore, with the above configuration, the measurement operation will be synchronized for fields X and Y and fields X1 and X2 respectively.

MetaOption.min

any optional

Domain minimum value, d3 is the domain, ggplot2 is the limits, not valid under type.

MetaOption.max

any optional

The maximum value of the domain. Invalid under type.

MetaOption.minLimit

any optional

The smallest value of the domain in strict mode. Set to force ticks to start at the smallest.

MetaOption.maxLimit

any optional

The maximum value of the domain in strict mode, which forces the ticks to end at the maximum.

MetaOption.base

number optional

Log is valid. Base.

MetaOption.exponent

number optional

Pow valid, exponent.

MetaOption.nice

boolean optional

Automatically adjust min and Max.

MetaOption.ticks

any[] optional

Use to specify tick, with the highest priority.

MetaOption.tickInterval

number optional

Tick interval, only for type and time type, takes precedence over tickCount.

MetaOption.minTickInterval

number optional

The tick interval is minimal and applies only to linear.

MetaOption.tickCount

number optional default: 5

The number of tick.

MetaOption.maxTickCount

number optional default: 10

Ticks maximum.

MetaOption.tickMethod

string | TickMethod optional

Algorithms for calculating ticks.

MetaOption.showLast

boolean optional

Only applies to scale of type: 'cat' and 'time-cat', forcing the last tick to be contained. Attention: if you have been config tickMethod (means customize ticks), will cause showLast not work

MetaOption.mask

string optional

Time measures Time and is valid when TIMECAT. The underlying use [fecha] (https://github.com/taylorhakes/fecha#formatting-tokens) for the date format, so for the mask strings can directly refer to their wording.