@esfaenza/es-charts 15.2.3 → 15.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ContentChild, InjectionToken, Inject, PLATFORM_ID, NgModule, Directive } from '@angular/core';
2
+ import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ContentChild, InjectionToken, Inject, Directive, PLATFORM_ID, NgModule } from '@angular/core';
3
3
  import * as i5 from '@angular/common';
4
- import { CommonModule, isPlatformBrowser } from '@angular/common';
4
+ import { isPlatformBrowser, CommonModule } from '@angular/common';
5
5
  import * as am4core from '@amcharts/amcharts4/core';
6
6
  import * as am4charts from '@amcharts/amcharts4/charts';
7
- import * as i4 from '@esfaenza/extensions';
8
- import * as i4$1 from '@esfaenza/localizations';
7
+ import * as i3 from '@esfaenza/extensions';
8
+ import * as i4 from '@esfaenza/localizations';
9
9
 
10
10
  /**
11
11
  * Adapter Base da reimplementare per trasformare i dati da una libreria di grafici a questa per evitare di riscrivere tutto il codice di
@@ -459,376 +459,214 @@ const ESC_THEME = new InjectionToken('ESC_THEME');
459
459
  const ESC_LOGS = new InjectionToken('ESC_LOGS');
460
460
 
461
461
  /**
462
- * Classe il cui unico scopo è gestire il setup e rendering di un LineChart
462
+ * Classe di supporto al caricamento dinamico dei vari pezzi di amcharts che mi servono per il grafico (temi, locali, ecc...)
463
+ *
464
+ * Essenzialmente ogni volta che viene creato un grafico, questo acquisisce il tema e il locale applicato IN QUEL MOMENTO,
465
+ * questo significa che per creare due grafici con temi diversi bisogna fare:
466
+ *
467
+ * 1) Caricamento tema 1
468
+ *
469
+ * 2) Creazione grafico 1
470
+ *
471
+ * 3) Scaricamento tema 1
472
+ *
473
+ * 3) Caricamento tema 2
474
+ *
475
+ * 4) Creazione grafico 2
476
+ *
463
477
  */
