How to use the vega-lite/build/src/scale.ScaleType.BAND function in vega-lite

To help you get started, we’ve selected a few vega-lite 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 apache-superset / superset-ui-plugins / packages / superset-ui-preset-chart-xy / src / encodeable / parsers / extractScale.ts View on Github external
export function deriveScaleTypeFromDataTypeAndChannelType(
  dataType: Type | undefined,
  channelType: ChannelType,
  isBinned: boolean = false,
): ScaleType | undefined {
  if (typeof dataType === 'undefined') {
    return undefined;
  } else if (dataType === 'nominal' || dataType === 'ordinal') {
    switch (channelType) {
      // For positional (x and y) ordinal and ordinal fields,
      // "point" is the default scale type for all marks
      // except bar and rect marks, which use "band" scales.
      // https://vega.github.io/vega-lite/docs/scale.html
      case 'XBand':
      case 'YBand':
        return ScaleType.BAND;
      case 'X':
      case 'Y':
      case 'Numeric':
        return ScaleType.POINT;
      case 'Color':
      case 'Category':
        return ScaleType.ORDINAL;
      default:
    }
  } else if (dataType === 'quantitative') {
    switch (channelType) {
      case 'XBand':
      case 'YBand':
      case 'X':
      case 'Y':
      case 'Numeric':
github apache-superset / superset-ui-plugins / packages / superset-ui-preset-chart-xy / src / encodeable / parsers / extractScale.ts View on Github external
return scaleTime<output>();
    case ScaleType.UTC:
      return scaleUtc<output>();
    case ScaleType.QUANTILE:
      return scaleQuantile<output>();
    case ScaleType.QUANTIZE:
      return scaleQuantize<output>();
    case ScaleType.THRESHOLD:
      return scaleThreshold();
    case ScaleType.BIN_ORDINAL:
      return scaleOrdinal&lt;{ toString(): string }, Output&gt;();
    case ScaleType.ORDINAL:
      return scaleOrdinal&lt;{ toString(): string }, Output&gt;();
    case ScaleType.POINT:
      return scalePoint&lt;{ toString(): string }&gt;();
    case ScaleType.BAND:
      return scaleBand&lt;{ toString(): string }&gt;();
    default:
      return undefined;
  }
}
</output></output></output></output>