@esfaenza/es-charts 20.3.6 → 20.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,59 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, EventEmitter, ContentChild, Output, Input, ChangeDetectionStrategy, Component, InjectionToken, Inject, Directive, PLATFORM_ID, NgModule } from '@angular/core';
3
- import * as i5 from '@angular/common';
2
+ import { EventEmitter, ContentChild, Output, Input, ChangeDetectionStrategy, Component, InjectionToken, Inject, Injectable, Directive, PLATFORM_ID, NgModule } from '@angular/core';
3
+ import * as i4 from '@angular/common';
4
4
  import { isPlatformBrowser, CommonModule } from '@angular/common';
5
- import * as am4core from '@amcharts/amcharts4/core';
6
- import * as am4charts from '@amcharts/amcharts4/charts';
5
+ import * as am5 from '@amcharts/amcharts5';
6
+ import * as am5xy from '@amcharts/amcharts5/xy';
7
+ import am5locales_it_IT from '@amcharts/amcharts5/locales/it_IT';
8
+ import * as am5percent from '@amcharts/amcharts5/percent';
7
9
  import * as i3 from '@esfaenza/extensions';
8
- import * as i4 from '@esfaenza/localizations';
9
-
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
12
- * generazione delle serie in caso si fossero usati grafici di altre librerie
13
- */
14
- class BaseAdapter {
15
- /**
16
- * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per gli Area Chart
17
- */
18
- adaptDataForAreaChart(anyData) {
19
- return anyData;
20
- }
21
- /**
22
- * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per i Line Chart
23
- */
24
- adaptDataForLineChart(anyData) {
25
- return anyData;
26
- }
27
- /**
28
- * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per i Line Chart
29
- */
30
- adaptDataForPieChart(anyData) {
31
- return anyData;
32
- }
33
- /**
34
- * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per i Vertical Chart
35
- */
36
- adaptDataForVerticalChart(anyData) {
37
- return anyData;
38
- }
39
- /**
40
- * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per i Vertical Chart a due dimensioni
41
- */
42
- adaptDataForVertical2DChart(anyData) {
43
- return anyData;
44
- }
45
- /**
46
- * Trasformatore dai dati della libreria vecchia ai dati della libreria nuova per i Vertical Chart sovrapposti
47
- */
48
- adaptDataForVerticalStackedChart(anyData) {
49
- return anyData;
50
- }
51
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: BaseAdapter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
52
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: BaseAdapter }); }
53
- }
54
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: BaseAdapter, decorators: [{
55
- type: Injectable
56
- }] });
10
+ import * as i3$1 from '@esfaenza/localizations';
57
11
 
58
12
  /**
59
13
  * Dati relativi a un grafico di tipo LineChart
@@ -363,12 +317,12 @@ class PageChartSelector {
363
317
  this.currentindex--;
364
318
  }, this.BrowseDelayMs);
365
319
  }
366
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PageChartSelector, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
367
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: PageChartSelector, isStandalone: false, 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 }); }
320
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: PageChartSelector, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
321
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.28", type: PageChartSelector, isStandalone: false, 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
322
  }
369
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PageChartSelector, decorators: [{
323
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: PageChartSelector, decorators: [{
370
324
  type: Component,
371
- args: [{ selector: "chart-pager", changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, 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"] }]
325
+ args: [{ selector: "chart-pager", changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, 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"] }]
372
326
  }], propDecorators: { Items: [{
373
327
  type: Input
374
328
  }], Dtos: [{
@@ -481,14 +435,6 @@ class ChartLoader {
481
435
  */