464
- class LineChartService {
465
- /** @ignore */
466
- constructor(Adapter, dateExts) {
467
- this.Adapter = Adapter;
468
- this.dateExts = dateExts;
469
- /** @ignore */
470
- this.DataGroupBucketSize = 1500;
471
- /** @ignore */
472
- this.OpacityOnSelected = 0.3;
473
- /** @ignore */
474
- this.OpacityOnFill = 0.75;
475
- /** @ignore */
476
- this.singleDataSet = false;
477
- //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
478
- //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
479
- /** @ignore */
480
- this.executionTimers = {};
481
- }
478
+ class ChartLoader {
482
479
  /**
483
- * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un LineChart
480
+ * @ignore
484
481
  */
485
- graphicate(data, settings) {
486
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
487
- let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
488
- let threshold = (_a = settings.DataGroupingThreshold) !== null && _a !== void 0 ? _a : 3000;
489
- this.singleDataSet = (_b = settings.MergeDatasets) !== null && _b !== void 0 ? _b : false;
490
- let showTicks = settings.ShowTicks == null ? true : settings === null || settings === void 0 ? void 0 : settings.ShowTicks;
491
- let dataShouldBeGrouped = Math.max(...dataConverted.series.map(t => t.values.length)) > threshold;
492
- let showTimeline = settings.Timeline || dataShouldBeGrouped;
493
- let seriesWithInterval = dataConverted.series.some(t => t.interval);
494
- let interval = seriesWithInterval ? dataConverted.series.find(t => t.interval).interval : null;
495
- let gapsAllowed = (settings === null || settings === void 0 ? void 0 : settings.AllowGaps) == null ? seriesWithInterval : settings === null || settings === void 0 ? void 0 : settings.AllowGaps;
496
- let finalInstant = (_c = settings === null || settings === void 0 ? void 0 : settings.FinalInstants) !== null && _c !== void 0 ? _c : true;
497
- //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
498
- am4core.options.autoDispose = true;
499
- this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
500
- let ChartInstanceCasted = this.ChartInstance;
501
- let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
502
- if (settings.YAxisTitle) {
503
- yAxis.title.text = settings.YAxisTitle;
504
- yAxis.title.fontWeight = "bold";
505
- }
506
- if (settings.Min)
507
- yAxis.min = settings.Min;
508
- if (settings.Max)
509
- yAxis.max = settings.Max;
510
- let limitNullOrUndef = dataConverted.limit == null || dataConverted.limit == undefined;
511
- let limits = limitNullOrUndef ? [] : !dataConverted.limit.length ? [dataConverted.limit] : dataConverted.limit;
512
- if (limits.length > 0) {
513
- for (let i = 0; i < limits.length; i++) {
514
- let limit = limits[i];
515
- if (limit.upper != null && limit.upper != undefined && limit.lower != null && limit.lower != undefined) {
516
- let range = yAxis.axisRanges.create();
517
- range.value = limit.lower;
518
- range.endValue = limit.upper;
519
- if (limit.fillColor) {
520
- range.contents.stroke = am4core.color(limit.fillColor);
521
- range.contents.fill = range.contents.stroke;
522
- }
523
- range.label.inside = true;
524
- range.label.text = limit.upperlabel;
525
- range.label.fill = range.grid.stroke;
526
- range.label.verticalCenter = "bottom";
527
- range.label.stroke = am4core.color(limit.uppercolor || "#F92200");
528
- range.grid.stroke = am4core.color(limit.uppercolor || "#F92200");
529
- range.grid.strokeWidth = 2;
530
- range.grid.strokeOpacity = 1;
531
- }
532
- else if ((limit.lower == null || limit.lower == undefined) && limit.upper != null && limit.upper != undefined) {
533
- let range = yAxis.axisRanges.create();
534
- range.value = limit.upper;
535
- range.label.inside = true;
536
- range.label.text = limit.upperlabel;
537
- range.label.fill = range.grid.stroke;
538
- range.label.verticalCenter = "bottom";
539
- range.label.stroke = am4core.color(limit.uppercolor || "#F92200");
540
- range.grid.stroke = am4core.color(limit.uppercolor || "#F92200");
541
- range.grid.strokeWidth = 2;
542
- range.grid.strokeOpacity = 1;
543
- }
544
- else if ((limit.upper == null || limit.upper == undefined) && limit.lower != null && limit.lower != undefined) {
545
- let range = yAxis.axisRanges.create();
546
- range.value = limit.lower;
547
- range.label.inside = true;
548
- range.label.text = limit.lowerlabel;
549
- range.label.fill = range.grid.stroke;
550
- range.label.verticalCenter = "bottom";
551
- range.label.stroke = am4core.color(limit.lowercolor || "#F92200");
552
- range.grid.stroke = am4core.color(limit.lowercolor || "#F92200");
553
- range.grid.strokeWidth = 2;
554
- range.grid.strokeOpacity = 1;
555
- }
556
- }
557
- }
558
- this.dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
559
- // Per comatibilità col codice scritto quando non era a livello globale, mi scoccia sostituire
560
- let dateAxis = this.dateAxis;
561
- if (settings.XAxisTitle) {
562
- dateAxis.title.text = settings.XAxisTitle;
563
- dateAxis.title.fontWeight = "bold";
564
- }
565
- if (showTicks) {
566
- dateAxis.renderer.ticks.template.disabled = false;
567
- dateAxis.renderer.ticks.template.strokeOpacity = 1;
568
- dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
569
- dateAxis.renderer.ticks.template.strokeWidth = 2;
570
- dateAxis.renderer.ticks.template.length = 10;
571
- dateAxis.renderer.ticks.template.location = 0;
572
- }
573
- dateAxis.renderer.minGridDistance = (_d = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _d !== void 0 ? _d : 50;
574
- dateAxis.renderer.grid.template.location = 0;
575
- dateAxis.minZoomCount = 5;
576
- dateAxis.groupData = dataShouldBeGrouped;
577
- dateAxis.groupCount = (_e = settings.DataGroupBucketSize) !== null && _e !== void 0 ? _e : this.DataGroupBucketSize;
578
- //Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
579
- if (gapsAllowed) {
580
- if (!seriesWithInterval) {
581
- console.error("Per utilizzare la funzionalità dei gap è obbligatorio definire un intervallo nelle serie del grafico");
582
- return null;
583
- }
584
- dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
585
- }
586
- if (showTimeline)
587
- ChartInstanceCasted.scrollbarX = new am4charts.XYChartScrollbar();
588
- let seriesToPush = [];
589
- let seriesColors = [];
590
- let defaultIndex = 0;
591
- // Ordinamento dei dati se serve
592
- dataConverted.series.forEach((s) => {
593
- if (s.values[0] && !(s.values[0].d instanceof Date)) {
594
- for (let v = 0; v < s.values.length; v++)
595
- s.values[v].d = new Date(s.values[v].d);
596
- }
597
- var correctOrder = true;
598
- var prevDate = null;
599
- for (let v = 0; v < s.values.length; v++) {
600
- if (!prevDate)
601
- prevDate = s.values[v].d;
602
- else if (s.values[v].d < prevDate) {
603
- correctOrder = false;
604
- break;
605
- }
606
- }
607
- if (!correctOrder)
608
- s.values.sort((d1, d2) => d1.d.getTime() - d2.d.getTime());
609
- });
610
- // Generazione di un unico dataset invece che N, per poter gestire un unico tooltip
611
- if (this.singleDataSet) {
612
- this.ChartInstance.data = this.generateSingleDataset(dataConverted);
613
- ;
614
- dateAxis.cursorTooltipEnabled = false;
615
- }
616
- dataConverted.series.forEach((s, index) => {
617
- var _a, _b, _c, _d;
618
- let stacked = s.stacked != null && s.stacked != undefined ? s.stacked : ((_a = settings === null || settings === void 0 ? void 0 : settings.Stacked) !== null && _a !== void 0 ? _a : false);
619
- let fill = stacked || (s.fill != null && s.fill != undefined ? s.fill : ((_b = settings === null || settings === void 0 ? void 0 : settings.Fill) !== null && _b !== void 0 ? _b : false));
620
- let series = (settings === null || settings === void 0 ? void 0 : settings.Step) ? new am4charts.StepLineSeries() : new am4charts.LineSeries();
621
- series.dataFields.valueY = "v" + (this.singleDataSet ? index : "");
622
- series.dataFields.dateX = "d";
623
- series.measureUnit = s.uom;
624
- series.name = s.name;
625
- series.strokeWidth = (_c = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _c !== void 0 ? _c : 1;
626
- series.connect = !gapsAllowed;
627
- series.minBulletDistance = 10;
628
- series.tooltipText = this.singleDataSet ? "" : s.name ? "{name}: [bold]{valueY}[/]" : "[bold]{valueY}[/]";
629
- series.tooltip.pointerOrientation = "vertical";
630
- series.tooltip.background.fillOpacity = 0.5;
631
- series.tooltip.label.padding(12, 12, 12, 12);
632
- series.fillOpacity = fill ? this.OpacityOnFill : 0.0001;
633
- series.stacked = stacked;
634
- series.hidden = s.hidden;
635
- //Dataset singolo, i dati sono registrati a livello di chart, creo il tooltip che permette di vederli tutti insieme
636
- //altrimenti assegno i dati della serie direttamente alla serie
637
- if (this.singleDataSet) {
638
- series.tooltip.getFillFromObject = false;
639
- series.tooltip.background.fill = am4core.color("#eee");
640
- series.tooltip.label.fill = am4core.color("#00");
641
- series.tooltip.defaultState.transitionDuration = 0;
642
- series.tooltip.hiddenState.transitionDuration = 0;
643
- //Utilizzo il mio dateService per la formattazione della data in modo che non debba mai gestire n formati fra n librerie... bellissimo
644
- series.dateFormatter.format = (source) => {
645
- if (interval && finalInstant && ["hour", "minute", "second"].includes(interval.timeunit)) {
646
- let timepart = null;
647
- switch (interval.timeunit) {
648
- case "hour":
649
- timepart = 'day';
650
- break;
651
- case "minute":
652
- timepart = 'hour';
653
- break;
654
- case "second":
655
- timepart = 'minute';
656
- break;
657
- }
658
- if (timepart)
659
- return this.dateExts.adjustDateToFinalInstant(source, timepart, interval ? interval.timeunit == "second" : false);
660
- }
661
- else
662
- return this.dateExts.getFormatted(source, interval ? ["day", "week", "month", "year"].includes(interval.timeunit) : false, interval ? interval.timeunit == "second" : false);
663
- };
664
- series.adapter.add("tooltipText", () => {
665
- var text = "[bold]{dateX.formatDate()}[/]\n";
666
- this.ChartInstance.series.each((item) => {
667
- let uom = " [font-style: italic]" + series.measureUnit || "" + "[/]";
668
- text += "[" + item.stroke.hex + "]●[/] " + (item.name ? (item.name + ": ") : "") + "[bold]{" + item.dataFields.valueY + "}[/]" + uom + "\n";
669
- });
670
- return text;
671
- });
672
- }
673
- else
674
- series.data = s.values;
675
- let segment = series.segments.template;
676
- let hoverState = segment.states.create("hover");
677
- hoverState.properties.strokeWidth = ((_d = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _d !== void 0 ? _d : 1) + 1;
678
- let dimmed = segment.states.create("dimmed");
679
- dimmed.properties.stroke = am4core.color("#dadada");
680
- //Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
681
- if (s.color)
682
- seriesColors.push(am4core.color(s.color));
683
- else {
684
- seriesColors.push(ChartInstanceCasted.colors.list[defaultIndex % ChartInstanceCasted.colors.list.length]);
685
- defaultIndex++;
686
- }
687
- seriesToPush.push(series);
688
- });
689
- ChartInstanceCasted.colors.list = seriesColors;
690
- //Scrivo le serie nel grafico
691
- seriesToPush.forEach(s => {
692
- ChartInstanceCasted.series.push(s);
693
- if (showTimeline)
694
- ChartInstanceCasted.scrollbarX.series.push(s);
695
- });
696
- if (settings.Legend) {
697
- this.ChartInstance.legend = new am4charts.Legend();
698
- this.ChartInstance.legend.position = (_f = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _f !== void 0 ? _f : 'right';
699
- this.ChartInstance.legend.scrollable = true;
700
- this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
701
- this.ChartInstance.legend.itemContainers.template.events.on("over", (event) => { this.processOver(event.target.dataItem.dataContext); });
702
- this.ChartInstance.legend.itemContainers.template.events.on("out", () => { this.processOut(); });
703
- if (settings.LegendPadding) {
704
- let template = this.ChartInstance.legend.itemContainers.template;
705
- template.paddingTop = (_g = settings.LegendPadding.top) !== null && _g !== void 0 ? _g : 0;
706
- template.paddingBottom = (_h = settings.LegendPadding.bottom) !== null && _h !== void 0 ? _h : 0;
707
- template.paddingLeft = (_j = settings.LegendPadding.left) !== null && _j !== void 0 ? _j : 0;
708
- template.paddingRight = (_k = settings.LegendPadding.right) !== null && _k !== void 0 ? _k : 0;
709
- }
710
- }
711
- this.ChartInstance.cursor = new am4charts.XYCursor();
712
- //Prove******************************************************************************************************************************
713
- // this.ChartInstance.cursor.events.on("cursorpositionchanged", (ev) => {
714
- // //var value = dateAxis.positionToDate(dateAxis.toAxisPosition(ev.target.xPosition));
715
- // var dt = dateAxis.series.values.find(t => t.dataItem.values.dateX);
716
- // if (dt && dt.dataItem) {
717
- // console.log(dt.dataItem.values);
718
- // // this.ChartInstance.tooltipText = dt;
719
- // }
720
- // else {
721
- // this.ChartInstance.tooltipText = "";
722
- // }
723
- // });
724
- //******************************************************************************************************************************
725
- this.ChartInstance.cursor.xAxis = dateAxis;
726
- this.ChartInstance.cursor.yAxis = yAxis;
727
- if (this.singleDataSet)
728
- this.ChartInstance.cursor.maxTooltipDistance = -1;
729
- //TODO: Cercare di capire perché è figlio di puttana......
730
- dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
731
- dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
732
- return this;
733
- }
734
- /** @ignore */
735
- setSelection(from, to) {
736
- this.dateAxis.zoomToDates(from, to, true, true);
482
+ constructor(logs) {
483
+ this.logs = logs;
484
+ /**
485
+ * Indica se attualmente ho le animazioni caricate in modo da non ricaricarle inutilmente
486
+ */
487
+ this.AnimationsAreLoaded = false;
488
+ /**
489
+ * Indica l'ultimo tema caricato in modo da non ricaricarlo inutilmente qualora il prossimo grafico da creare richieda lo stesso tema
490
+ */
491
+ this.LastLoadedTheme = "";
492
+ /**
493
+ * Cache dei temi (moduli caricati dinamicamente)
494
+ */
495
+ this.themeCache = {};
496
+ /**
497
+ * Cache delle localizzazioni (moduli caricati dinamicamente)
498
+ */
499
+ this.localizationCache = {};
737
500
  }
738
- /** @ignore */
739
- refreshData(data) {
740
- let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
741
- if (this.singleDataSet) {
742
- var data = this.generateSingleDataset(dataConverted);
743
- this.ChartInstance.addData(data);
744
- return;
501
+ /**
502
+ * Applica il tema con le animazioni all'istanza globale di amCharts
503
+ *
504
+ * @param {Object} chartsCore Istanza globale di amCharts
505
+ * @returns {Promise} Promise che identifica la fine del caricamento
506
+ */
507
+ applyAnimations(chartsCore) {
508
+ if (!this.AnimationsAreLoaded) {
509
+ return this.importIfNeeded('themes', ChartThemes.animated).then(() => {
510
+ this.log("CORE: Applying theme " + ChartThemes.animated);
511
+ chartsCore.useTheme(this.themeCache[ChartThemes.animated]);
512
+ this.AnimationsAreLoaded = true;
513
+ });
745
514
  }
746
- throw "Impossibile aggiornare i dati senza unire il dataset. Si prega di impostare [MergeDatasets] a true";
747
- }
748
- /** Partendo da dati divisi per seriue genera un dataset unito con la data come chiave e i vari valori dopo */
749
- generateSingleDataset(data) {
750
- let dto = {};
751
- data.series.forEach((vs, index) => {
752
- for (let i = 0; i < vs.values.length; i++) {
753
- var dataitem = vs.values[i];
754
- var indexer = new Date(dataitem.d).valueOf();
755
- if (!dto[indexer])
756
- dto[indexer] = {};
757
- dto[indexer]['v' + index] = dataitem.v;
758
- }
759
- });
760
- var dates = Object.keys(dto);
761
- var ret = [];
762
- for (let i = 0; i < dates.length; i++) {
763
- let values = dto[dates[i]];
764
- let item = { d: new Date(parseInt(dates[i])) };
765
- var vals = Object.keys(values);
766
- for (let ii = 0; ii < vals.length; ii++) {
767
- let series = vals[ii];
768
- let singleVal = values[series];
769
- item[series] = singleVal;
770
- }
771
- ret.push(item);
515
+ else {
516
+ this.log("CORE: theme already applyed " + ChartThemes.animated);
517
+ return new Promise((resolve) => { resolve(true); });
772
518
  }
773
- return ret;
774
519
  }
775
- /** @ignore */
776
- emitSelectionChanged(ev, settings) {
777
- if (settings.OnSelectionChangedCallback) {
778
- this.throttla("selchange", () => {
779
- var axis = ev.target;
780
- var start = new Date(axis.minZoomed);
781
- var end = new Date(axis.maxZoomed);
782
- var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
783
- settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
784
- }, 150);
520
+ /**
521
+ * De-applica il tema con le animazioni dall'istanza globale di amCharts
522
+ *
523
+ * @param {Object} chartsCore Istanza globale di amCharts
524
+ * @returns {Promise} Promise che identifica la fine dello scarico
525
+ */
526
+ unapplyAnimations(chartsCore) {
527
+ if (this.AnimationsAreLoaded) {
528
+ this.log("CORE: Animations in use, unapplying theme " + ChartThemes.animated);
529
+ chartsCore.unuseTheme(this.themeCache[ChartThemes.animated]);
530
+ this.AnimationsAreLoaded = false;
785
531
  }
532
+ else
533
+ this.log("CORE: Animations already unused, no need to unapply them");
534
+ return new Promise((resolve) => { resolve(true); });
786
535
  }
787
- /** @ignore */
788
- processOver(hoveredSeries) {
789
- hoveredSeries.zIndex = 999;
790
- let fill = hoveredSeries.fillOpacity == this.OpacityOnFill;
791
- hoveredSeries.segments.each((segment) => {
792
- segment.setState("hover");
793
- if (!fill)
794
- segment.fillSprite.fillOpacity = this.OpacityOnSelected;
795
- });
796
- if (!fill)
797
- hoveredSeries.legendDataItem.marker.children.getIndex(1).fillOpacity = this.OpacityOnSelected;
798
- this.ChartInstance.series.each((series) => {
799
- if (series != hoveredSeries) {
800
- let fill = series.fillOpacity == this.OpacityOnFill;
801
- series.segments.each((segment) => {
802
- segment.setState("dimmed");
803
- if (!fill)
804
- segment.fillSprite.fillOpacity = 0;
805
- });
806
- }
536
+ /**
537
+ * Applica il tema specificato all'istanza globale di amCharts
538
+ *
539
+ * @param {Object} chartsCore Istanza globale di amCharts
540
+ * @param {'spiritedaway' | 'moonrisekingdom' | 'frozen' | 'dark' | 'kelly' | 'material' | 'dataviz' | 'none'} theme Tema da applicare
541
+ * @returns {Promise} Promise che identifica la fine del caricamento
542
+ */
543
+ applyTheme(chartsCore, theme) {
544
+ // Ultimo tema applicato è lo stesso che mi è stato richiesto di applicare --> NO-OP
545
+ if (this.LastLoadedTheme == theme) {
546
+ this.log("CORE: theme already applied " + theme);
547
+ return new Promise((resolve) => { resolve(true); });
548
+ }
549
+ // Scarico il tema precedente a prescindere, ormai non mi serve più
550
+ this.unapplyPreviousTheme(chartsCore);
551
+ // Il tema è il none --> registro la cosa e basta, il tema precedente è stato rimosso subito qui sopra ^
552
+ if (theme == ChartThemes.none) {
553
+ this.LastLoadedTheme = ChartThemes.none;
554
+ return new Promise((resolve) => { resolve(true); });
555
+ }
556
+ // Il tema è diverso dal precedente e non è il tema vuoto --> Importo il tema specificato se non presente in memoria e lo applico al grafico attuale
557
+ return this.importIfNeeded('themes', theme).then(() => {
558
+ this.log("CORE: Applying theme " + theme);
559
+ chartsCore.useTheme(this.themeCache[theme]);
560
+ this.LastLoadedTheme = theme;
807
561
  });
808
562
  }
809
- /** @ignore */
810
- processOut() {
811
- this.ChartInstance.series.each((series, i) => {
812
- series.zIndex = i;
813
- let fill = series.fillOpacity == this.OpacityOnFill;
814
- series.segments.each((segment) => {
815
- segment.setState("default");
816
- if (!fill)
817
- segment.fillSprite.fillOpacity = 0;
818
- });
819
- if (!fill)
820
- series.legendDataItem.marker.children.getIndex(1).fillOpacity = 0;
563
+ /**
564
+ * De-applica il tema precedente dall'istanza globale di amCharts
565
+ *
566
+ * @param {Object} chartsCore Istanza globale di amCharts
567
+ */
568
+ unapplyPreviousTheme(chartsCore) {
569
+ if (!this.LastLoadedTheme || this.LastLoadedTheme == ChartThemes.none)
570
+ return;
571
+ this.log("CORE: Unapplying previously used theme " + this.LastLoadedTheme);
572
+ chartsCore.unuseTheme(this.themeCache[this.LastLoadedTheme]);
573
+ }
574
+ /**
575
+ * Applica il locale specificato all'istanza specifica del grafico
576
+ *
577
+ * @param {amCharts.Chart} chart Istanza specifica del grafico a cui applicare il locale
578
+ * @param {string} locale Locale da applicare
579
+ * @returns {Promise} Promise che identifica la fine del caricamento
580
+ */
581
+ applyLocale(chart, locale) {
582
+ return this.importIfNeeded('lang', locale).then(() => {
583
+ this.log("Chart " + chart.htmlContainer.id + ": applying locale " + locale);
584
+ chart.language.locale = this.localizationCache[locale];
821
585
  });
822
586
  }
823
- /** @ignore */
824
- throttla(id, func, throttleTime) {
825
- //Se ho la funzione che vuole eseguire ripulisco quel timeout
826
- if (this.executionTimers[id])
827
- clearTimeout(this.executionTimers[id]);
828
- //Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
829
- this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
587
+ /**
588
+ * Permette di importare, se serve un dato tema o localizzazione
589
+ *
590
+ * @param {'lang' | 'themes'} what Oggetto da importare, se localizzazione o tema
591
+ * @param {string} item Chiave dell'oggetto da importare
592
+ *
593
+ * @returns {Promise} Promise che identifica la fine del caricamento
594
+ */
595
+ importIfNeeded(what, item) {
596
+ // Se sto cercando di caricare qualcosa di già caricato non faccio nulla
597
+ if (!(what == 'themes' && !this.themeCache[item]) && !(what == 'lang' && !this.localizationCache[item])) {
598
+ this.log("CORE: " + (what == 'lang' ? "Language " : "Theme ") + item + " already loaded");
599
+ return new Promise((resolve) => { resolve(true); });
600
+ }
601
+ this.log("CORE: Loading " + (what == 'lang' ? "language " : "theme ") + item);
602
+ /*
603
+ * ****************************
604
+ * ******** ATTENZIONE ********
605
+ * ****************************
606
+ *
607
+ * Se stai vedendo questo codice di import e stai valutando di riscriverlo come:
608
+ *
609
+ * V V
610
+ * import(`@amcharts/amcharts4/${what}/${item}`).then(module => {
611
+ * if (what == 'themes') this.themeCache[item] = module.default;
612
+ * else if (what == 'lang') this.localizationCache[item] = module.default;
613
+ * });
614
+ *
615
+ * Sappi che è una pessima idea. Gli import sono valutati da webpack in compiletime per generare i chunk,
616
+ * mettere la navigazione agli import con la concatenazione viene preso malissimo ed essenzialmente dice a webpack
617
+ * di tirare su e bundlare l'intera node_modules. Divertente, no?
618
+ *
619
+ */
620
+ switch (what) {
621
+ case 'themes':
622
+ switch (item) {
623
+ case ChartThemes.spiritedaway:
624
+ return import('@amcharts/amcharts4/themes/spiritedaway').then(theme => this.themeCache[item] = theme.default);
625
+ case ChartThemes.moonrisekingdom:
626
+ return import('@amcharts/amcharts4/themes/moonrisekingdom').then(theme => this.themeCache[item] = theme.default);
627
+ case ChartThemes.frozen:
628
+ return import('@amcharts/amcharts4/themes/frozen').then(theme => this.themeCache[item] = theme.default);
629
+ case ChartThemes.dark:
630
+ return import('@amcharts/amcharts4/themes/dark').then(theme => this.themeCache[item] = theme.default);
631
+ case ChartThemes.kelly:
632
+ return import('@amcharts/amcharts4/themes/kelly').then(theme => this.themeCache[item] = theme.default);
633
+ case ChartThemes.material:
634
+ return import('@amcharts/amcharts4/themes/material').then(theme => this.themeCache[item] = theme.default);
635
+ case ChartThemes.dataviz:
636
+ return import('@amcharts/amcharts4/themes/dataviz').then(theme => this.themeCache[item] = theme.default);
637
+ case ChartThemes.animated:
638
+ return import('@amcharts/amcharts4/themes/animated').then(theme => this.themeCache[item] = theme.default);
639
+ }
640
+ break;
641
+ case 'lang':
642
+ switch (item) {
643
+ case 'it-IT':
644
+ return import('@amcharts/amcharts4/lang/it_IT').then(lang => this.localizationCache[item] = lang.default);
645
+ case 'en-US':
646
+ return import('@amcharts/amcharts4/lang/en_US').then(lang => this.localizationCache[item] = lang.default);
647
+ }
648
+ }
649
+ this.log("CORE: Loading Failed. " + (what == 'lang' ? "Language " : "Theme") + " not recognized: " + item);
650
+ return new Promise((resolve) => { resolve(true); });
830
651
  }
831
- }
652
+ /**
653
+ * @ignore
654
+ */
655
+ log(text) {
656
+ if (this.logs)
657
+ console.log("@esfaenza/es-charts: " + text);
658
+ }
659
+ }
660
+ ChartLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartLoader, deps: [{ token: ESC_LOGS }], target: i0.ɵɵFactoryTarget.Injectable });
661
+ ChartLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartLoader });
662
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartLoader, decorators: [{
663
+ type: Injectable
664
+ }], ctorParameters: function () {
665
+ return [{ type: undefined, decorators: [{
666
+ type: Inject,
667
+ args: [ESC_LOGS]
668
+ }] }];
669
+ } });
832
670
 
833
671
  /**
834
672
  * Classe che si occupa del dispatch delle operazioni di rendering dei grafici utilizzando una coda per permettere ad ogni grafico di avere temi e localizzazione custom
@@ -877,203 +715,498 @@ class ChartDispatcher {
877
715
  this.log("DISPATCHER: Registration missing for chart " + name + " it was probably destroyed during load");
878
716
  return;
879
717
  }
880
- this.log("DISPATCHER: Chart deregistered " + name);
881
- this.InitializedGraphs.splice(index, 1);
718
+ this.log("DISPATCHER: Chart deregistered " + name);
719
+ this.InitializedGraphs.splice(index, 1);
720
+ }
721
+ /**
722
+ * Metodo che esegue in maniera sequenziale le funzioni di inizializzazione dei grafici finché presenti
723
+ * in modo che nessun grafico possa essere inizializzato contemporaneamente ad un altro.
724
+ *
725
+ * Questo è il punto chiave che permette di avere per ogni grafico temi e locale differenti
726
+ */
727
+ drainInitQueues() {
728
+ let toExecute = this.Initializations[0];
729
+ this.log("DISPATCHER: Executing initialization function for chart " + toExecute.name);
730
+ toExecute.function().then(() => {
731
+ this.log("DISPATCHER: initialization for chart " + toExecute.name + " is done");
732
+ this.InitializedGraphs.push(toExecute.name);
733
+ this.Initializations.splice(0, 1);
734
+ if (this.Initializations.length >= 1) {
735
+ this.log("DISPATCHER: Found queued initializations. Continuing");
736
+ this.drainInitQueues();
737
+ }
738
+ else
739
+ this.log("DISPATCHER: queue is over, nothing more to do");
740
+ });
741
+ }
742
+ /**
743
+ * @ignore
744
+ */
745
+ log(text) {
746
+ if (this.logs)
747
+ console.log("@esfaenza/es-charts: " + text);
748
+ }
749
+ }
750
+ ChartDispatcher.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartDispatcher, deps: [{ token: ESC_LOGS }], target: i0.ɵɵFactoryTarget.Injectable });
751
+ ChartDispatcher.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartDispatcher });
752
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartDispatcher, decorators: [{
753
+ type: Injectable
754
+ }], ctorParameters: function () {
755
+ return [{ type: undefined, decorators: [{
756
+ type: Inject,
757
+ args: [ESC_LOGS]
758
+ }] }];
759
+ } });
760
+
761
+ /**
762
+ * Componente Grafico Base che gestisce tutte le cose comuni dei vari grafici istanziabili, come la presenza o menu di una legenda,
763
+ * il tema utilizzato, il locale del singolo grafico, ecc ecc...
764
+ */
765
+ class BaseChartComponent {
766
+ /**
767
+ * Costruttore
768
+ *
769
+ * @param {ElementRef} el Contenitore all'interno del cui viene creato il grafico. Utilizzato per estrapolarne la **ContainerHeight**
770
+ * @param {Object} platformId piattaforma Angular (browser, ecc...) per essere sicuri che amcharts venga attivato solo lato browser. Non utilizzando SSR nelle applicazioni che consumano questa libreria non è particolarmente significativo, ma non si sa mai
771
+ * @param {NgZone} zone NgZone di default per permettere di inizializzare il grafico all'infuori di Angular per avere qualche prestazione in più
772
+ * @param {ChartLoader} Charter Istanza del Loader che si occuperà di caricare in memoria tutto ciò che serve per il grafico attuale (temi, locale, animazioni, ecc...)
773
+ * @param {ChartDispatcher} Dispatcher Istanza del Dispatcher che si occupa di differire il caricamento dei grafici 1 dopo l'altro in modo che caricamenti pseudo paralleli incasinino tutto
774
+ * @param {boolean} logs Indica se effettuare log a console o meno, iniettato dalle classi specializzate dal token ESC_LOGS
775
+ * @param {boolean} animations Indica se per questo grafico devono essere attive o meno le animazioni. Impostazione generica presa dal token ESC_ANIMATIONS
776
+ * @param {string} locale Indica il locale specifico per questo grafico. Impostazione generica presa dal LocalizationService
777
+ * @param {string} theme Indica il tema specifico per questo grafico. Impostazione generica presa dal token ESC_THEME
778
+ */
779
+ constructor(el, platformId, zone, Charter, Dispatcher, logs, animations, locale, theme) {
780
+ this.el = el;
781
+ this.platformId = platformId;
782
+ this.zone = zone;
783
+ this.Charter = Charter;
784
+ this.Dispatcher = Dispatcher;
785
+ this.logs = logs;
786
+ this.animations = animations;
787
+ this.locale = locale;
788
+ this.theme = theme;
789
+ /**
790
+ * Nome del grafico, fondamentale assegnarlo per permettere alla libreria di schedularne la creazione
791
+ */
792
+ this.name = "";
793
+ /**
794
+ * Dopo aver navigato a un nuovo grafico verranno attesi questi millisecondi prima di richiedere i dati attraverso la **DataRetrieve**.
795
+ *
796
+ * Questo per evitare che l'utente cliccando velocemente "avanti" generi tonnellate di richieste inutili
797
+ */
798
+ this.BrowseDelayMs = 500;
799
+ /**
800
+ * Evento lanciato sulla selezione di un range di dati o dalla timeline o dal grafico. Valido per tutti i grafici che supportano serie basate sulle date
801
+ */
802
+ this.onSelectionChanged = new EventEmitter();
803
+ /**
804
+ * Evento lanciato dal click di una serie dalla Legenda, a patto che l'Input **HideSeriesOnLabelClick** sia impostato a false
805
+ */
806
+ this.onSeriesClicked = new EventEmitter();
807
+ /**
808
+ * Evento lanciato all'inizio del caricamento di una nuova pagina del grafico
809
+ */
810
+ this.onLoadStart = new EventEmitter();
811
+ /**
812
+ * Evento lanciato al termine del caricamento di una nuova pagina del grafico
813
+ */
814
+ this.onLoadEnd = new EventEmitter();
815
+ /**
816
+ * Evento lanciato al termine della creazione del grafico referenziando l'istanza nativa del grafico creato in modo da poter effettuare modifiche
817
+ * post inizializzazione lato applicativo
818
+ */
819
+ this.chartLoaded = new EventEmitter();
820
+ /**
821
+ * Serve a decidere se sarà presente l'interfaccia di paginazione
822
+ */
823
+ this.isPaged = false;
824
+ /**
825
+ * @ignore
826
+ */
827
+ this.initDone = false;
828
+ }
829
+ /**
830
+ * Metodo di inizializzazione post valorizzazione degli input, utilizzato per valorizzare correttamente le proprietà essenziali del grafico (Animazioni, Tema e Locale)
831
+ *
832
+ * Viene data priorità ai Settings (HTML), priorità secondaria agli Input diretti (Lato HTML), priorità ultima alle impostazioni globali,
833
+ * impostate in fase di import del modulo assegnando valori ai token ESC_ANIMATIONS, ESC_THEME
834
+ */
835
+ ngOnInit() {
836
+ var _a, _b, _c, _d, _e, _f;
837
+ // Qui servono solo le variabili da conoscere PRE-graficazione per il caricamento dei moduli lazy del grafico
838
+ this.Animations = ((_a = this.Settings) === null || _a === void 0 ? void 0 : _a.Animations) != null ? (_b = this.Settings) === null || _b === void 0 ? void 0 : _b.Animations : (this.Animations != null ? this.Animations : this.animations);
839
+ this.Theme = ((_c = this.Settings) === null || _c === void 0 ? void 0 : _c.Theme) != null ? (_d = this.Settings) === null || _d === void 0 ? void 0 : _d.Theme : (this.Theme != null ? this.Theme : this.theme);
840
+ this.Locale = ((_e = this.Settings) === null || _e === void 0 ? void 0 : _e.Locale) != null ? (_f = this.Settings) === null || _f === void 0 ? void 0 : _f.Locale : (this.Locale != null ? this.Locale : this.locale);
841
+ this.isPaged = (this.DataArray && this.DataArray.length > 0 && !this.Data) || (this.DataDtos && this.DataDtos.length > 0 && !!this.DataRetrieve);
842
+ this.log("Chart " + this.name + ": ngOnInit");
843
+ }
844
+ /**
845
+ * Implementazione utilizzata per controllare eventuali proprietà chiave del grafico e rigraficare tutto qualora si rivelasse necessario
846
+ *
847
+ * @param {SimpleChanges} changes Indicazione dei cambiamenti sulle proprietà del grafico. Vedere documentazione Angular in merito
848
+ */
849
+ ngOnChanges(changes) {
850
+ if (!this.initDone)
851
+ return;
852
+ this.log("Chart " + this.name + ": ngOnChanges");
853
+ let propsToCheck = ["Timeline", "Legend", "Settings", "Animations", "Theme", "Locale", ...this.getSpecificPropertiesToCheck()];
854
+ this.checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck);
855
+ }
856
+ /**
857
+ * Nel post inizializzazione, a patto che mi trovi in ambiente "browser", proseguo al caricamento del grafico sull'HTML
858
+ */
859
+ ngAfterViewInit() {
860
+ if (!this.name)
861
+ throw "a Unique name is mandatory to create a chart";
862
+ this.log("Chart " + this.name + ": ngAfterViewInit, graphicating chart outside Angular");
863
+ if (!this.isPaged)
864
+ this.dispatchLoadChart();
865
+ }
866
+ /**
867
+ * All'onDestroy scarico il grafico per liberare memoria
868
+ */
869
+ ngOnDestroy() {
870
+ if (this.Chart) {
871
+ this.log("Chart " + this.name + ": Unloading destroyed chart");
872
+ this.browserOnly(() => { this.Chart.dispose(); this.Dispatcher.deregisterGraph(this.name); });
873
+ }
874
+ else
875
+ this.log("Chart " + this.name + ": Unloading uncreated chart component. It probably was a duplicated");
876
+ }
877
+ /**
878
+ * Registra il grafico attuale nel Dispatcher in modo che venga caricato appena possibile
879
+ */
880
+ dispatchLoadChart() {
881
+ this.browserOnly(() => {
882
+ this.Dispatcher.register(this.name, () => { return this.loadChart(); });
883
+ });
884
+ }
885
+ /**
886
+ * Il caricamento del grafico funziona nel seguente modo:
887
+ *
888
+ * 1) Caricamento del tema e delle animazioni, qualora necessari
889
+ *
890
+ * 2) Caricamento delle impostazioni specifiche e integrazione con le impostazioni generiche
891
+ *
892
+ * 3) Graficazione
893
+ *
894
+ * 4) Caricamento del locale
895
+ */
896
+ loadChart() {
897
+ this.log("Chart " + this.name + ": Start loading Modules if needed");
898
+ return Promise.all([
899
+ this.setupAmChartsThemes().then(() => {
900
+ this.log("Chart " + this.name + ": Graphicating after modules load");
901
+ var castedSettings = this.getCastedSettings();
902
+ this.fillSettings(castedSettings);
903
+ this.fillSpecificSettings(castedSettings);
904
+ this.ChartService = this.graphicate(castedSettings);
905
+ this.Chart = this.ChartService.ChartInstance;
906
+ if (!this.Chart)
907
+ this.log("Chart " + this.name + ": Could not create graph");
908
+ // Unico punto reale in cui viene utilizzato il locale, tehe
909
+ return this.Charter.applyLocale(this.Chart, this.Locale).then(() => { this.initDone = true; this.chartLoaded.emit(this); });
910
+ })
911
+ ]);
912
+ }
913
+ /**
914
+ * Riempimento delle impostazioni nella classe Settings. Si danno priorità ai valori già impostati nei Settings,
915
+ * integrando eventualmente con le proprietà del grafico
916
+ *
917
+ * @param {BaseSettings} settings Impostazioni base ricevute dalla specializzazione del grafico
918
+ */
919
+ fillSettings(settings) {
920
+ var _a;
921
+ // Merge degli Input con i Settings, dando priorità ai Settings
922
+ settings.Theme = settings.Theme ? settings.Theme : this.Theme;
923
+ settings.Locale = settings.Locale ? settings.Locale : this.Locale;
924
+ settings.Animations = settings.Animations != null ? settings.Animations : this.Animations;
925
+ settings.Legend = settings.Legend != null ? settings.Legend : this.Legend;
926
+ settings.Name = settings.Name ? settings.Name : this.name;
927
+ settings.Timeline = settings.Timeline != null ? settings.Timeline : this.Timeline;
928
+ settings.AdaptLabelSizeAndOrientation = settings.AdaptLabelSizeAndOrientation != null ? settings.AdaptLabelSizeAndOrientation : this.AdaptLabelSizeAndOrientation;
929
+ settings.XAxisTitle = settings.XAxisTitle ? settings.XAxisTitle : this.XTitle;
930
+ settings.YAxisTitle = settings.YAxisTitle ? settings.YAxisTitle : this.YTitle;
931
+ settings.LegendPosition = settings.LegendPosition ? settings.LegendPosition : this.LegendPosition;
932
+ settings.HideSeriesOnLabelClick = settings.HideSeriesOnLabelClick != null ? settings.HideSeriesOnLabelClick : this.HideSeriesOnLabelClick;
933
+ settings.MinGridDistance = settings.MinGridDistance != null ? settings.MinGridDistance : this.MinGridDistance;
934
+ settings.LegendPadding = settings.LegendPadding ? settings.LegendPadding : (_a = this.LegendPadding) !== null && _a !== void 0 ? _a : null;
935
+ settings.ContainerHeight = this.el.nativeElement.parentElement.offsetHeight;
936
+ settings.OnSeriesClickCallback = (series) => { this.onSeriesClicked.emit(series); };
937
+ settings.OnSelectionChangedCallback = (event) => { this.onSelectionChanged.emit({ from: event.from, to: event.to, initial: event.initial }); };
938
+ }
939
+ /**
940
+ * Controlla i cambiamenti avvenuti alle proprietà chiave e rieffettua la graficazione qualora necessario
941
+ *
942
+ * @param {SimpleChanges} changes Indicazione della modifiche avvenute nei vari Input
943
+ * @param {string[]} propsToCheck Lista degli Input da controllare per cui una modifica causa una rigraficazione
944
+ */
945
+ checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck) {
946
+ let toReGraphicate = false;
947
+ for (let i = 0; i < propsToCheck.length; i++)
948
+ toReGraphicate = toReGraphicate || (changes[propsToCheck[i]] && changes[propsToCheck[i]].currentValue);
949
+ if (toReGraphicate)
950
+ this.reloadChart();
951
+ }
952
+ /**
953
+ * Funzione che effettua un cambio di pagina per i grafici paginati. Qualora **data** fosse nullo significa che è iniziato un caricamento
954
+ * e anche lato applicativo il DataRetrieve dovrà considerare che l'assenza di valori non è altro che un'indicazione di inizio caricamento
955
+ *
956
+ * Il caricamento di qualsiasi pagina genererà comunque una primo evento con **data** nullo in modo da indicare l'inizio caricamento e
957
+ * in seconda istanza un altro evento in cui **data** sarà sempre valorizzato, o con il Dto da usare per recuperare i dati, o con i dati
958
+ * veri e propri già presenti nel **DataArray**
959
+ *
960
+ * I callback **onLoadStart** e **onLoadEnd** vengono sempre chiamati
961
+ *
962
+ * @param {{ data: LineChartData | PieChartData | Vertical2DChartData | VerticalChartData | any, index: number }} nd Indice del caricamento dati, con eventualmente già i dati se disponibili
963
+ */
964
+ changePage(nd) {
965
+ if (!nd.data) {
966
+ this.loadingChart = true;
967
+ // Serve per informare l'applicativo in listening sull'indice attualmente in visualizzazione.
968
+ // La mancanza di dati indica che non devono essere effettuate ricerche per ora
969
+ if (this.DataRetrieve)
970
+ this.DataRetrieve(null, nd.index);
971
+ this.onLoadStart.emit();
972
+ return;
973
+ }
974
+ if (this.DataRetrieve)
975
+ this.DataRetrieve(nd.data, nd.index).then(t => { this.changePageDataReceived(t); });
976
+ else
977
+ this.changePageDataReceived(nd.data);
882
978
  }
883
979
  /**
884
- * Metodo che esegue in maniera sequenziale le funzioni di inizializzazione dei grafici finché presenti
885
- * in modo che nessun grafico possa essere inizializzato contemporaneamente ad un altro.
980
+ * Al termine del caricamento dei dati di una pagina questo metodo viene chiamato per rigraficare la situazione con i nuovi dati
886
981
  *
887
- * Questo è il punto chiave che permette di avere per ogni grafico temi e locale differenti
982
+ * @param {LineChartData | PieChartData | Vertical2DChartData | VerticalChartData | any} data Dati del grafico
888
983
  */
889
- drainInitQueues() {
890
- let toExecute = this.Initializations[0];
891
- this.log("DISPATCHER: Executing initialization function for chart " + toExecute.name);
892
- toExecute.function().then(() => {
893
- this.log("DISPATCHER: initialization for chart " + toExecute.name + " is done");
894
- this.InitializedGraphs.push(toExecute.name);
895
- this.Initializations.splice(0, 1);
896
- if (this.Initializations.length >= 1) {
897
- this.log("DISPATCHER: Found queued initializations. Continuing");
898
- this.drainInitQueues();
899
- }
900
- else
901
- this.log("DISPATCHER: queue is over, nothing more to do");
902
- });
984
+ changePageDataReceived(data) {
985
+ this.loadingChart = false;
986
+ this.onLoadEnd.emit();
987
+ let firstBind = !this.Data;
988
+ this.Data = data;
989
+ if (!firstBind)
990
+ this.reloadChart();
991
+ else
992
+ this.dispatchLoadChart();
903
993
  }
904
994
  /**
905
- * @ignore
995
+ * Ricarica il grafico distruggendo il vecchio e ricreando il nuovo
996
+ *
997
+ * Le chiamate a questo metodo possono essere trasformate in chiamate al metodo **graphicate** della Service, se solo quel metodo fosse abbastanza intelligente per capire
998
+ * le differenze fra il grafico com'era prima e come deve diventare, in modo da non ricrearlo ma semplicemente modificare quello che già è disegnato
906
999
  */
907
- log(text) {
908
- if (this.logs)
909
- console.log("@esfaenza/es-charts: " + text);
1000
+ reloadChart() {
1001
+ this.browserOnly(() => {
1002
+ if (!this.Chart.isDisposed())
1003
+ this.Chart.dispose();
1004
+ this.Dispatcher.deregisterGraph(this.name);
1005
+ });
1006
+ this.Dispatcher.register(this.name, () => { return this.loadChart(); });
910
1007
  }
911
- }
912
- ChartDispatcher.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartDispatcher, deps: [{ token: ESC_LOGS }], target: i0.ɵɵFactoryTarget.Injectable });
913
- ChartDispatcher.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartDispatcher, providedIn: 'root' });
914
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartDispatcher, decorators: [{
915
- type: Injectable,
916
- args: [{ providedIn: 'root' }]
917
- }], ctorParameters: function () {
918
- return [{ type: undefined, decorators: [{
919
- type: Inject,
920
- args: [ESC_LOGS]
921
- }] }];
922
- } });
923
-
924
- /**
925
- * Componente specifico per la graficazione di un grafico a Linea su un asse temporale
926
- */
927
- class EsLineChartComponent extends BaseChartComponent {
928
1008
  /**
929
- * @ignore
1009
+ * Permette di aggiungere un blocco di dati in maniera "live" ad un grafico
930
1010
  */
931
- constructor(el, ChartLoader, ChartDispatcher, adapter, dateService, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
932
- super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
933
- this.adapter = adapter;
934
- this.dateService = dateService;
1011
+ addData(chartData) {
1012
+ this.ChartService.refreshData(chartData);
935
1013
  }
1014
+ ;
936
1015
  /**
937
- * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
1016
+ * Funzione che si occupa di caricare i temi necessari per il grafico in oggetto. Prima applica il tema, poi, se serve, applica le animazioni
938
1017
  */
939
- getSpecificPropertiesToCheck() {
940
- return ["Data", "DataArray", "Step", "DataGroupBucketSize", "DataGroupingThreshold", "StrokeSize", "Stacked", "AllowGaps", "MergeDatasets", "FinalInstants", "Fill", "Min", "Max"];
1018
+ setupAmChartsThemes() {
1019
+ return Promise.all([
1020
+ this.Charter.applyTheme(am4core, this.Theme).then(() => {
1021
+ return this.Animations ? this.Charter.applyAnimations(am4core) : this.Charter.unapplyAnimations(am4core);
1022
+ })
1023
+ ]);
941
1024
  }
942
1025
  /**
943
- * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
944
- *
945
- * @returns {LineChartSettings} Settings castati al tipo giusto
1026
+ * @ignore
946
1027
  */
947
- getCastedSettings() {
948
- var _a;
949
- return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new LineChartSettings());
1028
+ log(log) {
1029
+ if (this.logs)
1030
+ console.log("@esfaenza/es-charts: " + log);
950
1031
  }
951
1032
  /**
952
- * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
1033
+ * Imposta lo zoom dal **from** al **to**
953
1034
  *
954
- * @param {LineChartSettings} settingsCasted Settings castati al tipo giusto
1035
+ * @param {Date} from Inizio dello zoom
1036
+ * @param {Date} to Fine dello zoom
955
1037
  */
956
- fillSpecificSettings(settingsCasted) {
957
- settingsCasted.Step = settingsCasted.Step != null ? settingsCasted.Step : this.Step;
958
- settingsCasted.DataGroupBucketSize = settingsCasted.DataGroupBucketSize != null ? settingsCasted.DataGroupBucketSize : this.DataGroupBucketSize;
959
- settingsCasted.StrokeSize = settingsCasted.StrokeSize != null ? settingsCasted.StrokeSize : this.StrokeSize;
960
- settingsCasted.DataGroupingThreshold = settingsCasted.DataGroupingThreshold != null ? settingsCasted.DataGroupingThreshold : this.DataGroupingThreshold;
961
- settingsCasted.AllowGaps = settingsCasted.AllowGaps != null ? settingsCasted.AllowGaps : this.AllowGaps;
962
- settingsCasted.MergeDatasets = settingsCasted.MergeDatasets != null ? settingsCasted.MergeDatasets : this.MergeDatasets;
963
- settingsCasted.FinalInstants = settingsCasted.FinalInstants != null ? settingsCasted.FinalInstants : this.FinalInstants;
964
- settingsCasted.Min = settingsCasted.Min != null ? settingsCasted.Min : this.Min;
965
- settingsCasted.Max = settingsCasted.Max != null ? settingsCasted.Max : this.Max;
966
- settingsCasted.Fill = settingsCasted.Fill != null ? settingsCasted.Fill : this.Fill;
967
- settingsCasted.Stacked = settingsCasted.Stacked != null ? settingsCasted.Stacked : this.Stacked;
1038
+ setSelection(from, to) {
1039
+ this.ChartService.setSelection(from, to);
968
1040
  }
969
1041
  /**
970
- * Effettua il rendering di questo grafico in base ai Settings
971
- *
972
- * @param {LineChartSettings} settingsCasted Impostazioni di graficazione
973
- * @returns {LineChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
1042
+ * @ignore
974
1043
  */
975
- graphicate(settingsCasted) {
976
- return new LineChartService(this.adapter, this.dateService).graphicate(this.Data, settingsCasted);
1044
+ browserOnly(f) {
1045
+ if (isPlatformBrowser(this.platformId)) {
1046
+ this.zone.runOutsideAngular(() => {
1047
+ f();
1048
+ });
1049
+ }
977
1050
  }
978
1051
  }
979
- EsLineChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsLineChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i4.DateService }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
980
- EsLineChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsLineChartComponent, selector: "es-line-chart", inputs: { Data: "Data", DataArray: "DataArray", Step: "Step", DataGroupBucketSize: "DataGroupBucketSize", DataGroupingThreshold: "DataGroupingThreshold", StrokeSize: "StrokeSize", AllowGaps: "AllowGaps", MergeDatasets: "MergeDatasets", FinalInstants: "FinalInstants", Min: "Min", Max: "Max", Fill: "Fill", Stacked: "Stacked" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
981
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsLineChartComponent, decorators: [{
982
- type: Component,
983
- args: [{ selector: 'es-line-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
984
- }], ctorParameters: function () {
985
- return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i4.DateService }, { type: i0.NgZone }, { type: Object, decorators: [{
986
- type: Inject,
987
- args: [PLATFORM_ID]
988
- }] }, { type: undefined, decorators: [{
989
- type: Inject,
990
- args: [ESC_LOGS]
991
- }] }, { type: undefined, decorators: [{
992
- type: Inject,
993
- args: [ESC_ANIMATIONS]
994
- }] }, { type: undefined, decorators: [{
995
- type: Inject,
996
- args: [ESC_THEME]
997
- }] }, { type: i4$1.LocalizationService }];
998
- }, propDecorators: { Data: [{
1052
+ BaseChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseChartComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
1053
+ BaseChartComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: BaseChartComponent, inputs: { XTitle: "XTitle", YTitle: "YTitle", Settings: "Settings", Legend: "Legend", LegendPosition: "LegendPosition", Timeline: "Timeline", name: "name", Animations: "Animations", Theme: "Theme", Locale: "Locale", HideSeriesOnLabelClick: "HideSeriesOnLabelClick", MinGridDistance: "MinGridDistance", AdaptLabelSizeAndOrientation: "AdaptLabelSizeAndOrientation", LegendPadding: "LegendPadding", DataDtos: "DataDtos", DataDtoStartIndex: "DataDtoStartIndex", DataRetrieve: "DataRetrieve", BrowseDelayMs: "BrowseDelayMs" }, outputs: { onSelectionChanged: "onSelectionChanged", onSeriesClicked: "onSeriesClicked", onLoadStart: "onLoadStart", onLoadEnd: "onLoadEnd", chartLoaded: "chartLoaded" }, queries: [{ propertyName: "header_tr", first: true, predicate: ["header"], descendants: true }, { propertyName: "loading_template", first: true, predicate: ["loading"], descendants: true }], usesOnChanges: true, ngImport: i0 });
1054
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseChartComponent, decorators: [{
1055
+ type: Directive
1056
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: Object }, { type: i0.NgZone }, { type: ChartLoader }, { type: ChartDispatcher }, { type: undefined }, { type: undefined }, { type: undefined }, { type: undefined }]; }, propDecorators: { XTitle: [{
999
1057
  type: Input
1000
- }], DataArray: [{
1058
+ }], YTitle: [{
1001
1059
  type: Input
1002
- }], Step: [{
1060
+ }], Settings: [{
1003
1061
  type: Input
1004
- }], DataGroupBucketSize: [{
1062
+ }], Legend: [{
1005
1063
  type: Input
1006
- }], DataGroupingThreshold: [{
1064
+ }], LegendPosition: [{
1007
1065
  type: Input
1008
- }], StrokeSize: [{
1066
+ }], Timeline: [{
1009
1067
  type: Input
1010
- }], AllowGaps: [{
1068
+ }], name: [{
1011
1069
  type: Input
1012
- }], MergeDatasets: [{
1070
+ }], Animations: [{
1013
1071
  type: Input
1014
- }], FinalInstants: [{
1072
+ }], Theme: [{
1015
1073
  type: Input
1016
- }], Min: [{
1074
+ }], Locale: [{
1017
1075
  type: Input
1018
- }], Max: [{
1076
+ }], HideSeriesOnLabelClick: [{
1019
1077
  type: Input
1020
- }], Fill: [{
1078
+ }], MinGridDistance: [{
1021
1079
  type: Input
1022
- }], Stacked: [{
1080
+ }], AdaptLabelSizeAndOrientation: [{
1081
+ type: Input
1082
+ }], LegendPadding: [{
1083
+ type: Input
1084
+ }], DataDtos: [{
1023
1085
  type: Input
1086
+ }], DataDtoStartIndex: [{
1087
+ type: Input
1088
+ }], DataRetrieve: [{
1089
+ type: Input
1090
+ }], BrowseDelayMs: [{
1091
+ type: Input
1092
+ }], header_tr: [{
1093
+ type: ContentChild,
1094
+ args: ['header', { static: false }]
1095
+ }], loading_template: [{
1096
+ type: ContentChild,
1097
+ args: ['loading', { static: false }]
1098
+ }], onSelectionChanged: [{
1099
+ type: Output
1100
+ }], onSeriesClicked: [{
1101
+ type: Output
1102
+ }], onLoadStart: [{
1103
+ type: Output
1104
+ }], onLoadEnd: [{
1105
+ type: Output
1106
+ }], chartLoaded: [{
1107
+ type: Output
1024
1108
  }] } });
1025
1109
 
1026
1110
  /**
1027
- * Classe il cui unico scopo è gestire il setup e rendering di un AreaChart
1111
+ * Classe il cui unico scopo è gestire il setup e rendering di un LineChart
1028
1112
  */
1029
- class AreaChartService {
1113
+ class LineChartService {
1030
1114
  /** @ignore */
1031
- constructor(Adapter) {
1115
+ constructor(Adapter, dateExts) {
1032
1116
  this.Adapter = Adapter;
1117
+ this.dateExts = dateExts;
1118
+ /** @ignore */
1119
+ this.DataGroupBucketSize = 1500;
1120
+ /** @ignore */
1121
+ this.OpacityOnSelected = 0.3;
1122
+ /** @ignore */
1123
+ this.OpacityOnFill = 0.75;
1124
+ /** @ignore */
1125
+ this.singleDataSet = false;
1033
1126
  //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
1034
1127
  //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
1035
1128
  /** @ignore */
1036
1129
  this.executionTimers = {};
1037
1130
  }
1038
1131
  /**
1039
- * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un AreaChart
1132
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un LineChart
1040
1133
  */
1041
1134
  graphicate(data, settings) {
1042
- var _a, _b, _c, _d, _e, _f;
1043
- if (settings.Timeline) {
1044
- console.error("Timeline not supported for area chart");
1045
- return null;
1046
- }
1047
- let dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
1135
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1136
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
1137
+ let threshold = (_a = settings.DataGroupingThreshold) !== null && _a !== void 0 ? _a : 3000;
1138
+ this.singleDataSet = (_b = settings.MergeDatasets) !== null && _b !== void 0 ? _b : false;
1048
1139
  let showTicks = settings.ShowTicks == null ? true : settings === null || settings === void 0 ? void 0 : settings.ShowTicks;
1049
- let interval = dataConverted.interval;
1140
+ let dataShouldBeGrouped = Math.max(...dataConverted.series.map(t => t.values.length)) > threshold;
1141
+ let showTimeline = settings.Timeline || dataShouldBeGrouped;
1142
+ let seriesWithInterval = dataConverted.series.some(t => t.interval);
1143
+ let interval = seriesWithInterval ? dataConverted.series.find(t => t.interval).interval : null;
1144
+ let gapsAllowed = (settings === null || settings === void 0 ? void 0 : settings.AllowGaps) == null ? seriesWithInterval : settings === null || settings === void 0 ? void 0 : settings.AllowGaps;
1145
+ let finalInstant = (_c = settings === null || settings === void 0 ? void 0 : settings.FinalInstants) !== null && _c !== void 0 ? _c : true;
1050
1146
  //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1051
1147
  am4core.options.autoDispose = true;
1052
1148
  this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1053
1149
  let ChartInstanceCasted = this.ChartInstance;
1054
- if (settings.Legend) {
1055
- ChartInstanceCasted.legend = new am4charts.Legend();
1056
- ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
1057
- ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
1058
- if (settings.LegendPadding) {
1059
- let template = this.ChartInstance.legend.itemContainers.template;
1060
- template.paddingTop = (_b = settings.LegendPadding.top) !== null && _b !== void 0 ? _b : 0;
1061
- template.paddingBottom = (_c = settings.LegendPadding.bottom) !== null && _c !== void 0 ? _c : 0;
1062
- template.paddingLeft = (_d = settings.LegendPadding.left) !== null && _d !== void 0 ? _d : 0;
1063
- template.paddingRight = (_e = settings.LegendPadding.right) !== null && _e !== void 0 ? _e : 0;
1150
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1151
+ if (settings.YAxisTitle) {
1152
+ yAxis.title.text = settings.YAxisTitle;
1153
+ yAxis.title.fontWeight = "bold";
1154
+ }
1155
+ if (settings.Min)
1156
+ yAxis.min = settings.Min;
1157
+ if (settings.Max)
1158
+ yAxis.max = settings.Max;
1159
+ let limitNullOrUndef = dataConverted.limit == null || dataConverted.limit == undefined;
1160
+ let limits = limitNullOrUndef ? [] : !dataConverted.limit.length ? [dataConverted.limit] : dataConverted.limit;
1161
+ if (limits.length > 0) {
1162
+ for (let i = 0; i < limits.length; i++) {
1163
+ let limit = limits[i];
1164
+ if (limit.upper != null && limit.upper != undefined && limit.lower != null && limit.lower != undefined) {
1165
+ let range = yAxis.axisRanges.create();
1166
+ range.value = limit.lower;
1167
+ range.endValue = limit.upper;
1168
+ if (limit.fillColor) {
1169
+ range.contents.stroke = am4core.color(limit.fillColor);
1170
+ range.contents.fill = range.contents.stroke;
1171
+ }
1172
+ range.label.inside = true;
1173
+ range.label.text = limit.upperlabel;
1174
+ range.label.fill = range.grid.stroke;
1175
+ range.label.verticalCenter = "bottom";
1176
+ range.label.stroke = am4core.color(limit.uppercolor || "#F92200");
1177
+ range.grid.stroke = am4core.color(limit.uppercolor || "#F92200");
1178
+ range.grid.strokeWidth = 2;
1179
+ range.grid.strokeOpacity = 1;
1180
+ }
1181
+ else if ((limit.lower == null || limit.lower == undefined) && limit.upper != null && limit.upper != undefined) {
1182
+ let range = yAxis.axisRanges.create();
1183
+ range.value = limit.upper;
1184
+ range.label.inside = true;
1185
+ range.label.text = limit.upperlabel;
1186
+ range.label.fill = range.grid.stroke;
1187
+ range.label.verticalCenter = "bottom";
1188
+ range.label.stroke = am4core.color(limit.uppercolor || "#F92200");
1189
+ range.grid.stroke = am4core.color(limit.uppercolor || "#F92200");
1190
+ range.grid.strokeWidth = 2;
1191
+ range.grid.strokeOpacity = 1;
1192
+ }
1193
+ else if ((limit.upper == null || limit.upper == undefined) && limit.lower != null && limit.lower != undefined) {
1194
+ let range = yAxis.axisRanges.create();
1195
+ range.value = limit.lower;
1196
+ range.label.inside = true;
1197
+ range.label.text = limit.lowerlabel;
1198
+ range.label.fill = range.grid.stroke;
1199
+ range.label.verticalCenter = "bottom";
1200
+ range.label.stroke = am4core.color(limit.lowercolor || "#F92200");
1201
+ range.grid.stroke = am4core.color(limit.lowercolor || "#F92200");
1202
+ range.grid.strokeWidth = 2;
1203
+ range.grid.strokeOpacity = 1;
1204
+ }
1064
1205
  }
1065
1206
  }
1066
- let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1067
- yAxis.tooltip.disabled = true;
1068
- if (settings.YAxisTitle) {
1069
- yAxis.title.text = settings.YAxisTitle;
1070
- yAxis.title.fontWeight = "bold";
1071
- }
1072
- yAxis.min = 0;
1073
- let dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
1074
- dateAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 50;
1075
- dateAxis.startLocation = 0.5;
1076
- dateAxis.endLocation = 0.5;
1207
+ this.dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
1208
+ // Per comatibilità col codice scritto quando non era a livello globale, mi scoccia sostituire
1209
+ let dateAxis = this.dateAxis;
1077
1210
  if (settings.XAxisTitle) {
1078
1211
  dateAxis.title.text = settings.XAxisTitle;
1079
1212
  dateAxis.title.fontWeight = "bold";
@@ -1086,40 +1219,207 @@ class AreaChartService {
1086
1219
  dateAxis.renderer.ticks.template.length = 10;
1087
1220
  dateAxis.renderer.ticks.template.location = 0;
1088
1221
  }
1089
- if (!!interval)
1222
+ dateAxis.renderer.minGridDistance = (_d = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _d !== void 0 ? _d : 50;
1223
+ dateAxis.renderer.grid.template.location = 0;
1224
+ dateAxis.minZoomCount = 5;
1225
+ dateAxis.groupData = dataShouldBeGrouped;
1226
+ dateAxis.groupCount = (_e = settings.DataGroupBucketSize) !== null && _e !== void 0 ? _e : this.DataGroupBucketSize;
1227
+ //Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
1228
+ if (gapsAllowed) {
1229
+ if (!seriesWithInterval) {
1230
+ console.error("Per utilizzare la funzionalità dei gap è obbligatorio definire un intervallo nelle serie del grafico");
1231
+ return null;
1232
+ }
1090
1233
  dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
1091
- // Unisco il dataset e tiro fuori i dati
1092
- let chartData = [];
1093
- let seriesToMakeCache = {};
1094
- let seriesToMake = [];
1095
- for (let i = 0; i < dataConverted.groups.length; i++) {
1096
- let group = dataConverted.groups[i];
1097
- let dataItem = { date: group.name };
1098
- for (let ii = 0; ii < group.values.length; ii++) {
1099
- let val = group.values[ii];
1100
- dataItem[val.k] = val.v;
1101
- if (!seriesToMakeCache[val.k]) {
1102
- seriesToMakeCache[val.k] = true;
1103
- seriesToMake.push(val.k);
1234
+ }
1235
+ if (showTimeline)
1236
+ ChartInstanceCasted.scrollbarX = new am4charts.XYChartScrollbar();
1237
+ let seriesToPush = [];
1238
+ let seriesColors = [];
1239
+ let defaultIndex = 0;
1240
+ // Ordinamento dei dati se serve
1241
+ dataConverted.series.forEach((s) => {
1242
+ if (s.values[0] && !(s.values[0].d instanceof Date)) {
1243
+ for (let v = 0; v < s.values.length; v++)
1244
+ s.values[v].d = new Date(s.values[v].d);
1245
+ }
1246
+ var correctOrder = true;
1247
+ var prevDate = null;
1248
+ for (let v = 0; v < s.values.length; v++) {
1249
+ if (!prevDate)
1250
+ prevDate = s.values[v].d;
1251
+ else if (s.values[v].d < prevDate) {
1252
+ correctOrder = false;
1253
+ break;
1104
1254
  }
1105
1255
  }
1106
- chartData.push(dataItem);
1256
+ if (!correctOrder)
1257
+ s.values.sort((d1, d2) => d1.d.getTime() - d2.d.getTime());
1258
+ });
1259
+ // Generazione di un unico dataset invece che N, per poter gestire un unico tooltip
1260
+ if (this.singleDataSet) {
1261
+ this.ChartInstance.data = this.generateSingleDataset(dataConverted);
1262
+ ;
1263
+ dateAxis.cursorTooltipEnabled = false;
1264
+ }
1265
+ dataConverted.series.forEach((s, index) => {
1266
+ var _a, _b, _c, _d;
1267
+ let stacked = s.stacked != null && s.stacked != undefined ? s.stacked : ((_a = settings === null || settings === void 0 ? void 0 : settings.Stacked) !== null && _a !== void 0 ? _a : false);
1268
+ let fill = stacked || (s.fill != null && s.fill != undefined ? s.fill : ((_b = settings === null || settings === void 0 ? void 0 : settings.Fill) !== null && _b !== void 0 ? _b : false));
1269
+ let series = (settings === null || settings === void 0 ? void 0 : settings.Step) ? new am4charts.StepLineSeries() : new am4charts.LineSeries();
1270
+ series.dataFields.valueY = "v" + (this.singleDataSet ? index : "");
1271
+ series.dataFields.dateX = "d";
1272
+ series.measureUnit = s.uom;
1273
+ series.name = s.name;
1274
+ series.strokeWidth = (_c = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _c !== void 0 ? _c : 1;
1275
+ series.connect = !gapsAllowed;
1276
+ series.minBulletDistance = 10;
1277
+ series.tooltipText = this.singleDataSet ? "" : s.name ? "{name}: [bold]{valueY}[/]" : "[bold]{valueY}[/]";
1278
+ series.tooltip.pointerOrientation = "vertical";
1279
+ series.tooltip.background.fillOpacity = 0.5;
1280
+ series.tooltip.label.padding(12, 12, 12, 12);
1281
+ series.fillOpacity = fill ? this.OpacityOnFill : 0.0001;
1282
+ series.stacked = stacked;
1283
+ series.hidden = s.hidden;
1284
+ //Dataset singolo, i dati sono registrati a livello di chart, creo il tooltip che permette di vederli tutti insieme
1285
+ //altrimenti assegno i dati della serie direttamente alla serie
1286
+ if (this.singleDataSet) {
1287
+ series.tooltip.getFillFromObject = false;
1288
+ series.tooltip.background.fill = am4core.color("#eee");
1289
+ series.tooltip.label.fill = am4core.color("#00");
1290
+ series.tooltip.defaultState.transitionDuration = 0;
1291
+ series.tooltip.hiddenState.transitionDuration = 0;
1292
+ //Utilizzo il mio dateService per la formattazione della data in modo che non debba mai gestire n formati fra n librerie... bellissimo
1293
+ series.dateFormatter.format = (source) => {
1294
+ if (interval && finalInstant && ["hour", "minute", "second"].includes(interval.timeunit)) {
1295
+ let timepart = null;
1296
+ switch (interval.timeunit) {
1297
+ case "hour":
1298
+ timepart = 'day';
1299
+ break;
1300
+ case "minute":
1301
+ timepart = 'hour';
1302
+ break;
1303
+ case "second":
1304
+ timepart = 'minute';
1305
+ break;
1306
+ }
1307
+ if (timepart)
1308
+ return this.dateExts.adjustDateToFinalInstant(source, timepart, interval ? interval.timeunit == "second" : false);
1309
+ }
1310
+ else
1311
+ return this.dateExts.getFormatted(source, interval ? ["day", "week", "month", "year"].includes(interval.timeunit) : false, interval ? interval.timeunit == "second" : false);
1312
+ };
1313
+ series.adapter.add("tooltipText", () => {
1314
+ var text = "[bold]{dateX.formatDate()}[/]\n";
1315
+ this.ChartInstance.series.each((item) => {
1316
+ let uom = " [font-style: italic]" + series.measureUnit || "" + "[/]";
1317
+ text += "[" + item.stroke.hex + "]●[/] " + (item.name ? (item.name + ": ") : "") + "[bold]{" + item.dataFields.valueY + "}[/]" + uom + "\n";
1318
+ });
1319
+ return text;
1320
+ });
1321
+ }
1322
+ else
1323
+ series.data = s.values;
1324
+ let segment = series.segments.template;
1325
+ let hoverState = segment.states.create("hover");
1326
+ hoverState.properties.strokeWidth = ((_d = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _d !== void 0 ? _d : 1) + 1;
1327
+ let dimmed = segment.states.create("dimmed");
1328
+ dimmed.properties.stroke = am4core.color("#dadada");
1329
+ //Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
1330
+ if (s.color)
1331
+ seriesColors.push(am4core.color(s.color));
1332
+ else {
1333
+ seriesColors.push(ChartInstanceCasted.colors.list[defaultIndex % ChartInstanceCasted.colors.list.length]);
1334
+ defaultIndex++;
1335
+ }
1336
+ seriesToPush.push(series);
1337
+ });
1338
+ ChartInstanceCasted.colors.list = seriesColors;
1339
+ //Scrivo le serie nel grafico
1340
+ seriesToPush.forEach(s => {
1341
+ ChartInstanceCasted.series.push(s);
1342
+ if (showTimeline)
1343
+ ChartInstanceCasted.scrollbarX.series.push(s);
1344
+ });
1345
+ if (settings.Legend) {
1346
+ this.ChartInstance.legend = new am4charts.Legend();
1347
+ this.ChartInstance.legend.position = (_f = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _f !== void 0 ? _f : 'right';
1348
+ this.ChartInstance.legend.scrollable = true;
1349
+ this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
1350
+ this.ChartInstance.legend.itemContainers.template.events.on("over", (event) => { this.processOver(event.target.dataItem.dataContext); });
1351
+ this.ChartInstance.legend.itemContainers.template.events.on("out", () => { this.processOut(); });
1352
+ if (settings.LegendPadding) {
1353
+ let template = this.ChartInstance.legend.itemContainers.template;
1354
+ template.paddingTop = (_g = settings.LegendPadding.top) !== null && _g !== void 0 ? _g : 0;
1355
+ template.paddingBottom = (_h = settings.LegendPadding.bottom) !== null && _h !== void 0 ? _h : 0;
1356
+ template.paddingLeft = (_j = settings.LegendPadding.left) !== null && _j !== void 0 ? _j : 0;
1357
+ template.paddingRight = (_k = settings.LegendPadding.right) !== null && _k !== void 0 ? _k : 0;
1358
+ }
1359
+ }
1360
+ this.ChartInstance.cursor = new am4charts.XYCursor();
1361
+ //Prove******************************************************************************************************************************
1362
+ // this.ChartInstance.cursor.events.on("cursorpositionchanged", (ev) => {
1363
+ // //var value = dateAxis.positionToDate(dateAxis.toAxisPosition(ev.target.xPosition));
1364
+ // var dt = dateAxis.series.values.find(t => t.dataItem.values.dateX);
1365
+ // if (dt && dt.dataItem) {
1366
+ // console.log(dt.dataItem.values);
1367
+ // // this.ChartInstance.tooltipText = dt;
1368
+ // }
1369
+ // else {
1370
+ // this.ChartInstance.tooltipText = "";
1371
+ // }
1372
+ // });
1373
+ //******************************************************************************************************************************
1374
+ this.ChartInstance.cursor.xAxis = dateAxis;
1375
+ this.ChartInstance.cursor.yAxis = yAxis;
1376
+ if (this.singleDataSet)
1377
+ this.ChartInstance.cursor.maxTooltipDistance = -1;
1378
+ //TODO: Cercare di capire perché è figlio di puttana......
1379
+ dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
1380
+ dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
1381
+ return this;
1382
+ }
1383
+ /** @ignore */
1384
+ setSelection(from, to) {
1385
+ this.dateAxis.zoomToDates(from, to, true, true);
1386
+ }
1387
+ /** @ignore */
1388
+ refreshData(data) {
1389
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
1390
+ if (this.singleDataSet) {
1391
+ var data = this.generateSingleDataset(dataConverted);
1392
+ this.ChartInstance.addData(data);
1393
+ return;
1394
+ }
1395
+ throw "Impossibile aggiornare i dati senza unire il dataset. Si prega di impostare [MergeDatasets] a true";
1396
+ }
1397
+ /** Partendo da dati divisi per seriue genera un dataset unito con la data come chiave e i vari valori dopo */
1398
+ generateSingleDataset(data) {
1399
+ let dto = {};
1400
+ data.series.forEach((vs, index) => {
1401
+ for (let i = 0; i < vs.values.length; i++) {
1402
+ var dataitem = vs.values[i];
1403
+ var indexer = new Date(dataitem.d).valueOf();
1404
+ if (!dto[indexer])
1405
+ dto[indexer] = {};
1406
+ dto[indexer]['v' + index] = dataitem.v;
1407
+ }
1408
+ });
1409
+ var dates = Object.keys(dto);
1410
+ var ret = [];
1411
+ for (let i = 0; i < dates.length; i++) {
1412
+ let values = dto[dates[i]];
1413
+ let item = { d: new Date(parseInt(dates[i])) };
1414
+ var vals = Object.keys(values);
1415
+ for (let ii = 0; ii < vals.length; ii++) {
1416
+ let series = vals[ii];
1417
+ let singleVal = values[series];
1418
+ item[series] = singleVal;
1419
+ }
1420
+ ret.push(item);
1107
1421
  }
1108
- ChartInstanceCasted.data = chartData;
1109
- //---------------------------------------------------------
1110
- seriesToMake.forEach(s => { this.createSeries(ChartInstanceCasted, s); });
1111
- ChartInstanceCasted.cursor = new am4charts.XYCursor();
1112
- ChartInstanceCasted.cursor.xAxis = dateAxis;
1113
- dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
1114
- dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
1115
- return this;
1116
- }
1117
- /** @ignore */
1118
- setSelection(from, to) {
1119
- }
1120
- /** @ignore */
1121
- refreshData(data) {
1122
- //TODO:IMPL
1422
+ return ret;
1123
1423
  }
1124
1424
  /** @ignore */
1125
1425
  emitSelectionChanged(ev, settings) {
@@ -1134,20 +1434,40 @@ class AreaChartService {
1134
1434
  }
1135
1435
  }
1136
1436
  /** @ignore */
1137
- createSeries(chart, name) {
1138
- let series = chart.series.push(new am4charts.LineSeries());
1139
- series.dataFields.dateX = "date";
1140
- series.name = name[0].toUpperCase() + name.slice(1);
1141
- series.dataFields.valueY = name;
1142
- series.tooltipText = "[#000]{valueY.value}[/]";
1143
- //series.tooltip.background.fill = am4core.color("#FFF");
1144
- series.tooltip.getStrokeFromObject = true;
1145
- series.tooltip.background.strokeWidth = 3;
1146
- series.tooltip.getFillFromObject = false;
1147
- series.fillOpacity = 0.6;
1148
- series.strokeWidth = 2;
1149
- series.stacked = true;
1150
- return series;
1437
+ processOver(hoveredSeries) {
1438
+ hoveredSeries.zIndex = 999;
1439
+ let fill = hoveredSeries.fillOpacity == this.OpacityOnFill;
1440
+ hoveredSeries.segments.each((segment) => {
1441
+ segment.setState("hover");
1442
+ if (!fill)
1443
+ segment.fillSprite.fillOpacity = this.OpacityOnSelected;
1444
+ });
1445
+ if (!fill)
1446
+ hoveredSeries.legendDataItem.marker.children.getIndex(1).fillOpacity = this.OpacityOnSelected;
1447
+ this.ChartInstance.series.each((series) => {
1448
+ if (series != hoveredSeries) {
1449
+ let fill = series.fillOpacity == this.OpacityOnFill;
1450
+ series.segments.each((segment) => {
1451
+ segment.setState("dimmed");
1452
+ if (!fill)
1453
+ segment.fillSprite.fillOpacity = 0;
1454
+ });
1455
+ }
1456
+ });
1457
+ }
1458
+ /** @ignore */
1459
+ processOut() {
1460
+ this.ChartInstance.series.each((series, i) => {
1461
+ series.zIndex = i;
1462
+ let fill = series.fillOpacity == this.OpacityOnFill;
1463
+ series.segments.each((segment) => {
1464
+ segment.setState("default");
1465
+ if (!fill)
1466
+ segment.fillSprite.fillOpacity = 0;
1467
+ });
1468
+ if (!fill)
1469
+ series.legendDataItem.marker.children.getIndex(1).fillOpacity = 0;
1470
+ });
1151
1471
  }
1152
1472
  /** @ignore */
1153
1473
  throttla(id, func, throttleTime) {
@@ -1159,74 +1479,6 @@ class AreaChartService {
1159
1479
  }
1160
1480
  }
1161
1481
 
1162
- /**
1163
- * Componente specifico per la graficazione di un grafico ad Area
1164
- */
1165
- class EsAreaChartComponent extends BaseChartComponent {
1166
- /**
1167
- * @ignore
1168
- */
1169
- constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
1170
- super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
1171
- this.adapter = adapter;
1172
- }
1173
- /**
1174
- * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
1175
- */
1176
- getSpecificPropertiesToCheck() {
1177
- return ["Data", "DataArray"];
1178
- }
1179
- /**
1180
- * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
1181
- *
1182
- * @returns {AreaChartSettings} Settings castati al tipo giusto
1183
- */
1184
- getCastedSettings() {
1185
- var _a;
1186
- return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new AreaChartSettings());
1187
- }
1188
- /**
1189
- * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
1190
- *
1191
- * @param {AreaChartSettings} settingsCasted Settings castati al tipo giusto
1192
- */
1193
- fillSpecificSettings(settingsCasted) {
1194
- }
1195
- /**
1196
- * Effettua il rendering di questo grafico in base ai Settings
1197
- *
1198
- * @param {AreaChartSettings} settingsCasted Impostazioni di graficazione
1199
- * @returns {AreaChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
1200
- */
1201
- graphicate(settingsCasted) {
1202
- return new AreaChartService(this.adapter).graphicate(this.Data, settingsCasted);
1203
- }
1204
- }
1205
- EsAreaChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsAreaChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
1206
- EsAreaChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsAreaChartComponent, selector: "es-area-chart", inputs: { Data: "Data", DataArray: "DataArray" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1207
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsAreaChartComponent, decorators: [{
1208
- type: Component,
1209
- args: [{ selector: 'es-area-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
1210
- }], ctorParameters: function () {
1211
- return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
1212
- type: Inject,
1213
- args: [PLATFORM_ID]
1214
- }] }, { type: undefined, decorators: [{
1215
- type: Inject,
1216
- args: [ESC_LOGS]
1217
- }] }, { type: undefined, decorators: [{
1218
- type: Inject,
1219
- args: [ESC_ANIMATIONS]
1220
- }] }, { type: undefined, decorators: [{
1221
- type: Inject,
1222
- args: [ESC_THEME]
1223
- }] }, { type: i4$1.LocalizationService }];
1224
- }, propDecorators: { Data: [{
1225
- type: Input
1226
- }], DataArray: [{
1227
- type: Input
1228
- }] } });
1229
-
1230
1482
  /**
1231
1483
  * Classe il cui unico scopo è gestire il setup e rendering di un PieChart
1232
1484
  */
@@ -1310,135 +1562,44 @@ class PieChartService {
1310
1562
  legend.itemContainers.template.events.on("hit", (ev) => {
1311
1563
  if (settings.OnSeriesClickCallback) {
1312
1564
  let clickedSeries = ev.target.dataItem.dataContext.legendDataItem.name;
1313
- settings.OnSeriesClickCallback(clickedSeries);
1314
- }
1315
- });
1316
- }
1317
- if (settings.LegendPadding) {
1318
- let template = this.ChartInstance.legend.itemContainers.template;
1319
- template.paddingTop = (_a = settings.LegendPadding.top) !== null && _a !== void 0 ? _a : 0;
1320
- template.paddingBottom = (_b = settings.LegendPadding.bottom) !== null && _b !== void 0 ? _b : 0;
1321
- template.paddingLeft = (_c = settings.LegendPadding.left) !== null && _c !== void 0 ? _c : 0;
1322
- template.paddingRight = (_d = settings.LegendPadding.right) !== null && _d !== void 0 ? _d : 0;
1323
- }
1324
- }
1325
- return this;
1326
- }
1327
- /** @ignore */
1328
- setSelection(from, to) {
1329
- }
1330
- /** @ignore */
1331
- refreshData(data) {
1332
- //TODO:IMPL
1333
- }
1334
- /** @ignore */
1335
- hideZeroes(ev) {
1336
- if (ev.target.dataItem && (ev.target.dataItem.values.value.percent == 0))
1337
- ev.target.hide();
1338
- else
1339
- ev.target.show();
1340
- }
1341
- }
1342
-
1343
- /**
1344
- * Componente specifico per la graficazione di un grafico a Torta
1345
- */
1346
- class EsPieChartComponent extends BaseChartComponent {
1347
- /**
1348
- * @ignore
1349
- */
1350
- constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
1351
- super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
1352
- this.adapter = adapter;
1353
- }
1354
- /**
1355
- * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
1356
- */
1357
- getSpecificPropertiesToCheck() {
1358
- return ["Data", "DataArray", "HideZeroes", "Mode3D", "LabelsWrap", "LabelsTruncate", "LabelsWidth", "LabelsVisible"];
1359
- }
1360
- /**
1361
- * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
1362
- *
1363
- * @returns {PieChartSettings} Settings castati al tipo giusto
1364
- */
1365
- getCastedSettings() {
1366
- var _a;
1367
- return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new PieChartSettings());
1368
- }
1369
- /**
1370
- * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
1371
- *
1372
- * @param {PieChartSettings} settingsCasted Settings castati al tipo giusto
1373
- */
1374
- fillSpecificSettings(settingsCasted) {
1375
- settingsCasted.HideZeroes = settingsCasted.HideZeroes != null ? settingsCasted.HideZeroes : this.HideZeroes;
1376
- settingsCasted.Mode3D = settingsCasted.Mode3D != null ? settingsCasted.Mode3D : this.Mode3D;
1377
- settingsCasted.DonutRadiusPercentage = settingsCasted.DonutRadiusPercentage != null ? settingsCasted.DonutRadiusPercentage : this.DonutRadiusPercentage;
1378
- settingsCasted.LabelsWrap = settingsCasted.LabelsWrap != null ? settingsCasted.LabelsWrap : this.LabelsWrap;
1379
- settingsCasted.LabelsTruncate = settingsCasted.LabelsTruncate != null ? settingsCasted.LabelsTruncate : this.LabelsTruncate;
1380
- settingsCasted.LabelsWidth = settingsCasted.LabelsWidth != null ? settingsCasted.LabelsWidth : this.LabelsWidth;
1381
- settingsCasted.LabelsVisible = settingsCasted.LabelsVisible != null ? settingsCasted.LabelsVisible : this.LabelsVisible;
1382
- }
1383
- /**
1384
- * Effettua il rendering di questo grafico in base ai Settings
1385
- *
1386
- * @param {PieChartSettings} settingsCasted Impostazioni di graficazione
1387
- * @returns {PieChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
1388
- */
1389
- graphicate(settingsCasted) {
1390
- return new PieChartService(this.adapter).graphicate(this.Data, settingsCasted);
1391
- }
1392
- }
1393
- EsPieChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsPieChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
1394
- EsPieChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsPieChartComponent, selector: "es-pie-chart", inputs: { Data: "Data", DataArray: "DataArray", HideZeroes: "HideZeroes", Mode3D: "Mode3D", DonutRadiusPercentage: "DonutRadiusPercentage", LabelsWrap: "LabelsWrap", LabelsTruncate: "LabelsTruncate", LabelsWidth: "LabelsWidth", LabelsVisible: "LabelsVisible" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1395
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsPieChartComponent, decorators: [{
1396
- type: Component,
1397
- args: [{ selector: 'es-pie-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
1398
- }], ctorParameters: function () {
1399
- return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
1400
- type: Inject,
1401
- args: [PLATFORM_ID]
1402
- }] }, { type: undefined, decorators: [{
1403
- type: Inject,
1404
- args: [ESC_LOGS]
1405
- }] }, { type: undefined, decorators: [{
1406
- type: Inject,
1407
- args: [ESC_ANIMATIONS]
1408
- }] }, { type: undefined, decorators: [{
1409
- type: Inject,
1410
- args: [ESC_THEME]
1411
- }] }, { type: i4$1.LocalizationService }];
1412
- }, propDecorators: { Data: [{
1413
- type: Input
1414
- }], DataArray: [{
1415
- type: Input
1416
- }], HideZeroes: [{
1417
- type: Input
1418
- }], Mode3D: [{
1419
- type: Input
1420
- }], DonutRadiusPercentage: [{
1421
- type: Input
1422
- }], LabelsWrap: [{
1423
- type: Input
1424
- }], LabelsTruncate: [{
1425
- type: Input
1426
- }], LabelsWidth: [{
1427
- type: Input
1428
- }], LabelsVisible: [{
1429
- type: Input
1430
- }] } });
1565
+ settings.OnSeriesClickCallback(clickedSeries);
1566
+ }
1567
+ });
1568
+ }
1569
+ if (settings.LegendPadding) {
1570
+ let template = this.ChartInstance.legend.itemContainers.template;
1571
+ template.paddingTop = (_a = settings.LegendPadding.top) !== null && _a !== void 0 ? _a : 0;
1572
+ template.paddingBottom = (_b = settings.LegendPadding.bottom) !== null && _b !== void 0 ? _b : 0;
1573
+ template.paddingLeft = (_c = settings.LegendPadding.left) !== null && _c !== void 0 ? _c : 0;
1574
+ template.paddingRight = (_d = settings.LegendPadding.right) !== null && _d !== void 0 ? _d : 0;
1575
+ }
1576
+ }
1577
+ return this;
1578
+ }
1579
+ /** @ignore */
1580
+ setSelection(from, to) {
1581
+ }
1582
+ /** @ignore */
1583
+ refreshData(data) {
1584
+ //TODO:IMPL
1585
+ }
1586
+ /** @ignore */
1587
+ hideZeroes(ev) {
1588
+ if (ev.target.dataItem && (ev.target.dataItem.values.value.percent == 0))
1589
+ ev.target.hide();
1590
+ else
1591
+ ev.target.show();
1592
+ }
1593
+ }
1431
1594
 
