Function scaleOrdinal

  • Constructs a new ordinal scale with the specified range. The domain defaults to the empty array. If range is not specified, it defaults to the empty array; an ordinal scale always returns undefined until a non-empty range is defined.

    The generic corresponds to the data type of range elements.

    Type Parameters

    • Range

    Parameters

    • Optional range: Iterable<Range>

      An optional array of range values to initialize the scale with.

    Returns ScaleOrdinal<string, Range>

  • Constructs a new ordinal scale with the specified range. The domain defaults to the empty array. If range is not specified, it defaults to the empty array; an ordinal scale always returns undefined until a non-empty range is defined.

    The first generic corresponds to the data type of domain elements. The second generic corresponds to the data type of range elements. The third generic corresponds to the data type of the unknown value.

    Type Parameters

    • Domain extends {
          toString(): string;
      }

    • Range

    • Unknown = never

    Parameters

    • Optional range: Iterable<Range>

      An optional array of range values to initialize the scale with.

    Returns ScaleOrdinal<Domain, Range, Unknown>

  • Constructs a new ordinal scale with the specified domain and range.

    The first generic corresponds to the data type of domain elements. The second generic corresponds to the data type of range elements. The third generic corresponds to the data type of the unknown value.

    Type Parameters

    • Domain extends {
          toString(): string;
      }

    • Range

    • Unknown = never

    Parameters

    • domain: Iterable<Domain>

      Array of domain values.

    • range: Iterable<Range>

      An optional array of range values to initialize the scale with.

    Returns ScaleOrdinal<Domain, Range, Unknown>