# Generated by detroit
# See https://github.com/bourbonut/detroit/tree/main/api_maker

from functools import partial
from operator import is_not

class scaleThreshold:
    def __init__(self, content="scaleThreshold"):
        self.content = content

    def __repr__(self):
        return self.content

    def __str__(self):
        return self.content

    def __call__(self, *args):
        arguments = ", ".join(map(repr, args))
        return f"{self}({arguments})"

    def invertExtent(self, value=None):
        """
        Source · Returns the extent of values in the domain [x0, x1] for the corresponding
        value in the range, representing the inverse mapping from range to domain.
        .. code:: javascript

            const color = d3.scaleThreshold([0, 1], ["red", "white", "green"]);
            color.invertExtent("red"); // [undefined, 0]
            color.invertExtent("white"); // [0, 1]
            color.invertExtent("green"); // [1, undefined]

        This method is useful for interaction, say to determine the value in the domain that
        corresponds to the pixel location under the mouse. The extent below the lowest
        threshold is undefined (unbounded), as is the extent above the highest threshold.

        See more informations `here <https://d3js.org/d3-scale/threshold#threshold_invertExtent>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (value,))))
        return scaleThreshold(content=f"{self.content}.invertExtent({arguments})")


    def domain(self, domain=None):
        """
        Auto generated method
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (domain,))))
        return scaleThreshold(content=f"{self.content}.domain({arguments})")


    def range(self, range=None):
        """
        Examples · Source · If range is specified, sets the scale’s range to the specified
        array of values.
        .. code:: javascript

            const color = d3.scaleThreshold().range(["red", "white", "green"]);

        If the number of values in the scale’s domain is n, the number of values in the scale’s
        range must be n + 1. If there are fewer than n + 1 elements in the range, the scale may
        return undefined for some inputs. If there are more than n + 1 elements in the range,
        the additional values are ignored. The elements in the given array need not be numbers;
        any value or type will work.
        If range is not specified, returns the scale’s current range.
        .. code:: javascript

            color.range() // ["red", "white", "green"]


        See more informations `here <https://d3js.org/d3-scale/threshold#threshold_range>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (range,))))
        return scaleThreshold(content=f"{self.content}.range({arguments})")


    def copy(self):
        """
        Examples · Source · Returns an exact copy of this scale.
        .. code:: javascript

            const c1 = d3.scaleThreshold(d3.schemeBlues[5]);
            const c2 = c1.copy();

        Changes to this scale will not affect the returned scale, and vice versa.

        See more informations `here <https://d3js.org/d3-scale/threshold#threshold_copy>`_.
        """
        return scaleThreshold(content=f"{self.content}.copy()")


    def nice(self):
        """
        Auto generated method
        """
        return scaleThreshold(content=f"{self.content}.nice()")

