
export type HistogramState = "disabled" | "ready";

/**
 * Function used to style or attach custom interaction to histogram bars. This function should be set to the
 * [Histogram#barCreatedFunction](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Histogram.html#barCreatedFunction) property. It fires
 * for each bar when it is created.
 *
 * @param index - The index of the histogram bar. This directly corresponds
 *   to the index of the associated [bin](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Histogram.html#bins).
 * @param element - The histogram bar element to style.
 */
export type BarCreatedFunction = (index: number, element: SVGElement) => void;

/**
 * Function used to style [Histogram#dataLines](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Histogram.html#dataLines). This function should be set to the
 * [Histogram#dataLineCreatedFunction](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Histogram.html#dataLineCreatedFunction) property. It fires
 * when each data line is created.
 *
 * @param lineElement - The SVG element representing the data line rendered
 *   on the histogram.
 * @param labelElement - The SVG element representing the label
 *    rendered on the histogram for the associated line element.
 * @param index - The index of the data line.
 */
export type DataLineCreatedFunction = (lineElement: SVGElement, labelElement?: SVGElement | null | undefined, index?: number | null | undefined) => void;

export interface DataLineInfos {
  /** The label associated with the line. */
  label?: string | number | null;
  /** The value on the data axis of the histogram where a line will be rendered. */
  value: number;
}