1432
1595
  /**
1433
- * Classe il cui unico scopo è gestire il setup e rendering di un Vertical2DChart
1596
+ * Classe il cui unico scopo è gestire il setup e rendering di un VerticalChart
1434
1597
  */
1435
- class Vertical2DChartService {
1598
+ class VerticalChartService {
1436
1599
  /** @ignore */
1437
1600
  constructor(Adapter) {
1438
1601
  this.Adapter = Adapter;
1439
1602
  /** @ignore */
1440
- this.DefaultGroupPaddingPercentage = 5;
1441
- /** @ignore */
1442
1603
  this.dangerZone = 50;
1443
1604
  /** @ignore */
1444
1605
  this.LabelWidth = 150;
@@ -1450,10 +1611,10 @@ class Vertical2DChartService {
1450
1611
  this.DefaultColumnWidthPercentage = 85;
1451
1612
  }
1452
1613
  /**
1453
- * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un Vertical2DChart
1614
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un VerticalChart
1454
1615
  */
1455
1616
  graphicate(data, settings) {
1456
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1617
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1457
1618
  if (settings.Timeline) {
1458
1619
  console.error("Timeline not supported for vertical chart");
1459
1620
  return null;
@@ -1462,6 +1623,9 @@ class Vertical2DChartService {
1462
1623
  am4core.options.autoDispose = true;
1463
1624
  this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1464
1625
  let ChartInstanceCasted = this.ChartInstance;
1626
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
1627
+ ChartInstanceCasted.data = dataConverted.values;
1628
+ let noStrokes = dataConverted.values.some(t => !!t.c);
1465
1629
  if (settings.Legend) {
1466
1630
  ChartInstanceCasted.legend = new am4charts.Legend();
1467
1631
  ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
@@ -1484,15 +1648,12 @@ class Vertical2DChartService {
1484
1648
  categoryAxis.title.text = settings.XAxisTitle;
1485
1649
  categoryAxis.title.fontWeight = "bold";
1486
1650
  }
1487
- yAxis.min = 0;
1488
- categoryAxis.dataFields.category = 'key';
1489
- categoryAxis.renderer.cellStartLocation = am4core.percent((_f = settings.GroupPaddingPercentage) !== null && _f !== void 0 ? _f : this.DefaultGroupPaddingPercentage).value;
1490
- categoryAxis.renderer.cellEndLocation = am4core.percent(100 - ((_g = settings.GroupPaddingPercentage) !== null && _g !== void 0 ? _g : this.DefaultGroupPaddingPercentage)).value;
1651
+ categoryAxis.dataFields.category = "k";
1491
1652
  categoryAxis.renderer.grid.template.location = 0;
1492
- categoryAxis.renderer.minGridDistance = (_h = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _h !== void 0 ? _h : 30;
1653
+ categoryAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 30;
1493
1654
  let label = categoryAxis.renderer.labels.template;
1494
1655
  label.truncate = true;
1495
- label.maxWidth = (_j = settings.LabelWidth) !== null && _j !== void 0 ? _j : this.LabelWidth;
1656
+ label.maxWidth = (_g = settings.LabelWidth) !== null && _g !== void 0 ? _g : this.LabelWidth;
1496
1657
  label.tooltipText = "{category}";
1497
1658
  if ((settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) == null ? true : settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) {
1498
1659
  categoryAxis.events.on("sizechanged", (ev) => {
@@ -1516,24 +1677,24 @@ class Vertical2DChartService {
1516
1677
  }
1517
1678
  });
1518
1679
  }
1519
- let dataPreConverted = this.Adapter ? this.Adapter.adaptDataForVertical2DChart(data) : data;
1520
- let dataConverted = [];
1521
- for (let i = 0; i < dataPreConverted.groups.length; i++) {
1522
- let item = dataPreConverted.groups[i];
1523
- let obj = { key: item.name };
1524
- for (let p = 0; p < item.values.length; p++) {
1525
- let value = item.values[p];
1526
- obj[value.k] = value.v;
1527
- }
1528
- dataConverted.push(obj);
1680
+ // Create series
1681
+ let series = ChartInstanceCasted.series.push(new am4charts.ColumnSeries());
1682
+ series.dataFields.valueY = "v";
1683
+ series.dataFields.categoryX = "k";
1684
+ series.name = "";
1685
+ let columnTemplate = series.columns.template;
1686
+ columnTemplate.tooltipText = "{categoryX}: [bold]{valueY}[/] {t}";
1687
+ columnTemplate.fillOpacity = .8;
1688
+ columnTemplate.width = am4core.percent((_h = settings.ColumnWidthPercentage) !== null && _h !== void 0 ? _h : this.DefaultColumnWidthPercentage);
1689
+ if (noStrokes) {
1690
+ columnTemplate.strokeOpacity = 0;
1691
+ columnTemplate.strokeWidth = 0;
1692
+ columnTemplate.adapter.add("fill", (_, target) => am4core.color(target.dataItem.dataContext.c));
1693
+ }
1694
+ else {
1695
+ columnTemplate.strokeWidth = 2;
1696
+ columnTemplate.strokeOpacity = 1;
1529
1697
  }
1530
- ChartInstanceCasted.data = dataConverted;
1531
- if (dataPreConverted.colorinfos)
1532
- ChartInstanceCasted.colors.list = dataPreConverted.colorinfos.map(c => am4core.color(c.color));
1533
- //Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
1534
- for (let prop in dataConverted[0])
1535
- if (prop !== "key")
1536
- this.createSeries(ChartInstanceCasted, settings, prop, prop);
1537
1698
  return this;
1538
1699
  }
1539
1700
  /** @ignore */
@@ -1543,150 +1704,18 @@ class Vertical2DChartService {
1543
1704
  refreshData(data) {
1544
1705
  //TODO:IMPL
1545
1706
  }
1546
- /** @ignore */
1547
- createSeries(chart, settings, value, name) {
1548
- var _a;
1549
- let series = chart.series.push(new am4charts.ColumnSeries());
1550
- series.dataFields.valueY = value;
1551
- series.dataFields.categoryX = 'key';
1552
- series.name = name;
1553
- series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
1554
- series.columns.template.fillOpacity = .8;
1555
- series.columns.template.width = am4core.percent((_a = settings.ColumnWidthPercentage) !== null && _a !== void 0 ? _a : this.DefaultColumnWidthPercentage);
1556
- series.events.on("hidden", () => this.arrangeColumns);
1557
- series.events.on("shown", () => this.arrangeColumns);
1558
- return series;
1559
- }
1560
- /** @ignore */
1561
- arrangeColumns() {
1562
- let ChartInstanceCasted = this.ChartInstance;
1563
- let series = ChartInstanceCasted.series.getIndex(0);
1564
- let xAxis = ChartInstanceCasted.xAxes.getIndex(0);
1565
- let w = 1 - xAxis.renderer.cellStartLocation - (1 - xAxis.renderer.cellEndLocation);
1566
- if (series.dataItems.length > 1) {
1567
- let x0 = xAxis.getX(series.dataItems.getIndex(0), "categoryX");
1568
- let x1 = xAxis.getX(series.dataItems.getIndex(1), "categoryX");
1569
- let delta = ((x1 - x0) / ChartInstanceCasted.series.length) * w;
1570
- if (am4core.isNumber(delta)) {
1571
- let middle = ChartInstanceCasted.series.length / 2;
1572
- let newIndex = 0;
1573
- ChartInstanceCasted.series.each((series) => {
1574
- if (!series.isHidden && !series.isHiding) {
1575
- series.dummyData = newIndex;
1576
- newIndex++;
1577
- }
1578
- else {
1579
- series.dummyData = ChartInstanceCasted.series.indexOf(series);
1580
- }
1581
- });
1582
- let visibleCount = newIndex;
1583
- let newMiddle = visibleCount / 2;
1584
- ChartInstanceCasted.series.each((series) => {
1585
- let trueIndex = ChartInstanceCasted.series.indexOf(series);
1586
- let newIndex = series.dummyData;
1587
- let dx = (newIndex - trueIndex + middle - newMiddle) * delta;
1588
- series.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
1589
- series.bulletsContainer.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
1590
- });
1591
- }
1592
- }
1593
- }
1594
1707
  }
1595
1708
 
1596
1709
  /**
1597
- * Componente specifico per la graficazione di un grafico a Barre con due dimensioni
1598
- */
1599
- class EsVertical2DChartComponent extends BaseChartComponent {
1600
- /**
1601
- * @ignore
1602
- */
1603
- constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
1604
- super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
1605
- this.adapter = adapter;
1606
- }
1607
- /**
1608
- * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
1609
- */
1610
- getSpecificPropertiesToCheck() {
1611
- return ["Data", "DataArray"];
1612
- }
1613
- /**
1614
- * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
1615
- *
1616
- * @returns {Vertical2DChartSettings} Settings castati al tipo giusto
1617
- */
1618
- getCastedSettings() {
1619
- var _a;
1620
- return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new Vertical2DChartSettings());
1621
- }
1622
- /**
1623
- * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
1624
- *
1625
- * @param {Vertical2DChartSettings} settingsCasted Settings castati al tipo giusto
1626
- */
1627
- fillSpecificSettings(settingsCasted) {
1628
- settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
1629
- settingsCasted.GroupPaddingPercentage = settingsCasted.GroupPaddingPercentage != null ? settingsCasted.GroupPaddingPercentage : this.GroupPaddingPercentage;
1630
- settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
1631
- settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
1632
- settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
1633
- settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
1634
- }
1635
- /**
1636
- * Effettua il rendering di questo grafico in base ai Settings
1637
- *
1638
- * @param {Vertical2DChartSettings} settingsCasted Impostazioni di graficazione
1639
- * @returns {Vertical2DChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
1640
- */
1641
- graphicate(settingsCasted) {
1642
- return new Vertical2DChartService(this.adapter).graphicate(this.Data, settingsCasted);
1643
- }
1644
- }
1645
- EsVertical2DChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVertical2DChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
1646
- EsVertical2DChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVertical2DChartComponent, selector: "es-vertical-2d-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", GroupPaddingPercentage: "GroupPaddingPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1647
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVertical2DChartComponent, decorators: [{
1648
- type: Component,
1649
- args: [{ selector: 'es-vertical-2d-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
1650
- }], ctorParameters: function () {
1651
- return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
1652
- type: Inject,
1653
- args: [PLATFORM_ID]
1654
- }] }, { type: undefined, decorators: [{
1655
- type: Inject,
1656
- args: [ESC_LOGS]
1657
- }] }, { type: undefined, decorators: [{
1658
- type: Inject,
1659
- args: [ESC_ANIMATIONS]
1660
- }] }, { type: undefined, decorators: [{
1661
- type: Inject,
1662
- args: [ESC_THEME]
1663
- }] }, { type: i4$1.LocalizationService }];
1664
- }, propDecorators: { Data: [{
1665
- type: Input
1666
- }], DataArray: [{
1667
- type: Input
1668
- }], ColumnWidthPercentage: [{
1669
- type: Input
1670
- }], GroupPaddingPercentage: [{
1671
- type: Input
1672
- }], LabelWidth: [{
1673
- type: Input
1674
- }], LabelVerticalOrientationCutoffWidth: [{
1675
- type: Input
1676
- }], LabelRightWhenCompressed: [{
1677
- type: Input
1678
- }], LabelTopWhenCompressed: [{
1679
- type: Input
1680
- }] } });
1681
-
1682
- /**
1683
- * Classe il cui unico scopo è gestire il setup e rendering di un VerticalChart
1710
+ * Classe il cui unico scopo è gestire il setup e rendering di un Vertical2DChart
1684
1711
  */
1685
- class VerticalChartService {
1712
+ class Vertical2DChartService {
1686
1713
  /** @ignore */
1687
1714
  constructor(Adapter) {
1688
1715
  this.Adapter = Adapter;
1689
1716
  /** @ignore */
1717
+ this.DefaultGroupPaddingPercentage = 5;
1718
+ /** @ignore */
1690
1719
  this.dangerZone = 50;
1691
1720
  /** @ignore */
1692
1721
  this.LabelWidth = 150;
@@ -1698,10 +1727,10 @@ class VerticalChartService {
1698
1727
  this.DefaultColumnWidthPercentage = 85;
1699
1728
  }
1700
1729
  /**
1701
- * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un VerticalChart
1730
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un Vertical2DChart
1702
1731
  */
1703
1732
  graphicate(data, settings) {
1704
- var _a, _b, _c, _d, _e, _f, _g, _h;
1733
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1705
1734
  if (settings.Timeline) {
1706
1735
  console.error("Timeline not supported for vertical chart");
1707
1736
  return null;
@@ -1710,9 +1739,6 @@ class VerticalChartService {
1710
1739
  am4core.options.autoDispose = true;
1711
1740
  this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1712
1741
  let ChartInstanceCasted = this.ChartInstance;
1713
- let dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
1714
- ChartInstanceCasted.data = dataConverted.values;
1715
- let noStrokes = dataConverted.values.some(t => !!t.c);
1716
1742
  if (settings.Legend) {
1717
1743
  ChartInstanceCasted.legend = new am4charts.Legend();
1718
1744
  ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
@@ -1735,12 +1761,15 @@ class VerticalChartService {
1735
1761
  categoryAxis.title.text = settings.XAxisTitle;
1736
1762
  categoryAxis.title.fontWeight = "bold";
1737
1763
  }
1738
- categoryAxis.dataFields.category = "k";
1764
+ yAxis.min = 0;
1765
+ categoryAxis.dataFields.category = 'key';
1766
+ categoryAxis.renderer.cellStartLocation = am4core.percent((_f = settings.GroupPaddingPercentage) !== null && _f !== void 0 ? _f : this.DefaultGroupPaddingPercentage).value;
1767
+ categoryAxis.renderer.cellEndLocation = am4core.percent(100 - ((_g = settings.GroupPaddingPercentage) !== null && _g !== void 0 ? _g : this.DefaultGroupPaddingPercentage)).value;
1739
1768
  categoryAxis.renderer.grid.template.location = 0;
1740
- categoryAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 30;
1769
+ categoryAxis.renderer.minGridDistance = (_h = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _h !== void 0 ? _h : 30;
1741
1770
  let label = categoryAxis.renderer.labels.template;
1742
1771
  label.truncate = true;
1743
- label.maxWidth = (_g = settings.LabelWidth) !== null && _g !== void 0 ? _g : this.LabelWidth;
1772
+ label.maxWidth = (_j = settings.LabelWidth) !== null && _j !== void 0 ? _j : this.LabelWidth;
1744
1773
  label.tooltipText = "{category}";
1745
1774
  if ((settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) == null ? true : settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) {
1746
1775
  categoryAxis.events.on("sizechanged", (ev) => {
@@ -1764,24 +1793,24 @@ class VerticalChartService {
1764
1793
  }
1765
1794
  });
1766
1795
  }
1767
- // Create series
1768
- let series = ChartInstanceCasted.series.push(new am4charts.ColumnSeries());
1769
- series.dataFields.valueY = "v";
1770
- series.dataFields.categoryX = "k";
1771
- series.name = "";
1772
- let columnTemplate = series.columns.template;
1773
- columnTemplate.tooltipText = "{categoryX}: [bold]{valueY}[/] {t}";
1774
- columnTemplate.fillOpacity = .8;
1775
- columnTemplate.width = am4core.percent((_h = settings.ColumnWidthPercentage) !== null && _h !== void 0 ? _h : this.DefaultColumnWidthPercentage);
1776
- if (noStrokes) {
1777
- columnTemplate.strokeOpacity = 0;
1778
- columnTemplate.strokeWidth = 0;
1779
- columnTemplate.adapter.add("fill", (_, target) => am4core.color(target.dataItem.dataContext.c));
1780
- }
1781
- else {
1782
- columnTemplate.strokeWidth = 2;
1783
- columnTemplate.strokeOpacity = 1;
1796
+ let dataPreConverted = this.Adapter ? this.Adapter.adaptDataForVertical2DChart(data) : data;
1797
+ let dataConverted = [];
1798
+ for (let i = 0; i < dataPreConverted.groups.length; i++) {
1799
+ let item = dataPreConverted.groups[i];
1800
+ let obj = { key: item.name };
1801
+ for (let p = 0; p < item.values.length; p++) {
1802
+ let value = item.values[p];
1803
+ obj[value.k] = value.v;
1804
+ }
1805
+ dataConverted.push(obj);
1784
1806
  }
1807
+ ChartInstanceCasted.data = dataConverted;
1808
+ if (dataPreConverted.colorinfos)
1809
+ ChartInstanceCasted.colors.list = dataPreConverted.colorinfos.map(c => am4core.color(c.color));
1810
+ //Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
1811
+ for (let prop in dataConverted[0])
1812
+ if (prop !== "key")
1813
+ this.createSeries(ChartInstanceCasted, settings, prop, prop);
1785
1814
  return this;
1786
1815
  }
1787
1816
  /** @ignore */
@@ -1791,90 +1820,55 @@ class VerticalChartService {
1791
1820
  refreshData(data) {
1792
1821
  //TODO:IMPL
1793
1822
  }
1794
- }
1795
-
1796
- /**
1797
- * Componente specifico per la graficazione di un grafico a Barre
1798
- */
1799
- class EsVerticalChartComponent extends BaseChartComponent {
1800
- /**
1801
- * @ignore
1802
- */
1803
- constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
1804
- super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
1805
- this.adapter = adapter;
1806
- }
1807
- /**
1808
- * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
1809
- */
1810
- getSpecificPropertiesToCheck() {
1811
- return ["Data", "DataArray"];
1812
- }
1813
- /**
1814
- * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
1815
- *
1816
- * @returns {VerticalChartSettings} Settings castati al tipo giusto
1817
- */
1818
- getCastedSettings() {
1823
+ /** @ignore */
1824
+ createSeries(chart, settings, value, name) {
1819
1825
  var _a;
1820
- return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new VerticalChartSettings());
1821
- }
1822
- /**
1823
- * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
1824
- *
1825
- * @param {VerticalChartSettings} settingsCasted Settings castati al tipo giusto
1826
- */
1827
- fillSpecificSettings(settingsCasted) {
1828
- settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
1829
- settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
1830
- settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
1831
- settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
1832
- settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
1826
+ let series = chart.series.push(new am4charts.ColumnSeries());
1827
+ series.dataFields.valueY = value;
1828
+ series.dataFields.categoryX = 'key';
1829
+ series.name = name;
1830
+ series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
1831
+ series.columns.template.fillOpacity = .8;
1832
+ series.columns.template.width = am4core.percent((_a = settings.ColumnWidthPercentage) !== null && _a !== void 0 ? _a : this.DefaultColumnWidthPercentage);
1833
+ series.events.on("hidden", () => this.arrangeColumns);
1834
+ series.events.on("shown", () => this.arrangeColumns);
1835
+ return series;
1833
1836
  }
1834
- /**
1835
- * Effettua il rendering di questo grafico in base ai Settings
1836
- *
1837
- * @param {VerticalChartSettings} settingsCasted Impostazioni di graficazione
1838
- * @returns {VerticalChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
1839
- */
1840
- graphicate(settingsCasted) {
1841
- return new VerticalChartService(this.adapter).graphicate(this.Data, settingsCasted);
1837
+ /** @ignore */
1838
+ arrangeColumns() {
1839
+ let ChartInstanceCasted = this.ChartInstance;
1840
+ let series = ChartInstanceCasted.series.getIndex(0);
1841
+ let xAxis = ChartInstanceCasted.xAxes.getIndex(0);
1842
+ let w = 1 - xAxis.renderer.cellStartLocation - (1 - xAxis.renderer.cellEndLocation);
1843
+ if (series.dataItems.length > 1) {
1844
+ let x0 = xAxis.getX(series.dataItems.getIndex(0), "categoryX");
1845
+ let x1 = xAxis.getX(series.dataItems.getIndex(1), "categoryX");
1846
+ let delta = ((x1 - x0) / ChartInstanceCasted.series.length) * w;
1847
+ if (am4core.isNumber(delta)) {
1848
+ let middle = ChartInstanceCasted.series.length / 2;
1849
+ let newIndex = 0;
1850
+ ChartInstanceCasted.series.each((series) => {
1851
+ if (!series.isHidden && !series.isHiding) {
1852
+ series.dummyData = newIndex;
1853
+ newIndex++;
1854
+ }
1855
+ else {
1856
+ series.dummyData = ChartInstanceCasted.series.indexOf(series);
1857
+ }
1858
+ });
1859
+ let visibleCount = newIndex;
1860
+ let newMiddle = visibleCount / 2;
1861
+ ChartInstanceCasted.series.each((series) => {
1862
+ let trueIndex = ChartInstanceCasted.series.indexOf(series);
1863
+ let newIndex = series.dummyData;
1864
+ let dx = (newIndex - trueIndex + middle - newMiddle) * delta;
1865
+ series.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
1866
+ series.bulletsContainer.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
1867
+ });
1868
+ }
1869
+ }
1842
1870
  }
1843
- }
1844
- EsVerticalChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
1845
- EsVerticalChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVerticalChartComponent, selector: "es-vertical-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1846
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalChartComponent, decorators: [{
1847
- type: Component,
1848
- args: [{ selector: 'es-vertical-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
1849
- }], ctorParameters: function () {
1850
- return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
1851
- type: Inject,
1852
- args: [PLATFORM_ID]
1853
- }] }, { type: undefined, decorators: [{
1854
- type: Inject,
1855
- args: [ESC_LOGS]
1856
- }] }, { type: undefined, decorators: [{
1857
- type: Inject,
1858
- args: [ESC_ANIMATIONS]
1859
- }] }, { type: undefined, decorators: [{
1860
- type: Inject,
1861
- args: [ESC_THEME]
1862
- }] }, { type: i4$1.LocalizationService }];
1863
- }, propDecorators: { Data: [{
1864
- type: Input
1865
- }], DataArray: [{
1866
- type: Input
1867
- }], ColumnWidthPercentage: [{
1868
- type: Input
1869
- }], LabelWidth: [{
1870
- type: Input
1871
- }], LabelVerticalOrientationCutoffWidth: [{
1872
- type: Input
1873
- }], LabelRightWhenCompressed: [{
1874
- type: Input
1875
- }], LabelTopWhenCompressed: [{
1876
- type: Input
1877
- }] } });
1871
+ }
1878
1872
 
1879
1873
  /**
1880
1874
  * Classe il cui unico scopo è gestire il setup e rendering di un VerticalStackedChart
@@ -2005,87 +1999,140 @@ class VerticalStackedChartService {
2005
1999
  }
2006
2000
 
2007
2001
  /**
2008
- * Componente specifico per la graficazione di un grafico a Barre in modalità Stacked (una serie sopra l'altra)
2002
+ * Classe il cui unico scopo è gestire il setup e rendering di un AreaChart
2009
2003
  */
2010
- class EsVerticalStackedChartComponent extends BaseChartComponent {
2011
- /**
2012
- * @ignore
2013
- */
2014
- constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
2015
- super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2016
- this.adapter = adapter;
2004
+ class AreaChartService {
2005
+ /** @ignore */
2006
+ constructor(Adapter) {
2007
+ this.Adapter = Adapter;
2008
+ //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
2009
+ //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
2010
+ /** @ignore */
2011
+ this.executionTimers = {};
2017
2012
  }
2018
2013
  /**
2019
- * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2014
+ * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un AreaChart
2020
2015
  */
2021
- getSpecificPropertiesToCheck() {
2022
- return ["Data", "DataArray"];
2016
+ graphicate(data, settings) {
2017
+ var _a, _b, _c, _d, _e, _f;
2018
+ if (settings.Timeline) {
2019
+ console.error("Timeline not supported for area chart");
2020
+ return null;
2021
+ }
2022
+ let dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
2023
+ let showTicks = settings.ShowTicks == null ? true : settings === null || settings === void 0 ? void 0 : settings.ShowTicks;
2024
+ let interval = dataConverted.interval;
2025
+ //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
2026
+ am4core.options.autoDispose = true;
2027
+ this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
2028
+ let ChartInstanceCasted = this.ChartInstance;
2029
+ if (settings.Legend) {
2030
+ ChartInstanceCasted.legend = new am4charts.Legend();
2031
+ ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
2032
+ ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
2033
+ if (settings.LegendPadding) {
2034
+ let template = this.ChartInstance.legend.itemContainers.template;
2035
+ template.paddingTop = (_b = settings.LegendPadding.top) !== null && _b !== void 0 ? _b : 0;
2036
+ template.paddingBottom = (_c = settings.LegendPadding.bottom) !== null && _c !== void 0 ? _c : 0;
2037
+ template.paddingLeft = (_d = settings.LegendPadding.left) !== null && _d !== void 0 ? _d : 0;
2038
+ template.paddingRight = (_e = settings.LegendPadding.right) !== null && _e !== void 0 ? _e : 0;
2039
+ }
2040
+ }
2041
+ let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
2042
+ yAxis.tooltip.disabled = true;
2043
+ if (settings.YAxisTitle) {
2044
+ yAxis.title.text = settings.YAxisTitle;
2045
+ yAxis.title.fontWeight = "bold";
2046
+ }
2047
+ yAxis.min = 0;
2048
+ let dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
2049
+ dateAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 50;
2050
+ dateAxis.startLocation = 0.5;
2051
+ dateAxis.endLocation = 0.5;
2052
+ if (settings.XAxisTitle) {
2053
+ dateAxis.title.text = settings.XAxisTitle;
2054
+ dateAxis.title.fontWeight = "bold";
2055
+ }
2056
+ if (showTicks) {
2057
+ dateAxis.renderer.ticks.template.disabled = false;
2058
+ dateAxis.renderer.ticks.template.strokeOpacity = 1;
2059
+ dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
2060
+ dateAxis.renderer.ticks.template.strokeWidth = 2;
2061
+ dateAxis.renderer.ticks.template.length = 10;
2062
+ dateAxis.renderer.ticks.template.location = 0;
2063
+ }
2064
+ if (!!interval)
2065
+ dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
2066
+ // Unisco il dataset e tiro fuori i dati
2067
+ let chartData = [];
2068
+ let seriesToMakeCache = {};
2069
+ let seriesToMake = [];
2070
+ for (let i = 0; i < dataConverted.groups.length; i++) {
2071
+ let group = dataConverted.groups[i];
2072
+ let dataItem = { date: group.name };
2073
+ for (let ii = 0; ii < group.values.length; ii++) {
2074
+ let val = group.values[ii];
2075
+ dataItem[val.k] = val.v;
2076
+ if (!seriesToMakeCache[val.k]) {
2077
+ seriesToMakeCache[val.k] = true;
2078
+ seriesToMake.push(val.k);
2079
+ }
2080
+ }
2081
+ chartData.push(dataItem);
2082
+ }
2083
+ ChartInstanceCasted.data = chartData;
2084
+ //---------------------------------------------------------
2085
+ seriesToMake.forEach(s => { this.createSeries(ChartInstanceCasted, s); });
2086
+ ChartInstanceCasted.cursor = new am4charts.XYCursor();
2087
+ ChartInstanceCasted.cursor.xAxis = dateAxis;
2088
+ dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
2089
+ dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
2090
+ return this;
2023
2091
  }
2024
- /**
2025
- * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2026
- *
2027
- * @returns {VerticalStackedChartSettings} Settings castati al tipo giusto
2028
- */
2029
- getCastedSettings() {
2030
- var _a;
2031
- return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new VerticalStackedChartSettings());
2092
+ /** @ignore */
2093
+ setSelection(from, to) {
2094
+ }
2095
+ /** @ignore */
2096
+ refreshData(data) {
2097
+ //TODO:IMPL
2098
+ }
2099
+ /** @ignore */
2100
+ emitSelectionChanged(ev, settings) {
2101
+ if (settings.OnSelectionChangedCallback) {
2102
+ this.throttla("selchange", () => {
2103
+ var axis = ev.target;
2104
+ var start = new Date(axis.minZoomed);
2105
+ var end = new Date(axis.maxZoomed);
2106
+ var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
2107
+ settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
2108
+ }, 150);
2109
+ }
2032
2110
  }
2033
- /**
2034
- * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2035
- *
2036
- * @param {VerticalStackedChartSettings} settingsCasted Settings castati al tipo giusto
2037
- */
2038
- fillSpecificSettings(settingsCasted) {
2039
- settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
2040
- settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
2041
- settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
2042
- settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
2043
- settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
2111
+ /** @ignore */
2112
+ createSeries(chart, name) {
2113
+ let series = chart.series.push(new am4charts.LineSeries());
2114
+ series.dataFields.dateX = "date";
2115
+ series.name = name[0].toUpperCase() + name.slice(1);
2116
+ series.dataFields.valueY = name;
2117
+ series.tooltipText = "[#000]{valueY.value}[/]";
2118
+ //series.tooltip.background.fill = am4core.color("#FFF");
2119
+ series.tooltip.getStrokeFromObject = true;
2120
+ series.tooltip.background.strokeWidth = 3;
2121
+ series.tooltip.getFillFromObject = false;
2122
+ series.fillOpacity = 0.6;
2123
+ series.strokeWidth = 2;
2124
+ series.stacked = true;
2125
+ return series;
2044
2126
  }
2045
- /**
2046
- * Effettua il rendering di questo grafico in base ai Settings
2047
- *
2048
- * @param {VerticalStackedChartSettings} settingsCasted Impostazioni di graficazione
2049
- * @returns {VerticalStackedChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2050
- */
2051
- graphicate(settingsCasted) {
2052
- return new VerticalStackedChartService(this.adapter).graphicate(this.Data, settingsCasted);
2127
+ /** @ignore */
2128
+ throttla(id, func, throttleTime) {
2129
+ //Se ho la funzione che vuole eseguire ripulisco quel timeout
2130
+ if (this.executionTimers[id])
2131
+ clearTimeout(this.executionTimers[id]);
2132
+ //Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
2133
+ this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
2053
2134
  }
2054
- }
2055
- EsVerticalStackedChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalStackedChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2056
- EsVerticalStackedChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVerticalStackedChartComponent, selector: "es-vertical-stacked-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2057
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalStackedChartComponent, decorators: [{
2058
- type: Component,
2059
- args: [{ selector: 'es-vertical-stacked-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2060
- }], ctorParameters: function () {
2061
- return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2062
- type: Inject,
2063
- args: [PLATFORM_ID]
2064
- }] }, { type: undefined, decorators: [{
2065
- type: Inject,
2066
- args: [ESC_LOGS]
2067
- }] }, { type: undefined, decorators: [{
2068
- type: Inject,
2069
- args: [ESC_ANIMATIONS]
2070
- }] }, { type: undefined, decorators: [{
2071
- type: Inject,
2072
- args: [ESC_THEME]
2073
- }] }, { type: i4$1.LocalizationService }];
2074
- }, propDecorators: { Data: [{
2075
- type: Input
2076
- }], DataArray: [{
2077
- type: Input
2078
- }], ColumnWidthPercentage: [{
2079
- type: Input
2080
- }], LabelWidth: [{
2081
- type: Input
2082
- }], LabelVerticalOrientationCutoffWidth: [{
2083
- type: Input
2084
- }], LabelRightWhenCompressed: [{
2085
- type: Input
2086
- }], LabelTopWhenCompressed: [{
2087
- type: Input
2088
- }] } });
2135
+ }
2089
2136
 
2090
2137
  /**
2091
2138
  * Componente specifico per la graficazione di un qualsiasi tipo di grafico.
@@ -2160,13 +2207,13 @@ class EsChartComponent extends BaseChartComponent {
2160
2207
  }
2161
2208
  }
2162
2209
  }
2163
- EsChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i4.DateService }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2210
+ EsChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i3.DateService }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2164
2211
  EsChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsChartComponent, selector: "es-chart", inputs: { Type: "Type", Data: "Data", DataArray: "DataArray" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2165
2212
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartComponent, decorators: [{
2166
2213
  type: Component,
2167
2214
  args: [{ selector: 'es-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2168
2215
  }], ctorParameters: function () {
2169
- return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i4.DateService }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2216
+ return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i3.DateService }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2170
2217
  type: Inject,
2171
2218
  args: [PLATFORM_ID]
2172
2219
  }] }, { type: undefined, decorators: [{
@@ -2178,7 +2225,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2178
2225
  }] }, { type: undefined, decorators: [{
2179
2226
  type: Inject,
2180
2227
  args: [ESC_THEME]
2181
- }] }, { type: i4$1.LocalizationService }];
2228
+ }] }, { type: i4.LocalizationService }];
2182
2229
  }, propDecorators: { Type: [{
2183
2230
  type: Input
2184
2231
  }], Data: [{
@@ -2187,614 +2234,515 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2187
2234
  type: Input
2188
2235
  }] } });
2189
2236
 
2190
- /** Componenti esportati dal modulo */
2191
- const COMPONENTS = [
2192
- EsChartComponent,
2193
- EsLineChartComponent,
2194
- EsPieChartComponent,
2195
- EsVertical2DChartComponent,
2196
- EsVerticalChartComponent,
2197
- EsVerticalStackedChartComponent,
2198
- PageChartSelector,
2199
- EsAreaChartComponent
2200
- ];
2201
- class EsChartsModule {
2202
- static forRoot(config) {
2203
- return {
2204
- ngModule: EsChartsModule,
2205
- providers: [
2206
- { provide: ESC_ANIMATIONS, useValue: (config === null || config === void 0 ? void 0 : config.animations) == null || (config === null || config === void 0 ? void 0 : config.animations) == undefined ? true : config === null || config === void 0 ? void 0 : config.animations },
2207
- { provide: ESC_THEME, useValue: (config === null || config === void 0 ? void 0 : config.theme) || 'spiritedaway' },
2208
- { provide: ESC_LOGS, useValue: (config === null || config === void 0 ? void 0 : config.debugMode) || false },
2209
- { provide: BaseAdapter, useClass: (config === null || config === void 0 ? void 0 : config.adapter) || BaseAdapter }
2210
- ]
2211
- };
2212
- }
2213
- }
2214
- EsChartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2215
- EsChartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, declarations: [EsChartComponent,
2216
- EsLineChartComponent,
2217
- EsPieChartComponent,
2218
- EsVertical2DChartComponent,
2219
- EsVerticalChartComponent,
2220
- EsVerticalStackedChartComponent,
2221
- PageChartSelector,
2222
- EsAreaChartComponent], imports: [CommonModule], exports: [EsChartComponent,
2223
- EsLineChartComponent,
2224
- EsPieChartComponent,
2225
- EsVertical2DChartComponent,
2226
- EsVerticalChartComponent,
2227
- EsVerticalStackedChartComponent,
2228
- PageChartSelector,
2229
- EsAreaChartComponent] });
2230
- EsChartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, imports: [CommonModule] });
2231
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, decorators: [{
2232
- type: NgModule,
2233
- args: [{
2234
- imports: [CommonModule],
2235
- declarations: [...COMPONENTS],
2236
- exports: [...COMPONENTS]
2237
- }]
2238
- }] });
2239
-
2240
2237
  /**
2241
- * Classe di supporto al caricamento dinamico dei vari pezzi di amcharts che mi servono per il grafico (temi, locali, ecc...)
2242
- *
2243
- * Essenzialmente ogni volta che viene creato un grafico, questo acquisisce il tema e il locale applicato IN QUEL MOMENTO,
2244
- * questo significa che per creare due grafici con temi diversi bisogna fare:
2245
- *
2246
- * 1) Caricamento tema 1
2247
- *
2248
- * 2) Creazione grafico 1
2249
- *
2250
- * 3) Scaricamento tema 1
2251
- *
2252
- * 3) Caricamento tema 2
2253
- *
2254
- * 4) Creazione grafico 2
2255
- *
2238
+ * Componente specifico per la graficazione di un grafico ad Area
2256
2239
  */
