Scales

Scales is a key-value object where keys are scale names and values are scale configs.

scales: {
    y: {
        type: 'linear'
        min: 0,
    }
}

Configuration

Type

scale.type.

  • 'linear' - linear scale
  • 'logarithmic' - logarithmic scale (log10)

Normalization

scale.normalize: boolean

If true, then normalize all series data in the scale to the given base (100% by default)

scale.normalizeBase: number

Normalization base

Ranges

Minimum and maximum

  • scale.min: number - scale minimum
  • scale.max: number - scale maximum

Range

scale.range:

  • 'nice' - NiceScale implementation with extra features to make charts look nice for stacked areas
  • 'offset' - static offset from data min and max
  • (u: uPlot, min: number, max: number, cfg: YagrConfig) => [min: number, max: number] - custom function

scale.offset: number

Offset value for scale.range = 'offset'.
scale.minRange: number

The minimum value of the scale range between min and max. Use to stabilize NiceScale with different scale bases.

Stacking

scale.stacking: boolean

This stacks values on a given scale. False by default. To define different stacks see stacking groups for more info.

Transformations

scale.transform

transform?: (v: number | null, series: DataSeries[], idx: number) => number;

This function is used to transform all the values on a given scale.