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AAU,KAAmB,EAAA;AAC3B,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,WAAW,KAAe,EAAA;AACxB,IAAA,IAAA,CAAK,MAAS,GAAA,KAAA;AACd,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,UAAU,KAAe,EAAA;AACvB,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAO,OAAA,IAAA;AAAA;AAEX","file":"donut.mjs","sourcesContent":["import { IElement, Element } from '../base';\n\nimport { ChartColor } from './color';\n\nexport interface IDonutChart extends IElement {\n  type: 'Chart.Donut';\n\n  /**\n   * the title of the chart.\n   */\n  title?: string;\n\n  /**\n   * the name of the set of colors to use.\n   */\n  colorSet?: string;\n\n  /**\n   * the data to display in the chart.\n   */\n  data: IDonutChartData[];\n\n  /**\n   * the area of a `Layout.AreaGrid` layout in which an element should be displayed.\n   */\n  'grid.area'?: string;\n}\n\nexport type DonutChartOptions = Omit<IDonutChart, 'type' | 'data'>;\n\nexport class DonutChart extends Element implements IDonutChart {\n  type: 'Chart.Donut';\n\n  /**\n   * the title of the chart.\n   */\n  title?: string;\n\n  /**\n   * the name of the set of colors to use.\n   */\n  colorSet?: string;\n\n  /**\n   * the data to display in the chart.\n   */\n  data: IDonutChartData[];\n\n  constructor(...data: IDonutChartData[]) {\n    super();\n    this.type = 'Chart.Donut';\n    this.data = data;\n  }\n\n  withOptions(value: DonutChartOptions) {\n    Object.assign(this, value);\n    return this;\n  }\n\n  withTitle(value: string) {\n    this.title = value;\n    return this;\n  }\n\n  withColorSet(value: string) {\n    this.colorSet = value;\n    return this;\n  }\n\n  addData(...data: IDonutChartData[]) {\n    this.data.push(...data);\n    return this;\n  }\n}\n\nexport interface IDonutChartData {\n  /**\n   * the color to use for the data point.\n   */\n  color?: ChartColor;\n\n  /**\n   * the legend of the chart.\n   */\n  legend?: string;\n\n  /**\n   * the value associated with the data point.\n   */\n  value: number;\n}\n\nexport type DonutChartDataOptions = Omit<IDonutChartData, 'value'>;\n\nexport class DonutChartData implements IDonutChartData {\n  /**\n   * the color to use for the data point.\n   */\n  color?: ChartColor;\n\n  /**\n   * the legend of the chart.\n   */\n  legend?: string;\n\n  /**\n   * the value associated with the data point.\n   */\n  value: number;\n\n  constructor(value = 0, options: DonutChartDataOptions = {}) {\n    this.value = value;\n    this.withOptions(options);\n  }\n\n  withOptions(value: DonutChartDataOptions) {\n    Object.assign(this, value);\n    return this;\n  }\n\n  withColor(value: ChartColor) {\n    this.color = value;\n    return this;\n  }\n\n  withLegend(value: string) {\n    this.legend = value;\n    return this;\n  }\n\n  withValue(value: number) {\n    this.value = value;\n    return this;\n  }\n}\n"]}