2257
- class ChartLoader {
2240
+ class EsAreaChartComponent extends BaseChartComponent {
2258
2241
  /**
2259
2242
  * @ignore
2260
2243
  */
2261
- constructor(logs) {
2262
- this.logs = logs;
2263
- /**
2264
- * Indica se attualmente ho le animazioni caricate in modo da non ricaricarle inutilmente
2265
- */
2266
- this.AnimationsAreLoaded = false;
2267
- /**
2268
- * Indica l'ultimo tema caricato in modo da non ricaricarlo inutilmente qualora il prossimo grafico da creare richieda lo stesso tema
2269
- */
2270
- this.LastLoadedTheme = "";
2271
- /**
2272
- * Cache dei temi (moduli caricati dinamicamente)
2273
- */
2274
- this.themeCache = {};
2275
- /**
2276
- * Cache delle localizzazioni (moduli caricati dinamicamente)
2277
- */
2278
- this.localizationCache = {};
2244
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
2245
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2246
+ this.adapter = adapter;
2279
2247
  }
2280
2248
  /**
2281
- * Applica il tema con le animazioni all'istanza globale di amCharts
2249
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2250
+ */
2251
+ getSpecificPropertiesToCheck() {
2252
+ return ["Data", "DataArray"];
2253
+ }
2254
+ /**
2255
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2282
2256
  *
2283
- * @param {Object} chartsCore Istanza globale di amCharts
2284
- * @returns {Promise} Promise che identifica la fine del caricamento
2257
+ * @returns {AreaChartSettings} Settings castati al tipo giusto
2285
2258
  */
2286
- applyAnimations(chartsCore) {
2287
- if (!this.AnimationsAreLoaded) {
2288
- return this.importIfNeeded('themes', ChartThemes.animated).then(() => {
2289
- this.log("CORE: Applying theme " + ChartThemes.animated);
2290
- chartsCore.useTheme(this.themeCache[ChartThemes.animated]);
2291
- this.AnimationsAreLoaded = true;
2292
- });
2293
- }
2294
- else {
2295
- this.log("CORE: theme already applyed " + ChartThemes.animated);
2296
- return new Promise((resolve) => { resolve(true); });
2297
- }
2259
+ getCastedSettings() {
2260
+ var _a;
2261
+ return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new AreaChartSettings());
2298
2262
  }
2299
2263
  /**
2300
- * De-applica il tema con le animazioni dall'istanza globale di amCharts
2264
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2301
2265
  *
2302
- * @param {Object} chartsCore Istanza globale di amCharts
2303
- * @returns {Promise} Promise che identifica la fine dello scarico
2266
+ * @param {AreaChartSettings} settingsCasted Settings castati al tipo giusto
2304
2267
  */
2305
- unapplyAnimations(chartsCore) {
2306
- if (this.AnimationsAreLoaded) {
2307
- this.log("CORE: Animations in use, unapplying theme " + ChartThemes.animated);
2308
- chartsCore.unuseTheme(this.themeCache[ChartThemes.animated]);
2309
- this.AnimationsAreLoaded = false;
2310
- }
2311
- else
2312
- this.log("CORE: Animations already unused, no need to unapply them");
2313
- return new Promise((resolve) => { resolve(true); });
2268
+ fillSpecificSettings(settingsCasted) {
2314
2269
  }
2315
2270
  /**
2316
- * Applica il tema specificato all'istanza globale di amCharts
2271
+ * Effettua il rendering di questo grafico in base ai Settings
2317
2272
  *
2318
- * @param {Object} chartsCore Istanza globale di amCharts
2319
- * @param {'spiritedaway' | 'moonrisekingdom' | 'frozen' | 'dark' | 'kelly' | 'material' | 'dataviz' | 'none'} theme Tema da applicare
2320
- * @returns {Promise} Promise che identifica la fine del caricamento
2273
+ * @param {AreaChartSettings} settingsCasted Impostazioni di graficazione
2274
+ * @returns {AreaChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2321
2275
  */
2322
- applyTheme(chartsCore, theme) {
2323
- // Ultimo tema applicato è lo stesso che mi è stato richiesto di applicare --> NO-OP
2324
- if (this.LastLoadedTheme == theme) {
2325
- this.log("CORE: theme already applied " + theme);
2326
- return new Promise((resolve) => { resolve(true); });
2327
- }
2328
- // Scarico il tema precedente a prescindere, ormai non mi serve più
2329
- this.unapplyPreviousTheme(chartsCore);
2330
- // Il tema è il none --> registro la cosa e basta, il tema precedente è stato rimosso subito qui sopra ^
2331
- if (theme == ChartThemes.none) {
2332
- this.LastLoadedTheme = ChartThemes.none;
2333
- return new Promise((resolve) => { resolve(true); });
2334
- }
2335
- // Il tema è diverso dal precedente e non è il tema vuoto --> Importo il tema specificato se non presente in memoria e lo applico al grafico attuale
2336
- return this.importIfNeeded('themes', theme).then(() => {
2337
- this.log("CORE: Applying theme " + theme);
2338
- chartsCore.useTheme(this.themeCache[theme]);
2339
- this.LastLoadedTheme = theme;
2340
- });
2276
+ graphicate(settingsCasted) {
2277
+ return new AreaChartService(this.adapter).graphicate(this.Data, settingsCasted);
2278
+ }
2279
+ }
2280
+ EsAreaChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsAreaChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2281
+ EsAreaChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsAreaChartComponent, selector: "es-area-chart", inputs: { Data: "Data", DataArray: "DataArray" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2282
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsAreaChartComponent, decorators: [{
2283
+ type: Component,
2284
+ args: [{ selector: 'es-area-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2285
+ }], ctorParameters: function () {
2286
+ return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2287
+ type: Inject,
2288
+ args: [PLATFORM_ID]
2289
+ }] }, { type: undefined, decorators: [{
2290
+ type: Inject,
2291
+ args: [ESC_LOGS]
2292
+ }] }, { type: undefined, decorators: [{
2293
+ type: Inject,
2294
+ args: [ESC_ANIMATIONS]
2295
+ }] }, { type: undefined, decorators: [{
2296
+ type: Inject,
2297
+ args: [ESC_THEME]
2298
+ }] }, { type: i4.LocalizationService }];
2299
+ }, propDecorators: { Data: [{
2300
+ type: Input
2301
+ }], DataArray: [{
2302
+ type: Input
2303
+ }] } });
2304
+
2305
+ /**
2306
+ * Componente specifico per la graficazione di un grafico a Linea su un asse temporale
2307
+ */
2308
+ class EsLineChartComponent extends BaseChartComponent {
2309
+ /**
2310
+ * @ignore
2311
+ */
2312
+ constructor(el, ChartLoader, ChartDispatcher, adapter, dateService, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
2313
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2314
+ this.adapter = adapter;
2315
+ this.dateService = dateService;
2341
2316
  }
2342
2317
  /**
2343
- * De-applica il tema precedente dall'istanza globale di amCharts
2344
- *
2345
- * @param {Object} chartsCore Istanza globale di amCharts
2318
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2346
2319
  */
2347
- unapplyPreviousTheme(chartsCore) {
2348
- if (!this.LastLoadedTheme || this.LastLoadedTheme == ChartThemes.none)
2349
- return;
2350
- this.log("CORE: Unapplying previously used theme " + this.LastLoadedTheme);
2351
- chartsCore.unuseTheme(this.themeCache[this.LastLoadedTheme]);
2320
+ getSpecificPropertiesToCheck() {
2321
+ return ["Data", "DataArray", "Step", "DataGroupBucketSize", "DataGroupingThreshold", "StrokeSize", "Stacked", "AllowGaps", "MergeDatasets", "FinalInstants", "Fill", "Min", "Max"];
2352
2322
  }
2353
2323
  /**
2354
- * Applica il locale specificato all'istanza specifica del grafico
2324
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2355
2325
  *
2356
- * @param {amCharts.Chart} chart Istanza specifica del grafico a cui applicare il locale
2357
- * @param {string} locale Locale da applicare
2358
- * @returns {Promise} Promise che identifica la fine del caricamento
2326
+ * @returns {LineChartSettings} Settings castati al tipo giusto
2359
2327
  */
2360
- applyLocale(chart, locale) {
2361
- return this.importIfNeeded('lang', locale).then(() => {
2362
- this.log("Chart " + chart.htmlContainer.id + ": applying locale " + locale);
2363
- chart.language.locale = this.localizationCache[locale];
2364
- });
2328
+ getCastedSettings() {
2329
+ var _a;
2330
+ return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new LineChartSettings());
2365
2331
  }
2366
2332
  /**
2367
- * Permette di importare, se serve un dato tema o localizzazione
2368
- *
2369
- * @param {'lang' | 'themes'} what Oggetto da importare, se localizzazione o tema
2370
- * @param {string} item Chiave dell'oggetto da importare
2333
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2371
2334
  *
2372
- * @returns {Promise} Promise che identifica la fine del caricamento
2335
+ * @param {LineChartSettings} settingsCasted Settings castati al tipo giusto
2373
2336
  */
2374
- importIfNeeded(what, item) {
2375
- // Se sto cercando di caricare qualcosa di già caricato non faccio nulla
2376
- if (!(what == 'themes' && !this.themeCache[item]) && !(what == 'lang' && !this.localizationCache[item])) {
2377
- this.log("CORE: " + (what == 'lang' ? "Language " : "Theme ") + item + " already loaded");
2378
- return new Promise((resolve) => { resolve(true); });
2379
- }
2380
- this.log("CORE: Loading " + (what == 'lang' ? "language " : "theme ") + item);
2381
- /*
2382
- * ****************************
2383
- * ******** ATTENZIONE ********
2384
- * ****************************
2385
- *
2386
- * Se stai vedendo questo codice di import e stai valutando di riscriverlo come:
2387
- *
2388
- * V V
2389
- * import(`@amcharts/amcharts4/${what}/${item}`).then(module => {
2390
- * if (what == 'themes') this.themeCache[item] = module.default;
2391
- * else if (what == 'lang') this.localizationCache[item] = module.default;
2392
- * });
2393
- *
2394
- * Sappi che è una pessima idea. Gli import sono valutati da webpack in compiletime per generare i chunk,
2395
- * mettere la navigazione agli import con la concatenazione viene preso malissimo ed essenzialmente dice a webpack
2396
- * di tirare su e bundlare l'intera node_modules. Divertente, no?
2397
- *
2398
- */
2399
- switch (what) {
2400
- case 'themes':
2401
- switch (item) {
2402
- case ChartThemes.spiritedaway:
2403
- return import('@amcharts/amcharts4/themes/spiritedaway').then(theme => this.themeCache[item] = theme.default);
2404
- case ChartThemes.moonrisekingdom:
2405
- return import('@amcharts/amcharts4/themes/moonrisekingdom').then(theme => this.themeCache[item] = theme.default);
2406
- case ChartThemes.frozen:
2407
- return import('@amcharts/amcharts4/themes/frozen').then(theme => this.themeCache[item] = theme.default);
2408
- case ChartThemes.dark:
2409
- return import('@amcharts/amcharts4/themes/dark').then(theme => this.themeCache[item] = theme.default);
2410
- case ChartThemes.kelly:
2411
- return import('@amcharts/amcharts4/themes/kelly').then(theme => this.themeCache[item] = theme.default);
2412
- case ChartThemes.material:
2413
- return import('@amcharts/amcharts4/themes/material').then(theme => this.themeCache[item] = theme.default);
2414
- case ChartThemes.dataviz:
2415
- return import('@amcharts/amcharts4/themes/dataviz').then(theme => this.themeCache[item] = theme.default);
2416
- case ChartThemes.animated:
2417
- return import('@amcharts/amcharts4/themes/animated').then(theme => this.themeCache[item] = theme.default);
2418
- }
2419
- break;
2420
- case 'lang':
2421
- switch (item) {
2422
- case 'it-IT':
2423
- return import('@amcharts/amcharts4/lang/it_IT').then(lang => this.localizationCache[item] = lang.default);
2424
- case 'en-US':
2425
- return import('@amcharts/amcharts4/lang/en_US').then(lang => this.localizationCache[item] = lang.default);
2426
- }
2427
- }
2428
- this.log("CORE: Loading Failed. " + (what == 'lang' ? "Language " : "Theme") + " not recognized: " + item);
2429
- return new Promise((resolve) => { resolve(true); });
2337
+ fillSpecificSettings(settingsCasted) {
2338
+ settingsCasted.Step = settingsCasted.Step != null ? settingsCasted.Step : this.Step;
2339
+ settingsCasted.DataGroupBucketSize = settingsCasted.DataGroupBucketSize != null ? settingsCasted.DataGroupBucketSize : this.DataGroupBucketSize;
2340
+ settingsCasted.StrokeSize = settingsCasted.StrokeSize != null ? settingsCasted.StrokeSize : this.StrokeSize;
2341
+ settingsCasted.DataGroupingThreshold = settingsCasted.DataGroupingThreshold != null ? settingsCasted.DataGroupingThreshold : this.DataGroupingThreshold;
2342
+ settingsCasted.AllowGaps = settingsCasted.AllowGaps != null ? settingsCasted.AllowGaps : this.AllowGaps;
2343
+ settingsCasted.MergeDatasets = settingsCasted.MergeDatasets != null ? settingsCasted.MergeDatasets : this.MergeDatasets;
2344
+ settingsCasted.FinalInstants = settingsCasted.FinalInstants != null ? settingsCasted.FinalInstants : this.FinalInstants;
2345
+ settingsCasted.Min = settingsCasted.Min != null ? settingsCasted.Min : this.Min;
2346
+ settingsCasted.Max = settingsCasted.Max != null ? settingsCasted.Max : this.Max;
2347
+ settingsCasted.Fill = settingsCasted.Fill != null ? settingsCasted.Fill : this.Fill;
2348
+ settingsCasted.Stacked = settingsCasted.Stacked != null ? settingsCasted.Stacked : this.Stacked;
2430
2349
  }
2431
2350
  /**
2432
- * @ignore
2351
+ * Effettua il rendering di questo grafico in base ai Settings
2352
+ *
2353
+ * @param {LineChartSettings} settingsCasted Impostazioni di graficazione
2354
+ * @returns {LineChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2433
2355
  */
2434
- log(text) {
2435
- if (this.logs)
2436
- console.log("@esfaenza/es-charts: " + text);
2356
+ graphicate(settingsCasted) {
2357
+ return new LineChartService(this.adapter, this.dateService).graphicate(this.Data, settingsCasted);
2437
2358
  }
2438
2359
  }
2439
- ChartLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartLoader, deps: [{ token: ESC_LOGS }], target: i0.ɵɵFactoryTarget.Injectable });
2440
- ChartLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartLoader, providedIn: EsChartsModule });
2441
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartLoader, decorators: [{
2442
- type: Injectable,
2443
- args: [{ providedIn: EsChartsModule }]
2360
+ EsLineChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsLineChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i3.DateService }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2361
+ EsLineChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsLineChartComponent, selector: "es-line-chart", inputs: { Data: "Data", DataArray: "DataArray", Step: "Step", DataGroupBucketSize: "DataGroupBucketSize", DataGroupingThreshold: "DataGroupingThreshold", StrokeSize: "StrokeSize", AllowGaps: "AllowGaps", MergeDatasets: "MergeDatasets", FinalInstants: "FinalInstants", Min: "Min", Max: "Max", Fill: "Fill", Stacked: "Stacked" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2362
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsLineChartComponent, decorators: [{
2363
+ type: Component,
2364
+ args: [{ selector: 'es-line-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2444
2365
  }], ctorParameters: function () {
2445
- return [{ type: undefined, decorators: [{
2366
+ return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i3.DateService }, { type: i0.NgZone }, { type: Object, decorators: [{
2367
+ type: Inject,
2368
+ args: [PLATFORM_ID]
2369
+ }] }, { type: undefined, decorators: [{
2446
2370
  type: Inject,
2447
2371
  args: [ESC_LOGS]
2448
- }] }];
2449
- } });
2372
+ }] }, { type: undefined, decorators: [{
2373
+ type: Inject,
2374
+ args: [ESC_ANIMATIONS]
2375
+ }] }, { type: undefined, decorators: [{
2376
+ type: Inject,
2377
+ args: [ESC_THEME]
2378
+ }] }, { type: i4.LocalizationService }];
2379
+ }, propDecorators: { Data: [{
2380
+ type: Input
2381
+ }], DataArray: [{
2382
+ type: Input
2383
+ }], Step: [{
2384
+ type: Input
2385
+ }], DataGroupBucketSize: [{
2386
+ type: Input
2387
+ }], DataGroupingThreshold: [{
2388
+ type: Input
2389
+ }], StrokeSize: [{
2390
+ type: Input
2391
+ }], AllowGaps: [{
2392
+ type: Input
2393
+ }], MergeDatasets: [{
2394
+ type: Input
2395
+ }], FinalInstants: [{
2396
+ type: Input
2397
+ }], Min: [{
2398
+ type: Input
2399
+ }], Max: [{
2400
+ type: Input
2401
+ }], Fill: [{
2402
+ type: Input
2403
+ }], Stacked: [{
2404
+ type: Input
2405
+ }] } });
2450
2406
 
