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

from functools import partial
from operator import is_not

class contourDensity:
    def __init__(self, content="contourDensity"):
        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 x(self, x=None):
        """
        Source · If x is specified, sets the x-coordinate accessor. If x is not specified,
        returns the current x-coordinate accessor, which defaults to:
        .. code:: javascript

            function x(d) {
              return d[0];
            }


        See more informations `here <https://d3js.org/d3-contour/density#density_x>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (x,))))
        return contourDensity(content=f"{self.content}.x({arguments})")


    def y(self, y=None):
        """
        Source · If y is specified, sets the y-coordinate accessor. If y is not specified,
        returns the current y-coordinate accessor, which defaults to:
        .. code:: javascript

            function y(d) {
              return d[1];
            }


        See more informations `here <https://d3js.org/d3-contour/density#density_y>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (y,))))
        return contourDensity(content=f"{self.content}.y({arguments})")


    def weight(self, weight=None):
        """
        Source · If weight is specified, sets the accessor for point weights. If weight is not
        specified, returns the current point weight accessor, which defaults to:
        .. code:: javascript

            function weight() {
              return 1;
            }


        See more informations `here <https://d3js.org/d3-contour/density#density_weight>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (weight,))))
        return contourDensity(content=f"{self.content}.weight({arguments})")


    def size(self, size=None):
        """
        Source · If size is specified, sets the size of the density estimator to the specified
        bounds and returns the estimator. The size is specified as an array [width, height],
        where width is the maximum x-value and height is the maximum y-value. If size is not
        specified, returns the current size which defaults to [960, 500]. The estimated density
        contours are only accurate within the defined size.

        See more informations `here <https://d3js.org/d3-contour/density#density_size>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (size,))))
        return contourDensity(content=f"{self.content}.size({arguments})")


    def cellSize(self, cellSize=None):
        """
        Source · If cellSize is specified, sets the size of individual cells in the underlying
        bin grid to the specified positive integer and returns the estimator. If cellSize is
        not specified, returns the current cell size, which defaults to 4. The cell size is
        rounded down to the nearest power of two. Smaller cells produce more detailed contour
        polygons, but are more expensive to compute.

        See more informations `here <https://d3js.org/d3-contour/density#density_cellSize>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (cellSize,))))
        return contourDensity(content=f"{self.content}.cellSize({arguments})")


    def thresholds(self, thresholds=None):
        """
        Source · If thresholds is specified, sets the threshold generator to the specified
        function or array and returns this contour generator. If thresholds is not specified,
        returns the current threshold generator, which by default generates about twenty
        nicely-rounded density thresholds.
        Thresholds are defined as an array of values [x0, x1, …]. The first generated density
        contour corresponds to the area where the estimated density is greater than or equal to
        x0; the second contour corresponds to the area where the estimated density is greater
        than or equal to x1, and so on. Thus, there is exactly one generated MultiPolygon
        geometry object for each specified threshold value; the threshold value is exposed as
        geometry.value. The first value x0 should typically be greater than zero.
        If a count is specified instead of an array of thresholds, then approximately count
        uniformly-spaced nicely-rounded thresholds will be generated; see ticks.

        See more informations `here <https://d3js.org/d3-contour/density#density_thresholds>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (thresholds,))))
        return contourDensity(content=f"{self.content}.thresholds({arguments})")


    def bandwidth(self, bandwidth=None):
        """
        Source · If bandwidth is specified, sets the bandwidth (the standard deviation) of the
        Gaussian kernel and returns the estimate. If bandwidth is not specified, returns the
        current bandwidth, which defaults to 20.4939…. The specified bandwidth is currently
        rounded to the nearest supported value by this implementation, and must be nonnegative.

        See more informations `here <https://d3js.org/d3-contour/density#density_bandwidth>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (bandwidth,))))
        return contourDensity(content=f"{self.content}.bandwidth({arguments})")


    def contours(self, data=None):
        """
        Examples · Source · Return a contour(value) function that can be used to compute an
        arbitrary contour on the given data without needing to recompute the underlying grid.
        The returned contour function also exposes a contour.max value which represents the
        maximum density of the grid.

        See more informations `here <https://d3js.org/d3-contour/density#density_contours>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (data,))))
        return contourDensity(content=f"{self.content}.contours({arguments})")