482
436
  constructor(logs) {
483
437
  this.logs = logs;
484
- /**
485
- * Indica se attualmente ho le animazioni caricate in modo da non ricaricarle inutilmente
486
- */
487
- this.AnimationsAreLoaded = false;
488
- /**
489
- * Indica l'ultimo tema caricato in modo da non ricaricarlo inutilmente qualora il prossimo grafico da creare richieda lo stesso tema
490
- */
491
- this.LastLoadedTheme = "";
492
438
  /**
493
439
  * Cache dei temi (moduli caricati dinamicamente)
494
440
  */
@@ -504,34 +450,8 @@ class ChartLoader {
504
450
  * @param {Object} chartsCore Istanza globale di amCharts
505
451
  * @returns {Promise} Promise che identifica la fine del caricamento
506
452
  */
507
- applyAnimations(chartsCore) {
508
- if (!this.AnimationsAreLoaded) {
509
- return this.importIfNeeded('themes', ChartThemes.animated).then(() => {
510
- this.log("CORE: Applying theme " + ChartThemes.animated);
511
- chartsCore.useTheme(this.themeCache[ChartThemes.animated]);
512
- this.AnimationsAreLoaded = true;
513
- });
514
- }
515
- else {
516
- this.log("CORE: theme already applyed " + ChartThemes.animated);
517
- return new Promise((resolve) => { resolve(true); });
518
- }
519
- }
520
- /**
521
- * De-applica il tema con le animazioni dall'istanza globale di amCharts
522
- *
523
- * @param {Object} chartsCore Istanza globale di amCharts
524
- * @returns {Promise} Promise che identifica la fine dello scarico
525
- */
526
- unapplyAnimations(chartsCore) {
527
- if (this.AnimationsAreLoaded) {
528
- this.log("CORE: Animations in use, unapplying theme " + ChartThemes.animated);
529
- chartsCore.unuseTheme(this.themeCache[ChartThemes.animated]);
530
- this.AnimationsAreLoaded = false;
531
- }
532
- else
533
- this.log("CORE: Animations already unused, no need to unapply them");
534
- return new Promise((resolve) => { resolve(true); });
453
+ applyAnimations(root) {
454
+ return this.applyTheme(root, ChartThemes.animated);
535
455
  }
536
456
  /**
537
457
  * Applica il tema specificato all'istanza globale di amCharts
@@ -540,37 +460,21 @@ class ChartLoader {
540
460
  * @param {'spiritedaway' | 'moonrisekingdom' | 'frozen' | 'dark' | 'kelly' | 'material' | 'dataviz' | 'none'} theme Tema da applicare
541
461
  * @returns {Promise} Promise che identifica la fine del caricamento
542
462
  */
543
- applyTheme(chartsCore, theme) {
544
- // Ultimo tema applicato è lo stesso che mi è stato richiesto di applicare --> NO-OP
545
- if (this.LastLoadedTheme == theme) {
546
- this.log("CORE: theme already applied " + theme);
547
- return new Promise((resolve) => { resolve(true); });
548
- }
549
- // Scarico il tema precedente a prescindere, ormai non mi serve più
550
- this.unapplyPreviousTheme(chartsCore);
551
- // Il tema è il none --> registro la cosa e basta, il tema precedente è stato rimosso subito qui sopra ^
463
+ applyTheme(root, theme) {
464
+ // Il tema è il none --> registro la cosa e basta
552
465
  if (theme == ChartThemes.none) {
553
- this.LastLoadedTheme = ChartThemes.none;
466
+ root.setThemes([]);
554
467
  return new Promise((resolve) => { resolve(true); });
555
468
  }
556
- // Il tema è diverso dal precedente e non è il tema vuoto --> Importo il tema specificato se non presente in memoria e lo applico al grafico attuale
557
- return this.importIfNeeded('themes', theme).then(() => {
469
+ // Importo il tema specificato se non presente in memoria e lo applico al grafico attuale
470
+ return this.importIfNeeded("themes", theme)
471
+ .then(() => {
558
472
  this.log("CORE: Applying theme " + theme);
559
- chartsCore.useTheme(this.themeCache[theme]);
560
- this.LastLoadedTheme = theme;
473
+ root.setThemes([
474
+ this.themeCache[theme].new(root)
475
+ ]);
561
476
  });
562
477
  }
563
- /**
564
- * De-applica il tema precedente dall'istanza globale di amCharts
565
- *
566
- * @param {Object} chartsCore Istanza globale di amCharts
567
- */
568
- unapplyPreviousTheme(chartsCore) {
569
- if (!this.LastLoadedTheme || this.LastLoadedTheme == ChartThemes.none)
570
- return;
571
- this.log("CORE: Unapplying previously used theme " + this.LastLoadedTheme);
572
- chartsCore.unuseTheme(this.themeCache[this.LastLoadedTheme]);
573
- }
574
478
  /**
575
479
  * Applica il locale specificato all'istanza specifica del grafico
576
480
  *
@@ -580,8 +484,9 @@ class ChartLoader {
580
484
  */
581
485
  applyLocale(chart, locale) {
582
486
  return this.importIfNeeded('lang', locale).then(() => {
583
- this.log("Chart " + chart.htmlContainer.id + ": applying locale " + locale);
584
- chart.language.locale = this.localizationCache[locale];
487
+ this.log("Chart " + chart.htmlContainer?.id + ": applying locale " + locale);
488
+ if (chart.language?.locale)
489
+ chart.language.locale = this.localizationCache[locale];
585
490
  });
586
491
  }
587
492
  /**
@@ -621,29 +526,29 @@ class ChartLoader {
621
526
  case 'themes':
622
527
  switch (item) {
623
528
  case ChartThemes.spiritedaway:
624
- return import('@amcharts/amcharts4/themes/spiritedaway').then(theme => this.themeCache[item] = theme.default);
529
+ return import('@amcharts/amcharts5/themes/Spirited').then(theme => this.themeCache[item] = theme.default);
625
530
  case ChartThemes.moonrisekingdom:
626
- return import('@amcharts/amcharts4/themes/moonrisekingdom').then(theme => this.themeCache[item] = theme.default);
531
+ return import('@amcharts/amcharts5/themes/Moonrise').then(theme => this.themeCache[item] = theme.default);
627
532
  case ChartThemes.frozen:
628
- return import('@amcharts/amcharts4/themes/frozen').then(theme => this.themeCache[item] = theme.default);
533
+ return import('@amcharts/amcharts5/themes/Frozen').then(theme => this.themeCache[item] = theme.default);
629
534
  case ChartThemes.dark:
630
- return import('@amcharts/amcharts4/themes/dark').then(theme => this.themeCache[item] = theme.default);
535
+ return import('@amcharts/amcharts5/themes/Dark').then(theme => this.themeCache[item] = theme.default);
631
536
  case ChartThemes.kelly:
632
- return import('@amcharts/amcharts4/themes/kelly').then(theme => this.themeCache[item] = theme.default);
537
+ return import('@amcharts/amcharts5/themes/Kelly').then(theme => this.themeCache[item] = theme.default);
633
538
  case ChartThemes.material:
634
- return import('@amcharts/amcharts4/themes/material').then(theme => this.themeCache[item] = theme.default);
539
+ return import('@amcharts/amcharts5/themes/Material').then(theme => this.themeCache[item] = theme.default);
635
540
  case ChartThemes.dataviz:
636
- return import('@amcharts/amcharts4/themes/dataviz').then(theme => this.themeCache[item] = theme.default);
541
+ return import('@amcharts/amcharts5/themes/Dataviz').then(theme => this.themeCache[item] = theme.default);
637
542
  case ChartThemes.animated:
638
- return import('@amcharts/amcharts4/themes/animated').then(theme => this.themeCache[item] = theme.default);
543
+ return import('@amcharts/amcharts5/themes/Animated').then(theme => this.themeCache[item] = theme.default);
639
544
  }
640
545
  break;
641
546
  case 'lang':
642
547
  switch (item) {
643
548
  case 'it-IT':
644
- return import('@amcharts/amcharts4/lang/it_IT').then(lang => this.localizationCache[item] = lang.default);
549
+ return import('@amcharts/amcharts5/locales/it_IT').then(lang => this.localizationCache[item] = lang.default);
645
550
  case 'en-US':
646
- return import('@amcharts/amcharts4/lang/en_US').then(lang => this.localizationCache[item] = lang.default);
551
+ return import('@amcharts/amcharts5/locales/en_US').then(lang => this.localizationCache[item] = lang.default);
647
552
  }
648
553
  }
649
554
  this.log("CORE: Loading Failed. " + (what == 'lang' ? "Language " : "Theme") + " not recognized: " + item);
@@ -656,10 +561,10 @@ class ChartLoader {
656
561
  if (this.logs)
657
562
  console.log("@esfaenza/es-charts: " + text);
658
563
  }
659
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ChartLoader, deps: [{ token: ESC_DEBUG_MODE }], target: i0.ɵɵFactoryTarget.Injectable }); }
660
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ChartLoader }); }
564
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: ChartLoader, deps: [{ token: ESC_DEBUG_MODE }], target: i0.ɵɵFactoryTarget.Injectable }); }
565
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: ChartLoader }); }
661
566
  }
662
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ChartLoader, decorators: [{
567
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: ChartLoader, decorators: [{
663
568
  type: Injectable
664
569
  }], ctorParameters: () => [{ type: undefined, decorators: [{
665
570
  type: Inject,
@@ -744,10 +649,10 @@ class ChartDispatcher {
744
649
  if (this.logs)
745
650
  console.log("@esfaenza/es-charts: " + text);
746
651
  }
747
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ChartDispatcher, deps: [{ token: ESC_DEBUG_MODE }], target: i0.ɵɵFactoryTarget.Injectable }); }
748
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ChartDispatcher }); }
652
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: ChartDispatcher, deps: [{ token: ESC_DEBUG_MODE }], target: i0.ɵɵFactoryTarget.Injectable }); }
653
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: ChartDispatcher }); }
749
654
  }
750
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ChartDispatcher, decorators: [{
655
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: ChartDispatcher, decorators: [{
751
656
  type: Injectable
752
657
  }], ctorParameters: () => [{ type: undefined, decorators: [{
753
658
  type: Inject,
@@ -833,7 +738,7 @@ class BaseChartComponent {
833
738
  this.Animations = this.Settings?.Animations != null ? this.Settings?.Animations : (this.Animations != null ? this.Animations : this.animations);
834
739
  this.Theme = this.Settings?.Theme != null ? this.Settings?.Theme : (this.Theme != null ? this.Theme : this.theme);
835
740
  this.Locale = this.Settings?.Locale != null ? this.Settings?.Locale : (this.Locale != null ? this.Locale : this.locale);
836
- this.isPaged = (this.DataArray && this.DataArray.length > 0 && !this.Data) || (this.DataDtos && this.DataDtos.length > 0 && !!this.DataRetrieve);
741
+ this.isPaged = (this.DataArray && this.DataArray.length > 0 && !this.Data) || (this.DataDtos && this.DataDtos.length > 0 && !!this.DataRetrieve) || false;
837
742
  this.log("Chart " + this.name + ": ngOnInit");
838
743
  }
839
744
  /**
@@ -925,7 +830,7 @@ class BaseChartComponent {
925
830
  settings.LegendPosition = settings.LegendPosition ? settings.LegendPosition : this.LegendPosition;
926
831
  settings.HideSeriesOnLabelClick = settings.HideSeriesOnLabelClick != null ? settings.HideSeriesOnLabelClick : this.HideSeriesOnLabelClick;
927
832
  settings.MinGridDistance = settings.MinGridDistance != null ? settings.MinGridDistance : this.MinGridDistance;
928
- settings.LegendPadding = settings.LegendPadding ? settings.LegendPadding : this.LegendPadding ?? null;
833
+ settings.LegendPadding = settings.LegendPadding ? settings.LegendPadding : this.LegendPadding ?? undefined;
929
834
  settings.ContainerHeight = this.el.nativeElement.parentElement.offsetHeight;
930
835
  settings.OnSeriesClickCallback = (series) => { this.onSeriesClicked.emit(series); };
931
836
  settings.OnSelectionChangedCallback = (event) => { this.onSelectionChanged.emit({ from: event.from, to: event.to, initial: event.initial }); };
@@ -1008,9 +913,9 @@ class BaseChartComponent {
1008
913
  */
1009
914
  setupAmChartsThemes() {
1010
915
  return Promise.all([
1011
- this.Charter.applyTheme(am4core, this.Theme).then(() => {
1012
- return this.Animations ? this.Charter.applyAnimations(am4core) : this.Charter.unapplyAnimations(am4core);
1013
- })
916
+ // this.Charter.applyTheme(am5, this.Theme).then(() => {
917
+ // return this.Animations ? this.Charter.applyAnimations(am5) : this.Charter.unapplyAnimations(am5);
918
+ // })
1014
919
  ]);
1015
920
  }
1016
921
  /**
@@ -1039,10 +944,10 @@ class BaseChartComponent {
1039
944
  });
1040
945
  }
1041
946
  }
1042
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: BaseChartComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
1043
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.25", type: BaseChartComponent, isStandalone: true, 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 }); }
947
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: BaseChartComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
948
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.28", type: BaseChartComponent, isStandalone: true, 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 }); }
1044
949
  }
1045
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: BaseChartComponent, decorators: [{
950
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: BaseChartComponent, decorators: [{
1046
951
  type: Directive
1047
952
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: Object }, { type: i0.NgZone }, { type: ChartLoader }, { type: ChartDispatcher }, { type: undefined }, { type: undefined }, { type: undefined }, { type: undefined }], propDecorators: { XTitle: [{
1048
953
  type: Input
@@ -1099,12 +1004,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
1099
1004
  }] } });
1100
1005
 
1101
1006
  /**
1102
- * Classe il cui unico scopo è gestire il setup e rendering di un LineChart
1007
+ * Classe il cui unico scopo e gestire il setup e rendering di un LineChart
1103
1008
  */
1104
1009
  class LineChartService {
1105
1010
  /** @ignore */
1106
- constructor(Adapter, dateExts) {
1107
- this.Adapter = Adapter;
1011
+ constructor(dateExts) {
1108
1012
  this.dateExts = dateExts;
1109
1013
  /** @ignore */
1110
1014
  this.DataGroupBucketSize = 1500;
@@ -1114,8 +1018,10 @@ class LineChartService {
1114
1018
  this.OpacityOnFill = 0.75;
1115
1019
  /** @ignore */
1116
1020
  this.singleDataSet = false;
1021
+ /** @ignore */
1022
+ this.mergedData = [];
1117
1023
  //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
1118
- //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
1024
+ //TODO: spostarla in un metodo di utilita (esfaenza/extensions)
1119
1025
  /** @ignore */
1120
1026
  this.executionTimers = {};
1121
1027
  }
@@ -1123,7 +1029,9 @@ class LineChartService {
1123
1029
  * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un LineChart
1124
1030
  */
1125
1031
  graphicate(data, settings) {
1126
- let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
1032
+ let dataConverted = data;
1033
+ this.currentSeriesData = dataConverted;
1034
+ this.currentSettings = settings;
1127
1035
  let threshold = settings.DataGroupingThreshold ?? 3000;
1128
1036
  this.singleDataSet = settings.MergeDatasets ?? false;
1129
1037
  let showTicks = settings.ShowTicks == null ? true : settings?.ShowTicks;
@@ -1133,240 +1041,158 @@ class LineChartService {
1133
1041
  let interval = seriesWithInterval ? dataConverted.series.find(t => t.interval).interval : null;
1134
1042
  let gapsAllowed = settings?.AllowGaps == null ? seriesWithInterval : settings?.AllowGaps;
1135
1043
  let finalInstant = settings?.FinalInstants ?? true;
1136
- //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1137
- am4core.options.autoDispose = true;
1138
- this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1139
- let ChartInstanceCasted = this.ChartInstance;
1140
- let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1044
+ if (gapsAllowed && !seriesWithInterval) {
1045
+ console.error("Per utilizzare la funzionalita dei gap e obbligatorio definire un intervallo nelle serie del grafico");
1046
+ return null;
1047
+ }
1048
+ this.sortSeriesData(dataConverted);
1049
+ //#region Carico il Grafico
1050
+ this.ChartRoot?.dispose();
1051
+ this.ChartRoot = am5.Root.new(settings.Name);
1052
+ this.applyLocale(settings);
1053
+ this.ChartInstance = this.ChartRoot.container.children.push(am5xy.XYChart.new(this.ChartRoot, {}));
1054
+ //#endregion
1055
+ // Carico l'Asse Y
1056
+ let yRenderer = am5xy.AxisRendererY.new(this.ChartRoot, {});
1057
+ let yAxis = this.ChartInstance.yAxes.push(am5xy.ValueAxis.new(this.ChartRoot, {
1058
+ renderer: yRenderer
1059
+ }));
1060
+ yAxis.set("tooltip", am5.Tooltip.new(this.ChartRoot, {}));
1061
+ yAxis.get("tooltip")?.set("forceHidden", true);
1141
1062
  if (settings.YAxisTitle) {
1142
- yAxis.title.text = settings.YAxisTitle;
1143
- yAxis.title.fontWeight = "bold";
1063
+ yAxis.children.unshift(am5.Label.new(this.ChartRoot, {
1064
+ text: settings.YAxisTitle,
1065
+ rotation: -90,
1066
+ fontWeight: "600",
1067
+ y: am5.p50,
1068
+ centerX: am5.p50
1069
+ }));
1144
1070
  }
1145
- if (settings.Min)
1146
- yAxis.min = settings.Min;
1147
- if (settings.Max)
1148
- yAxis.max = settings.Max;
1149
- let limitNullOrUndef = dataConverted.limit == null || dataConverted.limit == undefined;
1150
- let limits = limitNullOrUndef ? [] : !dataConverted.limit.length ? [dataConverted.limit] : dataConverted.limit;
1151
- if (limits.length > 0) {
1152
- for (let i = 0; i < limits.length; i++) {
1153
- let limit = limits[i];
1154
- if (limit.upper != null && limit.upper != undefined && limit.lower != null && limit.lower != undefined) {
1155
- let range = yAxis.axisRanges.create();
1156
- range.value = limit.lower;
1157
- range.endValue = limit.upper;
1158
- if (limit.fillColor) {
1159
- range.contents.stroke = am4core.color(limit.fillColor);
1160
- range.contents.fill = range.contents.stroke;
1161
- }
1162
- range.label.inside = true;
1163
- range.label.text = limit.upperlabel;
1164
- range.label.fill = range.grid.stroke;
1165
- range.label.verticalCenter = "bottom";
1166
- range.label.stroke = am4core.color(limit.uppercolor || "#F92200");
1167
- range.grid.stroke = am4core.color(limit.uppercolor || "#F92200");
1168
- range.grid.strokeWidth = 2;
1169
- range.grid.strokeOpacity = 1;
1170
- }
1171
- else if ((limit.lower == null || limit.lower == undefined) && limit.upper != null && limit.upper != undefined) {
1172
- let range = yAxis.axisRanges.create();
1173
- range.value = limit.upper;
1174
- range.label.inside = true;
1175
- range.label.text = limit.upperlabel;
1176
- range.label.fill = range.grid.stroke;
1177
- range.label.verticalCenter = "bottom";
1178
- range.label.stroke = am4core.color(limit.uppercolor || "#F92200");
1179
- range.grid.stroke = am4core.color(limit.uppercolor || "#F92200");
1180
- range.grid.strokeWidth = 2;
1181
- range.grid.strokeOpacity = 1;
1182
- }
1183
- else if ((limit.upper == null || limit.upper == undefined) && limit.lower != null && limit.lower != undefined) {
1184
- let range = yAxis.axisRanges.create();
1185
- range.value = limit.lower;
1186
- range.label.inside = true;
1187
- range.label.text = limit.lowerlabel;
1188
- range.label.fill = range.grid.stroke;
1189
- range.label.verticalCenter = "bottom";
1190
- range.label.stroke = am4core.color(limit.lowercolor || "#F92200");
1191
- range.grid.stroke = am4core.color(limit.lowercolor || "#F92200");
1192
- range.grid.strokeWidth = 2;
1193
- range.grid.strokeOpacity = 1;
1194
- }
1195
- }
1071
+ if (settings.Min != null)
1072
+ yAxis.set("min", settings.Min);
1073
+ if (settings.Max != null)
1074
+ yAxis.set("max", settings.Max);
1075
+ this.applyLimits(yAxis, dataConverted);
1076
+ // Carico l'Asse X
1077
+ let xRenderer = am5xy.AxisRendererX.new(this.ChartRoot, {
1078
+ minGridDistance: settings?.MinGridDistance ?? 50
1079
+ });
1080
+ xRenderer.grid.template.set("location", 0);
1081
+ if (showTicks) {
1082
+ xRenderer.ticks.template.setAll({
1083
+ visible: true,
1084
+ strokeOpacity: 1,
1085
+ stroke: am5.color(0x495C43),
1086
+ strokeWidth: 2,
1087
+ length: 10,
1088
+ location: 0
1089
+ });
1196
1090
  }
1197
- this.dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
1198
- // Per comatibilità col codice scritto quando non era a livello globale, mi scoccia sostituire
1091
+ else {
1092
+ xRenderer.ticks.template.set("visible", false);
1093
+ }
1094
+ let baseInterval = interval
1095
+ ? { count: interval.count, timeUnit: this.fixTimeUnit(interval.timeunit) }
1096
+ : this.inferBaseInterval(dataConverted);
1097
+ this.dateAxis = this.ChartInstance.xAxes.push(am5xy.DateAxis.new(this.ChartRoot, {
1098
+ renderer: xRenderer,
1099
+ minZoomCount: 5,
1100
+ groupData: dataShouldBeGrouped,
1101
+ groupCount: settings.DataGroupBucketSize ?? this.DataGroupBucketSize,
1102
+ baseInterval: baseInterval,
1103
+ gridIntervals: this.getGridIntervals(baseInterval.timeUnit),
1104
+ tooltipDateFormat: this.getTooltipDateFormat(baseInterval.timeUnit)
1105
+ }));
1199
1106
  let dateAxis = this.dateAxis;
1107
+ this.applyDateAxisFormats(dateAxis);
1200
1108
  if (settings.XAxisTitle) {
1201
- dateAxis.title.text = settings.XAxisTitle;
1202
- dateAxis.title.fontWeight = "bold";
1109
+ dateAxis.children.push(am5.Label.new(this.ChartRoot, {
1110
+ text: settings.XAxisTitle,
1111
+ fontWeight: "600",
1112
+ x: am5.p50,
1113
+ centerX: am5.p50
1114
+ }));
1203
1115
  }
1204
- if (showTicks) {
1205
- dateAxis.renderer.ticks.template.disabled = false;
1206
- dateAxis.renderer.ticks.template.strokeOpacity = 1;
1207
- dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
1208
- dateAxis.renderer.ticks.template.strokeWidth = 2;
1209
- dateAxis.renderer.ticks.template.length = 10;
1210
- dateAxis.renderer.ticks.template.location = 0;
1211
- }
1212
- dateAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 50;
1213
- dateAxis.renderer.grid.template.location = 0;
1214
- dateAxis.minZoomCount = 5;
1215
- dateAxis.groupData = dataShouldBeGrouped;
1216
- dateAxis.groupCount = settings.DataGroupBucketSize ?? this.DataGroupBucketSize;
1217
- //Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
1218
- if (gapsAllowed) {
1219
- if (!seriesWithInterval) {
1220
- console.error("Per utilizzare la funzionalità dei gap è obbligatorio definire un intervallo nelle serie del grafico");
1221
- return null;
1222
- }
1223
- dateAxis.baseInterval = { count: interval.count, timeUnit: this.fixTimeUnit(interval.timeunit) };
1224
- }
1225
- if (showTimeline)
1226
- ChartInstanceCasted.scrollbarX = new am4charts.XYChartScrollbar();
1227
- let seriesToPush = [];
1116
+ if (this.singleDataSet)
1117
+ this.mergedData = this.generateSingleDataset(dataConverted);
1228
1118
  let seriesColors = [];
1229
1119
  let defaultIndex = 0;
1230
- // Ordinamento dei dati se serve
1231
- dataConverted.series.forEach((s) => {
1232
- if (s.values[0] && !(s.values[0].d instanceof Date)) {
1233
- for (let v = 0; v < s.values.length; v++)
1234
- s.values[v].d = new Date(s.values[v].d);
1235
- }
1236
- var correctOrder = true;
1237
- var prevDate = null;
1238
- for (let v = 0; v < s.values.length; v++) {
1239
- if (!prevDate)
1240
- prevDate = s.values[v].d;
1241
- else if (s.values[v].d < prevDate) {
1242
- correctOrder = false;
1243
- break;
1244
- }
1245
- }
1246
- if (!correctOrder)
1247
- s.values.sort((d1, d2) => d1.d.getTime() - d2.d.getTime());
1248
- });
1249
- // Generazione di un unico dataset invece che N, per poter gestire un unico tooltip
1250
- if (this.singleDataSet) {
1251
- this.ChartInstance.data = this.generateSingleDataset(dataConverted);
1252
- ;
1253
- dateAxis.cursorTooltipEnabled = false;
1254
- }
1255
1120
  dataConverted.series.forEach((s, index) => {
1256
1121
  let stacked = s.stacked != null && s.stacked != undefined ? s.stacked : (settings?.Stacked ?? false);
1257
1122
  let fill = stacked || (s.fill != null && s.fill != undefined ? s.fill : (settings?.Fill ?? false));
1258
- let series = settings?.Step ? new am4charts.StepLineSeries() : new am4charts.LineSeries();
1259
- series.dataFields.valueY = "v" + (this.singleDataSet ? index : "");
1260
- series.dataFields.dateX = "d";
1261
- series.measureUnit = s.uom;
1262
- series.name = s.name;
1263
- series.strokeWidth = settings?.StrokeSize ?? 1;
1264
- series.connect = !gapsAllowed;
1265
- series.minBulletDistance = 10;
1266
- series.tooltipText = this.singleDataSet ? "" : s.name ? "{name}: [bold]{valueY}[/]" : "[bold]{valueY}[/]";
1267
- series.tooltip.pointerOrientation = "vertical";
1268
- series.tooltip.background.fillOpacity = 0.5;
1269
- series.tooltip.label.padding(12, 12, 12, 12);
1270
- series.fillOpacity = fill ? this.OpacityOnFill : 0.0001;
1271
- series.stacked = stacked;
1272
- series.hidden = s.hidden;
1273
- //Dataset singolo, i dati sono registrati a livello di chart, creo il tooltip che permette di vederli tutti insieme
1274
- //altrimenti assegno i dati della serie direttamente alla serie
1275
- if (this.singleDataSet) {
1276
- series.tooltip.getFillFromObject = false;
1277
- series.tooltip.background.fill = am4core.color("#eee");
1278
- series.tooltip.label.fill = am4core.color("#00");
1279
- series.tooltip.defaultState.transitionDuration = 0;
1280
- series.tooltip.hiddenState.transitionDuration = 0;
1281
- //Utilizzo il mio dateService per la formattazione della data in modo che non debba mai gestire n formati fra n librerie... bellissimo
1282
- series.dateFormatter.format = (source) => {
1283
- if (interval && finalInstant && ["hour", "minute", "second"].includes(interval.timeunit)) {
1284
- let timepart = null;
1285
- switch (interval.timeunit) {
1286
- case "hour":
1287
- timepart = 'day';
1288
- break;
1289
- case "minute":
1290
- timepart = 'hour';
1291
- break;
1292
- case "second":
1293
- timepart = 'minute';
1294
- break;
1295
- }
1296
- if (timepart)
1297
- return this.dateExts.adjustDateToFinalInstant(source, timepart, interval ? interval.timeunit == "second" : false);
1298
- }
1299
- else
1300
- return this.dateExts.getFormatted(source, interval ? ["day", "week", "month", "year"].includes(interval.timeunit) : false, interval ? interval.timeunit == "second" : false);
1301
- };
1302
- series.adapter.add("tooltipText", () => {
1303
- var text = "[bold]{dateX.formatDate()}[/]\n";
1304
- this.ChartInstance.series.each((item) => {
1305
- let uom = " [font-style: italic]" + series.measureUnit || "" + "[/]";
1306
- text += "[" + item.stroke.hex + "]●[/] " + (item.name ? (item.name + ": ") : "") + "[bold]{" + item.dataFields.valueY + "}[/]" + uom + "\n";
1307
- });
1308
- return text;
1309
- });
1310
- }
1311
- else
1312
- series.data = s.values;
1313
- let segment = series.segments.template;
1314
- let hoverState = segment.states.create("hover");
1315
- hoverState.properties.strokeWidth = (settings?.StrokeSize ?? 1) + 1;
1316
- let dimmed = segment.states.create("dimmed");
1317
- dimmed.properties.stroke = am4core.color("#dadada");
1318
- //Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
1319
- if (s.color)
1320
- seriesColors.push(am4core.color(s.color));
1321
- else {
1322
- seriesColors.push(ChartInstanceCasted.colors.list[defaultIndex % ChartInstanceCasted.colors.list.length]);
1323
- defaultIndex++;
1324
- }
1325
- seriesToPush.push(series);
1326
- });
1327
- ChartInstanceCasted.colors.list = seriesColors;
1328
- //Scrivo le serie nel grafico
1329
- seriesToPush.forEach(s => {
1330
- ChartInstanceCasted.series.push(s);
1123
+ let color = s.color ? am5.color(s.color) : this.ChartInstance.get("colors").getIndex(defaultIndex++);
1124
+ seriesColors.push(color);
1125
+ let series = this.createSeries(s, index, dateAxis, yAxis, settings, gapsAllowed, fill, stacked, color, interval, finalInstant);
1331
1126
  if (showTimeline)
1332
- ChartInstanceCasted.scrollbarX.series.push(s);
1127
+ this.addSeriesToScrollbar(series, s, index, dateAxis, yAxis, settings, gapsAllowed, color);
1333
1128
  });
1129
+ this.ChartInstance.set("colors", am5.ColorSet.new(this.ChartRoot, {
1130
+ colors: seriesColors
1131
+ }));
1132
+ //#region Carico la Legenda
1334
1133
  if (settings.Legend) {
1335
- this.ChartInstance.legend = new am4charts.Legend();
1336
- this.ChartInstance.legend.position = settings?.LegendPosition ?? 'right';
1337
- this.ChartInstance.legend.scrollable = true;
1338
- this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
1339
- this.ChartInstance.legend.itemContainers.template.events.on("over", (event) => { this.processOver(event.target.dataItem.dataContext); });
1340
- this.ChartInstance.legend.itemContainers.template.events.on("out", () => { this.processOut(); });
1134
+ // Default "right"
1135
+ switch (settings.LegendPosition ?? "right") {
1136
+ case "left":
1137
+ this.ChartInstance.set("layout", this.ChartRoot.horizontalLayout);
1138
+ this.ChartLegend = this.ChartInstance.children.unshift(am5.Legend.new(this.ChartRoot, {
1139
+ layout: this.ChartRoot.verticalLayout,
1140
+ centerY: am5.percent(50),
1141
+ y: am5.percent(50),
1142
+ useDefaultMarker: true
1143
+ }));
1144
+ break;
1145
+ case "right":
1146
+ this.ChartInstance.set("layout", this.ChartRoot.horizontalLayout);
1147
+ this.ChartLegend = this.ChartInstance.children.push(am5.Legend.new(this.ChartRoot, {
1148
+ layout: this.ChartRoot.verticalLayout,
1149
+ centerY: am5.percent(50),
1150
+ y: am5.percent(50),
1151
+ useDefaultMarker: true
1152
+ }));
1153
+ break;
1154
+ case "top":
1155
+ this.ChartInstance.set("layout", this.ChartRoot.verticalLayout);
1156
+ this.ChartLegend = this.ChartInstance.children.unshift(am5.Legend.new(this.ChartRoot, {
1157
+ layout: this.ChartRoot.horizontalLayout,
1158
+ useDefaultMarker: true
1159
+ }));
1160
+ break;
1161
+ case "bottom":
1162
+ this.ChartInstance.set("layout", this.ChartRoot.verticalLayout);
1163
+ this.ChartLegend = this.ChartInstance.children.push(am5.Legend.new(this.ChartRoot, {
1164
+ layout: this.ChartRoot.horizontalLayout,
1165
+ useDefaultMarker: true
1166
+ }));
1167
+ break;
1168
+ }
1169
+ this.ChartLegend.itemContainers.template.set("tooltipText", "{name}");
1170
+ this.ChartLegend.itemContainers.template.events.on("pointerover", (event) => {
1171
+ let series = event.target.dataItem?.dataContext;
1172
+ if (series)
1173
+ this.processOver(series);
1174
+ });
1175
+ this.ChartLegend.itemContainers.template.events.on("pointerout", () => { this.processOut(); });
1341
1176
  if (settings.LegendPadding) {
1342
- let template = this.ChartInstance.legend.itemContainers.template;
1343
- template.paddingTop = settings.LegendPadding.top ?? 0;
1344
- template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1345
- template.paddingLeft = settings.LegendPadding.left ?? 0;
1346
- template.paddingRight = settings.LegendPadding.right ?? 0;
1177
+ this.ChartLegend.itemContainers.template.setAll({
1178
+ paddingTop: settings.LegendPadding.top ?? 0,
1179
+ paddingBottom: settings.LegendPadding.bottom ?? 0,
1180
+ paddingLeft: settings.LegendPadding.left ?? 0,
1181
+ paddingRight: settings.LegendPadding.right ?? 0
1182
+ });
1347
1183
  }
1184
+ this.ChartLegend.data.setAll(this.ChartInstance.series.values);
1348
1185
  }
1349
- this.ChartInstance.cursor = new am4charts.XYCursor();
1350
- //Prove******************************************************************************************************************************
1351
- // this.ChartInstance.cursor.events.on("cursorpositionchanged", (ev) => {
1352
- // //var value = dateAxis.positionToDate(dateAxis.toAxisPosition(ev.target.xPosition));
1353
- // var dt = dateAxis.series.values.find(t => t.dataItem.values.dateX);
1354
- // if (dt && dt.dataItem) {
1355
- // console.log(dt.dataItem.values);
1356
- // // this.ChartInstance.tooltipText = dt;
1357
- // }
1358
- // else {
1359
- // this.ChartInstance.tooltipText = "";
1360
- // }
1361
- // });
1362
- //******************************************************************************************************************************
1363
- this.ChartInstance.cursor.xAxis = dateAxis;
1364
- this.ChartInstance.cursor.yAxis = yAxis;
1186
+ //#endregion
1187
+ let cursor = am5xy.XYCursor.new(this.ChartRoot, {
1188
+ xAxis: dateAxis,
1189
+ yAxis
1190
+ });
1191
+ this.ChartInstance.set("cursor", cursor);
1365
1192
  if (this.singleDataSet)
1366
- this.ChartInstance.cursor.maxTooltipDistance = -1;
1367
- //TODO: Cercare di capire perché è figlio di puttana......
1368
- dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
1369
- dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
1193
+ this.ChartInstance.set("maxTooltipDistance", -1);
1194
+ dateAxis.on("start", () => this.emitSelectionChanged(dateAxis, settings));
1195
+ dateAxis.on("end", () => this.emitSelectionChanged(dateAxis, settings));
1370
1196
  return this;
1371
1197
  }
1372
1198
  fixTimeUnit(tu) {
@@ -1391,19 +1217,21 @@ class LineChartService {
1391
1217
  }
1392
1218
  /** @ignore */
1393
1219
  setSelection(from, to) {
1394
- this.dateAxis.zoomToDates(from, to, true, true);
1220
+ this.dateAxis?.zoomToDates(from, to);
1395
1221
  }
1396
1222
  /** @ignore */
1397
1223
  refreshData(data) {
1398
- let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
1224
+ let dataConverted = data;
1399
1225
  if (this.singleDataSet) {
1400
- var data = this.generateSingleDataset(dataConverted);
1401
- this.ChartInstance.addData(data);
1226
+ this.mergedData = this.generateSingleDataset(dataConverted);
1227
+ this.ChartInstance?.series.each((series) => {
1228
+ series.data.setAll(this.mergedData);
1229
+ });
1402
1230
  return;
1403
1231
  }
1404
1232
  throw "Impossibile aggiornare i dati senza unire il dataset. Si prega di impostare [MergeDatasets] a true";
1405
1233
  }
1406
- /** Partendo da dati divisi per seriue genera un dataset unito con la data come chiave e i vari valori dopo */
1234
+ /** Partendo da dati divisi per serie genera un dataset unito con la data come chiave e i vari valori dopo */
1407
1235
  generateSingleDataset(data) {
1408
1236
  let dto = {};
1409
1237
  data.series.forEach((vs, index) => {
@@ -1419,7 +1247,7 @@ class LineChartService {
1419
1247
  var ret = [];
1420
1248
  for (let i = 0; i < dates.length; i++) {
1421
1249
  let values = dto[dates[i]];
1422
- let item = { d: new Date(parseInt(dates[i])) };
1250
+ let item = { d: parseInt(dates[i]) };
1423
1251
  var vals = Object.keys(values);
1424
1252
  for (let ii = 0; ii < vals.length; ii++) {
1425
1253
  let series = vals[ii];
@@ -1431,51 +1259,306 @@ class LineChartService {
1431
1259
  return ret;
1432
1260
  }
1433
1261
  /** @ignore */
1434
- emitSelectionChanged(ev, settings) {
1262
+ createSeries(source, index, dateAxis, yAxis, settings, gapsAllowed, fill, stacked, color, interval, finalInstant) {
1263
+ let SeriesClass = settings?.Step ? am5xy.StepLineSeries : am5xy.LineSeries;
1264
+ let valueField = "v" + (this.singleDataSet ? index : "");
1265
+ let series = this.ChartInstance.series.push(SeriesClass.new(this.ChartRoot, {
1266
+ name: source.name,
1267
+ xAxis: dateAxis,
1268
+ yAxis,
1269
+ valueYField: valueField,
1270
+ valueXField: "d",
1271
+ stroke: color,
1272
+ fill: color,
1273
+ connect: !gapsAllowed,
1274
+ stacked: stacked
1275
+ }));
1276
+ series.measureUnit = source.uom;
1277
+ series.strokes.template.setAll({
1278
+ strokeWidth: settings?.StrokeSize ?? 1
1279
+ });
1280
+ series.fills.template.setAll({
1281
+ fillOpacity: fill ? this.OpacityOnFill : 0.0001,
1282
+ visible: true
1283
+ });
1284
+ series.set("minBulletDistance", 10);
1285
+ series.set("tooltip", am5.Tooltip.new(this.ChartRoot, {
1286
+ pointerOrientation: "vertical",
1287
+ labelText: this.getTooltipText(source, index, interval, finalInstant)
1288
+ }));
1289
+ series.get("tooltip")?.get("background")?.setAll({
1290
+ fillOpacity: this.singleDataSet ? 1 : 0.5,
1291
+ fill: this.singleDataSet ? am5.color(0xeeeeee) : undefined
1292
+ });
1293
+ if (this.singleDataSet)
1294
+ series.data.setAll(this.mergedData);
1295
+ else
1296
+ series.data.setAll(source.values.map(item => ({ d: new Date(item.d).getTime(), v: item.v })));
1297
+ if (source.hidden)
1298
+ series.hide(0);
1299
+ return series;
1300
+ }
1301
+ /** @ignore */
1302
+ getTooltipText(source, index, interval, finalInstant) {
1303
+ if (!this.singleDataSet)
1304
+ return source.name ? "{name}: [bold]{valueY}[/]" : "[bold]{valueY}[/]";
1305
+ let text = "[bold]{valueX.formatDate()}[/]\n";
1306
+ this.currentSeriesData.series.forEach((serie, sindex) => {
1307
+ let uom = serie.uom ? " [fontStyle: italic]" + serie.uom + "[/]" : "";
1308
+ text += (serie.name ? (serie.name + ": ") : "") + "[bold]{v" + sindex + "}[/]" + uom + "\n";
1309
+ });
1310
+ return text;
1311
+ }
1312
+ /** @ignore */
1313
+ addSeriesToScrollbar(series, source, index, dateAxis, yAxis, settings, gapsAllowed, color) {
1314
+ if (!this.scrollbarX) {
1315
+ this.scrollbarX = am5xy.XYChartScrollbar.new(this.ChartRoot, {
1316
+ orientation: "horizontal",
1317
+ height: 60
1318
+ });
1319
+ this.ChartInstance.set("scrollbarX", this.scrollbarX);
1320
+ let scrollbarXAxis = this.scrollbarX.chart.xAxes.push(am5xy.DateAxis.new(this.ChartRoot, {
1321
+ renderer: am5xy.AxisRendererX.new(this.ChartRoot, {
1322
+ opposite: false,
1323
+ strokeOpacity: 0
1324
+ }),
1325
+ baseInterval: dateAxis.get("baseInterval"),
1326
+ gridIntervals: dateAxis.get("gridIntervals"),
1327
+ groupData: dateAxis.get("groupData"),
1328
+ groupCount: dateAxis.get("groupCount")
1329
+ }));
1330
+ this.applyDateAxisFormats(scrollbarXAxis);
1331
+ let scrollbarYAxis = this.scrollbarX.chart.yAxes.push(am5xy.ValueAxis.new(this.ChartRoot, {
1332
+ renderer: am5xy.AxisRendererY.new(this.ChartRoot, {})
1333
+ }));
1334
+ this.scrollbarX.esXAxis = scrollbarXAxis;
1335
+ this.scrollbarX.esYAxis = scrollbarYAxis;
1336
+ }
1337
+ let scrollbarXAxis = this.scrollbarX.esXAxis;
1338
+ let scrollbarYAxis = this.scrollbarX.esYAxis;
1339
+ let SeriesClass = settings?.Step ? am5xy.StepLineSeries : am5xy.LineSeries;
1340
+ let valueField = "v" + (this.singleDataSet ? index : "");
1341
+ let scrollbarSeries = this.scrollbarX.chart.series.push(SeriesClass.new(this.ChartRoot, {
1342
+ name: series.get("name"),
1343
+ xAxis: scrollbarXAxis,
1344
+ yAxis: scrollbarYAxis,
1345
+ valueYField: valueField,
1346
+ valueXField: "d",
1347
+ stroke: color,
1348
+ fill: color,
1349
+ connect: !gapsAllowed
1350
+ }));
1351
+ scrollbarSeries.strokes.template.setAll({
1352
+ strokeWidth: 1,
1353
+ strokeOpacity: 0.75
1354
+ });
1355
+ scrollbarSeries.fills.template.setAll({
1356
+ visible: false
1357
+ });
1358
+ if (this.singleDataSet)
1359
+ scrollbarSeries.data.setAll(this.mergedData);
1360
+ else
1361
+ scrollbarSeries.data.setAll(source.values.map(item => ({ d: new Date(item.d).getTime(), v: item.v })));
1362
+ }
1363
+ /** @ignore */
1364
+ applyLocale(settings) {
1365
+ if ((settings.Locale ?? "").toLowerCase().startsWith("it"))
1366
+ this.ChartRoot.locale = am5locales_it_IT;
1367
+ }
1368
+ /** @ignore */
1369
+ applyDateAxisFormats(dateAxis) {
1370
+ if (dateAxis.get("dateFormats")) {
1371
+ dateAxis.get("dateFormats")["millisecond"] = "HH:mm:ss";
1372
+ dateAxis.get("dateFormats")["second"] = "HH:mm:ss";
1373
+ dateAxis.get("dateFormats")["minute"] = "HH:mm";
1374
+ dateAxis.get("dateFormats")["hour"] = "HH:mm";
1375
+ dateAxis.get("dateFormats")["day"] = "dd MMM";
1376
+ dateAxis.get("dateFormats")["week"] = "dd MMM";
1377
+ dateAxis.get("dateFormats")["month"] = "MMM";
1378
+ }
1379
+ if (dateAxis.get("periodChangeDateFormats")) {
1380
+ dateAxis.get("periodChangeDateFormats")["millisecond"] = "HH:mm:ss";
1381
+ dateAxis.get("periodChangeDateFormats")["second"] = "HH:mm:ss";
1382
+ dateAxis.get("periodChangeDateFormats")["minute"] = "HH:mm";
1383
+ dateAxis.get("periodChangeDateFormats")["hour"] = "dd MMM";
1384
+ dateAxis.get("periodChangeDateFormats")["day"] = "dd MMM";
1385
+ dateAxis.get("periodChangeDateFormats")["week"] = "dd MMM";
1386
+ dateAxis.get("periodChangeDateFormats")["month"] = "MMM";
1387
+ }
1388
+ }
1389
+ /** @ignore */
1390
+ inferBaseInterval(data) {
1391
+ let minDelta = Number.MAX_SAFE_INTEGER;
1392
+ data.series.forEach(series => {
1393
+ for (let i = 1; i < series.values.length; i++) {
1394
+ let previous = new Date(series.values[i - 1].d).getTime();
1395
+ let current = new Date(series.values[i].d).getTime();
1396
+ let delta = current - previous;
1397
+ if (delta > 0 && delta < minDelta)
1398
+ minDelta = delta;
1399
+ }
1400
+ });
1401
+ if (minDelta <= 1000)
1402
+ return { timeUnit: "second", count: Math.max(1, Math.round(minDelta / 1000)) };
1403
+ if (minDelta <= 60 * 1000)
1404
+ return { timeUnit: "minute", count: Math.max(1, Math.round(minDelta / (60 * 1000))) };
1405
+ if (minDelta <= 60 * 60 * 1000)
1406
+ return { timeUnit: "hour", count: Math.max(1, Math.round(minDelta / (60 * 60 * 1000))) };
1407
+ if (minDelta <= 24 * 60 * 60 * 1000)
1408
+ return { timeUnit: "day", count: Math.max(1, Math.round(minDelta / (24 * 60 * 60 * 1000))) };
1409
+ if (minDelta <= 7 * 24 * 60 * 60 * 1000)
1410
+ return { timeUnit: "week", count: Math.max(1, Math.round(minDelta / (7 * 24 * 60 * 60 * 1000))) };
1411
+ return { timeUnit: "day", count: 1 };
1412
+ }
1413
+ /** @ignore */
1414
+ getGridIntervals(baseTimeUnit) {
1415
+ if (baseTimeUnit == "hour") {
1416
+ return [
1417
+ { timeUnit: "hour", count: 1 },
1418
+ { timeUnit: "hour", count: 3 },
1419
+ { timeUnit: "hour", count: 6 },
1420
+ { timeUnit: "hour", count: 12 },
1421
+ { timeUnit: "day", count: 1 },
1422
+ { timeUnit: "day", count: 2 },
1423
+ { timeUnit: "day", count: 3 },
1424
+ { timeUnit: "week", count: 1 },
1425
+ { timeUnit: "month", count: 1 },
1426
+ { timeUnit: "year", count: 1 }
1427
+ ];
1428
+ }
1429
+ return undefined;
1430
+ }
1431
+ /** @ignore */
1432
+ getTooltipDateFormat(baseTimeUnit) {
1433
+ if (baseTimeUnit == "hour")
1434
+ return "dd MMM yyyy, HH:mm";
1435
+ if (baseTimeUnit == "minute" || baseTimeUnit == "second")
1436
+ return "dd MMM yyyy, HH:mm:ss";
1437
+ return "dd MMM yyyy";
1438
+ }
1439
+ /** @ignore */
1440
+ applyLimits(yAxis, dataConverted) {
1441
+ let limitNullOrUndef = dataConverted.limit == null || dataConverted.limit == undefined;
1442
+ let limits = limitNullOrUndef ? [] : !dataConverted.limit.length ? [dataConverted.limit] : dataConverted.limit;
1443
+ for (let i = 0; i < limits.length; i++) {
1444
+ let limit = limits[i];
1445
+ if (limit.upper != null && limit.upper != undefined && limit.lower != null && limit.lower != undefined) {
1446
+ let rangeDataItem = yAxis.makeDataItem({
1447
+ value: limit.lower,
1448
+ endValue: limit.upper
1449
+ });
1450
+ let range = yAxis.createAxisRange(rangeDataItem);
1451
+ let color = am5.color(limit.uppercolor || "#F92200");
1452
+ range.get("grid")?.setAll({
1453
+ stroke: color,
1454
+ strokeWidth: 2,
1455
+ strokeOpacity: 1
1456
+ });
1457
+ range.get("label")?.setAll({
1458
+ text: limit.upperlabel,
1459
+ inside: true,
1460
+ fill: color,
1461
+ centerY: am5.p100
1462
+ });
1463
+ if (limit.fillColor) {
1464
+ range.get("axisFill")?.setAll({
1465
+ fill: am5.color(limit.fillColor),
1466
+ fillOpacity: 0.15,
1467
+ visible: true
1468
+ });
1469
+ }
1470
+ }
1471
+ else if ((limit.lower == null || limit.lower == undefined) && limit.upper != null && limit.upper != undefined) {
1472
+ this.createLimitLine(yAxis, limit.upper, limit.upperlabel ?? "", limit.uppercolor);
1473
+ }
1474
+ else if ((limit.upper == null || limit.upper == undefined) && limit.lower != null && limit.lower != undefined) {
1475
+ this.createLimitLine(yAxis, limit.lower, limit.lowerlabel ?? "", limit.lowercolor);
1476
+ }
1477
+ }
1478
+ }
1479
+ /** @ignore */
1480
+ createLimitLine(yAxis, value, label, colorString) {
1481
+ let color = am5.color(colorString || "#F92200");
1482
+ let rangeDataItem = yAxis.makeDataItem({ value });
1483
+ let range = yAxis.createAxisRange(rangeDataItem);
1484
+ range.get("grid")?.setAll({
1485
+ stroke: color,
1486
+ strokeWidth: 2,
1487
+ strokeOpacity: 1
1488
+ });
1489
+ range.get("label")?.setAll({
1490
+ text: label,
1491
+ inside: true,
1492
+ fill: color,
1493
+ centerY: am5.p100
1494
+ });
1495
+ }
1496
+ /** @ignore */
1497
+ sortSeriesData(dataConverted) {
1498
+ dataConverted.series.forEach((s) => {
1499
+ if (s.values[0] && !(s.values[0].d instanceof Date)) {
1500
+ for (let v = 0; v < s.values.length; v++)
1501
+ s.values[v].d = new Date(s.values[v].d);
1502
+ }
1503
+ var correctOrder = true;
1504
+ var prevDate = null;
1505
+ for (let v = 0; v < s.values.length; v++) {
1506
+ if (!prevDate)
1507
+ prevDate = s.values[v].d;
1508
+ else if (s.values[v].d < prevDate) {
1509
+ correctOrder = false;
1510
+ break;
1511
+ }
1512
+ }
1513
+ if (!correctOrder)
1514
+ s.values.sort((d1, d2) => d1.d.getTime() - d2.d.getTime());
1515
+ });
1516
+ }
1517
+ /** @ignore */
1518
+ emitSelectionChanged(axis, settings) {
1435
1519
  if (settings.OnSelectionChangedCallback) {
1436
1520
  this.throttla("selchange", () => {
1437
- var axis = ev.target;
1438
- var start = new Date(axis.minZoomed);
1439
- var end = new Date(axis.maxZoomed);
1440
- var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
1441
- settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
1521
+ let min = axis.getPrivate("selectionMin");
1522
+ let max = axis.getPrivate("selectionMax");
1523
+ if (min == null || max == null)
1524
+ return;
1525
+ settings.OnSelectionChangedCallback({
1526
+ from: new Date(min),
1527
+ to: new Date(max),
1528
+ initial: axis.get("start") == 0 && axis.get("end") == 1
1529
+ });
1442
1530
  }, 150);
1443
1531
  }
1444
1532
  }
1445
1533
  /** @ignore */
1446
1534
  processOver(hoveredSeries) {
1447
- hoveredSeries.zIndex = 999;
1448
- let fill = hoveredSeries.fillOpacity == this.OpacityOnFill;
1449
- hoveredSeries.segments.each((segment) => {
1450
- segment.setState("hover");
1451
- if (!fill)
1452
- segment.fillSprite.fillOpacity = this.OpacityOnSelected;
1453
- });
1535
+ hoveredSeries.toFront();
1536
+ let fill = hoveredSeries.fills.template.get("fillOpacity") == this.OpacityOnFill;
1537
+ hoveredSeries.strokes.template.set("strokeWidth", (this.currentSettings?.StrokeSize ?? 1) + 1);
1454
1538
  if (!fill)
1455
- hoveredSeries.legendDataItem.marker.children.getIndex(1).fillOpacity = this.OpacityOnSelected;
1456
- this.ChartInstance.series.each((series) => {
1539
+ hoveredSeries.fills.template.set("fillOpacity", this.OpacityOnSelected);
1540
+ this.ChartInstance?.series.each((series) => {
1457
1541
  if (series != hoveredSeries) {
1458
- let fill = series.fillOpacity == this.OpacityOnFill;
1459
- series.segments.each((segment) => {
1460
- segment.setState("dimmed");
1461
- if (!fill)
1462
- segment.fillSprite.fillOpacity = 0;
1463
- });
1542
+ series.strokes.template.set("stroke", am5.color(0xdadada));
1543
+ series.strokes.template.set("strokeOpacity", 0.6);
1544
+ series.fills.template.set("fillOpacity", 0);
1464
1545
  }
1465
1546
  });
1466
1547
  }
1467
1548
  /** @ignore */
1468
1549
  processOut() {
1469
- this.ChartInstance.series.each((series, i) => {
1470
- series.zIndex = i;
1471
- let fill = series.fillOpacity == this.OpacityOnFill;
1472
- series.segments.each((segment) => {
1473
- segment.setState("default");
1474
- if (!fill)
1475
- segment.fillSprite.fillOpacity = 0;
1550
+ this.ChartInstance?.series.each((series, i) => {
1551
+ let typedSeries = series;
1552
+ let source = this.currentSeriesData?.series[i];
1553
+ let color = source?.color ? am5.color(source.color) : typedSeries.get("stroke");
1554
+ let stacked = source?.stacked != null && source?.stacked != undefined ? source.stacked : (this.currentSettings?.Stacked ?? false);
1555
+ let fill = stacked || (source?.fill != null && source?.fill != undefined ? source.fill : (this.currentSettings?.Fill ?? false));
1556
+ typedSeries.strokes.template.setAll({
1557
+ stroke: color,
1558
+ strokeOpacity: 1,
1559
+ strokeWidth: this.currentSettings?.StrokeSize ?? 1
1476
1560
  });
1477
- if (!fill)
1478
- series.legendDataItem.marker.children.getIndex(1).fillOpacity = 0;
1561
+ typedSeries.fills.template.set("fillOpacity", fill ? this.OpacityOnFill : 0.0001);
1479
1562
  });
1480
1563
  }
1481
1564
  /** @ignore */
@@ -1493,11 +1576,7 @@ class LineChartService {
1493
1576
  */
1494
1577
  class PieChartService {
1495
1578
  /** @ignore */
1496
- constructor(Adapter) {
1497
- this.Adapter = Adapter;
1498
- /** @ignore */
1499
- this.ViewAbsoluteValues = true;
1500
- }
1579
+ constructor() { }
1501
1580
  /**
1502
1581
  * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un PieChart
1503
1582
  */
@@ -1506,126 +1585,198 @@ class PieChartService {
1506
1585
  console.error("Timeline not supported for pie chart");
1507
1586
  return null;
1508
1587
  }
1509
- //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1510
- am4core.options.autoDispose = true;
1511
- this.ChartInstance = am4core.create(settings.Name, settings.Mode3D ? am4charts.PieChart3D : am4charts.PieChart);
1512
- this.ChartInstance.innerRadius = ((settings.DonutRadiusPercentage || 15) / 100) * settings.ContainerHeight;
1513
- let series = this.ChartInstance.series.push(settings.Mode3D ? new am4charts.PieSeries3D() : new am4charts.PieSeries());
1514
- series.dataFields.value = "v";
1515
- series.dataFields.category = "k";
1516
- //Il default sono valori percentuali
1517
- if (this.ViewAbsoluteValues) {
1518
- series.legendSettings.valueText = "{value}";
1519
- series.labels.template.text = "{category}: [bold]{value}[/]";
1588
+ let dataConverted = data;
1589
+ //#region Carico il Grafico
1590
+ this.ChartRoot?.dispose();
1591
+ this.ChartRoot = am5.Root.new(settings.Name);
1592
+ let ChartContainer = this.ChartRoot.container.children.push(am5.Container.new(this.ChartRoot, {
1593
+ width: am5.percent(100),
1594
+ height: am5.percent(100),
1595
+ layout: this.ChartRoot.verticalLayout
1596
+ }));
1597
+ this.ChartInstance = ChartContainer.children.push(am5percent.PieChart.new(this.ChartRoot, {}));
1598
+ //#endregion
1599
+ // Raggio Torta
1600
+ // In am4 non c'era un modo automatico di calcolare il raggio sulle dimensioni del grafico, quindi si era fatto
1601
+ // questo workaround che calcolava un 15% sulle dimensioni del container.
1602
+ let innerRadiusOLD = ((settings.DonutRadiusPercentage || 15) / 100) * settings.ContainerHeight;
1603
+ let innerRadiusNEW = am5.percent(settings.DonutRadiusPercentage || 15); // Con am5 andrebbe calcolato così
1604
+ this.ChartInstance.set("innerRadius", innerRadiusOLD);
1605
+ //#region Carico la Legenda
1606
+ if (settings.Legend) {
1607
+ // Default "bottom"
1608
+ switch (settings.LegendPosition ?? "bottom") {
1609
+ case "left":
1610
+ ChartContainer.set("layout", this.ChartRoot.horizontalLayout);
1611
+ this.ChartLegend = ChartContainer.children.unshift(am5.Legend.new(this.ChartRoot, {}));
1612
+ break;
1613
+ case "right":
1614
+ ChartContainer.set("layout", this.ChartRoot.horizontalLayout);
1615
+ this.ChartLegend = ChartContainer.children.push(am5.Legend.new(this.ChartRoot, {}));
1616
+ break;
1617
+ case "top":
1618
+ ChartContainer.set("layout", this.ChartRoot.verticalLayout);
1619
+ this.ChartLegend = ChartContainer.children.unshift(am5.Legend.new(this.ChartRoot, {}));
1620
+ break;
1621
+ case "bottom":
1622
+ ChartContainer.set("layout", this.ChartRoot.verticalLayout);
1623
+ this.ChartLegend = ChartContainer.children.push(am5.Legend.new(this.ChartRoot, {}));
1624
+ break;
1625
+ }
1626
+ this.ChartLegend.setAll({
1627
+ x: am5.percent(50),
1628
+ centerX: am5.percent(50)
1629
+ });
1630
+ // Padding
1631
+ if (settings.LegendPadding) {
1632
+ this.ChartLegend.itemContainers.template.setAll({
1633
+ paddingTop: settings.LegendPadding.top ?? 0,
1634
+ paddingBottom: settings.LegendPadding.bottom ?? 0,
1635
+ paddingLeft: settings.LegendPadding.left ?? 0,
1636
+ paddingRight: settings.LegendPadding.right ?? 0
1637
+ });
1638
+ }
1639
+ // SPECIFICO PER PIE CHART:
1640
+ // Se la legenda non fa il toggle della serie la considero come se fosse un click sulla serie in se
1641
+ if (!settings.HideSeriesOnLabelClick) {
1642
+ this.ChartLegend.itemContainers.template.events.on("click", (ev) => {
1643
+ ev.originalEvent.preventDefault();
1644
+ let data = ev.target.dataItem?.dataContext;
1645
+ settings.OnSeriesClickCallback?.(data.k);
1646
+ });
1647
+ }
1520
1648
  }
1521
- series.slices.template.stroke = am4core.color("#fff");
1522
- series.slices.template.strokeOpacity = 1;
1523
- series.slices.template.togglable = false;
1524
- series.hiddenState.properties.opacity = 1;
1525
- series.hiddenState.properties.endAngle = -90;
1526
- series.hiddenState.properties.startAngle = -90;
1649
+ //#endregion
1650
+ // Definisco le Serie
1651
+ let series = this.ChartInstance.series.push(am5percent.PieSeries.new(this.ChartRoot, {
1652
+ valueField: "v",
1653
+ categoryField: "k"
1654
+ }));
1655
+ // Il default sono valori percentuali
1656
+ series.labels.template.set("text", "{category}: [bold]{value}[/]");
1657
+ series.slices.template.setAll({
1658
+ stroke: am5.color(0xffffff),
1659
+ strokeOpacity: 1,
1660
+ toggleKey: "none",
1661
+ tooltip: am5.Tooltip.new(this.ChartRoot, {
1662
+ labelText: "{category}: {valuePercentTotal.formatNumber('0.0')}% ({value})"
1663
+ })
1664
+ });
1665
+ // Configurazione "HideZeroes"
1527
1666
  if (settings.HideZeroes == null ? true : settings.HideZeroes) {
1528
- series.ticks.template.events.on("ready", this.hideZeroes);
1529
- series.ticks.template.events.on("visibilitychanged", this.hideZeroes);
1530
- series.labels.template.events.on("ready", this.hideZeroes);
1531
- series.labels.template.events.on("visibilitychanged", this.hideZeroes);
1667
+ series.labels.template.adapters.add("visible", (visible, target) => {
1668
+ let data = target.dataItem;
1669
+ if (!data)
1670
+ return visible;
1671
+ return data.get("valuePercentTotal") !== 0;
1672
+ });
1673
+ series.ticks.template.adapters.add("visible", (visible, target) => {
1674
+ let data = target.dataItem;
1675
+ if (!data)
1676
+ return visible;
1677
+ return data.get("valuePercentTotal") !== 0;
1678
+ });
1532
1679
  }
1533
- series.slices.template.events.on("hit", (ev) => {
1534
- if (settings.OnSeriesClickCallback) {
1535
- let clickedSeries = ev.target.dataItem.dataContext.k;
1536
- settings.OnSeriesClickCallback(clickedSeries);
1537
- }
1680
+ // Configurazione Click sulle Slice
1681
+ series.slices.template.events.on("click", (ev) => {
1682
+ if (!settings.OnSeriesClickCallback)
1683
+ return;
1684
+ let data = ev.target.dataItem?.dataContext;
1685
+ settings.OnSeriesClickCallback(data.k);
1538
1686
  });
1539
- let dataConverted = this.Adapter ? this.Adapter.adaptDataForPieChart(data) : data;
1687
+ // Configurazione Colori
1688
+ let colorSet = this.ChartInstance.get("colors");
1540
1689
  let defaultIndex = 0;
1541
- for (let i = 0; i < dataConverted.values.length; i++) {
1542
- if (!dataConverted.values[i].c) {
1543
- dataConverted.values[i].c = this.ChartInstance.colors.list[defaultIndex % this.ChartInstance.colors.list.length];
1544
- defaultIndex++;
1545
- }
1690
+ for (let value of dataConverted.values) {
1691
+ if (value.c)
1692
+ value.c = am5.color(value.c);
1546
1693
  else
1547
- dataConverted.values[i].c = am4core.color(dataConverted.values[i].c);
1694
+ value.c = colorSet?.getIndex(defaultIndex++);
1548
1695
  }
1549
- series.slices.template.propertyFields.fill = "c";
1550
- this.ChartInstance.data = dataConverted.values;
1696
+ series.slices.template.adapters.add("fill", (fill, target) => {
1697
+ let data = target.dataItem?.dataContext;
1698
+ if (data?.c)
1699
+ return data.c;
1700
+ return fill;
1701
+ });
1702
+ series.slices.template.adapters.add("stroke", (stroke, target) => {
1703
+ let data = target.dataItem?.dataContext;
1704
+ if (data?.c)
1705
+ return data.c;
1706
+ return stroke;
1707
+ });
1708
+ // Configurazione Label Visibili
1551
1709
  if (!settings.LabelsVisible) {
1552
- series.labels.template.disabled = true;
1553
- series.ticks.template.disabled = true;
1710
+ series.labels.template.set("forceHidden", true);
1711
+ series.ticks.template.set("forceHidden", true);
1554
1712
  }
1555
1713
  else if (settings.LabelsWrap || settings.LabelsTruncate) {
1556
- series.labels.template.maxWidth = settings.LabelsWidth || 100;
1714
+ series.labels.template.setAll({
1715
+ maxWidth: settings.LabelsWidth || 100
1716
+ });
1717
+ // Wrap o Truncate
1557
1718
  if (settings.LabelsWrap)
1558
- series.labels.template.wrap = true;
1719
+ series.labels.template.setAll({ oversizedBehavior: "wrap" });
1559
1720
  else if (settings.LabelsTruncate)
1560
- series.labels.template.truncate = true;
1721
+ series.labels.template.setAll({ oversizedBehavior: "truncate" });
1561
1722
  }
1723
+ // Configurazione "Mostra Totale"
1562
1724
  if (settings.Total?.Show) {
1563
- var label = this.ChartInstance.seriesContainer.createChild(am4core.Label);
1564
- label.textAlign = "middle";
1565
- label.horizontalCenter = "middle";
1566
- label.verticalCenter = "middle";
1567
- label.adapter.add("text", function (text, target) {
1568
- let sumString = (Math.trunc(series.dataItem.values.value.sum * 100) / 100).toString();
1569
- let fs = 0;
1725
+ let label = this.ChartInstance.children.push(am5.Label.new(this.ChartRoot, {
1726
+ centerX: am5.p50,
1727
+ centerY: am5.p50,
1728
+ textAlign: "center"
1729
+ }));
1730
+ let updateTotal = () => {
1731
+ let total = 0;
1732
+ series.dataItems.forEach(di => {
1733
+ if (!di.get("visible"))
1734
+ return;
1735
+ total += di.get("valueWorking") ?? di.get("value") ?? 0;
1736
+ });
1737
+ let sumString = (Math.trunc(total * 100) / 100).toString();
1738
+ let fs = 28;
1570
1739
  if (sumString.length >= 9)
1571
1740
  fs = 18;
1572
1741
  else if (sumString.length == 8)
1573
1742
  fs = 20;
1574
1743
  else if (sumString.length == 7)
1575
1744
  fs = 23;
1576
- else if (sumString.length <= 7)
1577
- fs = 28;
1578
- return `[font-size:${settings.Total.TitleSize || 18}px]Totale[/]:\n[bold font-size:${settings.Total.NumberSize || fs}px]${sumString}${settings.Total.UnitOfMeasure ? (' ' + settings.Total.UnitOfMeasure) : ''}[/]`;
1745
+ label.set("html", `<div style="text-align:center">
1746
+ <div style="font-size:${settings.Total?.TitleSize || 18}px">Totale</div>
1747
+ <div style="font-weight:bold;font-size:${settings.Total?.NumberSize || fs}px">
1748
+ <span>${sumString}${settings.Total?.UnitOfMeasure ? " " + settings.Total.UnitOfMeasure : ""}</span>
1749
+ </div>
1750
+ </div>`);
1751
+ };
1752
+ updateTotal();
1753
+ series.dataItems.forEach(di => {
1754
+ di.on("visible", updateTotal);
1755
+ di.on("valueWorking", updateTotal);
1579
1756
  });
1580
1757
  }
1758
+ series.data.setAll(dataConverted.values);
1581
1759
  if (settings.Legend) {
1582
- let legend = new am4charts.Legend();
1583
- this.ChartInstance.legend = legend;
1584
- legend.position = settings?.LegendPosition || "bottom";
1585
- legend.itemContainers.template.togglable = settings.HideSeriesOnLabelClick === true;
1586
- legend.itemContainers.template.tooltipText = "{category}";
1587
- //Se la legenda non fa il toggle della serie la considero come se fosse un click sulla serie in se
1588
- if (!settings.HideSeriesOnLabelClick) {
1589
- legend.itemContainers.template.events.on("hit", (ev) => {
1590
- if (settings.OnSeriesClickCallback) {
1591
- let clickedSeries = ev.target.dataItem.dataContext.legendDataItem.name;
1592
- settings.OnSeriesClickCallback(clickedSeries);
1593
- }
1594
- });
1595
- }
1596
- if (settings.LegendPadding) {
1597
- let template = this.ChartInstance.legend.itemContainers.template;
1598
- template.paddingTop = settings.LegendPadding.top ?? 0;
1599
- template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1600
- template.paddingLeft = settings.LegendPadding.left ?? 0;
1601
- template.paddingRight = settings.LegendPadding.right ?? 0;
1602
- }
1760
+ series.setAll({
1761
+ legendLabelText: "{category}:",
1762
+ legendValueText: "{value}"
1763
+ });
1764
+ this.ChartLegend.data.setAll(series.dataItems);
1603
1765
  }
1604
1766
  return this;
1605
1767
  }
1606
1768
  /** @ignore */
1607
- setSelection(from, to) {
1608
- }
1769
+ setSelection(from, to) { }
1609
1770
  /** @ignore */
1610
- refreshData(data) {
1611
- //TODO:IMPL
1612
- }
1613
- /** @ignore */
1614
- hideZeroes(ev) {
1615
- if (ev.target.dataItem && (ev.target.dataItem.values.value.percent == 0))
1616
- ev.target.hide();
1617
- else
1618
- ev.target.show();
1619
- }
1771
+ refreshData(data) { }
1620
1772
  }
1621
1773
 
1622
1774
  /**
1623
- * Classe il cui unico scopo è gestire il setup e rendering di un VerticalChart
1775
+ * Classe il cui unico scopo e gestire il setup e rendering di un VerticalChart
1624
1776
  */
1625
1777
  class VerticalChartService {
1626
1778
  /** @ignore */
1627
- constructor(Adapter) {
1628
- this.Adapter = Adapter;
1779
+ constructor() {
1629
1780
  /** @ignore */
1630
1781
  this.dangerZone = 50;
1631
1782
  /** @ignore */
@@ -1645,80 +1796,162 @@ class VerticalChartService {
1645
1796
  console.error("Timeline not supported for vertical chart");
1646
1797
  return null;
1647
1798
  }
1648
- //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1649
- am4core.options.autoDispose = true;
1650
- this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1651
- let ChartInstanceCasted = this.ChartInstance;
1652
- let dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
1653
- ChartInstanceCasted.data = dataConverted.values;
1799
+ let dataConverted = data;
1654
1800
  let noStrokes = dataConverted.values.some(t => !!t.c);
1801
+ //#region Carico il Grafico
1802
+ this.ChartRoot?.dispose();
1803
+ this.ChartRoot = am5.Root.new(settings.Name);
1804
+ this.ChartInstance = this.ChartRoot.container.children.push(am5xy.XYChart.new(this.ChartRoot, {}));
1805
+ //#endregion
1806
+ let chartData = dataConverted.values.map(value => ({
1807
+ ...value,
1808
+ c: typeof value.c == "string" ? am5.color(value.c) : value.c
1809
+ }));
1810
+ //#region Carico la Legenda
1655
1811
  if (settings.Legend) {
1656
- ChartInstanceCasted.legend = new am4charts.Legend();
1657
- ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
1658
- ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
1812
+ // Default "right"
1813
+ switch (settings.LegendPosition ?? "right") {
1814
+ case "left":
1815
+ this.ChartInstance.set("layout", this.ChartRoot.horizontalLayout);
1816
+ this.ChartLegend = this.ChartInstance.children.unshift(am5.Legend.new(this.ChartRoot, {}));
1817
+ break;
1818
+ case "right":
1819
+ this.ChartInstance.set("layout", this.ChartRoot.horizontalLayout);
1820
+ this.ChartLegend = this.ChartInstance.children.push(am5.Legend.new(this.ChartRoot, {}));
1821
+ break;
1822
+ case "top":
1823
+ this.ChartInstance.set("layout", this.ChartRoot.verticalLayout);
1824
+ this.ChartLegend = this.ChartInstance.children.unshift(am5.Legend.new(this.ChartRoot, {}));
1825
+ break;
1826
+ case "bottom":
1827
+ this.ChartInstance.set("layout", this.ChartRoot.verticalLayout);
1828
+ this.ChartLegend = this.ChartInstance.children.push(am5.Legend.new(this.ChartRoot, {}));
1829
+ break;
1830
+ }
1659
1831
  if (settings.LegendPadding) {
1660
- let template = this.ChartInstance.legend.itemContainers.template;
1661
- template.paddingTop = settings.LegendPadding.top ?? 0;
1662
- template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1663
- template.paddingLeft = settings.LegendPadding.left ?? 0;
1664
- template.paddingRight = settings.LegendPadding.right ?? 0;
1832
+ this.ChartLegend.itemContainers.template.setAll({
1833
+ paddingTop: settings.LegendPadding.top ?? 0,
1834
+ paddingBottom: settings.LegendPadding.bottom ?? 0,
1835
+ paddingLeft: settings.LegendPadding.left ?? 0,
1836
+ paddingRight: settings.LegendPadding.right ?? 0
1837
+ });
1665
1838
  }
1666
1839
  }
1667
- let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
1840
+ //#endregion
1841
+ // Carico l'Asse Y
1842
+ let yRenderer = am5xy.AxisRendererY.new(this.ChartRoot, {});
1843
+ let yAxis = this.ChartInstance.yAxes.push(am5xy.ValueAxis.new(this.ChartRoot, {
1844
+ renderer: yRenderer,
1845
+ min: 0
1846
+ }));
1847
+ yAxis.set("tooltip", am5.Tooltip.new(this.ChartRoot, {}));
1848
+ yAxis.get("tooltip")?.set("forceHidden", true);
1668
1849
  if (settings.YAxisTitle) {
1669
- yAxis.title.text = settings.YAxisTitle;
1670
- yAxis.title.fontWeight = "bold";
1850
+ yAxis.children.unshift(am5.Label.new(this.ChartRoot, {
1851
+ text: settings.YAxisTitle,
1852
+ rotation: -90,
1853
+ fontWeight: "600",
1854
+ y: am5.p50,
1855
+ centerX: am5.p50
1856
+ }));
1671
1857
  }
1672
- let categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts.CategoryAxis());
1858
+ // Carico l'Asse X
1859
+ let xRenderer = am5xy.AxisRendererX.new(this.ChartRoot, {
1860
+ minGridDistance: settings?.MinGridDistance ?? 30
1861
+ });
1862
+ xRenderer.grid.template.set("location", 0);
1863
+ let categoryAxis = this.ChartInstance.xAxes.push(am5xy.CategoryAxis.new(this.ChartRoot, {
1864
+ categoryField: "k",
1865
+ renderer: xRenderer
1866
+ }));
1867
+ // Creazione del Tooltip per la categoria
1868
+ categoryAxis.labelsContainer.set("tooltip", am5.Tooltip.new(this.ChartRoot, {
1869
+ pointerOrientation: "down"
1870
+ }));
1871
+ xRenderer.labels.template.setup = (target) => {
1872
+ target.set("background", am5.Rectangle.new(this.ChartRoot, {
1873
+ fill: am5.color(0x000000),
1874
+ fillOpacity: 0
1875
+ }));
1876
+ };
1673
1877
  if (settings.XAxisTitle) {
1674
- categoryAxis.title.text = settings.XAxisTitle;
1675
- categoryAxis.title.fontWeight = "bold";
1878
+ categoryAxis.children.push(am5.Label.new(this.ChartRoot, {
1879
+ text: settings.XAxisTitle,
1880
+ fontWeight: "600",
1881
+ x: am5.p50,
1882
+ centerX: am5.p50
1883
+ }));
1676
1884
  }
1677
- categoryAxis.dataFields.category = "k";
1678
- categoryAxis.renderer.grid.template.location = 0;
1679
- categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
1680
- let label = categoryAxis.renderer.labels.template;
1681
- label.truncate = true;
1682
- label.maxWidth = settings.LabelWidth ?? this.LabelWidth;
1683
- label.tooltipText = "{category}";
1885
+ categoryAxis.data.setAll(chartData);
1886
+ xRenderer.labels.template.setAll({
1887
+ maxWidth: settings.LabelWidth ?? this.LabelWidth,
1888
+ oversizedBehavior: "truncate",
1889
+ tooltipText: "{category}"
1890
+ });
1684
1891
  if (settings?.AdaptLabelSizeAndOrientation == null ? true : settings?.AdaptLabelSizeAndOrientation) {
1685
- categoryAxis.events.on("sizechanged", (ev) => {
1686
- let axis = ev.target;
1687
- var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
1688
- if (cellWidth < axis.renderer.labels.template.maxWidth) {
1892
+ let updateLabelOrientation = () => {
1893
+ let labelMaxWidth = settings.LabelWidth ?? this.LabelWidth;
1894
+ let valuesCount = Math.max(chartData.length, 1);
1895
+ let cellWidth = this.ChartInstance.plotContainer.width() / valuesCount;
1896
+ if (cellWidth < labelMaxWidth) {
1689
1897
  let areWeInDangerZone = cellWidth < (settings?.LabelVerticalOrientationCutoffWidth ?? this.dangerZone);
1690
- axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
1691
- axis.renderer.labels.template.dx = settings.LabelRightWhenCompressed ?? areWeInDangerZone ? 0 : this.LabelRightWhenCompressed;
1692
- axis.renderer.labels.template.dy = settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed;
1693
- axis.renderer.labels.template.horizontalCenter = "right";
1694
- axis.renderer.labels.template.verticalCenter = "middle";
1898
+ xRenderer.labels.template.setAll({
1899
+ rotation: areWeInDangerZone ? -90 : -45,
1900
+ dx: areWeInDangerZone ? 0 : (settings.LabelRightWhenCompressed ?? this.LabelRightWhenCompressed),
1901
+ dy: settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed,
1902
+ centerX: am5.p100,
1903
+ centerY: am5.p50
1904
+ });
1695
1905
  }
1696
1906
  else {
1697
- axis.renderer.labels.template.rotation = 0;
1698
- axis.renderer.labels.template.dx = 0;
1699
- axis.renderer.labels.template.dy = 0;
1700
- axis.renderer.labels.template.horizontalCenter = "middle";
1701
- axis.renderer.labels.template.verticalCenter = "top";
1907
+ xRenderer.labels.template.setAll({
1908
+ rotation: 0,
1909
+ dx: 0,
1910
+ dy: 0,
1911
+ centerX: am5.p50,
1912
+ centerY: am5.p0
1913
+ });
1702
1914
  }
1703
- });
1915
+ };
1916
+ this.ChartInstance.events.on("boundschanged", updateLabelOrientation);
1917
+ categoryAxis.events.on("datavalidated", updateLabelOrientation);
1704
1918
  }
1705
1919
  // Create series
1706
- let series = ChartInstanceCasted.series.push(new am4charts.ColumnSeries());
1707
- series.dataFields.valueY = "v";
1708
- series.dataFields.categoryX = "k";
1709
- series.name = "";
1710
- let columnTemplate = series.columns.template;
1711
- columnTemplate.tooltipText = "{categoryX}: [bold]{valueY}[/] {t}";
1712
- columnTemplate.fillOpacity = .8;
1713
- columnTemplate.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
1920
+ let series = this.ChartInstance.series.push(am5xy.ColumnSeries.new(this.ChartRoot, {
1921
+ name: "",
1922
+ xAxis: categoryAxis,
1923
+ yAxis,
1924
+ valueYField: "v",
1925
+ categoryXField: "k"
1926
+ }));
1927
+ series.columns.template.setAll({
1928
+ fillOpacity: .8,
1929
+ tooltipText: "{categoryX}: [bold]{valueY}[/] {t}",
1930
+ tooltipY: 0,
1931
+ width: am5.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage)
1932
+ });
1933
+ series.columns.template.set("tooltip", am5.Tooltip.new(this.ChartRoot, {
1934
+ pointerOrientation: "vertical"
1935
+ }));
1714
1936
  if (noStrokes) {
1715
- columnTemplate.strokeOpacity = 0;
1716
- columnTemplate.strokeWidth = 0;
1717
- columnTemplate.adapter.add("fill", (_, target) => am4core.color(target.dataItem.dataContext.c));
1937
+ series.columns.template.setAll({
1938
+ strokeOpacity: 0,
1939
+ strokeWidth: 0
1940
+ });
1941
+ series.columns.template.adapters.add("fill", (fill, target) => {
1942
+ let item = target.dataItem?.dataContext;
1943
+ return item?.c ? item.c : fill;
1944
+ });
1718
1945
  }
1719
1946
  else {
1720
- columnTemplate.strokeWidth = 2;
1721
- columnTemplate.strokeOpacity = 1;
1947
+ series.columns.template.setAll({
1948
+ strokeWidth: 2,
1949
+ strokeOpacity: 1
1950
+ });
1951
+ }
1952
+ series.data.setAll(chartData);
1953
+ if (settings.Legend) {
1954
+ this.ChartLegend.data.setAll(this.ChartInstance.series.values);
1722
1955
  }
1723
1956
  return this;
1724
1957
  }
@@ -1732,12 +1965,11 @@ class VerticalChartService {
1732
1965
  }
1733
1966
 
1734
1967
  /**
1735
- * Classe il cui unico scopo è gestire il setup e rendering di un Vertical2DChart
1968
+ * Classe il cui unico scopo e gestire il setup e rendering di un Vertical2DChart
1736
1969
  */
1737
1970
  class Vertical2DChartService {
1738
1971
  /** @ignore */
1739
- constructor(Adapter) {
1740
- this.Adapter = Adapter;
1972
+ constructor() {
1741
1973
  /** @ignore */
1742
1974
  this.DefaultGroupPaddingPercentage = 5;
1743
1975
  /** @ignore */
@@ -1759,81 +1991,146 @@ class Vertical2DChartService {
1759
1991
  console.error("Timeline not supported for vertical chart");
1760
1992
  return null;
1761
1993
  }
1762
- //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1763
- am4core.options.autoDispose = true;
1764
- this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1765
- let ChartInstanceCasted = this.ChartInstance;
1994
+ let dataPreConverted = data;
1995
+ let dataConverted = this.convertData(dataPreConverted);
1996
+ let seriesNames = dataConverted.length > 0 ? Object.keys(dataConverted[0]).filter(prop => prop !== "key") : [];
1997
+ //#region Carico il Grafico
1998
+ this.ChartRoot?.dispose();
1999
+ this.ChartRoot = am5.Root.new(settings.Name);
2000
+ this.ChartInstance = this.ChartRoot.container.children.push(am5xy.XYChart.new(this.ChartRoot, {}));
2001
+ //#endregion
2002
+ //#region Carico la Legenda
1766
2003
  if (settings.Legend) {
1767
- ChartInstanceCasted.legend = new am4charts.Legend();
1768
- ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
1769
- ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
2004
+ // Default "right"
2005
+ switch (settings.LegendPosition ?? "right") {
2006
+ case "left":
2007
+ this.ChartInstance.set("layout", this.ChartRoot.horizontalLayout);
2008
+ this.ChartLegend = this.ChartInstance.children.unshift(am5.Legend.new(this.ChartRoot, {
2009
+ layout: this.ChartRoot.verticalLayout,
2010
+ centerY: am5.percent(50),
2011
+ y: am5.percent(50)
2012
+ }));
2013
+ break;
2014
+ case "right":
2015
+ this.ChartInstance.set("layout", this.ChartRoot.horizontalLayout);
2016
+ this.ChartLegend = this.ChartInstance.children.push(am5.Legend.new(this.ChartRoot, {
2017
+ layout: this.ChartRoot.verticalLayout,
2018
+ centerY: am5.percent(50),
2019
+ y: am5.percent(50)
2020
+ }));
2021
+ break;
2022
+ case "top":
2023
+ this.ChartInstance.set("layout", this.ChartRoot.verticalLayout);
2024
+ this.ChartLegend = this.ChartInstance.children.unshift(am5.Legend.new(this.ChartRoot, {
2025
+ layout: this.ChartRoot.horizontalLayout
2026
+ }));
2027
+ break;
2028
+ case "bottom":
2029
+ this.ChartInstance.set("layout", this.ChartRoot.verticalLayout);
2030
+ this.ChartLegend = this.ChartInstance.children.push(am5.Legend.new(this.ChartRoot, {
2031
+ layout: this.ChartRoot.horizontalLayout
2032
+ }));
2033
+ break;
2034
+ }
1770
2035
  if (settings.LegendPadding) {
1771
- let template = this.ChartInstance.legend.itemContainers.template;
1772
- template.paddingTop = settings.LegendPadding.top ?? 0;
1773
- template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1774
- template.paddingLeft = settings.LegendPadding.left ?? 0;
1775
- template.paddingRight = settings.LegendPadding.right ?? 0;
2036
+ this.ChartLegend.itemContainers.template.setAll({
2037
+ paddingTop: settings.LegendPadding.top ?? 0,
2038
+ paddingBottom: settings.LegendPadding.bottom ?? 0,
2039
+ paddingLeft: settings.LegendPadding.left ?? 0,
2040
+ paddingRight: settings.LegendPadding.right ?? 0
2041
+ });
1776
2042
  }
1777
2043
  }
1778
- let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
2044
+ //#endregion
2045
+ // Carico l'Asse Y
2046
+ let yRenderer = am5xy.AxisRendererY.new(this.ChartRoot, {});
2047
+ let yAxis = this.ChartInstance.yAxes.push(am5xy.ValueAxis.new(this.ChartRoot, {
2048
+ renderer: yRenderer,
2049
+ min: 0
2050
+ }));
2051
+ yAxis.set("tooltip", am5.Tooltip.new(this.ChartRoot, {}));
2052
+ yAxis.get("tooltip")?.set("forceHidden", true);
1779
2053
  if (settings.YAxisTitle) {
1780
- yAxis.title.text = settings.YAxisTitle;
1781
- yAxis.title.fontWeight = "bold";
2054
+ yAxis.children.unshift(am5.Label.new(this.ChartRoot, {
2055
+ text: settings.YAxisTitle,
2056
+ rotation: -90,
2057
+ fontWeight: "600",
2058
+ y: am5.p50,
2059
+ centerX: am5.p50
2060
+ }));
1782
2061
  }
1783
- let categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts.CategoryAxis());
2062
+ // Carico l'Asse X
2063
+ let groupPadding = settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage;
2064
+ let xRenderer = am5xy.AxisRendererX.new(this.ChartRoot, {
2065
+ cellStartLocation: groupPadding / 100,
2066
+ cellEndLocation: (100 - groupPadding) / 100,
2067
+ minGridDistance: settings?.MinGridDistance ?? 30
2068
+ });
2069
+ xRenderer.grid.template.set("location", 0);
2070
+ let categoryAxis = this.ChartInstance.xAxes.push(am5xy.CategoryAxis.new(this.ChartRoot, {
2071
+ categoryField: "key",
2072
+ renderer: xRenderer
2073
+ }));
2074
+ // Creazione del Tooltip per la categoria
2075
+ categoryAxis.labelsContainer.set("tooltip", am5.Tooltip.new(this.ChartRoot, {
2076
+ pointerOrientation: "down"
2077
+ }));
2078
+ xRenderer.labels.template.setup = (target) => {
2079
+ target.set("background", am5.Rectangle.new(this.ChartRoot, {
2080
+ fill: am5.color(0x000000),
2081
+ fillOpacity: 0
2082
+ }));
2083
+ };
1784
2084
  if (settings.XAxisTitle) {
1785
- categoryAxis.title.text = settings.XAxisTitle;
1786
- categoryAxis.title.fontWeight = "bold";
2085
+ categoryAxis.children.push(am5.Label.new(this.ChartRoot, {
2086
+ text: settings.XAxisTitle,
2087
+ fontWeight: "600",
2088
+ x: am5.p50,
2089
+ centerX: am5.p50
2090
+ }));
1787
2091
  }
1788
- yAxis.min = 0;
1789
- categoryAxis.dataFields.category = 'key';
1790
- categoryAxis.renderer.cellStartLocation = am4core.percent(settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage).value;
1791
- categoryAxis.renderer.cellEndLocation = am4core.percent(100 - (settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage)).value;
1792
- categoryAxis.renderer.grid.template.location = 0;
1793
- categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
1794
- let label = categoryAxis.renderer.labels.template;
1795
- label.truncate = true;
1796
- label.maxWidth = settings.LabelWidth ?? this.LabelWidth;
1797
- label.tooltipText = "{category}";
2092
+ categoryAxis.data.setAll(dataConverted);
2093
+ xRenderer.labels.template.setAll({
2094
+ maxWidth: settings.LabelWidth ?? this.LabelWidth,
2095
+ oversizedBehavior: "truncate",
2096
+ tooltipText: "{category}",
2097
+ });
1798
2098
  if (settings?.AdaptLabelSizeAndOrientation == null ? true : settings?.AdaptLabelSizeAndOrientation) {
1799
- categoryAxis.events.on("sizechanged", (ev) => {
1800
- let axis = ev.target;
1801
- var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
1802
- if (cellWidth < axis.renderer.labels.template.maxWidth) {
2099
+ let updateLabelOrientation = () => {
2100
+ let labelMaxWidth = settings.LabelWidth ?? this.LabelWidth;
2101
+ let valuesCount = Math.max(dataConverted.length, 1);
2102
+ let cellWidth = this.ChartInstance.plotContainer.width() / valuesCount;
2103
+ if (cellWidth < labelMaxWidth) {
1803
2104
  let areWeInDangerZone = cellWidth < (settings?.LabelVerticalOrientationCutoffWidth ?? this.dangerZone);
1804
- axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
1805
- axis.renderer.labels.template.dx = settings.LabelRightWhenCompressed ?? areWeInDangerZone ? 0 : this.LabelRightWhenCompressed;
1806
- axis.renderer.labels.template.dy = settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed;
1807
- axis.renderer.labels.template.horizontalCenter = "right";
1808
- axis.renderer.labels.template.verticalCenter = "middle";
2105
+ xRenderer.labels.template.setAll({
2106
+ rotation: areWeInDangerZone ? -90 : -45,
2107
+ dx: areWeInDangerZone ? 0 : (settings.LabelRightWhenCompressed ?? this.LabelRightWhenCompressed),
2108
+ dy: settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed,
2109
+ centerX: am5.p100,
2110
+ centerY: am5.p50
2111
+ });
1809
2112
  }
1810
2113
  else {
1811
- axis.renderer.labels.template.rotation = 0;
1812
- axis.renderer.labels.template.dx = 0;
1813
- axis.renderer.labels.template.dy = 0;
1814
- axis.renderer.labels.template.horizontalCenter = "middle";
1815
- axis.renderer.labels.template.verticalCenter = "top";
2114
+ xRenderer.labels.template.setAll({
2115
+ rotation: 0,
2116
+ dx: 0,
2117
+ dy: 0,
2118
+ centerX: am5.p50,
2119
+ centerY: am5.p0
2120
+ });
1816
2121
  }
1817
- });
2122
+ };
2123
+ this.ChartInstance.events.on("boundschanged", updateLabelOrientation);
2124
+ categoryAxis.events.on("datavalidated", updateLabelOrientation);
1818
2125
  }
1819
- let dataPreConverted = this.Adapter ? this.Adapter.adaptDataForVertical2DChart(data) : data;
1820
- let dataConverted = [];
1821
- for (let i = 0; i < dataPreConverted.groups.length; i++) {
1822
- let item = dataPreConverted.groups[i];
1823
- let obj = { key: item.name };
1824
- for (let p = 0; p < item.values.length; p++) {
1825
- let value = item.values[p];
1826
- obj[value.k] = value.v;
1827
- }
1828
- dataConverted.push(obj);
2126
+ seriesNames.forEach((name, index) => {
2127
+ let colorInfo = dataPreConverted.colorinfos?.[index];
2128
+ let color = colorInfo?.color ? am5.color(colorInfo.color) : null;
2129
+ this.createSeries(this.ChartInstance, categoryAxis, yAxis, settings, name, dataConverted, color);
2130
+ });
2131
+ if (settings.Legend) {
2132
+ this.ChartLegend.data.setAll(this.ChartInstance.series.values);
1829
2133
  }
1830
- ChartInstanceCasted.data = dataConverted;
1831
- if (dataPreConverted.colorinfos)
1832
- ChartInstanceCasted.colors.list = dataPreConverted.colorinfos.map(c => am4core.color(c.color));
1833
- //Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
1834
- for (let prop in dataConverted[0])
1835
- if (prop !== "key")
1836
- this.createSeries(ChartInstanceCasted, settings, prop, prop);
1837
2134
  return this;
1838
2135
  }
1839
2136
  /** @ignore */
@@ -1844,61 +2141,58 @@ class Vertical2DChartService {
1844
2141
  //TODO:IMPL
1845
2142
  }
1846
2143
  /** @ignore */
1847
- createSeries(chart, settings, value, name) {
1848
- let series = chart.series.push(new am4charts.ColumnSeries());
1849
- series.dataFields.valueY = value;
1850
- series.dataFields.categoryX = 'key';
1851
- series.name = name;
1852
- series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
1853
- series.columns.template.fillOpacity = .8;
1854
- series.columns.template.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
1855
- series.events.on("hidden", () => this.arrangeColumns);
1856
- series.events.on("shown", () => this.arrangeColumns);
1857
- return series;
2144
+ convertData(dataPreConverted) {
2145
+ let dataConverted = [];
2146
+ for (let i = 0; i < dataPreConverted.groups.length; i++) {
2147
+ let item = dataPreConverted.groups[i];
2148
+ let obj = { key: item.name };
2149
+ for (let p = 0; p < item.values.length; p++) {
2150
+ let value = item.values[p];
2151
+ obj[value.k] = value.v;
2152
+ }
2153
+ dataConverted.push(obj);
2154
+ }
2155
+ return dataConverted;
1858
2156
  }
1859
2157
  /** @ignore */
1860
- arrangeColumns() {
1861
- let ChartInstanceCasted = this.ChartInstance;
1862
- let series = ChartInstanceCasted.series.getIndex(0);
1863
- let xAxis = ChartInstanceCasted.xAxes.getIndex(0);
1864
- let w = 1 - xAxis.renderer.cellStartLocation - (1 - xAxis.renderer.cellEndLocation);
1865
- if (series.dataItems.length > 1) {
1866
- let x0 = xAxis.getX(series.dataItems.getIndex(0), "categoryX");
1867
- let x1 = xAxis.getX(series.dataItems.getIndex(1), "categoryX");
1868
- let delta = ((x1 - x0) / ChartInstanceCasted.series.length) * w;
1869
- if (am4core.isNumber(delta)) {
1870
- let middle = ChartInstanceCasted.series.length / 2;
1871
- let newIndex = 0;
1872
- ChartInstanceCasted.series.each((series) => {
1873
- if (!series.isHidden && !series.isHiding) {
1874
- series.dummyData = newIndex;
1875
- newIndex++;
1876
- }
1877
- else {
1878
- series.dummyData = ChartInstanceCasted.series.indexOf(series);
1879
- }
1880
- });
1881
- let visibleCount = newIndex;
1882
- let newMiddle = visibleCount / 2;
1883
- ChartInstanceCasted.series.each((series) => {
1884
- let trueIndex = ChartInstanceCasted.series.indexOf(series);
1885
- let newIndex = series.dummyData;
1886
- let dx = (newIndex - trueIndex + middle - newMiddle) * delta;
1887
- series.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
1888
- series.bulletsContainer.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
1889
- });
1890
- }
2158
+ createSeries(chart, categoryAxis, yAxis, settings, value, data, color) {
2159
+ let series = chart.series.push(am5xy.ColumnSeries.new(this.ChartRoot, {
2160
+ name: value,
2161
+ xAxis: categoryAxis,
2162
+ yAxis,
2163
+ valueYField: value,
2164
+ categoryXField: "key"
2165
+ }));
2166
+ series.columns.template.setAll({
2167
+ fillOpacity: .8,
2168
+ tooltipText: "{name} {categoryX}: [bold]{valueY}[/]",
2169
+ tooltipY: 0,
2170
+ width: am5.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage)
2171
+ });
2172
+ series.columns.template.set("tooltip", am5.Tooltip.new(this.ChartRoot, {
2173
+ pointerOrientation: "vertical"
2174
+ }));
2175
+ if (color) {
2176
+ series.setAll({
2177
+ fill: color,
2178
+ stroke: color
2179
+ });
2180
+ series.columns.template.setAll({
2181
+ fill: color,
2182
+ stroke: color
2183
+ });
1891
2184
  }
2185
+ series.data.setAll(data);
2186
+ return series;
1892
2187
  }
1893
2188
  }
1894
2189
 
1895
2190
  /**
1896
- * Classe il cui unico scopo è gestire il setup e rendering di un VerticalStackedChart
2191
+ * Classe il cui unico scopo e gestire il setup e rendering di un VerticalStackedChart
1897
2192
  */
1898
2193
  class VerticalStackedChartService {
1899
2194
  /** @ignore */
1900
- constructor(Adapter) {
1901
- this.Adapter = Adapter;
2195
+ constructor() {
1902
2196
  /** @ignore */
1903
2197
  this.dangerZone = 50;
1904
2198
  /** @ignore */
@@ -1918,78 +2212,140 @@ class VerticalStackedChartService {
1918
2212
  console.error("Timeline not supported for vertical chart");
1919
2213
  return null;
1920
2214
  }
1921
- //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1922
- am4core.options.autoDispose = true;
1923
- this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
1924
- let ChartInstanceCasted = this.ChartInstance;
1925
- // Create axes
1926
- let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
2215
+ let dataPreConverted = data;
2216
+ let dataConverted = this.convertData(dataPreConverted);
2217
+ let seriesNames = dataConverted.length > 0 ? Object.keys(dataConverted[0]).filter(prop => prop !== "key") : [];
2218
+ //#region Carico il Grafico
2219
+ this.ChartRoot?.dispose();
2220
+ this.ChartRoot = am5.Root.new(settings.Name);
2221
+ this.ChartInstance = this.ChartRoot.container.children.push(am5xy.XYChart.new(this.ChartRoot, {}));
2222
+ //#endregion
2223
+ //#region Carico la Legenda
2224
+ if (settings.Legend) {
2225
+ // Default "right"
2226
+ switch (settings.LegendPosition ?? "right") {
2227
+ case "left":
2228
+ this.ChartInstance.set("layout", this.ChartRoot.horizontalLayout);
2229
+ this.ChartLegend = this.ChartInstance.children.unshift(am5.Legend.new(this.ChartRoot, {
2230
+ layout: this.ChartRoot.verticalLayout,
2231
+ centerY: am5.percent(50),
2232
+ y: am5.percent(50)
2233
+ }));
2234
+ break;
2235
+ case "right":
2236
+ this.ChartInstance.set("layout", this.ChartRoot.horizontalLayout);
2237
+ this.ChartLegend = this.ChartInstance.children.push(am5.Legend.new(this.ChartRoot, {
2238
+ layout: this.ChartRoot.verticalLayout,
2239
+ centerY: am5.percent(50),
2240
+ y: am5.percent(50)
2241
+ }));
2242
+ break;
2243
+ case "top":
2244
+ this.ChartInstance.set("layout", this.ChartRoot.verticalLayout);
2245
+ this.ChartLegend = this.ChartInstance.children.unshift(am5.Legend.new(this.ChartRoot, {
2246
+ layout: this.ChartRoot.horizontalLayout
2247
+ }));
2248
+ break;
2249
+ case "bottom":
2250
+ this.ChartInstance.set("layout", this.ChartRoot.verticalLayout);
2251
+ this.ChartLegend = this.ChartInstance.children.push(am5.Legend.new(this.ChartRoot, {
2252
+ layout: this.ChartRoot.horizontalLayout
2253
+ }));
2254
+ break;
2255
+ }
2256
+ if (settings.LegendPadding) {
2257
+ this.ChartLegend.itemContainers.template.setAll({
2258
+ paddingTop: settings.LegendPadding.top ?? 0,
2259
+ paddingBottom: settings.LegendPadding.bottom ?? 0,
2260
+ paddingLeft: settings.LegendPadding.left ?? 0,
2261
+ paddingRight: settings.LegendPadding.right ?? 0
2262
+ });
2263
+ }
2264
+ }
2265
+ //#endregion
2266
+ // Carico l'Asse Y
2267
+ let yRenderer = am5xy.AxisRendererY.new(this.ChartRoot, {});
2268
+ let yAxis = this.ChartInstance.yAxes.push(am5xy.ValueAxis.new(this.ChartRoot, {
2269
+ renderer: yRenderer,
2270
+ min: 0
2271
+ }));
2272
+ yAxis.set("tooltip", am5.Tooltip.new(this.ChartRoot, {}));
2273
+ yAxis.get("tooltip")?.set("forceHidden", true);
1927
2274
  if (settings.YAxisTitle) {
1928
- yAxis.title.text = settings.YAxisTitle;
1929
- yAxis.title.fontWeight = "bold";
2275
+ yAxis.children.unshift(am5.Label.new(this.ChartRoot, {
2276
+ text: settings.YAxisTitle,
2277
+ rotation: -90,
2278
+ fontWeight: "600",
2279
+ y: am5.p50,
2280
+ centerX: am5.p50
2281
+ }));
1930
2282
  }
1931
- let categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts.CategoryAxis());
2283
+ // Carico l'Asse X
2284
+ let xRenderer = am5xy.AxisRendererX.new(this.ChartRoot, {
2285
+ minGridDistance: settings?.MinGridDistance ?? 30
2286
+ });
2287
+ xRenderer.grid.template.set("location", 0);
2288
+ let categoryAxis = this.ChartInstance.xAxes.push(am5xy.CategoryAxis.new(this.ChartRoot, {
2289
+ categoryField: "key",
2290
+ renderer: xRenderer
2291
+ }));
2292
+ // Creazione del Tooltip per la categoria
2293
+ categoryAxis.labelsContainer.set("tooltip", am5.Tooltip.new(this.ChartRoot, {
2294
+ pointerOrientation: "down"
2295
+ }));
2296
+ xRenderer.labels.template.setup = (target) => {
2297
+ target.set("background", am5.Rectangle.new(this.ChartRoot, {
2298
+ fill: am5.color(0x000000),
2299
+ fillOpacity: 0
2300
+ }));
2301
+ };
1932
2302
  if (settings.XAxisTitle) {
1933
- categoryAxis.title.text = settings.XAxisTitle;
1934
- categoryAxis.title.fontWeight = "bold";
2303
+ categoryAxis.children.push(am5.Label.new(this.ChartRoot, {
2304
+ text: settings.XAxisTitle,
2305
+ fontWeight: "600",
2306
+ x: am5.p50,
2307
+ centerX: am5.p50
2308
+ }));
1935
2309
  }
1936
- yAxis.min = 0;
1937
- categoryAxis.dataFields.category = "key";
1938
- categoryAxis.renderer.grid.template.location = 0;
1939
- categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
1940
- let label = categoryAxis.renderer.labels.template;
1941
- label.truncate = true;
1942
- label.maxWidth = settings.LabelWidth ?? this.LabelWidth;
1943
- label.tooltipText = "{category}";
2310
+ categoryAxis.data.setAll(dataConverted);
2311
+ xRenderer.labels.template.setAll({
2312
+ maxWidth: settings.LabelWidth ?? this.LabelWidth,
2313
+ oversizedBehavior: "truncate",
2314
+ tooltipText: "{category}"
2315
+ });
1944
2316
  if (settings?.AdaptLabelSizeAndOrientation == null ? true : settings?.AdaptLabelSizeAndOrientation) {
1945
- categoryAxis.events.on("sizechanged", (ev) => {
1946
- let axis = ev.target;
1947
- var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
1948
- if (cellWidth < axis.renderer.labels.template.maxWidth) {
2317
+ let updateLabelOrientation = () => {
2318
+ let labelMaxWidth = settings.LabelWidth ?? this.LabelWidth;
2319
+ let valuesCount = Math.max(dataConverted.length, 1);
2320
+ let cellWidth = this.ChartInstance.plotContainer.width() / valuesCount;
2321
+ if (cellWidth < labelMaxWidth) {
1949
2322
  let areWeInDangerZone = cellWidth < (settings?.LabelVerticalOrientationCutoffWidth ?? this.dangerZone);
1950
- axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
1951
- axis.renderer.labels.template.dx = settings.LabelRightWhenCompressed ?? areWeInDangerZone ? 0 : this.LabelRightWhenCompressed;
1952
- axis.renderer.labels.template.dy = settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed;
1953
- axis.renderer.labels.template.horizontalCenter = "right";
1954
- axis.renderer.labels.template.verticalCenter = "middle";
2323
+ xRenderer.labels.template.setAll({
2324
+ rotation: areWeInDangerZone ? -90 : -45,
2325
+ dx: areWeInDangerZone ? 0 : (settings.LabelRightWhenCompressed ?? this.LabelRightWhenCompressed),
2326
+ dy: settings.LabelTopWhenCompressed ?? this.LabelTopWhenCompressed,
2327
+ centerX: am5.p100,
2328
+ centerY: am5.p50
2329
+ });
1955
2330
  }
1956
2331
  else {
1957
- axis.renderer.labels.template.rotation = 0;
1958
- axis.renderer.labels.template.dx = 0;
1959
- axis.renderer.labels.template.dy = 0;
1960
- axis.renderer.labels.template.horizontalCenter = "middle";
1961
- axis.renderer.labels.template.verticalCenter = "top";
2332
+ xRenderer.labels.template.setAll({
2333
+ rotation: 0,
2334
+ dx: 0,
2335
+ dy: 0,
2336
+ centerX: am5.p50,
2337
+ centerY: am5.p0
2338
+ });
1962
2339
  }
1963
- });
1964
- }
1965
- let dataPreConverted = this.Adapter ? this.Adapter.adaptDataForVerticalStackedChart(data) : data;
1966
- let dataConverted = [];
1967
- for (let i = 0; i < dataPreConverted.groups.length; i++) {
1968
- let item = dataPreConverted.groups[i];
1969
- let obj = { key: item.name };
1970
- for (let p = 0; p < item.values.length; p++) {
1971
- let value = item.values[p];
1972
- obj[value.k] = value.v;
1973
- }
1974
- dataConverted.push(obj);
1975
- }
1976
- ChartInstanceCasted.data = dataConverted;
1977
- //Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
1978
- for (let prop in dataConverted[0]) {
1979
- if (prop !== "key")
1980
- this.createSeriesStacked(ChartInstanceCasted, settings, prop, prop);
2340
+ };
2341
+ this.ChartInstance.events.on("boundschanged", updateLabelOrientation);
2342
+ categoryAxis.events.on("datavalidated", updateLabelOrientation);
1981
2343
  }
2344
+ seriesNames.forEach(name => {
2345
+ this.createSeriesStacked(this.ChartInstance, categoryAxis, yAxis, settings, name, dataConverted);
2346
+ });
1982
2347
  if (settings.Legend) {
1983
- ChartInstanceCasted.legend = new am4charts.Legend();
1984
- ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
1985
- ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
1986
- if (settings.LegendPadding) {
1987
- let template = this.ChartInstance.legend.itemContainers.template;
1988
- template.paddingTop = settings.LegendPadding.top ?? 0;
1989
- template.paddingBottom = settings.LegendPadding.bottom ?? 0;
1990
- template.paddingLeft = settings.LegendPadding.left ?? 0;
1991
- template.paddingRight = settings.LegendPadding.right ?? 0;
1992
- }
2348
+ this.ChartLegend.data.setAll(this.ChartInstance.series.values);
1993
2349
  }
1994
2350
  return this;
1995
2351
  }
@@ -2001,18 +2357,40 @@ class VerticalStackedChartService {
2001
2357
  //TODO:IMPL
2002
2358
  }
2003
2359
  /** @ignore */
2004
- createSeriesStacked(chart, settings, field, name) {
2005
- // Set up series
2006
- let series = chart.series.push(new am4charts.ColumnSeries());
2007
- series.name = name;
2008
- series.dataFields.valueY = field;
2009
- series.dataFields.categoryX = "key";
2010
- series.sequencedInterpolation = true;
2011
- series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
2012
- series.columns.template.fillOpacity = .8;
2013
- series.columns.template.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
2014
- // Make it stacked
2015
- series.stacked = true;
2360
+ convertData(dataPreConverted) {
2361
+ let dataConverted = [];
2362
+ for (let i = 0; i < dataPreConverted.groups.length; i++) {
2363
+ let item = dataPreConverted.groups[i];
2364
+ let obj = { key: item.name };
2365
+ for (let p = 0; p < item.values.length; p++) {
2366
+ let value = item.values[p];
2367
+ obj[value.k] = value.v;
2368
+ }
2369
+ dataConverted.push(obj);
2370
+ }
2371
+ return dataConverted;
2372
+ }
2373
+ /** @ignore */
2374
+ createSeriesStacked(chart, categoryAxis, yAxis, settings, field, data) {
2375
+ let series = chart.series.push(am5xy.ColumnSeries.new(this.ChartRoot, {
2376
+ name: field,
2377
+ xAxis: categoryAxis,
2378
+ yAxis,
2379
+ valueYField: field,
2380
+ categoryXField: "key",
2381
+ sequencedInterpolation: true,
2382
+ stacked: true
2383
+ }));
2384
+ series.columns.template.setAll({
2385
+ fillOpacity: .8,
2386
+ tooltipText: "{name} {categoryX}: [bold]{valueY}[/]",
2387
+ tooltipY: 0,
2388
+ width: am5.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage)
2389
+ });
2390
+ series.columns.template.set("tooltip", am5.Tooltip.new(this.ChartRoot, {
2391
+ pointerOrientation: "vertical"
2392
+ }));
2393
+ series.data.setAll(data);
2016
2394
  return series;
2017
2395
  }
2018
2396
  }
@@ -2022,8 +2400,7 @@ class VerticalStackedChartService {
2022
2400
  */
2023
2401
  class AreaChartService {
2024
2402
  /** @ignore */
2025
- constructor(Adapter) {
2026
- this.Adapter = Adapter;
2403
+ constructor() {
2027
2404
  //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
2028
2405
  //TODO: spostarla in un metodo di utilità (esfaenza/extensions)
2029
2406
  /** @ignore */
@@ -2037,57 +2414,116 @@ class AreaChartService {
2037
2414
  console.error("Timeline not supported for area chart");
2038
2415
  return null;
2039
2416
  }
2040
- let dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
2417
+ let dataConverted = data;
2041
2418
  let showTicks = settings.ShowTicks == null ? true : settings?.ShowTicks;
2042
2419
  let interval = dataConverted.interval;
2043
- //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
2044
- am4core.options.autoDispose = true;
2045
- this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
2046
- let ChartInstanceCasted = this.ChartInstance;
2420
+ //#region Carico il Grafico
2421
+ this.ChartRoot?.dispose();
2422
+ this.ChartRoot = am5.Root.new(settings.Name);
2423
+ this.ChartInstance = this.ChartRoot.container.children.push(am5xy.XYChart.new(this.ChartRoot, {}));
2424
+ //#endregion
2425
+ //#region Carico la Legenda
2047
2426
  if (settings.Legend) {
2048
- ChartInstanceCasted.legend = new am4charts.Legend();
2049
- ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
2050
- ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
2427
+ // Default "right"
2428
+ switch (settings.LegendPosition ?? "right") {
2429
+ case "left":
2430
+ this.ChartInstance.set("layout", this.ChartRoot.horizontalLayout);
2431
+ this.ChartLegend = this.ChartInstance.children.unshift(am5.Legend.new(this.ChartRoot, {
2432
+ layout: this.ChartRoot.verticalLayout,
2433
+ centerY: am5.percent(50),
2434
+ y: am5.percent(50)
2435
+ }));
2436
+ break;
2437
+ case "right":
2438
+ this.ChartInstance.set("layout", this.ChartRoot.horizontalLayout);
2439
+ this.ChartLegend = this.ChartInstance.children.push(am5.Legend.new(this.ChartRoot, {
2440
+ layout: this.ChartRoot.verticalLayout,
2441
+ centerY: am5.percent(50),
2442
+ y: am5.percent(50)
2443
+ }));
2444
+ break;
2445
+ case "top":
2446
+ this.ChartInstance.set("layout", this.ChartRoot.verticalLayout);
2447
+ this.ChartLegend = this.ChartInstance.children.unshift(am5.Legend.new(this.ChartRoot, {
2448
+ layout: this.ChartRoot.horizontalLayout
2449
+ }));
2450
+ break;
2451
+ case "bottom":
2452
+ this.ChartInstance.set("layout", this.ChartRoot.verticalLayout);
2453
+ this.ChartLegend = this.ChartInstance.children.push(am5.Legend.new(this.ChartRoot, {
2454
+ layout: this.ChartRoot.horizontalLayout
2455
+ }));
2456
+ break;
2457
+ }
2051
2458
  if (settings.LegendPadding) {
2052
- let template = this.ChartInstance.legend.itemContainers.template;
2053
- template.paddingTop = settings.LegendPadding.top ?? 0;
2054
- template.paddingBottom = settings.LegendPadding.bottom ?? 0;
2055
- template.paddingLeft = settings.LegendPadding.left ?? 0;
2056
- template.paddingRight = settings.LegendPadding.right ?? 0;
2459
+ this.ChartLegend.itemContainers.template.setAll({
2460
+ paddingTop: settings.LegendPadding.top ?? 0,
2461
+ paddingBottom: settings.LegendPadding.bottom ?? 0,
2462
+ paddingLeft: settings.LegendPadding.left ?? 0,
2463
+ paddingRight: settings.LegendPadding.right ?? 0
2464
+ });
2057
2465
  }
2058
2466
  }
2059
- let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
2060
- yAxis.tooltip.disabled = true;
2467
+ //#endregion
2468
+ // Carico l'Asse Y
2469
+ let yRenderer = am5xy.AxisRendererY.new(this.ChartRoot, {});
2470
+ let yAxis = this.ChartInstance.yAxes.push(am5xy.ValueAxis.new(this.ChartRoot, {
2471
+ renderer: yRenderer,
2472
+ min: 0
2473
+ }));
2474
+ yAxis.set("tooltip", am5.Tooltip.new(this.ChartRoot, {}));
2475
+ yAxis.get("tooltip")?.set("forceHidden", true);
2061
2476
  if (settings.YAxisTitle) {
2062
- yAxis.title.text = settings.YAxisTitle;
2063
- yAxis.title.fontWeight = "bold";
2477
+ yAxis.children.unshift(am5.Label.new(this.ChartRoot, {
2478
+ text: settings.YAxisTitle,
2479
+ rotation: -90,
2480
+ fontWeight: "600", // bold
2481
+ y: am5.p50,
2482
+ centerX: am5.p50
2483
+ }));
2064
2484
  }
2065
- yAxis.min = 0;
2066
- let dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
2067
- dateAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 50;
2068
- dateAxis.startLocation = 0.5;
2069
- dateAxis.endLocation = 0.5;
2485
+ // Carico l'Asse X
2486
+ let xRenderer = am5xy.AxisRendererX.new(this.ChartRoot, {
2487
+ minGridDistance: settings?.MinGridDistance ?? 50,
2488
+ cellStartLocation: 0.5,
2489
+ cellEndLocation: 0.5
2490
+ });
2491
+ let dateAxis = this.ChartInstance.xAxes.push(am5xy.DateAxis.new(this.ChartRoot, {
2492
+ renderer: xRenderer,
2493
+ baseInterval: {
2494
+ timeUnit: this.fixTimeUnit(interval?.timeunit ?? 4), // TODO: Capire come fargli prendere un interval automatico
2495
+ count: interval?.count ?? 1
2496
+ }
2497
+ }));
2070
2498
  if (settings.XAxisTitle) {
2071
- dateAxis.title.text = settings.XAxisTitle;
2072
- dateAxis.title.fontWeight = "bold";
2499
+ dateAxis.children.push(am5.Label.new(this.ChartRoot, {
2500
+ text: settings.XAxisTitle,
2501
+ fontWeight: "600", // bold
2502
+ x: am5.p50,
2503
+ centerX: am5.p50
2504
+ }));
2073
2505
  }
2506
+ // Ticks
2074
2507
  if (showTicks) {
2075
- dateAxis.renderer.ticks.template.disabled = false;
2076
- dateAxis.renderer.ticks.template.strokeOpacity = 1;
2077
- dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
2078
- dateAxis.renderer.ticks.template.strokeWidth = 2;
2079
- dateAxis.renderer.ticks.template.length = 10;
2080
- dateAxis.renderer.ticks.template.location = 0;
2508
+ xRenderer.ticks.template.setAll({
2509
+ visible: true,
2510
+ strokeOpacity: 1,
2511
+ stroke: am5.color(0x495C43),
2512
+ strokeWidth: 2,
2513
+ length: 10
2514
+ });
2515
+ xRenderer.grid.template.set("location", 0);
2516
+ }
2517
+ else {
2518
+ xRenderer.ticks.template.set("visible", false);
2081
2519
  }
2082
- if (!!interval)
2083
- dateAxis.baseInterval = { count: interval.count, timeUnit: this.fixTimeUnit(interval.timeunit) };
2084
2520
  // Unisco il dataset e tiro fuori i dati
2085
2521
  let chartData = [];
2086
2522
  let seriesToMakeCache = {};
2087
2523
  let seriesToMake = [];
2088
2524
  for (let i = 0; i < dataConverted.groups.length; i++) {
2089
2525
  let group = dataConverted.groups[i];
2090
- let dataItem = { date: group.name };
2526
+ let dataItem = { date: new Date(group.name).getTime() };
2091
2527
  for (let ii = 0; ii < group.values.length; ii++) {
2092
2528
  let val = group.values[ii];
2093
2529
  dataItem[val.k] = val.v;
@@ -2098,13 +2534,16 @@ class AreaChartService {
2098
2534
  }
2099
2535
  chartData.push(dataItem);
2100
2536
  }
2101
- ChartInstanceCasted.data = chartData;
2102
- //---------------------------------------------------------
2103
- seriesToMake.forEach(s => { this.createSeries(ChartInstanceCasted, s); });
2104
- ChartInstanceCasted.cursor = new am4charts.XYCursor();
2105
- ChartInstanceCasted.cursor.xAxis = dateAxis;
2106
- dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
2107
- dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
2537
+ seriesToMake.forEach(chartName => {
2538
+ this.createSeries(this.ChartInstance, dateAxis, yAxis, chartName, chartData);
2539
+ });
2540
+ if (settings.Legend) {
2541
+ this.ChartLegend.data.setAll(this.ChartInstance.series.values);
2542
+ }
2543
+ this.ChartInstance.set("cursor", am5xy.XYCursor.new(this.ChartRoot, { xAxis: dateAxis }));
2544
+ // let cursor = ^, cursor.lineY.set("visible", false), per cursore verticale
2545
+ dateAxis.on("start", () => { this.emitSelectionChanged(dateAxis, settings); });
2546
+ dateAxis.on("end", () => { this.emitSelectionChanged(dateAxis, settings); });
2108
2547
  return this;
2109
2548
  }
2110
2549
  fixTimeUnit(tu) {
@@ -2132,34 +2571,43 @@ class AreaChartService {
2132
2571
  }
2133
2572
  /** @ignore */
2134
2573
  refreshData(data) {
2135
- //TODO:IMPL
2136
2574
  }
2137
2575
  /** @ignore */
2138
- emitSelectionChanged(ev, settings) {
2139
- if (settings.OnSelectionChangedCallback) {
2140
- this.throttla("selchange", () => {
2141
- var axis = ev.target;
2142
- var start = new Date(axis.minZoomed);
2143
- var end = new Date(axis.maxZoomed);
2144
- var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
2145
- settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
2146
- }, 150);
2147
- }
2576
+ emitSelectionChanged(axis, settings) {
2577
+ if (!settings.OnSelectionChangedCallback)
2578
+ return;
2579
+ this.throttla("selchange", () => {
2580
+ let min = axis.getPrivate("selectionMin");
2581
+ let max = axis.getPrivate("selectionMax");
2582
+ if (min == null || max == null)
2583
+ return;
2584
+ settings.OnSelectionChangedCallback({
2585
+ from: new Date(min),
2586
+ to: new Date(max),
2587
+ initial: axis.get("start") == 0 && axis.get("end") == 1
2588
+ });
2589
+ }, 150);
2148
2590
  }
2149
2591
  /** @ignore */
2150
- createSeries(chart, name) {
2151
- let series = chart.series.push(new am4charts.LineSeries());
2152
- series.dataFields.dateX = "date";
2153
- series.name = name[0].toUpperCase() + name.slice(1);
2154
- series.dataFields.valueY = name;
2155
- series.tooltipText = "[#000]{valueY.value}[/]";
2156
- //series.tooltip.background.fill = am4core.color("#FFF");
2157
- series.tooltip.getStrokeFromObject = true;
2158
- series.tooltip.background.strokeWidth = 3;
2159
- series.tooltip.getFillFromObject = false;
2160
- series.fillOpacity = 0.6;
2161
- series.strokeWidth = 2;
2162
- series.stacked = true;
2592
+ createSeries(chart, xAxis, yAxis, name, data) {
2593
+ let series = chart.series.push(am5xy.LineSeries.new(this.ChartRoot, {
2594
+ name: name[0].toUpperCase() + name.slice(1),
2595
+ xAxis,
2596
+ yAxis,
2597
+ valueYField: name,
2598
+ valueXField: "date",
2599
+ stacked: true,
2600
+ connect: true // Unisce i valori mancanti
2601
+ }));
2602
+ series.data.setAll(data);
2603
+ series.set("tooltip", am5.Tooltip.new(this.ChartRoot, {
2604
+ labelText: "{valueY}"
2605
+ }));
2606
+ series.get("tooltip")?.get("background")?.setAll({
2607
+ strokeWidth: 3
2608
+ });
2609
+ series.strokes.template.setAll({ strokeWidth: 2 });
2610
+ series.fills.template.setAll({ fillOpacity: 0.6, visible: true });
2163
2611
  return series;
2164
2612
  }
2165
2613
  /** @ignore */
@@ -2181,10 +2629,9 @@ class EsChartComponent extends BaseChartComponent {
2181
2629
  /**
2182
2630
  * @ignore
2183
2631
  */
2184
- constructor(el, ChartLoader, ChartDispatcher, dateService, adapter, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2632
+ constructor(el, ChartLoader, ChartDispatcher, dateService, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2185
2633
  super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_DEBUG_MODE, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2186
2634
  this.dateService = dateService;
2187
- this.adapter = adapter;
2188
2635
  }
2189
2636
  /**
2190
2637
  * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
@@ -2230,26 +2677,26 @@ class EsChartComponent extends BaseChartComponent {
2230
2677
  graphicate(settings) {
2231
2678
  switch (this.Type) {
2232
2679
  case 'pie':
2233
- return new PieChartService(this.adapter).graphicate(this.Data, settings);
2680
+ return new PieChartService().graphicate(this.Data, settings);
2234
2681
  case 'area':
2235
- return new AreaChartService(this.adapter).graphicate(this.Data, settings);
2682
+ return new AreaChartService().graphicate(this.Data, settings);
2236
2683
  case 'line':
2237
- return new LineChartService(this.adapter, this.dateService).graphicate(this.Data, settings);
2684
+ return new LineChartService(this.dateService).graphicate(this.Data, settings);
2238
2685
  case 'vertical':
2239
- return new VerticalChartService(this.adapter).graphicate(this.Data, settings);
2686
+ return new VerticalChartService().graphicate(this.Data, settings);
2240
2687
  case 'vertical-2d':
2241
- return new Vertical2DChartService(this.adapter).graphicate(this.Data, settings);
2688
+ return new Vertical2DChartService().graphicate(this.Data, settings);
2242
2689
  case 'vertical-stacked':
2243
- return new VerticalStackedChartService(this.adapter).graphicate(this.Data, settings);
2690
+ return new VerticalStackedChartService().graphicate(this.Data, settings);
2244
2691
  }
2245
2692
  }
2246
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", 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_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2247
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: EsChartComponent, isStandalone: false, 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:#9999;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 }); }
2693
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i3.DateService }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i3$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2694
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.28", type: EsChartComponent, isStandalone: false, 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:#9999;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 }); }
2248
2695
  }
2249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsChartComponent, decorators: [{
2696
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsChartComponent, decorators: [{
2250
2697
  type: Component,
2251
2698
  args: [{ selector: 'es-chart', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, 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:#9999;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"] }]
2252
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i3.DateService }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2699
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i3.DateService }, { type: i0.NgZone }, { type: Object, decorators: [{
2253
2700
  type: Inject,
2254
2701
  args: [PLATFORM_ID]
2255
2702
  }] }, { type: undefined, decorators: [{
@@ -2261,7 +2708,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
2261
2708
  }] }, { type: undefined, decorators: [{
2262
2709
  type: Inject,
2263
2710
  args: [ESC_THEME]
2264
- }] }, { type: i4.LocalizationService }], propDecorators: { Type: [{
2711
+ }] }, { type: i3$1.LocalizationService }], propDecorators: { Type: [{
2265
2712
  type: Input
2266
2713
  }], Data: [{
2267
2714
  type: Input
@@ -2276,9 +2723,8 @@ class EsAreaChartComponent extends BaseChartComponent {
2276
2723
  /**
2277
2724
  * @ignore
2278
2725
  */
2279
- constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2726
+ constructor(el, ChartLoader, ChartDispatcher, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2280
2727
  super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_DEBUG_MODE, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2281
- this.adapter = adapter;
2282
2728
  }
2283
2729
  /**
2284
2730
  * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
@@ -2308,15 +2754,15 @@ class EsAreaChartComponent extends BaseChartComponent {
2308
2754
  * @returns {AreaChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2309
2755
  */
2310
2756
  graphicate(settingsCasted) {
2311
- return new AreaChartService(this.adapter).graphicate(this.Data, settingsCasted);
2757
+ return new AreaChartService().graphicate(this.Data, settingsCasted);
2312
2758
  }
2313
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsAreaChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2314
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: EsAreaChartComponent, isStandalone: false, 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:#9999;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 }); }
2759
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsAreaChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i3$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2760
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.28", type: EsAreaChartComponent, isStandalone: false, 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:#9999;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 }); }
2315
2761
  }
2316
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsAreaChartComponent, decorators: [{
2762
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsAreaChartComponent, decorators: [{
2317
2763
  type: Component,
2318
2764
  args: [{ selector: 'es-area-chart', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, 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:#9999;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"] }]
2319
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2765
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i0.NgZone }, { type: Object, decorators: [{
2320
2766
  type: Inject,
2321
2767
  args: [PLATFORM_ID]
2322
2768
  }] }, { type: undefined, decorators: [{
@@ -2328,7 +2774,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
2328
2774
  }] }, { type: undefined, decorators: [{
2329
2775
  type: Inject,
2330
2776
  args: [ESC_THEME]
2331
- }] }, { type: i4.LocalizationService }], propDecorators: { Data: [{
2777
+ }] }, { type: i3$1.LocalizationService }], propDecorators: { Data: [{
2332
2778
  type: Input
2333
2779
  }], DataArray: [{
2334
2780
  type: Input
@@ -2341,9 +2787,8 @@ class EsLineChartComponent extends BaseChartComponent {
2341
2787
  /**
2342
2788
  * @ignore
2343
2789
  */
2344
- constructor(el, ChartLoader, ChartDispatcher, adapter, dateService, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2790
+ constructor(el, ChartLoader, ChartDispatcher, dateService, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2345
2791
  super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_DEBUG_MODE, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2346
- this.adapter = adapter;
2347
2792
  this.dateService = dateService;
2348
2793
  }
2349
2794
  /**
@@ -2385,15 +2830,15 @@ class EsLineChartComponent extends BaseChartComponent {
2385
2830
  * @returns {LineChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2386
2831
  */
2387
2832
  graphicate(settingsCasted) {
2388
- return new LineChartService(this.adapter, this.dateService).graphicate(this.Data, settingsCasted);
2833
+ return new LineChartService(this.dateService).graphicate(this.Data, settingsCasted);
2389
2834
  }
2390
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", 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_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2391
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: EsLineChartComponent, isStandalone: false, 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:#9999;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 }); }
2835
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsLineChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i3.DateService }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i3$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2836
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.28", type: EsLineChartComponent, isStandalone: false, 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:#9999;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 }); }
2392
2837
  }
2393
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsLineChartComponent, decorators: [{
2838
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsLineChartComponent, decorators: [{
2394
2839
  type: Component,
2395
2840
  args: [{ selector: 'es-line-chart', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, 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:#9999;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"] }]
2396
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i3.DateService }, { type: i0.NgZone }, { type: Object, decorators: [{
2841
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i3.DateService }, { type: i0.NgZone }, { type: Object, decorators: [{
2397
2842
  type: Inject,
2398
2843
  args: [PLATFORM_ID]
2399
2844
  }] }, { type: undefined, decorators: [{
@@ -2405,7 +2850,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
2405
2850
  }] }, { type: undefined, decorators: [{
2406
2851
  type: Inject,
2407
2852
  args: [ESC_THEME]
2408
- }] }, { type: i4.LocalizationService }], propDecorators: { Data: [{
2853
+ }] }, { type: i3$1.LocalizationService }], propDecorators: { Data: [{
2409
2854
  type: Input
2410
2855
  }], DataArray: [{
2411
2856
  type: Input
@@ -2440,9 +2885,8 @@ class EsPieChartComponent extends BaseChartComponent {
2440
2885
  /**
2441
2886
  * @ignore
2442
2887
  */
2443
- constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2888
+ constructor(el, ChartLoader, ChartDispatcher, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2444
2889
  super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_DEBUG_MODE, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2445
- this.adapter = adapter;
2446
2890
  }
2447
2891
  /**
2448
2892
  * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
@@ -2465,7 +2909,6 @@ class EsPieChartComponent extends BaseChartComponent {
2465
2909
  */
2466
2910
  fillSpecificSettings(settingsCasted) {
2467
2911
  settingsCasted.HideZeroes = settingsCasted.HideZeroes != null ? settingsCasted.HideZeroes : this.HideZeroes;
2468
- settingsCasted.Mode3D = settingsCasted.Mode3D != null ? settingsCasted.Mode3D : this.Mode3D;
2469
2912
  settingsCasted.DonutRadiusPercentage = settingsCasted.DonutRadiusPercentage != null ? settingsCasted.DonutRadiusPercentage : this.DonutRadiusPercentage;
2470
2913
  settingsCasted.LabelsWrap = settingsCasted.LabelsWrap != null ? settingsCasted.LabelsWrap : this.LabelsWrap;
2471
2914
  settingsCasted.LabelsTruncate = settingsCasted.LabelsTruncate != null ? settingsCasted.LabelsTruncate : this.LabelsTruncate;
@@ -2480,15 +2923,15 @@ class EsPieChartComponent extends BaseChartComponent {
2480
2923
  * @returns {PieChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2481
2924
  */
2482
2925
  graphicate(settingsCasted) {
2483
- return new PieChartService(this.adapter).graphicate(this.Data, settingsCasted);
2926
+ return new PieChartService().graphicate(this.Data, settingsCasted);
2484
2927
  }
2485
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsPieChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2486
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: EsPieChartComponent, isStandalone: false, selector: "es-pie-chart", inputs: { Data: "Data", DataArray: "DataArray", HideZeroes: "HideZeroes", Mode3D: "Mode3D", DonutRadiusPercentage: "DonutRadiusPercentage", LabelsWrap: "LabelsWrap", LabelsTruncate: "LabelsTruncate", LabelsWidth: "LabelsWidth", LabelsVisible: "LabelsVisible", Total: "Total" }, 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:#9999;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 }); }
2928
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsPieChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i3$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2929
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.28", type: EsPieChartComponent, isStandalone: false, selector: "es-pie-chart", inputs: { Data: "Data", DataArray: "DataArray", HideZeroes: "HideZeroes", Mode3D: "Mode3D", DonutRadiusPercentage: "DonutRadiusPercentage", LabelsWrap: "LabelsWrap", LabelsTruncate: "LabelsTruncate", LabelsWidth: "LabelsWidth", LabelsVisible: "LabelsVisible", Total: "Total" }, 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:#9999;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 }); }
2487
2930
  }
2488
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsPieChartComponent, decorators: [{
2931
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsPieChartComponent, decorators: [{
2489
2932
  type: Component,
2490
2933
  args: [{ selector: 'es-pie-chart', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, 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:#9999;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"] }]
2491
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
2934
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i0.NgZone }, { type: Object, decorators: [{
2492
2935
  type: Inject,
2493
2936
  args: [PLATFORM_ID]
2494
2937
  }] }, { type: undefined, decorators: [{
@@ -2500,7 +2943,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
2500
2943
  }] }, { type: undefined, decorators: [{
2501
2944
  type: Inject,
2502
2945
  args: [ESC_THEME]
2503
- }] }, { type: i4.LocalizationService }], propDecorators: { Data: [{
2946
+ }] }, { type: i3$1.LocalizationService }], propDecorators: { Data: [{
2504
2947
  type: Input
2505
2948
  }], DataArray: [{
2506
2949
  type: Input
@@ -2529,9 +2972,8 @@ class EsVertical2DChartComponent extends BaseChartComponent {
2529
2972
  /**
2530
2973
  * @ignore
2531
2974
  */
2532
- constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2975
+ constructor(el, ChartLoader, ChartDispatcher, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2533
2976
  super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_DEBUG_MODE, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2534
- this.adapter = adapter;
2535
2977
  }
2536
2978
  /**
2537
2979
  * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
@@ -2567,15 +3009,15 @@ class EsVertical2DChartComponent extends BaseChartComponent {
2567
3009
  * @returns {Vertical2DChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2568
3010
  */
2569
3011
  graphicate(settingsCasted) {
2570
- return new Vertical2DChartService(this.adapter).graphicate(this.Data, settingsCasted);
3012
+ return new Vertical2DChartService().graphicate(this.Data, settingsCasted);
2571
3013
  }
2572
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsVertical2DChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2573
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: EsVertical2DChartComponent, isStandalone: false, 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:#9999;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 }); }
3014
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsVertical2DChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i3$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
3015
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.28", type: EsVertical2DChartComponent, isStandalone: false, 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:#9999;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 }); }
2574
3016
  }
2575
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsVertical2DChartComponent, decorators: [{
3017
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsVertical2DChartComponent, decorators: [{
2576
3018
  type: Component,
2577
3019
  args: [{ selector: 'es-vertical-2d-chart', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, 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:#9999;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"] }]
2578
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
3020
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i0.NgZone }, { type: Object, decorators: [{
2579
3021
  type: Inject,
2580
3022
  args: [PLATFORM_ID]
2581
3023
  }] }, { type: undefined, decorators: [{
@@ -2587,7 +3029,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
2587
3029
  }] }, { type: undefined, decorators: [{
2588
3030
  type: Inject,
2589
3031
  args: [ESC_THEME]
2590
- }] }, { type: i4.LocalizationService }], propDecorators: { Data: [{
3032
+ }] }, { type: i3$1.LocalizationService }], propDecorators: { Data: [{
2591
3033
  type: Input
2592
3034
  }], DataArray: [{
2593
3035
  type: Input
@@ -2612,9 +3054,8 @@ class EsVerticalChartComponent extends BaseChartComponent {
2612
3054
  /**
2613
3055
  * @ignore
2614
3056
  */
2615
- constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
3057
+ constructor(el, ChartLoader, ChartDispatcher, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2616
3058
  super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_DEBUG_MODE, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2617
- this.adapter = adapter;
2618
3059
  }
2619
3060
  /**
2620
3061
  * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
@@ -2649,15 +3090,15 @@ class EsVerticalChartComponent extends BaseChartComponent {
2649
3090
  * @returns {VerticalChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2650
3091
  */
2651
3092
  graphicate(settingsCasted) {
2652
- return new VerticalChartService(this.adapter).graphicate(this.Data, settingsCasted);
3093
+ return new VerticalChartService().graphicate(this.Data, settingsCasted);
2653
3094
  }
2654
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsVerticalChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2655
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: EsVerticalChartComponent, isStandalone: false, 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:#9999;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 }); }
3095
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsVerticalChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i3$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
3096
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.28", type: EsVerticalChartComponent, isStandalone: false, 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:#9999;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 }); }
2656
3097
  }
2657
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsVerticalChartComponent, decorators: [{
3098
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsVerticalChartComponent, decorators: [{
2658
3099
  type: Component,
2659
3100
  args: [{ selector: 'es-vertical-chart', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, 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:#9999;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"] }]
2660
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
3101
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i0.NgZone }, { type: Object, decorators: [{
2661
3102
  type: Inject,
2662
3103
  args: [PLATFORM_ID]
2663
3104
  }] }, { type: undefined, decorators: [{
@@ -2669,7 +3110,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
2669
3110
  }] }, { type: undefined, decorators: [{
2670
3111
  type: Inject,
2671
3112
  args: [ESC_THEME]
2672
- }] }, { type: i4.LocalizationService }], propDecorators: { Data: [{
3113
+ }] }, { type: i3$1.LocalizationService }], propDecorators: { Data: [{
2673
3114
  type: Input
2674
3115
  }], DataArray: [{
2675
3116
  type: Input
@@ -2692,9 +3133,8 @@ class EsVerticalStackedChartComponent extends BaseChartComponent {
2692
3133
  /**
2693
3134
  * @ignore
2694
3135
  */
2695
- constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
3136
+ constructor(el, ChartLoader, ChartDispatcher, zone, platformId, ESC_DEBUG_MODE, ESC_ANIMATIONS, ESC_THEME, lc) {
2696
3137
  super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_DEBUG_MODE, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
2697
- this.adapter = adapter;
2698
3138
  }
2699
3139
  /**
2700
3140
  * Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
@@ -2729,15 +3169,15 @@ class EsVerticalStackedChartComponent extends BaseChartComponent {
2729
3169
  * @returns {VerticalStackedChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
2730
3170
  */
2731
3171
  graphicate(settingsCasted) {
2732
- return new VerticalStackedChartService(this.adapter).graphicate(this.Data, settingsCasted);
3172
+ return new VerticalStackedChartService().graphicate(this.Data, settingsCasted);
2733
3173
  }
2734
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsVerticalStackedChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
2735
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: EsVerticalStackedChartComponent, isStandalone: false, 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:#9999;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 }); }
3174
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsVerticalStackedChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_DEBUG_MODE }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i3$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
3175
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.28", type: EsVerticalStackedChartComponent, isStandalone: false, 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:#9999;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 }); }
2736
3176
  }
2737
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsVerticalStackedChartComponent, decorators: [{
3177
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsVerticalStackedChartComponent, decorators: [{
2738
3178
  type: Component,
2739
3179
  args: [{ selector: 'es-vertical-stacked-chart', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, 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:#9999;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"] }]
2740
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
3180
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i0.NgZone }, { type: Object, decorators: [{
2741
3181
  type: Inject,
2742
3182
  args: [PLATFORM_ID]
2743
3183
  }] }, { type: undefined, decorators: [{
@@ -2749,7 +3189,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
2749
3189
  }] }, { type: undefined, decorators: [{
2750
3190
  type: Inject,
2751
3191
  args: [ESC_THEME]
2752
- }] }, { type: i4.LocalizationService }], propDecorators: { Data: [{
3192
+ }] }, { type: i3$1.LocalizationService }], propDecorators: { Data: [{
2753
3193
  type: Input
2754
3194
  }], DataArray: [{
2755
3195
  type: Input
@@ -2806,12 +3246,11 @@ class EsChartsModule {
2806
3246
  { provide: ESC_ANIMATIONS, useValue: config?.animations == null || config?.animations == undefined ? true : config?.animations },
2807
3247
  { provide: ESC_THEME, useValue: config?.theme || 'spiritedaway' },
2808
3248
  { provide: ESC_DEBUG_MODE, useValue: config?.debugMode || false },
2809
- { provide: BaseAdapter, useClass: config?.adapter || BaseAdapter }
2810
3249
  ]
2811
3250
  };
2812
3251
  }
2813
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsChartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2814
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.25", ngImport: i0, type: EsChartsModule, declarations: [EsChartComponent,
3252
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsChartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3253
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.28", ngImport: i0, type: EsChartsModule, declarations: [EsChartComponent,
2815
3254
  EsLineChartComponent,
2816
3255
  EsPieChartComponent,
2817
3256
  EsVertical2DChartComponent,
@@ -2826,9 +3265,9 @@ class EsChartsModule {
2826
3265
  EsVerticalStackedChartComponent,
2827
3266
  PageChartSelector,
2828
3267
  EsAreaChartComponent] }); }
2829
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsChartsModule, imports: [CommonModule] }); }
3268
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsChartsModule, imports: [CommonModule] }); }
2830
3269
  }
2831
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: EsChartsModule, decorators: [{
3270
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.28", ngImport: i0, type: EsChartsModule, decorators: [{
2832
3271
  type: NgModule,
2833
3272
  args: [{
2834
3273
  imports: [CommonModule],
@@ -2845,5 +3284,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
2845
3284
  * Generated bundle index. Do not edit.
2846
3285
  */
2847
3286
 
2848
- export { AreaChartData, AreaChartSettings, BaseAdapter, BaseChartComponent, BaseInterval, BaseSettings, ChartThemes, DateValue, ESC_ANIMATIONS, ESC_DEBUG_MODE, ESC_THEME, EsAreaChartComponent, EsChartComponent, EsChartsModule, EsLineChartComponent, EsPieChartComponent, EsVertical2DChartComponent, EsVerticalChartComponent, EsVerticalStackedChartComponent, KeyValue, KeyValueColor, LegendPad, Limit, LineChartData, LineChartSettings, LineSerie, PageChartSelector, PagedChartData, PieChartData, PieChartSettings, Vertical2DChartData, Vertical2DChartSettings, VerticalChartData, VerticalChartSettings, VerticalStackedChartData, VerticalStackedChartSettings };
3287
+ export { AreaChartData, AreaChartSettings, BaseChartComponent, BaseInterval, BaseSettings, ChartThemes, DateValue, ESC_ANIMATIONS, ESC_DEBUG_MODE, ESC_THEME, EsAreaChartComponent, EsChartComponent, EsChartsModule, EsLineChartComponent, EsPieChartComponent, EsVertical2DChartComponent, EsVerticalChartComponent, EsVerticalStackedChartComponent, KeyValue, KeyValueColor, LegendPad, Limit, LineChartData, LineChartSettings, LineSerie, PageChartSelector, PagedChartData, PieChartData, PieChartSettings, Vertical2DChartData, Vertical2DChartSettings, VerticalChartData, VerticalChartSettings, VerticalStackedChartData, VerticalStackedChartSettings };
2849
3288
  //# sourceMappingURL=esfaenza-es-charts.mjs.map