2451
2407
  /**
2452
- * Componente Grafico Base che gestisce tutte le cose comuni dei vari grafici istanziabili, come la presenza o menu di una legenda,
2453
- * il tema utilizzato, il locale del singolo grafico, ecc ecc...
2408
+ * Componente specifico per la graficazione di un grafico a Torta
2454
2409
  */
2455
- class BaseChartComponent {
2410
+ class EsPieChartComponent extends BaseChartComponent {
2456
2411
  /**
2457
- * Costruttore
2458
- *
2459
- * @param {ElementRef} el Contenitore all'interno del cui viene creato il grafico. Utilizzato per estrapolarne la **ContainerHeight**
2460
- * @param {Object} platformId piattaforma Angular (browser, ecc...) per essere sicuri che amcharts venga attivato solo lato browser. Non utilizzando SSR nelle applicazioni che consumano questa libreria non è particolarmente significativo, ma non si sa mai
2461
- * @param {NgZone} zone NgZone di default per permettere di inizializzare il grafico all'infuori di Angular per avere qualche prestazione in più
2462
- * @param {ChartLoader} Charter Istanza del Loader che si occuperà di caricare in memoria tutto ciò che serve per il grafico attuale (temi, locale, animazioni, ecc...)
2463
- * @param {ChartDispatcher} Dispatcher Istanza del Dispatcher che si occupa di differire il caricamento dei grafici 1 dopo l'altro in modo che caricamenti pseudo paralleli incasinino tutto
2464
- * @param {boolean} logs Indica se effettuare log a console o meno, iniettato dalle classi specializzate dal token ESC_LOGS
2465
- * @param {boolean} animations Indica se per questo grafico devono essere attive o meno le animazioni. Impostazione generica presa dal token ESC_ANIMATIONS
2466
- * @param {string} locale Indica il locale specifico per questo grafico. Impostazione generica presa dal LocalizationService
2467
- * @param {string} theme Indica il tema specifico per questo grafico. Impostazione generica presa dal token ESC_THEME
2412
+ * @ignore
2468
2413
  */
2469
- constructor(el, platformId, zone, Charter, Dispatcher, logs, animations, locale, theme) {
2470
- this.el = el;
2471
- this.platformId = platformId;
2472
- this.zone = zone;
2473
- this.Charter = Charter;
2474
- this.Dispatcher = Dispatcher;
2475
- this.logs = logs;
2476
- this.animations = animations;
2477
- this.locale = locale;
2478
- this.theme = theme;
2479
- /**
2480
- * Nome del grafico, fondamentale assegnarlo per permettere alla libreria di schedularne la creazione
2481
- */
2482
- this.name = "";
2483
- /**
2484
- * Dopo aver navigato a un nuovo grafico verranno attesi questi millisecondi prima di richiedere i dati attraverso la **DataRetrieve**.
2485
- *
2486
- * Questo per evitare che l'utente cliccando velocemente "avanti" generi tonnellate di richieste inutili
2487
- */
2488
- this.BrowseDelayMs = 500;
2489
- /**
2490
- * Evento lanciato sulla selezione di un range di dati o dalla timeline o dal grafico. Valido per tutti i grafici che supportano serie basate sulle date
2491
- */
2492
- this.onSelectionChanged = new EventEmitter();
2493
- /**
2494
- * Evento lanciato dal click di una serie dalla Legenda, a patto che l'Input **HideSeriesOnLabelClick** sia impostato a false
2495
- */
2496
- this.onSeriesClicked = new EventEmitter();
2497
- /**
2498
- * Evento lanciato all'inizio del caricamento di una nuova pagina del grafico
2499
- */
2500
- this.onLoadStart = new EventEmitter();
2501
- /**
2502
- * Evento lanciato al termine del caricamento di una nuova pagina del grafico
2503
- */
2504
- this.onLoadEnd = new EventEmitter();
2505
- /**
2506
- * Evento lanciato al termine della creazione del grafico referenziando l'istanza nativa del grafico creato in modo da poter effettuare modifiche
2507
- * post inizializzazione lato applicativo
2508
- */
2509
- this.chartLoaded = new EventEmitter();
2510
- /**
2511
- * Serve a decidere se sarà presente l'interfaccia di paginazione
2512
- */
2513
- this.isPaged = false;
2514
- /**
2515
- * @ignore
2516
- */
2517
- this.initDone = false;
2414
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
2415
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2416
+ this.adapter = adapter;
2417
+ }
2418
+ /**
2419
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2420
+ */
2421
+ getSpecificPropertiesToCheck() {
2422
+ return ["Data", "DataArray", "HideZeroes", "Mode3D", "LabelsWrap", "LabelsTruncate", "LabelsWidth", "LabelsVisible"];
2423
+ }
2424
+ /**
2425
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2426
+ *
2427
+ * @returns {PieChartSettings} Settings castati al tipo giusto
2428
+ */
2429
+ getCastedSettings() {
2430
+ var _a;
2431
+ return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new PieChartSettings());
2518
2432
  }
2519
2433
  /**
2520
- * Metodo di inizializzazione post valorizzazione degli input, utilizzato per valorizzare correttamente le proprietà essenziali del grafico (Animazioni, Tema e Locale)
2434
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2521
2435
  *
2522
- * Viene data priorità ai Settings (HTML), priorità secondaria agli Input diretti (Lato HTML), priorità ultima alle impostazioni globali,
2523
- * impostate in fase di import del modulo assegnando valori ai token ESC_ANIMATIONS, ESC_THEME
2436
+ * @param {PieChartSettings} settingsCasted Settings castati al tipo giusto
2524
2437
  */
2525
- ngOnInit() {
2526
- var _a, _b, _c, _d, _e, _f;
2527
- // Qui servono solo le variabili da conoscere PRE-graficazione per il caricamento dei moduli lazy del grafico
2528
- this.Animations = ((_a = this.Settings) === null || _a === void 0 ? void 0 : _a.Animations) != null ? (_b = this.Settings) === null || _b === void 0 ? void 0 : _b.Animations : (this.Animations != null ? this.Animations : this.animations);
2529
- this.Theme = ((_c = this.Settings) === null || _c === void 0 ? void 0 : _c.Theme) != null ? (_d = this.Settings) === null || _d === void 0 ? void 0 : _d.Theme : (this.Theme != null ? this.Theme : this.theme);
2530
- this.Locale = ((_e = this.Settings) === null || _e === void 0 ? void 0 : _e.Locale) != null ? (_f = this.Settings) === null || _f === void 0 ? void 0 : _f.Locale : (this.Locale != null ? this.Locale : this.locale);
2531
- this.isPaged = (this.DataArray && this.DataArray.length > 0 && !this.Data) || (this.DataDtos && this.DataDtos.length > 0 && !!this.DataRetrieve);
2532
- this.log("Chart " + this.name + ": ngOnInit");
2438
+ fillSpecificSettings(settingsCasted) {
2439
+ settingsCasted.HideZeroes = settingsCasted.HideZeroes != null ? settingsCasted.HideZeroes : this.HideZeroes;
2440
+ settingsCasted.Mode3D = settingsCasted.Mode3D != null ? settingsCasted.Mode3D : this.Mode3D;
2441
+ settingsCasted.DonutRadiusPercentage = settingsCasted.DonutRadiusPercentage != null ? settingsCasted.DonutRadiusPercentage : this.DonutRadiusPercentage;
2442
+ settingsCasted.LabelsWrap = settingsCasted.LabelsWrap != null ? settingsCasted.LabelsWrap : this.LabelsWrap;
2443
+ settingsCasted.LabelsTruncate = settingsCasted.LabelsTruncate != null ? settingsCasted.LabelsTruncate : this.LabelsTruncate;
2444
+ settingsCasted.LabelsWidth = settingsCasted.LabelsWidth != null ? settingsCasted.LabelsWidth : this.LabelsWidth;
2445
+ settingsCasted.LabelsVisible = settingsCasted.LabelsVisible != null ? settingsCasted.LabelsVisible : this.LabelsVisible;
2533
2446
  }
2534
2447
  /**
2535
- * Implementazione utilizzata per controllare eventuali proprietà chiave del grafico e rigraficare tutto qualora si rivelasse necessario
2448
+ * Effettua il rendering di questo grafico in base ai Settings
2536
2449
  *
2537
- * @param {SimpleChanges} changes Indicazione dei cambiamenti sulle proprietà del grafico. Vedere documentazione Angular in merito
2450
+ * @param {PieChartSettings} settingsCasted Impostazioni di graficazione
2451
+ * @returns {PieChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2538
2452
  */
2539
- ngOnChanges(changes) {
2540
- if (!this.initDone)
2541
- return;
2542
- this.log("Chart " + this.name + ": ngOnChanges");
2543
- let propsToCheck = ["Timeline", "Legend", "Settings", "Animations", "Theme", "Locale", ...this.getSpecificPropertiesToCheck()];
2544
- this.checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck);
2453
+ graphicate(settingsCasted) {
2454
+ return new PieChartService(this.adapter).graphicate(this.Data, settingsCasted);
2545
2455
  }
2456
+ }
2457
+ EsPieChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsPieChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2458
+ EsPieChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsPieChartComponent, selector: "es-pie-chart", inputs: { Data: "Data", DataArray: "DataArray", HideZeroes: "HideZeroes", Mode3D: "Mode3D", DonutRadiusPercentage: "DonutRadiusPercentage", LabelsWrap: "LabelsWrap", LabelsTruncate: "LabelsTruncate", LabelsWidth: "LabelsWidth", LabelsVisible: "LabelsVisible" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2459
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsPieChartComponent, decorators: [{
2460
+ type: Component,
2461
+ args: [{ selector: 'es-pie-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2462
+ }], ctorParameters: function () {
2463
+ return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2464
+ type: Inject,
2465
+ args: [PLATFORM_ID]
2466
+ }] }, { type: undefined, decorators: [{
2467
+ type: Inject,
2468
+ args: [ESC_LOGS]
2469
+ }] }, { type: undefined, decorators: [{
2470
+ type: Inject,
2471
+ args: [ESC_ANIMATIONS]
2472
+ }] }, { type: undefined, decorators: [{
2473
+ type: Inject,
2474
+ args: [ESC_THEME]
2475
+ }] }, { type: i4.LocalizationService }];
2476
+ }, propDecorators: { Data: [{
2477
+ type: Input
2478
+ }], DataArray: [{
2479
+ type: Input
2480
+ }], HideZeroes: [{
2481
+ type: Input
2482
+ }], Mode3D: [{
2483
+ type: Input
2484
+ }], DonutRadiusPercentage: [{
2485
+ type: Input
2486
+ }], LabelsWrap: [{
2487
+ type: Input
2488
+ }], LabelsTruncate: [{
2489
+ type: Input
2490
+ }], LabelsWidth: [{
2491
+ type: Input
2492
+ }], LabelsVisible: [{
2493
+ type: Input
2494
+ }] } });
2495
+
2496
+ /**
2497
+ * Componente specifico per la graficazione di un grafico a Barre con due dimensioni
2498
+ */
2499
+ class EsVertical2DChartComponent extends BaseChartComponent {
2546
2500
  /**
2547
- * Nel post inizializzazione, a patto che mi trovi in ambiente "browser", proseguo al caricamento del grafico sull'HTML
2501
+ * @ignore
2548
2502
  */
2549
- ngAfterViewInit() {
2550
- if (!this.name)
2551
- throw "a Unique name is mandatory to create a chart";
2552
- this.log("Chart " + this.name + ": ngAfterViewInit, graphicating chart outside Angular");
2553
- if (!this.isPaged)
2554
- this.dispatchLoadChart();
2503
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
2504
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2505
+ this.adapter = adapter;
2555
2506
  }
2556
2507
  /**
2557
- * All'onDestroy scarico il grafico per liberare memoria
2508
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2558
2509
  */
2559
- ngOnDestroy() {
2560
- if (this.Chart) {
2561
- this.log("Chart " + this.name + ": Unloading destroyed chart");
2562
- this.browserOnly(() => { this.Chart.dispose(); this.Dispatcher.deregisterGraph(this.name); });
2563
- }
2564
- else
2565
- this.log("Chart " + this.name + ": Unloading uncreated chart component. It probably was a duplicated");
2510
+ getSpecificPropertiesToCheck() {
2511
+ return ["Data", "DataArray"];
2566
2512
  }
2567
2513
  /**
2568
- * Registra il grafico attuale nel Dispatcher in modo che venga caricato appena possibile
2514
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2515
+ *
2516
+ * @returns {Vertical2DChartSettings} Settings castati al tipo giusto
2569
2517
  */
2570
- dispatchLoadChart() {
2571
- this.browserOnly(() => {
2572
- this.Dispatcher.register(this.name, () => { return this.loadChart(); });
2573
- });
2518
+ getCastedSettings() {
2519
+ var _a;
2520
+ return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new Vertical2DChartSettings());
2574
2521
  }
2575
2522
  /**
2576
- * Il caricamento del grafico funziona nel seguente modo:
2577
- *
2578
- * 1) Caricamento del tema e delle animazioni, qualora necessari
2579
- *
2580
- * 2) Caricamento delle impostazioni specifiche e integrazione con le impostazioni generiche
2581
- *
2582
- * 3) Graficazione
2523
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2583
2524
  *
2584
- * 4) Caricamento del locale
2525
+ * @param {Vertical2DChartSettings} settingsCasted Settings castati al tipo giusto
2585
2526
  */
2586
- loadChart() {
2587
- this.log("Chart " + this.name + ": Start loading Modules if needed");
2588
- return Promise.all([
2589
- this.setupAmChartsThemes().then(() => {
2590
- this.log("Chart " + this.name + ": Graphicating after modules load");
2591
- var castedSettings = this.getCastedSettings();
2592
- this.fillSettings(castedSettings);
2593
- this.fillSpecificSettings(castedSettings);
2594
- this.ChartService = this.graphicate(castedSettings);
2595
- this.Chart = this.ChartService.ChartInstance;
2596
- if (!this.Chart)
2597
- this.log("Chart " + this.name + ": Could not create graph");
2598
- // Unico punto reale in cui viene utilizzato il locale, tehe
2599
- return this.Charter.applyLocale(this.Chart, this.Locale).then(() => { this.initDone = true; this.chartLoaded.emit(this); });
2600
- })
2601
- ]);
2527
+ fillSpecificSettings(settingsCasted) {
2528
+ settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
2529
+ settingsCasted.GroupPaddingPercentage = settingsCasted.GroupPaddingPercentage != null ? settingsCasted.GroupPaddingPercentage : this.GroupPaddingPercentage;
2530
+ settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
2531
+ settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
2532
+ settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
2533
+ settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
2602
2534
  }
2603
2535
  /**
2604
- * Riempimento delle impostazioni nella classe Settings. Si danno priorità ai valori già impostati nei Settings,
2605
- * integrando eventualmente con le proprietà del grafico
2536
+ * Effettua il rendering di questo grafico in base ai Settings
2606
2537
  *
2607
- * @param {BaseSettings} settings Impostazioni base ricevute dalla specializzazione del grafico
2538
+ * @param {Vertical2DChartSettings} settingsCasted Impostazioni di graficazione
2539
+ * @returns {Vertical2DChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2608
2540
  */
2609
- fillSettings(settings) {
2610
- var _a;
2611
- // Merge degli Input con i Settings, dando priorità ai Settings
2612
- settings.Theme = settings.Theme ? settings.Theme : this.Theme;
2613
- settings.Locale = settings.Locale ? settings.Locale : this.Locale;
2614
- settings.Animations = settings.Animations != null ? settings.Animations : this.Animations;
2615
- settings.Legend = settings.Legend != null ? settings.Legend : this.Legend;
2616
- settings.Name = settings.Name ? settings.Name : this.name;
2617
- settings.Timeline = settings.Timeline != null ? settings.Timeline : this.Timeline;
2618
- settings.AdaptLabelSizeAndOrientation = settings.AdaptLabelSizeAndOrientation != null ? settings.AdaptLabelSizeAndOrientation : this.AdaptLabelSizeAndOrientation;
2619
- settings.XAxisTitle = settings.XAxisTitle ? settings.XAxisTitle : this.XTitle;
2620
- settings.YAxisTitle = settings.YAxisTitle ? settings.YAxisTitle : this.YTitle;
2621
- settings.LegendPosition = settings.LegendPosition ? settings.LegendPosition : this.LegendPosition;
2622
- settings.HideSeriesOnLabelClick = settings.HideSeriesOnLabelClick != null ? settings.HideSeriesOnLabelClick : this.HideSeriesOnLabelClick;
2623
- settings.MinGridDistance = settings.MinGridDistance != null ? settings.MinGridDistance : this.MinGridDistance;
2624
- settings.LegendPadding = settings.LegendPadding ? settings.LegendPadding : (_a = this.LegendPadding) !== null && _a !== void 0 ? _a : null;
2625
- settings.ContainerHeight = this.el.nativeElement.parentElement.offsetHeight;
2626
- settings.OnSeriesClickCallback = (series) => { this.onSeriesClicked.emit(series); };
2627
- settings.OnSelectionChangedCallback = (event) => { this.onSelectionChanged.emit({ from: event.from, to: event.to, initial: event.initial }); };
2541
+ graphicate(settingsCasted) {
2542
+ return new Vertical2DChartService(this.adapter).graphicate(this.Data, settingsCasted);
2628
2543
  }
2544
+ }
2545
+ EsVertical2DChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVertical2DChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2546
+ EsVertical2DChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVertical2DChartComponent, selector: "es-vertical-2d-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", GroupPaddingPercentage: "GroupPaddingPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2547
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVertical2DChartComponent, decorators: [{
2548
+ type: Component,
2549
+ args: [{ selector: 'es-vertical-2d-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2550
+ }], ctorParameters: function () {
2551
+ return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2552
+ type: Inject,
2553
+ args: [PLATFORM_ID]
2554
+ }] }, { type: undefined, decorators: [{
2555
+ type: Inject,
2556
+ args: [ESC_LOGS]
2557
+ }] }, { type: undefined, decorators: [{
2558
+ type: Inject,
2559
+ args: [ESC_ANIMATIONS]
2560
+ }] }, { type: undefined, decorators: [{
2561
+ type: Inject,
2562
+ args: [ESC_THEME]
2563
+ }] }, { type: i4.LocalizationService }];
2564
+ }, propDecorators: { Data: [{
2565
+ type: Input
2566
+ }], DataArray: [{
2567
+ type: Input
2568
+ }], ColumnWidthPercentage: [{
2569
+ type: Input
2570
+ }], GroupPaddingPercentage: [{
2571
+ type: Input
2572
+ }], LabelWidth: [{
2573
+ type: Input
2574
+ }], LabelVerticalOrientationCutoffWidth: [{
2575
+ type: Input
2576
+ }], LabelRightWhenCompressed: [{
2577
+ type: Input
2578
+ }], LabelTopWhenCompressed: [{
2579
+ type: Input
2580
+ }] } });
2581
+
2582
+ /**
2583
+ * Componente specifico per la graficazione di un grafico a Barre
2584
+ */
2585
+ class EsVerticalChartComponent extends BaseChartComponent {
2629
2586
  /**
2630
- * Controlla i cambiamenti avvenuti alle proprietà chiave e rieffettua la graficazione qualora necessario
2631
- *
2632
- * @param {SimpleChanges} changes Indicazione della modifiche avvenute nei vari Input
2633
- * @param {string[]} propsToCheck Lista degli Input da controllare per cui una modifica causa una rigraficazione
2587
+ * @ignore
2634
2588
  */
2635
- checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck) {
2636
- let toReGraphicate = false;
2637
- for (let i = 0; i < propsToCheck.length; i++)
2638
- toReGraphicate = toReGraphicate || (changes[propsToCheck[i]] && changes[propsToCheck[i]].currentValue);
2639
- if (toReGraphicate)
2640
- this.reloadChart();
2589
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
2590
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2591
+ this.adapter = adapter;
2641
2592
  }
