@esfaenza/es-charts 11.2.21 → 11.2.24
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.
- package/bundles/esfaenza-es-charts.umd.js +435 -463
- package/bundles/esfaenza-es-charts.umd.js.map +1 -1
- package/bundles/esfaenza-es-charts.umd.min.js +1 -1
- package/bundles/esfaenza-es-charts.umd.min.js.map +1 -1
- package/esfaenza-es-charts.d.ts +3 -5
- package/esfaenza-es-charts.metadata.json +1 -1
- package/esm2015/esfaenza-es-charts.js +4 -6
- package/esm2015/lib/adapters/BaseAdapter.js +47 -0
- package/esm2015/lib/adapters/IBaseAdapter.js +2 -0
- package/esm2015/lib/components/base/base-chart.component.js +3 -2
- package/esm2015/lib/components/chart-pager/chart-pager.component.js +1 -1
- package/esm2015/lib/components/specializations/es-area-chart.component.js +6 -5
- package/esm2015/lib/components/specializations/es-chart.component.js +18 -5
- package/esm2015/lib/components/specializations/es-line-chart.component.js +6 -5
- package/esm2015/lib/components/specializations/es-pie-chart.component.js +6 -5
- package/esm2015/lib/components/specializations/es-vertical-2d-chart.component.js +6 -5
- package/esm2015/lib/components/specializations/es-vertical-chart.component.js +6 -5
- package/esm2015/lib/components/specializations/es-vertical-stacked-chart.component.js +6 -5
- package/esm2015/lib/es-charts.module.js +13 -5
- package/esm2015/lib/models/core/ChartDispatcher.js +88 -0
- package/esm2015/lib/models/core/ChartLoader.js +201 -0
- package/esm2015/lib/models/core/ChartThemes.js +61 -0
- package/esm2015/lib/models/data/AreaChartData.js +16 -0
- package/esm2015/lib/models/data/LineChartData.js +16 -0
- package/esm2015/lib/models/data/PagedChartData.js +20 -0
- package/esm2015/lib/models/data/PieChartData.js +14 -0
- package/esm2015/lib/models/data/Vertical2DChartData.js +16 -0
- package/esm2015/lib/models/data/VerticalChartData.js +14 -0
- package/esm2015/lib/models/data/VerticalStackedChartData.js +14 -0
- package/esm2015/lib/models/data/base/DateValue.js +11 -0
- package/esm2015/lib/models/data/base/KeyValue.js +11 -0
- package/esm2015/lib/models/data/base/KeyValueColor.js +12 -0
- package/esm2015/lib/models/data/base/Limit.js +15 -0
- package/esm2015/lib/models/data/base/LineSerie.js +24 -0
- package/esm2015/lib/models/settings/AreaChartSettings.js +11 -0
- package/esm2015/lib/models/settings/LineChartSettings.js +11 -0
- package/esm2015/lib/models/settings/PieChartSettings.js +7 -0
- package/esm2015/lib/models/settings/Vertical2DChartSettings.js +11 -0
- package/esm2015/lib/models/settings/VerticalChartSettings.js +11 -0
- package/esm2015/lib/models/settings/VerticalStackedChartSettings.js +11 -0
- package/esm2015/lib/models/settings/base/BaseInterval.js +6 -0
- package/esm2015/lib/models/settings/base/BaseSettings.js +6 -0
- package/esm2015/lib/models/settings/base/LegendPad.js +6 -0
- package/esm2015/lib/services/AreaChartService.js +135 -0
- package/esm2015/lib/services/LineChartService.js +339 -0
- package/esm2015/lib/services/PieChartService.js +112 -0
- package/esm2015/lib/services/Vertical2DChartService.js +163 -0
- package/esm2015/lib/services/VerticalChartService.js +105 -0
- package/esm2015/lib/services/VerticalStackedChartService.js +127 -0
- package/esm2015/lib/services/base/IBaseService.js +2 -0
- package/esm2015/public-api.js +26 -25
- package/fesm2015/esfaenza-es-charts.js +412 -431
- package/fesm2015/esfaenza-es-charts.js.map +1 -1
- package/lib/adapters/{classes/BaseAdapter.d.ts → BaseAdapter.d.ts} +6 -1
- package/lib/adapters/{classes/IBaseAdapter.d.ts → IBaseAdapter.d.ts} +6 -1
- package/lib/components/base/base-chart.component.d.ts +10 -4
- package/lib/components/chart-pager/chart-pager.component.d.ts +1 -1
- package/lib/components/specializations/es-area-chart.component.d.ts +6 -4
- package/lib/components/specializations/es-chart.component.d.ts +17 -5
- package/lib/components/specializations/es-line-chart.component.d.ts +6 -4
- package/lib/components/specializations/es-pie-chart.component.d.ts +6 -4
- package/lib/components/specializations/es-vertical-2d-chart.component.d.ts +6 -4
- package/lib/components/specializations/es-vertical-chart.component.d.ts +6 -4
- package/lib/components/specializations/es-vertical-stacked-chart.component.d.ts +6 -4
- package/lib/models/core/{classes/ChartDispatcher.d.ts → ChartDispatcher.d.ts} +0 -0
- package/lib/models/core/{classes/ChartLoader.d.ts → ChartLoader.d.ts} +0 -0
- package/lib/models/core/{classes/ChartThemes.d.ts → ChartThemes.d.ts} +0 -0
- package/lib/models/data/{classes/AreaChartData.d.ts → AreaChartData.d.ts} +1 -1
- package/lib/models/data/{classes/LineChartData.d.ts → LineChartData.d.ts} +0 -0
- package/lib/models/data/{classes/PagedChartData.d.ts → PagedChartData.d.ts} +0 -0
- package/lib/models/data/{classes/PieChartData.d.ts → PieChartData.d.ts} +0 -0
- package/lib/models/data/{classes/Vertical2DChartData.d.ts → Vertical2DChartData.d.ts} +0 -0
- package/lib/models/data/{classes/VerticalChartData.d.ts → VerticalChartData.d.ts} +0 -0
- package/lib/models/data/{classes/VerticalStackedChartData.d.ts → VerticalStackedChartData.d.ts} +0 -0
- package/lib/models/data/{classes/base → base}/DateValue.d.ts +0 -0
- package/lib/models/data/{classes/base → base}/KeyValue.d.ts +0 -0
- package/lib/models/data/{classes/base → base}/KeyValueColor.d.ts +0 -0
- package/lib/models/data/base/Limit.d.ts +13 -0
- package/lib/models/data/{classes/base → base}/LineSerie.d.ts +1 -1
- package/lib/models/settings/{classes/AreaChartSettings.d.ts → AreaChartSettings.d.ts} +0 -0
- package/lib/models/settings/{classes/LineChartSettings.d.ts → LineChartSettings.d.ts} +0 -0
- package/lib/models/settings/{classes/PieChartSettings.d.ts → PieChartSettings.d.ts} +0 -0
- package/lib/models/settings/{classes/Vertical2DChartSettings.d.ts → Vertical2DChartSettings.d.ts} +0 -0
- package/lib/models/settings/{classes/VerticalChartSettings.d.ts → VerticalChartSettings.d.ts} +0 -0
- package/lib/models/settings/{classes/VerticalStackedChartSettings.d.ts → VerticalStackedChartSettings.d.ts} +0 -0
- package/lib/models/settings/{classes/base → base}/BaseInterval.d.ts +0 -0
- package/lib/models/settings/{classes/base → base}/BaseSettings.d.ts +1 -1
- package/lib/models/settings/{classes/base → base}/LegendPad.d.ts +0 -0
- package/lib/services/{classes/AreaChartService.d.ts → AreaChartService.d.ts} +3 -3
- package/lib/services/{classes/LineChartService.d.ts → LineChartService.d.ts} +3 -3
- package/lib/services/{classes/PieChartService.d.ts → PieChartService.d.ts} +3 -3
- package/lib/services/{classes/Vertical2DChartService.d.ts → Vertical2DChartService.d.ts} +3 -3
- package/lib/services/{classes/VerticalChartService.d.ts → VerticalChartService.d.ts} +3 -3
- package/lib/services/{classes/VerticalStackedChartService.d.ts → VerticalStackedChartService.d.ts} +3 -3
- package/lib/services/{classes/base → base}/IBaseService.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +25 -24
- package/esm2015/lib/adapters/classes/BaseAdapter.js +0 -47
- package/esm2015/lib/adapters/classes/IBaseAdapter.js +0 -2
- package/esm2015/lib/adapters/index.js +0 -3
- package/esm2015/lib/components/index.js +0 -9
- package/esm2015/lib/models/core/classes/ChartDispatcher.js +0 -88
- package/esm2015/lib/models/core/classes/ChartLoader.js +0 -201
- package/esm2015/lib/models/core/classes/ChartThemes.js +0 -61
- package/esm2015/lib/models/core/index.js +0 -4
- package/esm2015/lib/models/data/classes/AreaChartData.js +0 -16
- package/esm2015/lib/models/data/classes/LineChartData.js +0 -16
- package/esm2015/lib/models/data/classes/PagedChartData.js +0 -20
- package/esm2015/lib/models/data/classes/PieChartData.js +0 -14
- package/esm2015/lib/models/data/classes/Vertical2DChartData.js +0 -16
- package/esm2015/lib/models/data/classes/VerticalChartData.js +0 -14
- package/esm2015/lib/models/data/classes/VerticalStackedChartData.js +0 -14
- package/esm2015/lib/models/data/classes/base/DateValue.js +0 -11
- package/esm2015/lib/models/data/classes/base/KeyValue.js +0 -11
- package/esm2015/lib/models/data/classes/base/KeyValueColor.js +0 -12
- package/esm2015/lib/models/data/classes/base/Limit.js +0 -15
- package/esm2015/lib/models/data/classes/base/LineSerie.js +0 -24
- package/esm2015/lib/models/data/index.js +0 -13
- package/esm2015/lib/models/settings/classes/AreaChartSettings.js +0 -11
- package/esm2015/lib/models/settings/classes/LineChartSettings.js +0 -11
- package/esm2015/lib/models/settings/classes/PieChartSettings.js +0 -7
- package/esm2015/lib/models/settings/classes/Vertical2DChartSettings.js +0 -11
- package/esm2015/lib/models/settings/classes/VerticalChartSettings.js +0 -11
- package/esm2015/lib/models/settings/classes/VerticalStackedChartSettings.js +0 -11
- package/esm2015/lib/models/settings/classes/base/BaseInterval.js +0 -6
- package/esm2015/lib/models/settings/classes/base/BaseSettings.js +0 -6
- package/esm2015/lib/models/settings/classes/base/LegendPad.js +0 -6
- package/esm2015/lib/models/settings/index.js +0 -10
- package/esm2015/lib/services/classes/AreaChartService.js +0 -135
- package/esm2015/lib/services/classes/LineChartService.js +0 -358
- package/esm2015/lib/services/classes/PieChartService.js +0 -112
- package/esm2015/lib/services/classes/Vertical2DChartService.js +0 -163
- package/esm2015/lib/services/classes/VerticalChartService.js +0 -105
- package/esm2015/lib/services/classes/VerticalStackedChartService.js +0 -127
- package/esm2015/lib/services/classes/base/IBaseService.js +0 -2
- package/esm2015/lib/services/index.js +0 -8
- package/lib/adapters/index.d.ts +0 -2
- package/lib/components/index.d.ts +0 -8
- package/lib/models/core/index.d.ts +0 -3
- package/lib/models/data/classes/base/Limit.d.ts +0 -13
- package/lib/models/data/index.d.ts +0 -12
- package/lib/models/settings/index.d.ts +0 -9
- package/lib/services/index.d.ts +0 -7
|
@@ -600,13 +600,13 @@
|
|
|
600
600
|
*/
|
|
601
601
|
var Limit = /** @class */ (function () {
|
|
602
602
|
/** @ignore */
|
|
603
|
-
function Limit(upper,
|
|
603
|
+
function Limit(upper, upperlabel, uppercolor, lower, lowerlabel, lowercolor) {
|
|
604
604
|
this.upper = upper;
|
|
605
|
-
this.
|
|
606
|
-
this.
|
|
605
|
+
this.upperlabel = upperlabel;
|
|
606
|
+
this.uppercolor = uppercolor;
|
|
607
607
|
this.lower = lower;
|
|
608
|
-
this.
|
|
609
|
-
this.
|
|
608
|
+
this.lowerlabel = lowerlabel;
|
|
609
|
+
this.lowercolor = lowercolor;
|
|
610
610
|
}
|
|
611
611
|
return Limit;
|
|
612
612
|
}());
|
|
@@ -674,109 +674,90 @@
|
|
|
674
674
|
}());
|
|
675
675
|
|
|
676
676
|
/**
|
|
677
|
-
*
|
|
678
|
-
*/
|
|
679
|
-
var ESC_LOCALE = new core.InjectionToken('ESC_LOCALE');
|
|
680
|
-
/**
|
|
681
|
-
* Token che identifica il default per l'utilizzo o meno delle Animazioni per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
|
|
682
|
-
*/
|
|
683
|
-
var ESC_ANIMATIONS = new core.InjectionToken('ESC_ANIMATIONS');
|
|
684
|
-
/**
|
|
685
|
-
* Token che identifica il Tema di default per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
|
|
686
|
-
*/
|
|
687
|
-
var ESC_THEME = new core.InjectionToken('ESC_THEME');
|
|
688
|
-
/**
|
|
689
|
-
* Token che identifica l'utilizzo o meno del sistema di Log per l'intera libreria
|
|
690
|
-
*/
|
|
691
|
-
var ESC_LOGS = new core.InjectionToken('ESC_LOGS');
|
|
692
|
-
|
|
693
|
-
/**
|
|
694
|
-
* Classe che si occupa del dispatch delle operazioni di rendering dei grafici utilizzando una coda per permettere ad ogni grafico di avere temi e localizzazione custom
|
|
677
|
+
* Componente che si occupa della paginazione dei grafici qualora servisse
|
|
695
678
|
*/
|
|
696
|
-
var
|
|
697
|
-
|
|
698
|
-
* @ignore
|
|
699
|
-
*/
|
|
700
|
-
function ChartDispatcher(logs) {
|
|
701
|
-
this.logs = logs;
|
|
702
|
-
/**
|
|
703
|
-
* Coda di inizializzazioni ancora da eseguire. Quando questa è vuota significa che nessuno sta creando grafici
|
|
704
|
-
*/
|
|
705
|
-
this.Initializations = [];
|
|
679
|
+
var PageChartSelector = /** @class */ (function () {
|
|
680
|
+
function PageChartSelector() {
|
|
706
681
|
/**
|
|
707
|
-
*
|
|
682
|
+
* Indica un cambio di pagina ed emette un oggetto con i dati attuali e l'indice attuale.
|
|
683
|
+
*
|
|
684
|
+
* Qualora la proprietà **data** fosse null indica un evento di "loading"
|
|
708
685
|
*/
|
|
709
|
-
this.
|
|
686
|
+
this.onPageChange = new core.EventEmitter();
|
|
710
687
|
}
|
|
711
688
|
/**
|
|
712
|
-
*
|
|
713
|
-
* precedentemente registati non hanno finito la fase di inizializzazione
|
|
714
|
-
*
|
|
715
|
-
* @param {string} name Identificativo del grafico da registrare
|
|
716
|
-
* @param {Function} chartCreationFunction Funzione che fisicamente dovrà occuparsi della creazione del grafico
|
|
689
|
+
* @ignore
|
|
717
690
|
*/
|
|
718
|
-
|
|
719
|
-
if (this.
|
|
720
|
-
throw
|
|
721
|
-
|
|
722
|
-
this.
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
this.drainInitQueues();
|
|
726
|
-
}
|
|
691
|
+
PageChartSelector.prototype.ngOnChanges = function () {
|
|
692
|
+
if (!(this.Items || this.Dtos) || (this.Items || this.Dtos).length == 0)
|
|
693
|
+
throw new Error("Chart array cannot be empty!");
|
|
694
|
+
var idx = (this.StartIndex || 0);
|
|
695
|
+
this.currentindex = idx;
|
|
696
|
+
this.currentpage = idx + 1;
|
|
697
|
+
this.handlePageChange();
|
|
727
698
|
};
|
|
728
699
|
/**
|
|
729
|
-
*
|
|
730
|
-
*
|
|
731
|
-
* @param {string} name Identificativo del grafico da deregistrare
|
|
700
|
+
* Gestisce un cambio pagina inviando al callback **onPageChange** i dati attuali (siano essi il Dto per il caricamento dati i
|
|
701
|
+
* o i dati già presenti) e l'indice di visualizzazione
|
|
732
702
|
*/
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
this.log("DISPATCHER: Chart deregistered " + name);
|
|
741
|
-
this.InitializedGraphs.splice(index, 1);
|
|
703
|
+
PageChartSelector.prototype.handlePageChange = function () {
|
|
704
|
+
this.finalIndex = this.currentpage - 1;
|
|
705
|
+
this.currentindex = this.currentpage - 1;
|
|
706
|
+
var data = this.Items && this.Items.length > 0 ? this.Items[this.finalIndex].data : this.Dtos[this.finalIndex];
|
|
707
|
+
this.onPageChange.emit({ data: data, index: this.finalIndex });
|
|
742
708
|
};
|
|
743
709
|
/**
|
|
744
|
-
*
|
|
745
|
-
* in modo che nessun grafico possa essere inizializzato contemporaneamente ad un altro.
|
|
746
|
-
*
|
|
747
|
-
* Questo è il punto chiave che permette di avere per ogni grafico temi e locale differenti
|
|
710
|
+
* Visualizza il grafico successivo
|
|
748
711
|
*/
|
|
749
|
-
|
|
712
|
+
PageChartSelector.prototype.Next = function () {
|
|
750
713
|
var _this = this;
|
|
751
|
-
|
|
752
|
-
this.
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
if (_this.
|
|
758
|
-
_this.
|
|
759
|
-
_this.drainInitQueues();
|
|
760
|
-
}
|
|
714
|
+
// Per passare da page a index è sempre un -1
|
|
715
|
+
this.currentpage++;
|
|
716
|
+
this.onPageChange.emit({ data: null, index: this.currentpage - 1 });
|
|
717
|
+
// Delay pseudo-intelligente per click compulsivi.
|
|
718
|
+
// Se dopo questo delay sono andato avanti solo di 1 effettuo il callback altrimenti incremento l'indice
|
|
719
|
+
setTimeout(function () {
|
|
720
|
+
if (_this.currentindex == _this.currentpage - 2)
|
|
721
|
+
_this.handlePageChange();
|
|
761
722
|
else
|
|
762
|
-
_this.
|
|
763
|
-
});
|
|
723
|
+
_this.currentindex++;
|
|
724
|
+
}, this.BrowseDelayMs);
|
|
764
725
|
};
|
|
765
726
|
/**
|
|
766
|
-
*
|
|
727
|
+
* Visualizza il grafico precedente
|
|
767
728
|
*/
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
729
|
+
PageChartSelector.prototype.Previous = function () {
|
|
730
|
+
var _this = this;
|
|
731
|
+
// Per passare da page a index è sempre un -1
|
|
732
|
+
this.currentpage--;
|
|
733
|
+
this.onPageChange.emit({ data: null, index: this.currentpage - 1 });
|
|
734
|
+
// Delay pseudo-intelligente per click compulsivi.
|
|
735
|
+
// Se dopo questo delay sono andato indietro solo di 1 effettuo il callback altrimenti decremento l'indice
|
|
736
|
+
setTimeout(function () {
|
|
737
|
+
if (_this.currentindex == _this.currentpage)
|
|
738
|
+
_this.handlePageChange();
|
|
739
|
+
else
|
|
740
|
+
_this.currentindex--;
|
|
741
|
+
}, this.BrowseDelayMs);
|
|
771
742
|
};
|
|
772
|
-
return
|
|
743
|
+
return PageChartSelector;
|
|
773
744
|
}());
|
|
774
|
-
|
|
775
|
-
{ type: core.
|
|
745
|
+
PageChartSelector.decorators = [
|
|
746
|
+
{ type: core.Component, args: [{
|
|
747
|
+
selector: "chart-pager",
|
|
748
|
+
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>",
|
|
749
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
750
|
+
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:medium none currentcolor}.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}"]
|
|
751
|
+
},] }
|
|
776
752
|
];
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
753
|
+
PageChartSelector.propDecorators = {
|
|
754
|
+
Items: [{ type: core.Input }],
|
|
755
|
+
Dtos: [{ type: core.Input }],
|
|
756
|
+
BrowseDelayMs: [{ type: core.Input }],
|
|
757
|
+
StartIndex: [{ type: core.Input }],
|
|
758
|
+
onPageChange: [{ type: core.Output }],
|
|
759
|
+
headerInner_tr: [{ type: core.ContentChild, args: ['header_inner', { static: false },] }]
|
|
760
|
+
};
|
|
780
761
|
|
|
781
762
|
/** @ignore */
|
|
782
763
|
var _spiritedaway = 'spiritedaway';
|
|
@@ -1119,6 +1100,111 @@
|
|
|
1119
1100
|
return ChartLoader;
|
|
1120
1101
|
}());
|
|
1121
1102
|
|
|
1103
|
+
/**
|
|
1104
|
+
* Token che identifica il Locale di default per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
|
|
1105
|
+
*/
|
|
1106
|
+
var ESC_LOCALE = new core.InjectionToken('ESC_LOCALE');
|
|
1107
|
+
/**
|
|
1108
|
+
* Token che identifica il default per l'utilizzo o meno delle Animazioni per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
|
|
1109
|
+
*/
|
|
1110
|
+
var ESC_ANIMATIONS = new core.InjectionToken('ESC_ANIMATIONS');
|
|
1111
|
+
/**
|
|
1112
|
+
* Token che identifica il Tema di default per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
|
|
1113
|
+
*/
|
|
1114
|
+
var ESC_THEME = new core.InjectionToken('ESC_THEME');
|
|
1115
|
+
/**
|
|
1116
|
+
* Token che identifica l'utilizzo o meno del sistema di Log per l'intera libreria
|
|
1117
|
+
*/
|
|
1118
|
+
var ESC_LOGS = new core.InjectionToken('ESC_LOGS');
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* Classe che si occupa del dispatch delle operazioni di rendering dei grafici utilizzando una coda per permettere ad ogni grafico di avere temi e localizzazione custom
|
|
1122
|
+
*/
|
|
1123
|
+
var ChartDispatcher = /** @class */ (function () {
|
|
1124
|
+
/**
|
|
1125
|
+
* @ignore
|
|
1126
|
+
*/
|
|
1127
|
+
function ChartDispatcher(logs) {
|
|
1128
|
+
this.logs = logs;
|
|
1129
|
+
/**
|
|
1130
|
+
* Coda di inizializzazioni ancora da eseguire. Quando questa è vuota significa che nessuno sta creando grafici
|
|
1131
|
+
*/
|
|
1132
|
+
this.Initializations = [];
|
|
1133
|
+
/**
|
|
1134
|
+
* Lista dei grafici inizializzati e attivi in un dato momento (viene registrata la proprietà **name**). Non è possibile registrare due grafici con lo stesso identificativo
|
|
1135
|
+
*/
|
|
1136
|
+
this.InitializedGraphs = [];
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Registra un grafico da visualizzare insieme alla propria funzione di creazione. Quest'ultima sarà differita fino a che tutti i grafici
|
|
1140
|
+
* precedentemente registati non hanno finito la fase di inizializzazione
|
|
1141
|
+
*
|
|
1142
|
+
* @param {string} name Identificativo del grafico da registrare
|
|
1143
|
+
* @param {Function} chartCreationFunction Funzione che fisicamente dovrà occuparsi della creazione del grafico
|
|
1144
|
+
*/
|
|
1145
|
+
ChartDispatcher.prototype.register = function (name, chartCreationFunction) {
|
|
1146
|
+
if (this.InitializedGraphs.indexOf(name) != -1)
|
|
1147
|
+
throw "Attempting to register a duplicate chart '" + name + "'. Make sure the 'name' properties of your charts are univoque";
|
|
1148
|
+
this.log("DISPATCHER: Registering chart creation function execution for " + name);
|
|
1149
|
+
this.Initializations.push({ name: name, function: chartCreationFunction });
|
|
1150
|
+
if (this.Initializations.length == 1) {
|
|
1151
|
+
this.log("DISPATCHER: Initial drain started");
|
|
1152
|
+
this.drainInitQueues();
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
/**
|
|
1156
|
+
* Deregistra un grafico presente. Chiamata generalmente al dispose del grafico in questione quando non dev'essere più mostrato nella pagina corrente
|
|
1157
|
+
*
|
|
1158
|
+
* @param {string} name Identificativo del grafico da deregistrare
|
|
1159
|
+
*/
|
|
1160
|
+
ChartDispatcher.prototype.deregisterGraph = function (name) {
|
|
1161
|
+
var index = this.InitializedGraphs.indexOf(name);
|
|
1162
|
+
if (index == -1) {
|
|
1163
|
+
//Questo succede quando si cerca di distruggere il grafico mentre sta venendo graficato
|
|
1164
|
+
this.log("DISPATCHER: Registration missing for chart " + name + " it was probably destroyed during load");
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
this.log("DISPATCHER: Chart deregistered " + name);
|
|
1168
|
+
this.InitializedGraphs.splice(index, 1);
|
|
1169
|
+
};
|
|
1170
|
+
/**
|
|
1171
|
+
* Metodo che esegue in maniera sequenziale le funzioni di inizializzazione dei grafici finché presenti
|
|
1172
|
+
* in modo che nessun grafico possa essere inizializzato contemporaneamente ad un altro.
|
|
1173
|
+
*
|
|
1174
|
+
* Questo è il punto chiave che permette di avere per ogni grafico temi e locale differenti
|
|
1175
|
+
*/
|
|
1176
|
+
ChartDispatcher.prototype.drainInitQueues = function () {
|
|
1177
|
+
var _this = this;
|
|
1178
|
+
var toExecute = this.Initializations[0];
|
|
1179
|
+
this.log("DISPATCHER: Executing initialization function for chart " + toExecute.name);
|
|
1180
|
+
toExecute.function().then(function () {
|
|
1181
|
+
_this.log("DISPATCHER: initialization for chart " + toExecute.name + " is done");
|
|
1182
|
+
_this.InitializedGraphs.push(toExecute.name);
|
|
1183
|
+
_this.Initializations.splice(0, 1);
|
|
1184
|
+
if (_this.Initializations.length >= 1) {
|
|
1185
|
+
_this.log("DISPATCHER: Found queued initializations. Continuing");
|
|
1186
|
+
_this.drainInitQueues();
|
|
1187
|
+
}
|
|
1188
|
+
else
|
|
1189
|
+
_this.log("DISPATCHER: queue is over, nothing more to do");
|
|
1190
|
+
});
|
|
1191
|
+
};
|
|
1192
|
+
/**
|
|
1193
|
+
* @ignore
|
|
1194
|
+
*/
|
|
1195
|
+
ChartDispatcher.prototype.log = function (text) {
|
|
1196
|
+
if (this.logs)
|
|
1197
|
+
console.log("@esfaenza/es-charts: " + text);
|
|
1198
|
+
};
|
|
1199
|
+
return ChartDispatcher;
|
|
1200
|
+
}());
|
|
1201
|
+
ChartDispatcher.decorators = [
|
|
1202
|
+
{ type: core.Injectable }
|
|
1203
|
+
];
|
|
1204
|
+
ChartDispatcher.ctorParameters = function () { return [
|
|
1205
|
+
{ type: Boolean, decorators: [{ type: core.Inject, args: [ESC_LOGS,] }] }
|
|
1206
|
+
]; };
|
|
1207
|
+
|
|
1122
1208
|
/**
|
|
1123
1209
|
* Componente Grafico Base che gestisce tutte le cose comuni dei vari grafici istanziabili, come la presenza o menu di una legenda,
|
|
1124
1210
|
* il tema utilizzato, il locale del singolo grafico, ecc ecc...
|
|
@@ -1503,11 +1589,11 @@
|
|
|
1503
1589
|
var range = yAxis.axisRanges.create();
|
|
1504
1590
|
range.value = dataConverted.limit.upper;
|
|
1505
1591
|
range.label.inside = true;
|
|
1506
|
-
range.label.text = dataConverted.limit.
|
|
1592
|
+
range.label.text = dataConverted.limit.upperlabel;
|
|
1507
1593
|
range.label.fill = range.grid.stroke;
|
|
1508
1594
|
range.label.verticalCenter = "bottom";
|
|
1509
|
-
range.label.stroke = am4core__namespace.color(dataConverted.limit.
|
|
1510
|
-
range.grid.stroke = am4core__namespace.color(dataConverted.limit.
|
|
1595
|
+
range.label.stroke = am4core__namespace.color(dataConverted.limit.uppercolor || "#F92200");
|
|
1596
|
+
range.grid.stroke = am4core__namespace.color(dataConverted.limit.uppercolor || "#F92200");
|
|
1511
1597
|
range.grid.strokeWidth = 2;
|
|
1512
1598
|
range.grid.strokeOpacity = 1;
|
|
1513
1599
|
}
|
|
@@ -1515,11 +1601,11 @@
|
|
|
1515
1601
|
var range = yAxis.axisRanges.create();
|
|
1516
1602
|
range.value = dataConverted.limit.lower;
|
|
1517
1603
|
range.label.inside = true;
|
|
1518
|
-
range.label.text = dataConverted.limit.
|
|
1604
|
+
range.label.text = dataConverted.limit.lowerlabel;
|
|
1519
1605
|
range.label.fill = range.grid.stroke;
|
|
1520
1606
|
range.label.verticalCenter = "bottom";
|
|
1521
|
-
range.label.stroke = am4core__namespace.color(dataConverted.limit.
|
|
1522
|
-
range.grid.stroke = am4core__namespace.color(dataConverted.limit.
|
|
1607
|
+
range.label.stroke = am4core__namespace.color(dataConverted.limit.lowercolor || "#F92200");
|
|
1608
|
+
range.grid.stroke = am4core__namespace.color(dataConverted.limit.lowercolor || "#F92200");
|
|
1523
1609
|
range.grid.strokeWidth = 2;
|
|
1524
1610
|
range.grid.strokeOpacity = 1;
|
|
1525
1611
|
}
|
|
@@ -1702,26 +1788,7 @@
|
|
|
1702
1788
|
this.ChartInstance.addData(data);
|
|
1703
1789
|
return;
|
|
1704
1790
|
}
|
|
1705
|
-
|
|
1706
|
-
var relativeSerie = dataConverted.series.find(function (t) { return t.name == s.name; });
|
|
1707
|
-
// Una serie del grafico è stata ggiornata, ordino i datapoint e li aggiungo
|
|
1708
|
-
var correctOrder = true;
|
|
1709
|
-
var prevDate = null;
|
|
1710
|
-
for (var v = 0; v < relativeSerie.values.length; v++) {
|
|
1711
|
-
if (!prevDate)
|
|
1712
|
-
prevDate = relativeSerie.values[v].d;
|
|
1713
|
-
else if (relativeSerie.values[v].d < prevDate) {
|
|
1714
|
-
correctOrder = false;
|
|
1715
|
-
break;
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
if (!correctOrder)
|
|
1719
|
-
relativeSerie.values.sort(function (d1, d2) { return d1.d.getTime() - d2.d.getTime(); });
|
|
1720
|
-
for (var v = 0; v < relativeSerie.values.length; v++) {
|
|
1721
|
-
var obj = relativeSerie.values[v];
|
|
1722
|
-
s.addData({ date: obj.d, value: obj.v });
|
|
1723
|
-
}
|
|
1724
|
-
});
|
|
1791
|
+
throw "Impossibile aggiornare i dati senza unire il dataset. Si prega di impostare [MergeDatasets] a true";
|
|
1725
1792
|
};
|
|
1726
1793
|
/** Partendo da dati divisi per seriue genera un dataset unito con la data come chiave e i vari valori dopo */
|
|
1727
1794
|
LineChartService.prototype.generateSingleDataset = function (data) {
|
|
@@ -1810,142 +1877,6 @@
|
|
|
1810
1877
|
return LineChartService;
|
|
1811
1878
|
}());
|
|
1812
1879
|
|
|
1813
|
-
/**
|
|
1814
|
-
* Classe il cui unico scopo è gestire il setup e rendering di un AreaChart
|
|
1815
|
-
*/
|
|
1816
|
-
var AreaChartService = /** @class */ (function () {
|
|
1817
|
-
/** @ignore */
|
|
1818
|
-
function AreaChartService(Adapter) {
|
|
1819
|
-
this.Adapter = Adapter;
|
|
1820
|
-
//******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
|
|
1821
|
-
//TODO: spostarla in un metodo di utilità (esfaenza/extensions)
|
|
1822
|
-
/** @ignore */
|
|
1823
|
-
this.executionTimers = {};
|
|
1824
|
-
}
|
|
1825
|
-
/**
|
|
1826
|
-
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un AreaChart
|
|
1827
|
-
*/
|
|
1828
|
-
AreaChartService.prototype.graphicate = function (data, settings) {
|
|
1829
|
-
var _this = this;
|
|
1830
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1831
|
-
if (settings.Timeline) {
|
|
1832
|
-
console.error("Timeline not supported for area chart");
|
|
1833
|
-
return null;
|
|
1834
|
-
}
|
|
1835
|
-
var dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
|
|
1836
|
-
var showTicks = settings.ShowTicks == null ? true : settings === null || settings === void 0 ? void 0 : settings.ShowTicks;
|
|
1837
|
-
var interval = dataConverted.interval;
|
|
1838
|
-
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
1839
|
-
am4core__namespace.options.autoDispose = true;
|
|
1840
|
-
this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
|
|
1841
|
-
var ChartInstanceCasted = this.ChartInstance;
|
|
1842
|
-
if (settings.Legend) {
|
|
1843
|
-
ChartInstanceCasted.legend = new am4charts__namespace.Legend();
|
|
1844
|
-
ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
|
|
1845
|
-
ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
|
|
1846
|
-
if (settings.LegendPadding) {
|
|
1847
|
-
var template = this.ChartInstance.legend.itemContainers.template;
|
|
1848
|
-
template.paddingTop = (_b = settings.LegendPadding.top) !== null && _b !== void 0 ? _b : 0;
|
|
1849
|
-
template.paddingBottom = (_c = settings.LegendPadding.bottom) !== null && _c !== void 0 ? _c : 0;
|
|
1850
|
-
template.paddingLeft = (_d = settings.LegendPadding.left) !== null && _d !== void 0 ? _d : 0;
|
|
1851
|
-
template.paddingRight = (_e = settings.LegendPadding.right) !== null && _e !== void 0 ? _e : 0;
|
|
1852
|
-
}
|
|
1853
|
-
}
|
|
1854
|
-
var yAxis = ChartInstanceCasted.yAxes.push(new am4charts__namespace.ValueAxis());
|
|
1855
|
-
yAxis.tooltip.disabled = true;
|
|
1856
|
-
if (settings.YAxisTitle) {
|
|
1857
|
-
yAxis.title.text = settings.YAxisTitle;
|
|
1858
|
-
yAxis.title.fontWeight = "bold";
|
|
1859
|
-
}
|
|
1860
|
-
yAxis.min = 0;
|
|
1861
|
-
var dateAxis = ChartInstanceCasted.xAxes.push(new am4charts__namespace.DateAxis());
|
|
1862
|
-
dateAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 50;
|
|
1863
|
-
dateAxis.startLocation = 0.5;
|
|
1864
|
-
dateAxis.endLocation = 0.5;
|
|
1865
|
-
if (settings.XAxisTitle) {
|
|
1866
|
-
dateAxis.title.text = settings.XAxisTitle;
|
|
1867
|
-
dateAxis.title.fontWeight = "bold";
|
|
1868
|
-
}
|
|
1869
|
-
if (showTicks) {
|
|
1870
|
-
dateAxis.renderer.ticks.template.disabled = false;
|
|
1871
|
-
dateAxis.renderer.ticks.template.strokeOpacity = 1;
|
|
1872
|
-
dateAxis.renderer.ticks.template.stroke = am4core__namespace.color("#495C43");
|
|
1873
|
-
dateAxis.renderer.ticks.template.strokeWidth = 2;
|
|
1874
|
-
dateAxis.renderer.ticks.template.length = 10;
|
|
1875
|
-
dateAxis.renderer.ticks.template.location = 0;
|
|
1876
|
-
}
|
|
1877
|
-
if (!!interval)
|
|
1878
|
-
dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
|
|
1879
|
-
// Unisco il dataset e tiro fuori i dati
|
|
1880
|
-
var chartData = [];
|
|
1881
|
-
var seriesToMakeCache = {};
|
|
1882
|
-
var seriesToMake = [];
|
|
1883
|
-
for (var i = 0; i < dataConverted.groups.length; i++) {
|
|
1884
|
-
var group = dataConverted.groups[i];
|
|
1885
|
-
var dataItem = { date: group.name };
|
|
1886
|
-
for (var ii = 0; ii < group.values.length; ii++) {
|
|
1887
|
-
var val = group.values[ii];
|
|
1888
|
-
dataItem[val.k] = val.v;
|
|
1889
|
-
if (!seriesToMakeCache[val.k]) {
|
|
1890
|
-
seriesToMakeCache[val.k] = true;
|
|
1891
|
-
seriesToMake.push(val.k);
|
|
1892
|
-
}
|
|
1893
|
-
}
|
|
1894
|
-
chartData.push(dataItem);
|
|
1895
|
-
}
|
|
1896
|
-
ChartInstanceCasted.data = chartData;
|
|
1897
|
-
//---------------------------------------------------------
|
|
1898
|
-
seriesToMake.forEach(function (s) { _this.createSeries(ChartInstanceCasted, s); });
|
|
1899
|
-
ChartInstanceCasted.cursor = new am4charts__namespace.XYCursor();
|
|
1900
|
-
ChartInstanceCasted.cursor.xAxis = dateAxis;
|
|
1901
|
-
dateAxis.events.on("startchanged", function (t) { return _this.emitSelectionChanged(t, settings); });
|
|
1902
|
-
dateAxis.events.on("endchanged", function (t) { return _this.emitSelectionChanged(t, settings); });
|
|
1903
|
-
return this;
|
|
1904
|
-
};
|
|
1905
|
-
/** @ignore */
|
|
1906
|
-
AreaChartService.prototype.refreshData = function (data) {
|
|
1907
|
-
//TODO:IMPL
|
|
1908
|
-
};
|
|
1909
|
-
/** @ignore */
|
|
1910
|
-
AreaChartService.prototype.emitSelectionChanged = function (ev, settings) {
|
|
1911
|
-
if (settings.OnSelectionChangedCallback) {
|
|
1912
|
-
this.throttla("selchange", function () {
|
|
1913
|
-
var axis = ev.target;
|
|
1914
|
-
var start = new Date(axis.minZoomed);
|
|
1915
|
-
var end = new Date(axis.maxZoomed);
|
|
1916
|
-
var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
|
|
1917
|
-
settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
|
|
1918
|
-
}, 150);
|
|
1919
|
-
}
|
|
1920
|
-
};
|
|
1921
|
-
/** @ignore */
|
|
1922
|
-
AreaChartService.prototype.createSeries = function (chart, name) {
|
|
1923
|
-
var series = chart.series.push(new am4charts__namespace.LineSeries());
|
|
1924
|
-
series.dataFields.dateX = "date";
|
|
1925
|
-
series.name = name[0].toUpperCase() + name.slice(1);
|
|
1926
|
-
series.dataFields.valueY = name;
|
|
1927
|
-
series.tooltipText = "[#000]{valueY.value}[/]";
|
|
1928
|
-
//series.tooltip.background.fill = am4core.color("#FFF");
|
|
1929
|
-
series.tooltip.getStrokeFromObject = true;
|
|
1930
|
-
series.tooltip.background.strokeWidth = 3;
|
|
1931
|
-
series.tooltip.getFillFromObject = false;
|
|
1932
|
-
series.fillOpacity = 0.6;
|
|
1933
|
-
series.strokeWidth = 2;
|
|
1934
|
-
series.stacked = true;
|
|
1935
|
-
return series;
|
|
1936
|
-
};
|
|
1937
|
-
/** @ignore */
|
|
1938
|
-
AreaChartService.prototype.throttla = function (id, func, throttleTime) {
|
|
1939
|
-
var _this = this;
|
|
1940
|
-
//Se ho la funzione che vuole eseguire ripulisco quel timeout
|
|
1941
|
-
if (this.executionTimers[id])
|
|
1942
|
-
clearTimeout(this.executionTimers[id]);
|
|
1943
|
-
//Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
|
|
1944
|
-
this.executionTimers[id] = setTimeout(function () { func(); _this.executionTimers[id] = null; }, throttleTime);
|
|
1945
|
-
};
|
|
1946
|
-
return AreaChartService;
|
|
1947
|
-
}());
|
|
1948
|
-
|
|
1949
1880
|
/**
|
|
1950
1881
|
* Classe il cui unico scopo è gestire il setup e rendering di un PieChart
|
|
1951
1882
|
*/
|
|
@@ -2058,15 +1989,13 @@
|
|
|
2058
1989
|
}());
|
|
2059
1990
|
|
|
2060
1991
|
/**
|
|
2061
|
-
* Classe il cui unico scopo è gestire il setup e rendering di un
|
|
1992
|
+
* Classe il cui unico scopo è gestire il setup e rendering di un VerticalChart
|
|
2062
1993
|
*/
|
|
2063
|
-
var
|
|
1994
|
+
var VerticalChartService = /** @class */ (function () {
|
|
2064
1995
|
/** @ignore */
|
|
2065
|
-
function
|
|
1996
|
+
function VerticalChartService(Adapter) {
|
|
2066
1997
|
this.Adapter = Adapter;
|
|
2067
1998
|
/** @ignore */
|
|
2068
|
-
this.DefaultGroupPaddingPercentage = 5;
|
|
2069
|
-
/** @ignore */
|
|
2070
1999
|
this.dangerZone = 50;
|
|
2071
2000
|
/** @ignore */
|
|
2072
2001
|
this.LabelWidth = 150;
|
|
@@ -2078,11 +2007,11 @@
|
|
|
2078
2007
|
this.DefaultColumnWidthPercentage = 85;
|
|
2079
2008
|
}
|
|
2080
2009
|
/**
|
|
2081
|
-
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un
|
|
2010
|
+
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un VerticalChart
|
|
2082
2011
|
*/
|
|
2083
|
-
|
|
2012
|
+
VerticalChartService.prototype.graphicate = function (data, settings) {
|
|
2084
2013
|
var _this = this;
|
|
2085
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
2014
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2086
2015
|
if (settings.Timeline) {
|
|
2087
2016
|
console.error("Timeline not supported for vertical chart");
|
|
2088
2017
|
return null;
|
|
@@ -2091,6 +2020,8 @@
|
|
|
2091
2020
|
am4core__namespace.options.autoDispose = true;
|
|
2092
2021
|
this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
|
|
2093
2022
|
var ChartInstanceCasted = this.ChartInstance;
|
|
2023
|
+
var dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
|
|
2024
|
+
ChartInstanceCasted.data = dataConverted.values;
|
|
2094
2025
|
if (settings.Legend) {
|
|
2095
2026
|
ChartInstanceCasted.legend = new am4charts__namespace.Legend();
|
|
2096
2027
|
ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
|
|
@@ -2113,15 +2044,12 @@
|
|
|
2113
2044
|
categoryAxis.title.text = settings.XAxisTitle;
|
|
2114
2045
|
categoryAxis.title.fontWeight = "bold";
|
|
2115
2046
|
}
|
|
2116
|
-
|
|
2117
|
-
categoryAxis.dataFields.category = 'key';
|
|
2118
|
-
categoryAxis.renderer.cellStartLocation = am4core__namespace.percent((_f = settings.GroupPaddingPercentage) !== null && _f !== void 0 ? _f : this.DefaultGroupPaddingPercentage).value;
|
|
2119
|
-
categoryAxis.renderer.cellEndLocation = am4core__namespace.percent(100 - ((_g = settings.GroupPaddingPercentage) !== null && _g !== void 0 ? _g : this.DefaultGroupPaddingPercentage)).value;
|
|
2047
|
+
categoryAxis.dataFields.category = "k";
|
|
2120
2048
|
categoryAxis.renderer.grid.template.location = 0;
|
|
2121
|
-
categoryAxis.renderer.minGridDistance = (
|
|
2049
|
+
categoryAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 30;
|
|
2122
2050
|
var label = categoryAxis.renderer.labels.template;
|
|
2123
2051
|
label.truncate = true;
|
|
2124
|
-
label.maxWidth = (
|
|
2052
|
+
label.maxWidth = (_g = settings.LabelWidth) !== null && _g !== void 0 ? _g : this.LabelWidth;
|
|
2125
2053
|
label.tooltipText = "{category}";
|
|
2126
2054
|
if ((settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) == null ? true : settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) {
|
|
2127
2055
|
categoryAxis.events.on("sizechanged", function (ev) {
|
|
@@ -2145,90 +2073,36 @@
|
|
|
2145
2073
|
}
|
|
2146
2074
|
});
|
|
2147
2075
|
}
|
|
2148
|
-
|
|
2149
|
-
var
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
ChartInstanceCasted.data = dataConverted;
|
|
2160
|
-
if (dataPreConverted.colorInfos)
|
|
2161
|
-
ChartInstanceCasted.colors.list = dataPreConverted.colorInfos.map(function (c) { return am4core__namespace.color(c.color); });
|
|
2162
|
-
//Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
|
|
2163
|
-
for (var prop in dataConverted[0])
|
|
2164
|
-
if (prop !== "key")
|
|
2165
|
-
this.createSeries(ChartInstanceCasted, settings, prop, prop);
|
|
2076
|
+
// Create series
|
|
2077
|
+
var series = ChartInstanceCasted.series.push(new am4charts__namespace.ColumnSeries());
|
|
2078
|
+
series.dataFields.valueY = "v";
|
|
2079
|
+
series.dataFields.categoryX = "k";
|
|
2080
|
+
series.name = "";
|
|
2081
|
+
series.columns.template.tooltipText = "{categoryX}: [bold]{valueY}[/]";
|
|
2082
|
+
series.columns.template.fillOpacity = .8;
|
|
2083
|
+
series.columns.template.width = am4core__namespace.percent((_h = settings.ColumnWidthPercentage) !== null && _h !== void 0 ? _h : this.DefaultColumnWidthPercentage);
|
|
2084
|
+
var columnTemplate = series.columns.template;
|
|
2085
|
+
columnTemplate.strokeWidth = 2;
|
|
2086
|
+
columnTemplate.strokeOpacity = 1;
|
|
2166
2087
|
return this;
|
|
2167
2088
|
};
|
|
2168
2089
|
/** @ignore */
|
|
2169
|
-
|
|
2090
|
+
VerticalChartService.prototype.refreshData = function (data) {
|
|
2170
2091
|
//TODO:IMPL
|
|
2171
2092
|
};
|
|
2172
|
-
|
|
2173
|
-
Vertical2DChartService.prototype.createSeries = function (chart, settings, value, name) {
|
|
2174
|
-
var _this = this;
|
|
2175
|
-
var _a;
|
|
2176
|
-
var series = chart.series.push(new am4charts__namespace.ColumnSeries());
|
|
2177
|
-
series.dataFields.valueY = value;
|
|
2178
|
-
series.dataFields.categoryX = 'key';
|
|
2179
|
-
series.name = name;
|
|
2180
|
-
series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
|
|
2181
|
-
series.columns.template.fillOpacity = .8;
|
|
2182
|
-
series.columns.template.width = am4core__namespace.percent((_a = settings.ColumnWidthPercentage) !== null && _a !== void 0 ? _a : this.DefaultColumnWidthPercentage);
|
|
2183
|
-
series.events.on("hidden", function () { return _this.arrangeColumns; });
|
|
2184
|
-
series.events.on("shown", function () { return _this.arrangeColumns; });
|
|
2185
|
-
return series;
|
|
2186
|
-
};
|
|
2187
|
-
/** @ignore */
|
|
2188
|
-
Vertical2DChartService.prototype.arrangeColumns = function () {
|
|
2189
|
-
var ChartInstanceCasted = this.ChartInstance;
|
|
2190
|
-
var series = ChartInstanceCasted.series.getIndex(0);
|
|
2191
|
-
var xAxis = ChartInstanceCasted.xAxes.getIndex(0);
|
|
2192
|
-
var w = 1 - xAxis.renderer.cellStartLocation - (1 - xAxis.renderer.cellEndLocation);
|
|
2193
|
-
if (series.dataItems.length > 1) {
|
|
2194
|
-
var x0 = xAxis.getX(series.dataItems.getIndex(0), "categoryX");
|
|
2195
|
-
var x1 = xAxis.getX(series.dataItems.getIndex(1), "categoryX");
|
|
2196
|
-
var delta_1 = ((x1 - x0) / ChartInstanceCasted.series.length) * w;
|
|
2197
|
-
if (am4core__namespace.isNumber(delta_1)) {
|
|
2198
|
-
var middle_1 = ChartInstanceCasted.series.length / 2;
|
|
2199
|
-
var newIndex_1 = 0;
|
|
2200
|
-
ChartInstanceCasted.series.each(function (series) {
|
|
2201
|
-
if (!series.isHidden && !series.isHiding) {
|
|
2202
|
-
series.dummyData = newIndex_1;
|
|
2203
|
-
newIndex_1++;
|
|
2204
|
-
}
|
|
2205
|
-
else {
|
|
2206
|
-
series.dummyData = ChartInstanceCasted.series.indexOf(series);
|
|
2207
|
-
}
|
|
2208
|
-
});
|
|
2209
|
-
var visibleCount = newIndex_1;
|
|
2210
|
-
var newMiddle_1 = visibleCount / 2;
|
|
2211
|
-
ChartInstanceCasted.series.each(function (series) {
|
|
2212
|
-
var trueIndex = ChartInstanceCasted.series.indexOf(series);
|
|
2213
|
-
var newIndex = series.dummyData;
|
|
2214
|
-
var dx = (newIndex - trueIndex + middle_1 - newMiddle_1) * delta_1;
|
|
2215
|
-
series.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
|
|
2216
|
-
series.bulletsContainer.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
|
|
2217
|
-
});
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
};
|
|
2221
|
-
return Vertical2DChartService;
|
|
2093
|
+
return VerticalChartService;
|
|
2222
2094
|
}());
|
|
2223
2095
|
|
|
2224
2096
|
/**
|
|
2225
|
-
* Classe il cui unico scopo è gestire il setup e rendering di un
|
|
2097
|
+
* Classe il cui unico scopo è gestire il setup e rendering di un Vertical2DChart
|
|
2226
2098
|
*/
|
|
2227
|
-
var
|
|
2099
|
+
var Vertical2DChartService = /** @class */ (function () {
|
|
2228
2100
|
/** @ignore */
|
|
2229
|
-
function
|
|
2101
|
+
function Vertical2DChartService(Adapter) {
|
|
2230
2102
|
this.Adapter = Adapter;
|
|
2231
2103
|
/** @ignore */
|
|
2104
|
+
this.DefaultGroupPaddingPercentage = 5;
|
|
2105
|
+
/** @ignore */
|
|
2232
2106
|
this.dangerZone = 50;
|
|
2233
2107
|
/** @ignore */
|
|
2234
2108
|
this.LabelWidth = 150;
|
|
@@ -2240,11 +2114,11 @@
|
|
|
2240
2114
|
this.DefaultColumnWidthPercentage = 85;
|
|
2241
2115
|
}
|
|
2242
2116
|
/**
|
|
2243
|
-
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un
|
|
2117
|
+
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un Vertical2DChart
|
|
2244
2118
|
*/
|
|
2245
|
-
|
|
2119
|
+
Vertical2DChartService.prototype.graphicate = function (data, settings) {
|
|
2246
2120
|
var _this = this;
|
|
2247
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2121
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2248
2122
|
if (settings.Timeline) {
|
|
2249
2123
|
console.error("Timeline not supported for vertical chart");
|
|
2250
2124
|
return null;
|
|
@@ -2253,8 +2127,6 @@
|
|
|
2253
2127
|
am4core__namespace.options.autoDispose = true;
|
|
2254
2128
|
this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
|
|
2255
2129
|
var ChartInstanceCasted = this.ChartInstance;
|
|
2256
|
-
var dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
|
|
2257
|
-
ChartInstanceCasted.data = dataConverted.values;
|
|
2258
2130
|
if (settings.Legend) {
|
|
2259
2131
|
ChartInstanceCasted.legend = new am4charts__namespace.Legend();
|
|
2260
2132
|
ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
|
|
@@ -2277,12 +2149,15 @@
|
|
|
2277
2149
|
categoryAxis.title.text = settings.XAxisTitle;
|
|
2278
2150
|
categoryAxis.title.fontWeight = "bold";
|
|
2279
2151
|
}
|
|
2280
|
-
|
|
2152
|
+
yAxis.min = 0;
|
|
2153
|
+
categoryAxis.dataFields.category = 'key';
|
|
2154
|
+
categoryAxis.renderer.cellStartLocation = am4core__namespace.percent((_f = settings.GroupPaddingPercentage) !== null && _f !== void 0 ? _f : this.DefaultGroupPaddingPercentage).value;
|
|
2155
|
+
categoryAxis.renderer.cellEndLocation = am4core__namespace.percent(100 - ((_g = settings.GroupPaddingPercentage) !== null && _g !== void 0 ? _g : this.DefaultGroupPaddingPercentage)).value;
|
|
2281
2156
|
categoryAxis.renderer.grid.template.location = 0;
|
|
2282
|
-
categoryAxis.renderer.minGridDistance = (
|
|
2157
|
+
categoryAxis.renderer.minGridDistance = (_h = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _h !== void 0 ? _h : 30;
|
|
2283
2158
|
var label = categoryAxis.renderer.labels.template;
|
|
2284
2159
|
label.truncate = true;
|
|
2285
|
-
label.maxWidth = (
|
|
2160
|
+
label.maxWidth = (_j = settings.LabelWidth) !== null && _j !== void 0 ? _j : this.LabelWidth;
|
|
2286
2161
|
label.tooltipText = "{category}";
|
|
2287
2162
|
if ((settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) == null ? true : settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) {
|
|
2288
2163
|
categoryAxis.events.on("sizechanged", function (ev) {
|
|
@@ -2306,24 +2181,80 @@
|
|
|
2306
2181
|
}
|
|
2307
2182
|
});
|
|
2308
2183
|
}
|
|
2309
|
-
|
|
2310
|
-
var
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2184
|
+
var dataPreConverted = this.Adapter ? this.Adapter.adaptDataForVertical2DChart(data) : data;
|
|
2185
|
+
var dataConverted = [];
|
|
2186
|
+
for (var i = 0; i < dataPreConverted.groups.length; i++) {
|
|
2187
|
+
var item = dataPreConverted.groups[i];
|
|
2188
|
+
var obj = { key: item.name };
|
|
2189
|
+
for (var p = 0; p < item.values.length; p++) {
|
|
2190
|
+
var value = item.values[p];
|
|
2191
|
+
obj[value.k] = value.v;
|
|
2192
|
+
}
|
|
2193
|
+
dataConverted.push(obj);
|
|
2194
|
+
}
|
|
2195
|
+
ChartInstanceCasted.data = dataConverted;
|
|
2196
|
+
if (dataPreConverted.colorInfos)
|
|
2197
|
+
ChartInstanceCasted.colors.list = dataPreConverted.colorInfos.map(function (c) { return am4core__namespace.color(c.color); });
|
|
2198
|
+
//Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
|
|
2199
|
+
for (var prop in dataConverted[0])
|
|
2200
|
+
if (prop !== "key")
|
|
2201
|
+
this.createSeries(ChartInstanceCasted, settings, prop, prop);
|
|
2202
|
+
return this;
|
|
2203
|
+
};
|
|
2204
|
+
/** @ignore */
|
|
2205
|
+
Vertical2DChartService.prototype.refreshData = function (data) {
|
|
2206
|
+
//TODO:IMPL
|
|
2207
|
+
};
|
|
2208
|
+
/** @ignore */
|
|
2209
|
+
Vertical2DChartService.prototype.createSeries = function (chart, settings, value, name) {
|
|
2210
|
+
var _this = this;
|
|
2211
|
+
var _a;
|
|
2212
|
+
var series = chart.series.push(new am4charts__namespace.ColumnSeries());
|
|
2213
|
+
series.dataFields.valueY = value;
|
|
2214
|
+
series.dataFields.categoryX = 'key';
|
|
2215
|
+
series.name = name;
|
|
2216
|
+
series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
|
|
2217
|
+
series.columns.template.fillOpacity = .8;
|
|
2218
|
+
series.columns.template.width = am4core__namespace.percent((_a = settings.ColumnWidthPercentage) !== null && _a !== void 0 ? _a : this.DefaultColumnWidthPercentage);
|
|
2219
|
+
series.events.on("hidden", function () { return _this.arrangeColumns; });
|
|
2220
|
+
series.events.on("shown", function () { return _this.arrangeColumns; });
|
|
2221
|
+
return series;
|
|
2222
|
+
};
|
|
2223
|
+
/** @ignore */
|
|
2224
|
+
Vertical2DChartService.prototype.arrangeColumns = function () {
|
|
2225
|
+
var ChartInstanceCasted = this.ChartInstance;
|
|
2226
|
+
var series = ChartInstanceCasted.series.getIndex(0);
|
|
2227
|
+
var xAxis = ChartInstanceCasted.xAxes.getIndex(0);
|
|
2228
|
+
var w = 1 - xAxis.renderer.cellStartLocation - (1 - xAxis.renderer.cellEndLocation);
|
|
2229
|
+
if (series.dataItems.length > 1) {
|
|
2230
|
+
var x0 = xAxis.getX(series.dataItems.getIndex(0), "categoryX");
|
|
2231
|
+
var x1 = xAxis.getX(series.dataItems.getIndex(1), "categoryX");
|
|
2232
|
+
var delta_1 = ((x1 - x0) / ChartInstanceCasted.series.length) * w;
|
|
2233
|
+
if (am4core__namespace.isNumber(delta_1)) {
|
|
2234
|
+
var middle_1 = ChartInstanceCasted.series.length / 2;
|
|
2235
|
+
var newIndex_1 = 0;
|
|
2236
|
+
ChartInstanceCasted.series.each(function (series) {
|
|
2237
|
+
if (!series.isHidden && !series.isHiding) {
|
|
2238
|
+
series.dummyData = newIndex_1;
|
|
2239
|
+
newIndex_1++;
|
|
2240
|
+
}
|
|
2241
|
+
else {
|
|
2242
|
+
series.dummyData = ChartInstanceCasted.series.indexOf(series);
|
|
2243
|
+
}
|
|
2244
|
+
});
|
|
2245
|
+
var visibleCount = newIndex_1;
|
|
2246
|
+
var newMiddle_1 = visibleCount / 2;
|
|
2247
|
+
ChartInstanceCasted.series.each(function (series) {
|
|
2248
|
+
var trueIndex = ChartInstanceCasted.series.indexOf(series);
|
|
2249
|
+
var newIndex = series.dummyData;
|
|
2250
|
+
var dx = (newIndex - trueIndex + middle_1 - newMiddle_1) * delta_1;
|
|
2251
|
+
series.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
|
|
2252
|
+
series.bulletsContainer.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2325
2256
|
};
|
|
2326
|
-
return
|
|
2257
|
+
return Vertical2DChartService;
|
|
2327
2258
|
}());
|
|
2328
2259
|
|
|
2329
2260
|
/**
|
|
@@ -2453,6 +2384,142 @@
|
|
|
2453
2384
|
return VerticalStackedChartService;
|
|
2454
2385
|
}());
|
|
2455
2386
|
|
|
2387
|
+
/**
|
|
2388
|
+
* Classe il cui unico scopo è gestire il setup e rendering di un AreaChart
|
|
2389
|
+
*/
|
|
2390
|
+
var AreaChartService = /** @class */ (function () {
|
|
2391
|
+
/** @ignore */
|
|
2392
|
+
function AreaChartService(Adapter) {
|
|
2393
|
+
this.Adapter = Adapter;
|
|
2394
|
+
//******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
|
|
2395
|
+
//TODO: spostarla in un metodo di utilità (esfaenza/extensions)
|
|
2396
|
+
/** @ignore */
|
|
2397
|
+
this.executionTimers = {};
|
|
2398
|
+
}
|
|
2399
|
+
/**
|
|
2400
|
+
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un AreaChart
|
|
2401
|
+
*/
|
|
2402
|
+
AreaChartService.prototype.graphicate = function (data, settings) {
|
|
2403
|
+
var _this = this;
|
|
2404
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2405
|
+
if (settings.Timeline) {
|
|
2406
|
+
console.error("Timeline not supported for area chart");
|
|
2407
|
+
return null;
|
|
2408
|
+
}
|
|
2409
|
+
var dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
|
|
2410
|
+
var showTicks = settings.ShowTicks == null ? true : settings === null || settings === void 0 ? void 0 : settings.ShowTicks;
|
|
2411
|
+
var interval = dataConverted.interval;
|
|
2412
|
+
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
2413
|
+
am4core__namespace.options.autoDispose = true;
|
|
2414
|
+
this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
|
|
2415
|
+
var ChartInstanceCasted = this.ChartInstance;
|
|
2416
|
+
if (settings.Legend) {
|
|
2417
|
+
ChartInstanceCasted.legend = new am4charts__namespace.Legend();
|
|
2418
|
+
ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
|
|
2419
|
+
ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
|
|
2420
|
+
if (settings.LegendPadding) {
|
|
2421
|
+
var template = this.ChartInstance.legend.itemContainers.template;
|
|
2422
|
+
template.paddingTop = (_b = settings.LegendPadding.top) !== null && _b !== void 0 ? _b : 0;
|
|
2423
|
+
template.paddingBottom = (_c = settings.LegendPadding.bottom) !== null && _c !== void 0 ? _c : 0;
|
|
2424
|
+
template.paddingLeft = (_d = settings.LegendPadding.left) !== null && _d !== void 0 ? _d : 0;
|
|
2425
|
+
template.paddingRight = (_e = settings.LegendPadding.right) !== null && _e !== void 0 ? _e : 0;
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
var yAxis = ChartInstanceCasted.yAxes.push(new am4charts__namespace.ValueAxis());
|
|
2429
|
+
yAxis.tooltip.disabled = true;
|
|
2430
|
+
if (settings.YAxisTitle) {
|
|
2431
|
+
yAxis.title.text = settings.YAxisTitle;
|
|
2432
|
+
yAxis.title.fontWeight = "bold";
|
|
2433
|
+
}
|
|
2434
|
+
yAxis.min = 0;
|
|
2435
|
+
var dateAxis = ChartInstanceCasted.xAxes.push(new am4charts__namespace.DateAxis());
|
|
2436
|
+
dateAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 50;
|
|
2437
|
+
dateAxis.startLocation = 0.5;
|
|
2438
|
+
dateAxis.endLocation = 0.5;
|
|
2439
|
+
if (settings.XAxisTitle) {
|
|
2440
|
+
dateAxis.title.text = settings.XAxisTitle;
|
|
2441
|
+
dateAxis.title.fontWeight = "bold";
|
|
2442
|
+
}
|
|
2443
|
+
if (showTicks) {
|
|
2444
|
+
dateAxis.renderer.ticks.template.disabled = false;
|
|
2445
|
+
dateAxis.renderer.ticks.template.strokeOpacity = 1;
|
|
2446
|
+
dateAxis.renderer.ticks.template.stroke = am4core__namespace.color("#495C43");
|
|
2447
|
+
dateAxis.renderer.ticks.template.strokeWidth = 2;
|
|
2448
|
+
dateAxis.renderer.ticks.template.length = 10;
|
|
2449
|
+
dateAxis.renderer.ticks.template.location = 0;
|
|
2450
|
+
}
|
|
2451
|
+
if (!!interval)
|
|
2452
|
+
dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
|
|
2453
|
+
// Unisco il dataset e tiro fuori i dati
|
|
2454
|
+
var chartData = [];
|
|
2455
|
+
var seriesToMakeCache = {};
|
|
2456
|
+
var seriesToMake = [];
|
|
2457
|
+
for (var i = 0; i < dataConverted.groups.length; i++) {
|
|
2458
|
+
var group = dataConverted.groups[i];
|
|
2459
|
+
var dataItem = { date: group.name };
|
|
2460
|
+
for (var ii = 0; ii < group.values.length; ii++) {
|
|
2461
|
+
var val = group.values[ii];
|
|
2462
|
+
dataItem[val.k] = val.v;
|
|
2463
|
+
if (!seriesToMakeCache[val.k]) {
|
|
2464
|
+
seriesToMakeCache[val.k] = true;
|
|
2465
|
+
seriesToMake.push(val.k);
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
chartData.push(dataItem);
|
|
2469
|
+
}
|
|
2470
|
+
ChartInstanceCasted.data = chartData;
|
|
2471
|
+
//---------------------------------------------------------
|
|
2472
|
+
seriesToMake.forEach(function (s) { _this.createSeries(ChartInstanceCasted, s); });
|
|
2473
|
+
ChartInstanceCasted.cursor = new am4charts__namespace.XYCursor();
|
|
2474
|
+
ChartInstanceCasted.cursor.xAxis = dateAxis;
|
|
2475
|
+
dateAxis.events.on("startchanged", function (t) { return _this.emitSelectionChanged(t, settings); });
|
|
2476
|
+
dateAxis.events.on("endchanged", function (t) { return _this.emitSelectionChanged(t, settings); });
|
|
2477
|
+
return this;
|
|
2478
|
+
};
|
|
2479
|
+
/** @ignore */
|
|
2480
|
+
AreaChartService.prototype.refreshData = function (data) {
|
|
2481
|
+
//TODO:IMPL
|
|
2482
|
+
};
|
|
2483
|
+
/** @ignore */
|
|
2484
|
+
AreaChartService.prototype.emitSelectionChanged = function (ev, settings) {
|
|
2485
|
+
if (settings.OnSelectionChangedCallback) {
|
|
2486
|
+
this.throttla("selchange", function () {
|
|
2487
|
+
var axis = ev.target;
|
|
2488
|
+
var start = new Date(axis.minZoomed);
|
|
2489
|
+
var end = new Date(axis.maxZoomed);
|
|
2490
|
+
var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
|
|
2491
|
+
settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
|
|
2492
|
+
}, 150);
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
/** @ignore */
|
|
2496
|
+
AreaChartService.prototype.createSeries = function (chart, name) {
|
|
2497
|
+
var series = chart.series.push(new am4charts__namespace.LineSeries());
|
|
2498
|
+
series.dataFields.dateX = "date";
|
|
2499
|
+
series.name = name[0].toUpperCase() + name.slice(1);
|
|
2500
|
+
series.dataFields.valueY = name;
|
|
2501
|
+
series.tooltipText = "[#000]{valueY.value}[/]";
|
|
2502
|
+
//series.tooltip.background.fill = am4core.color("#FFF");
|
|
2503
|
+
series.tooltip.getStrokeFromObject = true;
|
|
2504
|
+
series.tooltip.background.strokeWidth = 3;
|
|
2505
|
+
series.tooltip.getFillFromObject = false;
|
|
2506
|
+
series.fillOpacity = 0.6;
|
|
2507
|
+
series.strokeWidth = 2;
|
|
2508
|
+
series.stacked = true;
|
|
2509
|
+
return series;
|
|
2510
|
+
};
|
|
2511
|
+
/** @ignore */
|
|
2512
|
+
AreaChartService.prototype.throttla = function (id, func, throttleTime) {
|
|
2513
|
+
var _this = this;
|
|
2514
|
+
//Se ho la funzione che vuole eseguire ripulisco quel timeout
|
|
2515
|
+
if (this.executionTimers[id])
|
|
2516
|
+
clearTimeout(this.executionTimers[id]);
|
|
2517
|
+
//Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
|
|
2518
|
+
this.executionTimers[id] = setTimeout(function () { func(); _this.executionTimers[id] = null; }, throttleTime);
|
|
2519
|
+
};
|
|
2520
|
+
return AreaChartService;
|
|
2521
|
+
}());
|
|
2522
|
+
|
|
2456
2523
|
/**
|
|
2457
2524
|
* Componente specifico per la graficazione di un qualsiasi tipo di grafico.
|
|
2458
2525
|
*
|
|
@@ -3071,92 +3138,6 @@
|
|
|
3071
3138
|
return PagedChartData;
|
|
3072
3139
|
}());
|
|
3073
3140
|
|
|
3074
|
-
/**
|
|
3075
|
-
* Componente che si occupa della paginazione dei grafici qualora servisse
|
|
3076
|
-
*/
|
|
3077
|
-
var PageChartSelector = /** @class */ (function () {
|
|
3078
|
-
function PageChartSelector() {
|
|
3079
|
-
/**
|
|
3080
|
-
* Indica un cambio di pagina ed emette un oggetto con i dati attuali e l'indice attuale.
|
|
3081
|
-
*
|
|
3082
|
-
* Qualora la proprietà **data** fosse null indica un evento di "loading"
|
|
3083
|
-
*/
|
|
3084
|
-
this.onPageChange = new core.EventEmitter();
|
|
3085
|
-
}
|
|
3086
|
-
/**
|
|
3087
|
-
* @ignore
|
|
3088
|
-
*/
|
|
3089
|
-
PageChartSelector.prototype.ngOnChanges = function () {
|
|
3090
|
-
if (!(this.Items || this.Dtos) || (this.Items || this.Dtos).length == 0)
|
|
3091
|
-
throw new Error("Chart array cannot be empty!");
|
|
3092
|
-
var idx = (this.StartIndex || 0);
|
|
3093
|
-
this.currentindex = idx;
|
|
3094
|
-
this.currentpage = idx + 1;
|
|
3095
|
-
this.handlePageChange();
|
|
3096
|
-
};
|
|
3097
|
-
/**
|
|
3098
|
-
* Gestisce un cambio pagina inviando al callback **onPageChange** i dati attuali (siano essi il Dto per il caricamento dati i
|
|
3099
|
-
* o i dati già presenti) e l'indice di visualizzazione
|
|
3100
|
-
*/
|
|
3101
|
-
PageChartSelector.prototype.handlePageChange = function () {
|
|
3102
|
-
this.finalIndex = this.currentpage - 1;
|
|
3103
|
-
this.currentindex = this.currentpage - 1;
|
|
3104
|
-
var data = this.Items && this.Items.length > 0 ? this.Items[this.finalIndex].data : this.Dtos[this.finalIndex];
|
|
3105
|
-
this.onPageChange.emit({ data: data, index: this.finalIndex });
|
|
3106
|
-
};
|
|
3107
|
-
/**
|
|
3108
|
-
* Visualizza il grafico successivo
|
|
3109
|
-
*/
|
|
3110
|
-
PageChartSelector.prototype.Next = function () {
|
|
3111
|
-
var _this = this;
|
|
3112
|
-
// Per passare da page a index è sempre un -1
|
|
3113
|
-
this.currentpage++;
|
|
3114
|
-
this.onPageChange.emit({ data: null, index: this.currentpage - 1 });
|
|
3115
|
-
// Delay pseudo-intelligente per click compulsivi.
|
|
3116
|
-
// Se dopo questo delay sono andato avanti solo di 1 effettuo il callback altrimenti incremento l'indice
|
|
3117
|
-
setTimeout(function () {
|
|
3118
|
-
if (_this.currentindex == _this.currentpage - 2)
|
|
3119
|
-
_this.handlePageChange();
|
|
3120
|
-
else
|
|
3121
|
-
_this.currentindex++;
|
|
3122
|
-
}, this.BrowseDelayMs);
|
|
3123
|
-
};
|
|
3124
|
-
/**
|
|
3125
|
-
* Visualizza il grafico precedente
|
|
3126
|
-
*/
|
|
3127
|
-
PageChartSelector.prototype.Previous = function () {
|
|
3128
|
-
var _this = this;
|
|
3129
|
-
// Per passare da page a index è sempre un -1
|
|
3130
|
-
this.currentpage--;
|
|
3131
|
-
this.onPageChange.emit({ data: null, index: this.currentpage - 1 });
|
|
3132
|
-
// Delay pseudo-intelligente per click compulsivi.
|
|
3133
|
-
// Se dopo questo delay sono andato indietro solo di 1 effettuo il callback altrimenti decremento l'indice
|
|
3134
|
-
setTimeout(function () {
|
|
3135
|
-
if (_this.currentindex == _this.currentpage)
|
|
3136
|
-
_this.handlePageChange();
|
|
3137
|
-
else
|
|
3138
|
-
_this.currentindex--;
|
|
3139
|
-
}, this.BrowseDelayMs);
|
|
3140
|
-
};
|
|
3141
|
-
return PageChartSelector;
|
|
3142
|
-
}());
|
|
3143
|
-
PageChartSelector.decorators = [
|
|
3144
|
-
{ type: core.Component, args: [{
|
|
3145
|
-
selector: "chart-pager",
|
|
3146
|
-
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>",
|
|
3147
|
-
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
3148
|
-
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:medium none currentcolor}.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}"]
|
|
3149
|
-
},] }
|
|
3150
|
-
];
|
|
3151
|
-
PageChartSelector.propDecorators = {
|
|
3152
|
-
Items: [{ type: core.Input }],
|
|
3153
|
-
Dtos: [{ type: core.Input }],
|
|
3154
|
-
BrowseDelayMs: [{ type: core.Input }],
|
|
3155
|
-
StartIndex: [{ type: core.Input }],
|
|
3156
|
-
onPageChange: [{ type: core.Output }],
|
|
3157
|
-
headerInner_tr: [{ type: core.ContentChild, args: ['header_inner', { static: false },] }]
|
|
3158
|
-
};
|
|
3159
|
-
|
|
3160
3141
|
/** Componenti esportati dal modulo */
|
|
3161
3142
|
var COMPONENTS = [
|
|
3162
3143
|
EsChartComponent,
|
|
@@ -3227,6 +3208,7 @@
|
|
|
3227
3208
|
exports.LineChartData = LineChartData;
|
|
3228
3209
|
exports.LineChartSettings = LineChartSettings;
|
|
3229
3210
|
exports.LineSerie = LineSerie;
|
|
3211
|
+
exports.PageChartSelector = PageChartSelector;
|
|
3230
3212
|
exports.PagedChartData = PagedChartData;
|
|
3231
3213
|
exports.PieChartData = PieChartData;
|
|
3232
3214
|
exports.PieChartSettings = PieChartSettings;
|
|
@@ -3236,22 +3218,12 @@
|
|
|
3236
3218
|
exports.VerticalChartSettings = VerticalChartSettings;
|
|
3237
3219
|
exports.VerticalStackedChartData = VerticalStackedChartData;
|
|
3238
3220
|
exports.VerticalStackedChartSettings = VerticalStackedChartSettings;
|
|
3239
|
-
exports.ɵa =
|
|
3240
|
-
exports.ɵb =
|
|
3241
|
-
exports.ɵc =
|
|
3242
|
-
exports.ɵd =
|
|
3243
|
-
exports.ɵe =
|
|
3244
|
-
exports.ɵf =
|
|
3245
|
-
exports.ɵg = ESC_LOGS;
|
|
3246
|
-
exports.ɵh = BaseAdapter;
|
|
3247
|
-
exports.ɵi = EsChartComponent;
|
|
3248
|
-
exports.ɵj = EsLineChartComponent;
|
|
3249
|
-
exports.ɵk = EsPieChartComponent;
|
|
3250
|
-
exports.ɵl = EsVertical2DChartComponent;
|
|
3251
|
-
exports.ɵm = EsVerticalChartComponent;
|
|
3252
|
-
exports.ɵn = EsVerticalStackedChartComponent;
|
|
3253
|
-
exports.ɵo = PageChartSelector;
|
|
3254
|
-
exports.ɵp = EsAreaChartComponent;
|
|
3221
|
+
exports.ɵa = ChartLoader;
|
|
3222
|
+
exports.ɵb = ChartDispatcher;
|
|
3223
|
+
exports.ɵc = ESC_LOCALE;
|
|
3224
|
+
exports.ɵd = ESC_ANIMATIONS;
|
|
3225
|
+
exports.ɵe = ESC_THEME;
|
|
3226
|
+
exports.ɵf = ESC_LOGS;
|
|
3255
3227
|
|
|
3256
3228
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3257
3229
|
|