@esfaenza/es-charts 15.2.1 → 15.2.3

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