2642
2593
  /**
2643
- * Funzione che effettua un cambio di pagina per i grafici paginati. Qualora **data** fosse nullo significa che è iniziato un caricamento
2644
- * e anche lato applicativo il DataRetrieve dovrà considerare che l'assenza di valori non è altro che un'indicazione di inizio caricamento
2645
- *
2646
- * Il caricamento di qualsiasi pagina genererà comunque una primo evento con **data** nullo in modo da indicare l'inizio caricamento e
2647
- * in seconda istanza un altro evento in cui **data** sarà sempre valorizzato, o con il Dto da usare per recuperare i dati, o con i dati
2648
- * veri e propri già presenti nel **DataArray**
2649
- *
2650
- * I callback **onLoadStart** e **onLoadEnd** vengono sempre chiamati
2651
- *
2652
- * @param {{ data: LineChartData | PieChartData | Vertical2DChartData | VerticalChartData | any, index: number }} nd Indice del caricamento dati, con eventualmente già i dati se disponibili
2594
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2653
2595
  */
2654
- changePage(nd) {
2655
- if (!nd.data) {
2656
- this.loadingChart = true;
2657
- // Serve per informare l'applicativo in listening sull'indice attualmente in visualizzazione.
2658
- // La mancanza di dati indica che non devono essere effettuate ricerche per ora
2659
- if (this.DataRetrieve)
2660
- this.DataRetrieve(null, nd.index);
2661
- this.onLoadStart.emit();
2662
- return;
2663
- }
2664
- if (this.DataRetrieve)
2665
- this.DataRetrieve(nd.data, nd.index).then(t => { this.changePageDataReceived(t); });
2666
- else
2667
- this.changePageDataReceived(nd.data);
2596
+ getSpecificPropertiesToCheck() {
2597
+ return ["Data", "DataArray"];
2598
+ }
2599
+ /**
2600
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2601
+ *
2602
+ * @returns {VerticalChartSettings} Settings castati al tipo giusto
2603
+ */
2604
+ getCastedSettings() {
2605
+ var _a;
2606
+ return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new VerticalChartSettings());
2668
2607
  }
