{"version":3,"file":"ajf-core-chart.mjs","sources":["../../../projects/core/chart/src/chart.ts","../../../projects/core/chart/src/chart.html","../../../projects/core/chart/src/chart-module.ts","../../../projects/core/chart/src/public_api.ts","../../../projects/core/chart/src/ajf-core-chart.ts"],"sourcesContent":["/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {deepCopy} from '@ajf/core/utils';\nimport {\n  AfterViewInit,\n  ChangeDetectionStrategy,\n  Component,\n  ElementRef,\n  Input,\n  OnChanges,\n  Renderer2,\n  SimpleChanges,\n  ViewEncapsulation,\n} from '@angular/core';\n\nimport {Chart, ChartData, ChartOptions, ChartType} from 'chart.js';\n\n// We only need to set canvasDataUrl of the AjfChartWidgetInstance here,\n// avoid importing the actual interface because of the circular dependency:\ninterface ChartWidgetInstance {\n  canvasDataUrl?(): string;\n}\n\n@Component({\n  selector: 'ajf-chart',\n  templateUrl: 'chart.html',\n  styleUrls: ['chart.scss'],\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class AjfChartComponent implements AfterViewInit, OnChanges {\n  @Input() data?: ChartData;\n  @Input() options?: ChartOptions;\n  @Input() chartType?: ChartType;\n  @Input() instance?: ChartWidgetInstance;\n\n  /**\n   * When specified, this number of different single data entries will be displayed as separate\n   * options/bars/slices in the chart. The rest will be displayed as an aggregate \"other\" option/bar/slice.\n   */\n  @Input()\n  set mainDataNumberThreshold(mainDataNumberThreshold: number | undefined) {\n    this._mainDataNumberThreshold =\n      mainDataNumberThreshold || mainDataNumberThreshold === 0 ? mainDataNumberThreshold : 10;\n  }\n  private _mainDataNumberThreshold: number = 10;\n\n  /**\n   * If true remove zero values from the chart dataset\n   */\n  @Input()\n  set removeZeroValues(removeZeroValues: boolean | undefined) {\n    this._removeZeroValues = Boolean(removeZeroValues);\n  }\n  private _removeZeroValues: boolean = false;\n\n  private _chart: Chart | null = null;\n  private _chartCanvasElement: HTMLCanvasElement | null = null;\n\n  constructor(private _el: ElementRef, private _renderer: Renderer2) {}\n\n  ngAfterViewInit(): void {\n    this._rebuildChart();\n  }\n\n  ngOnChanges(changes: SimpleChanges): void {\n    if ('chartType' in changes) {\n      this._rebuildChart();\n    } else if ('options' in changes || 'data' in changes) {\n      this._updateChart();\n    }\n    if ('instance' in changes && this.instance != null) {\n      this.instance.canvasDataUrl = () => {\n        if (this._chartCanvasElement == null) {\n          return '';\n        }\n        return this._chartCanvasElement.toDataURL();\n      };\n    }\n  }\n\n  private _fixData(data: ChartData): ChartData {\n    const newData: ChartData = deepCopy(data);\n    let maxPointsNum = 0;\n    (newData.datasets || []).forEach(dataset => {\n      if (dataset.label == null) {\n        dataset.label = '';\n      }\n      maxPointsNum = Math.max(maxPointsNum, (dataset.data || []).length);\n    });\n    const labels = newData.labels || [];\n    if (maxPointsNum > 0 && labels.length < maxPointsNum) {\n      for (let i = labels.length; i < maxPointsNum; i++) {\n        labels.push('');\n      }\n      newData.labels = labels;\n    }\n    if (\n      newData.datasets &&\n      this.chartType &&\n      ['bar', 'horizontalBar', 'doughnut', 'pie'].includes(this.chartType)\n    ) {\n      return this._rebuildDatasets(newData);\n    }\n    return newData;\n  }\n\n  /**\n   * Rebuilds datasets by aggregating options and omitting the unselected ones.\n   * @param data The original chartData with datasets\n   * @returns The chartData with rebuilt datasets\n   */\n  private _rebuildDatasets(data: ChartData): ChartData {\n    const datasets = data.datasets;\n    if (!datasets || !datasets.length) return data;\n    if (datasets.length === 1 && datasets[0].data && datasets[0].data.length > 1) {\n      // pie, doughnut\n      let rebuiltDatasets = datasets[0].data.map((value, idx) => {\n        const label = data.labels && data.labels[idx] ? (data.labels[idx] as string) : '';\n        return {value: value as number, label};\n      });\n\n      if (this._mainDataNumberThreshold && this._mainDataNumberThreshold > 0) {\n        const sortedDatasets = [...rebuiltDatasets].sort((a, b) => {\n          if (a.value != null && b.value != null) {\n            return +b.value - +a.value;\n          }\n          return 0;\n        });\n        const datasetsOverThreshold = sortedDatasets.splice(0, this._mainDataNumberThreshold);\n        const otherDataset = {...sortedDatasets[0]};\n        if (sortedDatasets.length && otherDataset.value) {\n          const otherDatasetsTotal = sortedDatasets\n            .map(sd => sd.value)\n            .reduce((total, num) => {\n              if (total != null && num != null) {\n                return +total + +num;\n              }\n              return 0;\n            });\n          otherDataset.value = otherDatasetsTotal;\n          otherDataset.label = 'Other';\n          rebuiltDatasets = [...datasetsOverThreshold, otherDataset];\n        } else {\n          rebuiltDatasets = [...datasetsOverThreshold];\n        }\n      }\n      if (this._removeZeroValues) {\n        rebuiltDatasets = rebuiltDatasets.filter(ds => ds.value);\n      }\n      const newDataset = [{...datasets[0], data: rebuiltDatasets.map(d => d.value)}];\n      return {...data, labels: rebuiltDatasets.map(d => d.label), datasets: newDataset};\n    } else {\n      // bar, horizontalBar\n      let rebuiltDatasets = [...datasets];\n      if (this._mainDataNumberThreshold && this._mainDataNumberThreshold > 0) {\n        const sortedDatasets = [...rebuiltDatasets].sort((a, b) => {\n          if (a.data && b.data && a.data[0] != null && b.data[0] != null) {\n            return +b.data[0] - +a.data[0];\n          }\n          return 0;\n        });\n        const datasetsOverThreshold = sortedDatasets.splice(0, this._mainDataNumberThreshold);\n        const otherDataset = {...sortedDatasets[0]};\n        if (sortedDatasets.length && otherDataset.data) {\n          const otherDatasetsTotal = sortedDatasets\n            .map(sd => sd.data && sd.data[0])\n            .reduce((total, num) => {\n              if (total != null && num != null) {\n                return +total + +num;\n              }\n              return 0;\n            });\n          otherDataset.data[0] = otherDatasetsTotal;\n          otherDataset.label = 'Other';\n          rebuiltDatasets = [...datasetsOverThreshold, otherDataset];\n        } else {\n          rebuiltDatasets = [...datasetsOverThreshold];\n        }\n      }\n      if (this._removeZeroValues) {\n        rebuiltDatasets = rebuiltDatasets.filter(ds => ds.data);\n      }\n      return {...data, datasets: rebuiltDatasets};\n    }\n  }\n\n  private _updateChart(): void {\n    if (this._chart == null) {\n      this._rebuildChart();\n    } else {\n      (<any>this._chart).options = {\n        ...deepCopy((<any>this._chart).options),\n        ...deepCopy(this.options || {}),\n      };\n      this._chart.data = {\n        ...deepCopy(this._chart.data),\n        ...deepCopy(this.data),\n      };\n      this._chart.update();\n    }\n  }\n\n  private _rebuildChart(): void {\n    if (this._chart != null) {\n      this._chart.destroy();\n      this._chart = null;\n    }\n    if (this._chartCanvasElement != null) {\n      this._chartCanvasElement.remove();\n      this._chartCanvasElement = null;\n    }\n    if (this.data != null) {\n      this._chartCanvasElement = this._renderer.createElement('canvas');\n      const widgetExportElement: HTMLElement = this._el.nativeElement.parentElement.parentElement;\n      const height = widgetExportElement.clientHeight;\n      const width = widgetExportElement.clientWidth;\n      if (widgetExportElement != null) {\n        if (height > 0) {\n          this._renderer.setStyle(this._el.nativeElement, 'height', `${height}px`);\n          this._renderer.setStyle(this._chartCanvasElement, 'height', `${height}px`);\n        }\n        if (width > 0) {\n          this._renderer.setStyle(this._chartCanvasElement, 'width', width);\n        }\n      } else {\n        this._renderer.setStyle(this._chartCanvasElement, 'width', 'inherit');\n        this._renderer.setStyle(this._chartCanvasElement, 'height', 'inherit');\n      }\n      this._renderer.appendChild(this._el.nativeElement, this._chartCanvasElement);\n      if (this.chartType != null) {\n        const ctx = this._chartCanvasElement!.getContext('2d') as CanvasRenderingContext2D;\n        this._chart = new Chart(ctx, {\n          type: this.chartType,\n          data: this._fixData(this.data),\n          options: this.options,\n        });\n      }\n    }\n  }\n}\n","","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {NgModule} from '@angular/core';\n\nimport {AjfChartComponent} from './chart';\n\n@NgModule({\n  declarations: [AjfChartComponent],\n  exports: [AjfChartComponent],\n})\nexport class AjfChartModule {}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport * from './chart';\nexport * from './chart-module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAoBG;MA8BU,iBAAiB,CAAA;AAM5B;;;AAGG;IACH,IACI,uBAAuB,CAAC,uBAA2C,EAAA;AACrE,QAAA,IAAI,CAAC,wBAAwB;AAC3B,YAAA,uBAAuB,IAAI,uBAAuB,KAAK,CAAC,G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