How to use the @antv/scale/lib.isCategory function in @antv/scale

To help you get started, we’ve selected a few @antv/scale examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G2 / src / chart / controller / scale.js View on Github external
_getScaleCfg(type, field, data) {
    const cfg = {
      field
    };
    const values = Util.Array.values(data, field);
    cfg.values = values;
    if (!Scale.isCategory(type) && type !== 'time') {
      const range = Util.Array.getRange(values);
      cfg.min = range.min;
      cfg.max = range.max;
      cfg.nice = true;
    }

    if (type === 'time') {
      cfg.nice = false;
    }
    return cfg;
  }

@antv/scale

Toolkit for mapping abstract data into visual representation.

MIT
Latest version published 6 months ago

Package Health Score

73 / 100
Full package analysis