2669
2608
  /**
2670
- * Al termine del caricamento dei dati di una pagina questo metodo viene chiamato per rigraficare la situazione con i nuovi dati
2609
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2671
2610
  *
2672
- * @param {LineChartData | PieChartData | Vertical2DChartData | VerticalChartData | any} data Dati del grafico
2611
+ * @param {VerticalChartSettings} settingsCasted Settings castati al tipo giusto
2673
2612
  */
2674
- changePageDataReceived(data) {
2675
- this.loadingChart = false;
2676
- this.onLoadEnd.emit();
2677
- let firstBind = !this.Data;
2678
- this.Data = data;
2679
- if (!firstBind)
2680
- this.reloadChart();
2681
- else
2682
- this.dispatchLoadChart();
2613
+ fillSpecificSettings(settingsCasted) {
2614
+ settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
2615
+ settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
2616
+ settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
2617
+ settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
2618
+ settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
2683
2619
  }
2684
2620
  /**
2685
- * Ricarica il grafico distruggendo il vecchio e ricreando il nuovo
2621
+ * Effettua il rendering di questo grafico in base ai Settings
2686
2622
  *
2687
- * Le chiamate a questo metodo possono essere trasformate in chiamate al metodo **graphicate** della Service, se solo quel metodo fosse abbastanza intelligente per capire
2688
- * le differenze fra il grafico com'era prima e come deve diventare, in modo da non ricrearlo ma semplicemente modificare quello che già è disegnato
2623
+ * @param {VerticalChartSettings} settingsCasted Impostazioni di graficazione
2624
+ * @returns {VerticalChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2689
2625
  */
2690
- reloadChart() {
2691
- this.browserOnly(() => {
2692
- if (!this.Chart.isDisposed())
2693
- this.Chart.dispose();
2694
- this.Dispatcher.deregisterGraph(this.name);
2695
- });
2696
- this.Dispatcher.register(this.name, () => { return this.loadChart(); });
2626
+ graphicate(settingsCasted) {
2627
+ return new VerticalChartService(this.adapter).graphicate(this.Data, settingsCasted);
2697
2628
  }
2629
+ }
2630
+ EsVerticalChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2631
+ EsVerticalChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVerticalChartComponent, selector: "es-vertical-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2632
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalChartComponent, decorators: [{
2633
+ type: Component,
2634
+ args: [{ selector: 'es-vertical-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2635
+ }], ctorParameters: function () {
2636
+ return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2637
+ type: Inject,
2638
+ args: [PLATFORM_ID]
2639
+ }] }, { type: undefined, decorators: [{
2640
+ type: Inject,
2641
+ args: [ESC_LOGS]
2642
+ }] }, { type: undefined, decorators: [{
2643
+ type: Inject,
2644
+ args: [ESC_ANIMATIONS]
2645
+ }] }, { type: undefined, decorators: [{
2646
+ type: Inject,
2647
+ args: [ESC_THEME]
2648
+ }] }, { type: i4.LocalizationService }];
2649
+ }, propDecorators: { Data: [{
2650
+ type: Input
2651
+ }], DataArray: [{
2652
+ type: Input
2653
+ }], ColumnWidthPercentage: [{
2654
+ type: Input
2655
+ }], LabelWidth: [{
2656
+ type: Input
2657
+ }], LabelVerticalOrientationCutoffWidth: [{
2658
+ type: Input
2659
+ }], LabelRightWhenCompressed: [{
2660
+ type: Input
2661
+ }], LabelTopWhenCompressed: [{
2662
+ type: Input
2663
+ }] } });
2664
+
2665
+ /**
2666
+ * Componente specifico per la graficazione di un grafico a Barre in modalità Stacked (una serie sopra l'altra)
2667
+ */
2668
+ class EsVerticalStackedChartComponent extends BaseChartComponent {
2698
2669
  /**
2699
- * Permette di aggiungere un blocco di dati in maniera "live" ad un grafico
2670
+ * @ignore
2700
2671
  */
2701
- addData(chartData) {
2702
- this.ChartService.refreshData(chartData);
2672
+ constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
2673
+ super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2674
+ this.adapter = adapter;
2703
2675
  }
2704
- ;
2705
2676
  /**
2706
- * Funzione che si occupa di caricare i temi necessari per il grafico in oggetto. Prima applica il tema, poi, se serve, applica le animazioni
2677
+ * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
2707
2678
  */
2708
- setupAmChartsThemes() {
2709
- return Promise.all([
2710
- this.Charter.applyTheme(am4core, this.Theme).then(() => {
2711
- return this.Animations ? this.Charter.applyAnimations(am4core) : this.Charter.unapplyAnimations(am4core);
2712
- })
2713
- ]);
2679
+ getSpecificPropertiesToCheck() {
2680
+ return ["Data", "DataArray"];
2714
2681
  }
2715
2682
  /**
2716
- * @ignore
2683
+ * Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
2684
+ *
2685
+ * @returns {VerticalStackedChartSettings} Settings castati al tipo giusto
2717
2686
  */
2718
- log(log) {
2719
- if (this.logs)
2720
- console.log("@esfaenza/es-charts: " + log);
2687
+ getCastedSettings() {
2688
+ var _a;
2689
+ return ((_a = this.Settings) !== null && _a !== void 0 ? _a : new VerticalStackedChartSettings());
2721
2690
  }
2722
2691
  /**
2723
- * Imposta lo zoom dal **from** al **to**
2692
+ * Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
2724
2693
  *
2725
- * @param {Date} from Inizio dello zoom
2726
- * @param {Date} to Fine dello zoom
2694
+ * @param {VerticalStackedChartSettings} settingsCasted Settings castati al tipo giusto
2727
2695
  */
2728
- setSelection(from, to) {
2729
- this.ChartService.setSelection(from, to);
2696
+ fillSpecificSettings(settingsCasted) {
2697
+ settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
2698
+ settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
2699
+ settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
2700
+ settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
2701
+ settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
2730
2702
  }
2731
2703
  /**
2732
- * @ignore
2704
+ * Effettua il rendering di questo grafico in base ai Settings
2705
+ *
2706
+ * @param {VerticalStackedChartSettings} settingsCasted Impostazioni di graficazione
2707
+ * @returns {VerticalStackedChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2733
2708
  */
2734
- browserOnly(f) {
2735
- if (isPlatformBrowser(this.platformId)) {
2736
- this.zone.runOutsideAngular(() => {
2737
- f();
2738
- });
2739
- }
2709
+ graphicate(settingsCasted) {
2710
+ return new VerticalStackedChartService(this.adapter).graphicate(this.Data, settingsCasted);
2740
2711
  }
2741
2712
  }
2742
- BaseChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseChartComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
2743
- BaseChartComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: BaseChartComponent, inputs: { XTitle: "XTitle", YTitle: "YTitle", Settings: "Settings", Legend: "Legend", LegendPosition: "LegendPosition", Timeline: "Timeline", name: "name", Animations: "Animations", Theme: "Theme", Locale: "Locale", HideSeriesOnLabelClick: "HideSeriesOnLabelClick", MinGridDistance: "MinGridDistance", AdaptLabelSizeAndOrientation: "AdaptLabelSizeAndOrientation", LegendPadding: "LegendPadding", DataDtos: "DataDtos", DataDtoStartIndex: "DataDtoStartIndex", DataRetrieve: "DataRetrieve", BrowseDelayMs: "BrowseDelayMs" }, outputs: { onSelectionChanged: "onSelectionChanged", onSeriesClicked: "onSeriesClicked", onLoadStart: "onLoadStart", onLoadEnd: "onLoadEnd", chartLoaded: "chartLoaded" }, queries: [{ propertyName: "header_tr", first: true, predicate: ["header"], descendants: true }, { propertyName: "loading_template", first: true, predicate: ["loading"], descendants: true }], usesOnChanges: true, ngImport: i0 });
2744
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseChartComponent, decorators: [{
2745
- type: Directive
2746
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: Object }, { type: i0.NgZone }, { type: ChartLoader }, { type: ChartDispatcher }, { type: undefined }, { type: undefined }, { type: undefined }, { type: undefined }]; }, propDecorators: { XTitle: [{
2747
- type: Input
2748
- }], YTitle: [{
2749
- type: Input
2750
- }], Settings: [{
2751
- type: Input
2752
- }], Legend: [{
2753
- type: Input
2754
- }], LegendPosition: [{
2755
- type: Input
2756
- }], Timeline: [{
2757
- type: Input
2758
- }], name: [{
2759
- type: Input
2760
- }], Animations: [{
2761
- type: Input
2762
- }], Theme: [{
2763
- type: Input
2764
- }], Locale: [{
2765
- type: Input
2766
- }], HideSeriesOnLabelClick: [{
2767
- type: Input
2768
- }], MinGridDistance: [{
2713
+ EsVerticalStackedChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalStackedChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2714
+ EsVerticalStackedChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVerticalStackedChartComponent, selector: "es-vertical-stacked-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2715
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalStackedChartComponent, decorators: [{
2716
+ type: Component,
2717
+ args: [{ selector: 'es-vertical-stacked-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
2718
+ }], ctorParameters: function () {
2719
+ return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2720
+ type: Inject,
2721
+ args: [PLATFORM_ID]
2722
+ }] }, { type: undefined, decorators: [{
2723
+ type: Inject,
2724
+ args: [ESC_LOGS]
2725
+ }] }, { type: undefined, decorators: [{
2726
+ type: Inject,
2727
+ args: [ESC_ANIMATIONS]
2728
+ }] }, { type: undefined, decorators: [{
2729
+ type: Inject,
2730
+ args: [ESC_THEME]
2731
+ }] }, { type: i4.LocalizationService }];
2732
+ }, propDecorators: { Data: [{
2769
2733
  type: Input
2770
- }], AdaptLabelSizeAndOrientation: [{
2734
+ }], DataArray: [{
2771
2735
  type: Input
2772
- }], LegendPadding: [{
2736
+ }], ColumnWidthPercentage: [{
2773
2737
  type: Input
2774
- }], DataDtos: [{
2738
+ }], LabelWidth: [{
2775
2739
  type: Input
2776
- }], DataDtoStartIndex: [{
2740
+ }], LabelVerticalOrientationCutoffWidth: [{
2777
2741
  type: Input
2778
- }], DataRetrieve: [{
2742
+ }], LabelRightWhenCompressed: [{
2779
2743
  type: Input
2780
- }], BrowseDelayMs: [{
2744
+ }], LabelTopWhenCompressed: [{
2781
2745
  type: Input
2782
- }], header_tr: [{
2783
- type: ContentChild,
2784
- args: ['header', { static: false }]
2785
- }], loading_template: [{
2786
- type: ContentChild,
2787
- args: ['loading', { static: false }]
2788
- }], onSelectionChanged: [{
2789
- type: Output
2790
- }], onSeriesClicked: [{
2791
- type: Output
2792
- }], onLoadStart: [{
2793
- type: Output
2794
- }], onLoadEnd: [{
2795
- type: Output
2796
- }], chartLoaded: [{
2797
- type: Output
2798
2746
  }] } });
2799
2747
 
2800
2748
  /**
@@ -2817,6 +2765,58 @@ class PagedChartData {
2817
2765
  }
2818
2766
  }
2819
2767
 
2768
+ /** Componenti esportati dal modulo */
2769
+ const COMPONENTS = [
2770
+ EsChartComponent,
2771
+ EsLineChartComponent,
2772
+ EsPieChartComponent,
2773
+ EsVertical2DChartComponent,
2774
+ EsVerticalChartComponent,
2775
+ EsVerticalStackedChartComponent,
2776
+ PageChartSelector,
2777
+ EsAreaChartComponent
2778
+ ];
2779
+ class EsChartsModule {
2780
+ static forRoot(config) {
2781
+ return {
2782
+ ngModule: EsChartsModule,
2783
+ providers: [
2784
+ ChartLoader,
2785
+ ChartDispatcher,
2786
+ { provide: ESC_ANIMATIONS, useValue: (config === null || config === void 0 ? void 0 : config.animations) == null || (config === null || config === void 0 ? void 0 : config.animations) == undefined ? true : config === null || config === void 0 ? void 0 : config.animations },
2787
+ { provide: ESC_THEME, useValue: (config === null || config === void 0 ? void 0 : config.theme) || 'spiritedaway' },
2788
+ { provide: ESC_LOGS, useValue: (config === null || config === void 0 ? void 0 : config.debugMode) || false },
2789
+ { provide: BaseAdapter, useClass: (config === null || config === void 0 ? void 0 : config.adapter) || BaseAdapter }
2790
+ ]
2791
+ };
2792
+ }
2793
+ }
2794
+ EsChartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2795
+ EsChartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, declarations: [EsChartComponent,
2796
+ EsLineChartComponent,
2797
+ EsPieChartComponent,
2798
+ EsVertical2DChartComponent,
2799
+ EsVerticalChartComponent,
2800
+ EsVerticalStackedChartComponent,
2801
+ PageChartSelector,
2802
+ EsAreaChartComponent], imports: [CommonModule], exports: [EsChartComponent,
2803
+ EsLineChartComponent,
2804
+ EsPieChartComponent,
2805
+ EsVertical2DChartComponent,
2806
+ EsVerticalChartComponent,
2807
+ EsVerticalStackedChartComponent,
2808
+ PageChartSelector,
2809
+ EsAreaChartComponent] });
2810
+ EsChartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, imports: [CommonModule] });
2811
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, decorators: [{
2812
+ type: NgModule,
2813
+ args: [{
2814
+ imports: [CommonModule],
2815
+ declarations: [...COMPONENTS],
2816
+ exports: [...COMPONENTS]
2817
+ }]
2818
+ }] });
2819
+
2820
2820
  /*
2821
2821
  * Public API Surface of es-charts
2822
2822
  */