@esfaenza/es-charts 11.2.18 → 11.2.22
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 +419 -408
- 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 +4 -6
- package/esfaenza-es-charts.metadata.json +1 -1
- package/esm2015/esfaenza-es-charts.js +5 -7
- 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 +11 -3
- 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 +395 -375
- 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 +15 -5
- 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/{classes/base → base}/Limit.d.ts +0 -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} +7 -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 -326
- 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/index.d.ts +0 -12
- package/lib/models/settings/index.d.ts +0 -9
- package/lib/services/index.d.ts +0 -7
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@esfaenza/es-charts', ['exports', '@angular/core', '@
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza['es-charts'] = {}), global.ng.core, global.
|
|
5
|
-
}(this, (function (exports, core,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@amcharts/amcharts4/core'), require('@esfaenza/extensions'), require('@amcharts/amcharts4/charts')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@esfaenza/es-charts', ['exports', '@angular/core', '@angular/common', '@amcharts/amcharts4/core', '@esfaenza/extensions', '@amcharts/amcharts4/charts'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza['es-charts'] = {}), global.ng.core, global.ng.common, global.am4core, global.extensions, global.am4charts));
|
|
5
|
+
}(this, (function (exports, core, common, am4core, extensions, am4charts) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -673,111 +673,6 @@
|
|
|
673
673
|
return LineSerie;
|
|
674
674
|
}());
|
|
675
675
|
|
|
676
|
-
/**
|
|
677
|
-
* Token che identifica il Locale di default per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
|
|
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
|
|
695
|
-
*/
|
|
696
|
-
var ChartDispatcher = /** @class */ (function () {
|
|
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 = [];
|
|
706
|
-
/**
|
|
707
|
-
* Lista dei grafici inizializzati e attivi in un dato momento (viene registrata la proprietà **name**). Non è possibile registrare due grafici con lo stesso identificativo
|
|
708
|
-
*/
|
|
709
|
-
this.InitializedGraphs = [];
|
|
710
|
-
}
|
|
711
|
-
/**
|
|
712
|
-
* Registra un grafico da visualizzare insieme alla propria funzione di creazione. Quest'ultima sarà differita fino a che tutti i grafici
|
|
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
|
|
717
|
-
*/
|
|
718
|
-
ChartDispatcher.prototype.register = function (name, chartCreationFunction) {
|
|
719
|
-
if (this.InitializedGraphs.indexOf(name) != -1)
|
|
720
|
-
throw "Attempting to register a duplicate chart '" + name + "'. Make sure the 'name' properties of your charts are univoque";
|
|
721
|
-
this.log("DISPATCHER: Registering chart creation function execution for " + name);
|
|
722
|
-
this.Initializations.push({ name: name, function: chartCreationFunction });
|
|
723
|
-
if (this.Initializations.length == 1) {
|
|
724
|
-
this.log("DISPATCHER: Initial drain started");
|
|
725
|
-
this.drainInitQueues();
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
/**
|
|
729
|
-
* Deregistra un grafico presente. Chiamata generalmente al dispose del grafico in questione quando non dev'essere più mostrato nella pagina corrente
|
|
730
|
-
*
|
|
731
|
-
* @param {string} name Identificativo del grafico da deregistrare
|
|
732
|
-
*/
|
|
733
|
-
ChartDispatcher.prototype.deregisterGraph = function (name) {
|
|
734
|
-
var index = this.InitializedGraphs.indexOf(name);
|
|
735
|
-
if (index == -1) {
|
|
736
|
-
//Questo succede quando si cerca di distruggere il grafico mentre sta venendo graficato
|
|
737
|
-
this.log("DISPATCHER: Registration missing for chart " + name + " it was probably destroyed during load");
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
this.log("DISPATCHER: Chart deregistered " + name);
|
|
741
|
-
this.InitializedGraphs.splice(index, 1);
|
|
742
|
-
};
|
|
743
|
-
/**
|
|
744
|
-
* Metodo che esegue in maniera sequenziale le funzioni di inizializzazione dei grafici finché presenti
|
|
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
|
|
748
|
-
*/
|
|
749
|
-
ChartDispatcher.prototype.drainInitQueues = function () {
|
|
750
|
-
var _this = this;
|
|
751
|
-
var toExecute = this.Initializations[0];
|
|
752
|
-
this.log("DISPATCHER: Executing initialization function for chart " + toExecute.name);
|
|
753
|
-
toExecute.function().then(function () {
|
|
754
|
-
_this.log("DISPATCHER: initialization for chart " + toExecute.name + " is done");
|
|
755
|
-
_this.InitializedGraphs.push(toExecute.name);
|
|
756
|
-
_this.Initializations.splice(0, 1);
|
|
757
|
-
if (_this.Initializations.length >= 1) {
|
|
758
|
-
_this.log("DISPATCHER: Found queued initializations. Continuing");
|
|
759
|
-
_this.drainInitQueues();
|
|
760
|
-
}
|
|
761
|
-
else
|
|
762
|
-
_this.log("DISPATCHER: queue is over, nothing more to do");
|
|
763
|
-
});
|
|
764
|
-
};
|
|
765
|
-
/**
|
|
766
|
-
* @ignore
|
|
767
|
-
*/
|
|
768
|
-
ChartDispatcher.prototype.log = function (text) {
|
|
769
|
-
if (this.logs)
|
|
770
|
-
console.log("@esfaenza/es-charts: " + text);
|
|
771
|
-
};
|
|
772
|
-
return ChartDispatcher;
|
|
773
|
-
}());
|
|
774
|
-
ChartDispatcher.decorators = [
|
|
775
|
-
{ type: core.Injectable }
|
|
776
|
-
];
|
|
777
|
-
ChartDispatcher.ctorParameters = function () { return [
|
|
778
|
-
{ type: Boolean, decorators: [{ type: core.Inject, args: [ESC_LOGS,] }] }
|
|
779
|
-
]; };
|
|
780
|
-
|
|
781
676
|
/** @ignore */
|
|
782
677
|
var _spiritedaway = 'spiritedaway';
|
|
783
678
|
/** @ignore */
|
|
@@ -1119,6 +1014,111 @@
|
|
|
1119
1014
|
return ChartLoader;
|
|
1120
1015
|
}());
|
|
1121
1016
|
|
|
1017
|
+
/**
|
|
1018
|
+
* Token che identifica il Locale di default per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
|
|
1019
|
+
*/
|
|
1020
|
+
var ESC_LOCALE = new core.InjectionToken('ESC_LOCALE');
|
|
1021
|
+
/**
|
|
1022
|
+
* 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)
|
|
1023
|
+
*/
|
|
1024
|
+
var ESC_ANIMATIONS = new core.InjectionToken('ESC_ANIMATIONS');
|
|
1025
|
+
/**
|
|
1026
|
+
* Token che identifica il Tema di default per tutti i grafici, può essere sovrascritto dalle impostazioni locali (Settings e Input)
|
|
1027
|
+
*/
|
|
1028
|
+
var ESC_THEME = new core.InjectionToken('ESC_THEME');
|
|
1029
|
+
/**
|
|
1030
|
+
* Token che identifica l'utilizzo o meno del sistema di Log per l'intera libreria
|
|
1031
|
+
*/
|
|
1032
|
+
var ESC_LOGS = new core.InjectionToken('ESC_LOGS');
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* 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
|
|
1036
|
+
*/
|
|
1037
|
+
var ChartDispatcher = /** @class */ (function () {
|
|
1038
|
+
/**
|
|
1039
|
+
* @ignore
|
|
1040
|
+
*/
|
|
1041
|
+
function ChartDispatcher(logs) {
|
|
1042
|
+
this.logs = logs;
|
|
1043
|
+
/**
|
|
1044
|
+
* Coda di inizializzazioni ancora da eseguire. Quando questa è vuota significa che nessuno sta creando grafici
|
|
1045
|
+
*/
|
|
1046
|
+
this.Initializations = [];
|
|
1047
|
+
/**
|
|
1048
|
+
* Lista dei grafici inizializzati e attivi in un dato momento (viene registrata la proprietà **name**). Non è possibile registrare due grafici con lo stesso identificativo
|
|
1049
|
+
*/
|
|
1050
|
+
this.InitializedGraphs = [];
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Registra un grafico da visualizzare insieme alla propria funzione di creazione. Quest'ultima sarà differita fino a che tutti i grafici
|
|
1054
|
+
* precedentemente registati non hanno finito la fase di inizializzazione
|
|
1055
|
+
*
|
|
1056
|
+
* @param {string} name Identificativo del grafico da registrare
|
|
1057
|
+
* @param {Function} chartCreationFunction Funzione che fisicamente dovrà occuparsi della creazione del grafico
|
|
1058
|
+
*/
|
|
1059
|
+
ChartDispatcher.prototype.register = function (name, chartCreationFunction) {
|
|
1060
|
+
if (this.InitializedGraphs.indexOf(name) != -1)
|
|
1061
|
+
throw "Attempting to register a duplicate chart '" + name + "'. Make sure the 'name' properties of your charts are univoque";
|
|
1062
|
+
this.log("DISPATCHER: Registering chart creation function execution for " + name);
|
|
1063
|
+
this.Initializations.push({ name: name, function: chartCreationFunction });
|
|
1064
|
+
if (this.Initializations.length == 1) {
|
|
1065
|
+
this.log("DISPATCHER: Initial drain started");
|
|
1066
|
+
this.drainInitQueues();
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
/**
|
|
1070
|
+
* Deregistra un grafico presente. Chiamata generalmente al dispose del grafico in questione quando non dev'essere più mostrato nella pagina corrente
|
|
1071
|
+
*
|
|
1072
|
+
* @param {string} name Identificativo del grafico da deregistrare
|
|
1073
|
+
*/
|
|
1074
|
+
ChartDispatcher.prototype.deregisterGraph = function (name) {
|
|
1075
|
+
var index = this.InitializedGraphs.indexOf(name);
|
|
1076
|
+
if (index == -1) {
|
|
1077
|
+
//Questo succede quando si cerca di distruggere il grafico mentre sta venendo graficato
|
|
1078
|
+
this.log("DISPATCHER: Registration missing for chart " + name + " it was probably destroyed during load");
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
this.log("DISPATCHER: Chart deregistered " + name);
|
|
1082
|
+
this.InitializedGraphs.splice(index, 1);
|
|
1083
|
+
};
|
|
1084
|
+
/**
|
|
1085
|
+
* Metodo che esegue in maniera sequenziale le funzioni di inizializzazione dei grafici finché presenti
|
|
1086
|
+
* in modo che nessun grafico possa essere inizializzato contemporaneamente ad un altro.
|
|
1087
|
+
*
|
|
1088
|
+
* Questo è il punto chiave che permette di avere per ogni grafico temi e locale differenti
|
|
1089
|
+
*/
|
|
1090
|
+
ChartDispatcher.prototype.drainInitQueues = function () {
|
|
1091
|
+
var _this = this;
|
|
1092
|
+
var toExecute = this.Initializations[0];
|
|
1093
|
+
this.log("DISPATCHER: Executing initialization function for chart " + toExecute.name);
|
|
1094
|
+
toExecute.function().then(function () {
|
|
1095
|
+
_this.log("DISPATCHER: initialization for chart " + toExecute.name + " is done");
|
|
1096
|
+
_this.InitializedGraphs.push(toExecute.name);
|
|
1097
|
+
_this.Initializations.splice(0, 1);
|
|
1098
|
+
if (_this.Initializations.length >= 1) {
|
|
1099
|
+
_this.log("DISPATCHER: Found queued initializations. Continuing");
|
|
1100
|
+
_this.drainInitQueues();
|
|
1101
|
+
}
|
|
1102
|
+
else
|
|
1103
|
+
_this.log("DISPATCHER: queue is over, nothing more to do");
|
|
1104
|
+
});
|
|
1105
|
+
};
|
|
1106
|
+
/**
|
|
1107
|
+
* @ignore
|
|
1108
|
+
*/
|
|
1109
|
+
ChartDispatcher.prototype.log = function (text) {
|
|
1110
|
+
if (this.logs)
|
|
1111
|
+
console.log("@esfaenza/es-charts: " + text);
|
|
1112
|
+
};
|
|
1113
|
+
return ChartDispatcher;
|
|
1114
|
+
}());
|
|
1115
|
+
ChartDispatcher.decorators = [
|
|
1116
|
+
{ type: core.Injectable }
|
|
1117
|
+
];
|
|
1118
|
+
ChartDispatcher.ctorParameters = function () { return [
|
|
1119
|
+
{ type: Boolean, decorators: [{ type: core.Inject, args: [ESC_LOGS,] }] }
|
|
1120
|
+
]; };
|
|
1121
|
+
|
|
1122
1122
|
/**
|
|
1123
1123
|
* Componente Grafico Base che gestisce tutte le cose comuni dei vari grafici istanziabili, come la presenza o menu di una legenda,
|
|
1124
1124
|
* il tema utilizzato, il locale del singolo grafico, ecc ecc...
|
|
@@ -1269,7 +1269,7 @@
|
|
|
1269
1269
|
_this.Chart = _this.ChartService.ChartInstance;
|
|
1270
1270
|
if (!_this.Chart)
|
|
1271
1271
|
_this.log("Chart " + _this.name + ": Could not create graph");
|
|
1272
|
-
return _this.Charter.applyLocale(_this.Chart, _this.Locale).then(function () { _this.initDone = true; _this.chartLoaded.emit(_this
|
|
1272
|
+
return _this.Charter.applyLocale(_this.Chart, _this.Locale).then(function () { _this.initDone = true; _this.chartLoaded.emit(_this); });
|
|
1273
1273
|
})
|
|
1274
1274
|
]);
|
|
1275
1275
|
};
|
|
@@ -1371,6 +1371,13 @@
|
|
|
1371
1371
|
});
|
|
1372
1372
|
this.Dispatcher.register(this.name, function () { return _this.loadChart(); });
|
|
1373
1373
|
};
|
|
1374
|
+
/**
|
|
1375
|
+
* Permette di aggiungere un blocco di dati in maniera "live" ad un grafico
|
|
1376
|
+
*/
|
|
1377
|
+
BaseChartComponent.prototype.addData = function (chartData) {
|
|
1378
|
+
this.ChartService.refreshData(chartData);
|
|
1379
|
+
};
|
|
1380
|
+
;
|
|
1374
1381
|
/**
|
|
1375
1382
|
* Funzione che si occupa di caricare i temi necessari per il grafico in oggetto. Prima applica il tema, poi, se serve, applica le animazioni
|
|
1376
1383
|
*/
|
|
@@ -1455,6 +1462,8 @@
|
|
|
1455
1462
|
this.DataGroupBucketSize = 1500;
|
|
1456
1463
|
/** @ignore */
|
|
1457
1464
|
this.OpacityOnSelected = 0.3;
|
|
1465
|
+
/** @ignore */
|
|
1466
|
+
this.singleDataSet = false;
|
|
1458
1467
|
//******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
|
|
1459
1468
|
//TODO: spostarla in un metodo di utilità (esfaenza/extensions)
|
|
1460
1469
|
/** @ignore */
|
|
@@ -1468,7 +1477,7 @@
|
|
|
1468
1477
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1469
1478
|
var dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
|
|
1470
1479
|
var threshold = (_a = settings.DataGroupingThreshold) !== null && _a !== void 0 ? _a : 3000;
|
|
1471
|
-
|
|
1480
|
+
this.singleDataSet = (_b = settings.MergeDatasets) !== null && _b !== void 0 ? _b : false;
|
|
1472
1481
|
var showTicks = settings.ShowTicks == null ? true : settings === null || settings === void 0 ? void 0 : settings.ShowTicks;
|
|
1473
1482
|
var dataShouldBeGrouped = Math.max.apply(Math, __spread(dataConverted.series.map(function (t) { return t.values.length; }))) > threshold;
|
|
1474
1483
|
var showTimeline = settings.Timeline || dataShouldBeGrouped;
|
|
@@ -1547,31 +1556,9 @@
|
|
|
1547
1556
|
var seriesColors = [];
|
|
1548
1557
|
var defaultIndex = 0;
|
|
1549
1558
|
//-- Generazione di un unico dataset invece che N, per poter gestire un unico tooltip
|
|
1550
|
-
if (singleDataSet) {
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
for (var i = 0; i < vs.values.length; i++) {
|
|
1554
|
-
var dataitem = vs.values[i];
|
|
1555
|
-
var indexer = new Date(dataitem.d).valueOf();
|
|
1556
|
-
if (!dto_1[indexer])
|
|
1557
|
-
dto_1[indexer] = {};
|
|
1558
|
-
dto_1[indexer]['v' + index] = dataitem.v;
|
|
1559
|
-
}
|
|
1560
|
-
});
|
|
1561
|
-
var dates = Object.keys(dto_1);
|
|
1562
|
-
var singleDS = [];
|
|
1563
|
-
for (var i = 0; i < dates.length; i++) {
|
|
1564
|
-
var values = dto_1[dates[i]];
|
|
1565
|
-
var item = { d: new Date(parseInt(dates[i])) };
|
|
1566
|
-
var vals = Object.keys(values);
|
|
1567
|
-
for (var ii = 0; ii < vals.length; ii++) {
|
|
1568
|
-
var series = vals[ii];
|
|
1569
|
-
var singleVal = values[series];
|
|
1570
|
-
item[series] = singleVal;
|
|
1571
|
-
}
|
|
1572
|
-
singleDS.push(item);
|
|
1573
|
-
}
|
|
1574
|
-
this.ChartInstance.data = singleDS;
|
|
1559
|
+
if (this.singleDataSet) {
|
|
1560
|
+
this.ChartInstance.data = this.generateSingleDataset(dataConverted);
|
|
1561
|
+
;
|
|
1575
1562
|
dateAxis.cursorTooltipEnabled = false;
|
|
1576
1563
|
}
|
|
1577
1564
|
//-- Fine generazione
|
|
@@ -1595,14 +1582,14 @@
|
|
|
1595
1582
|
s.values.sort(function (d1, d2) { return d1.d.getTime() - d2.d.getTime(); });
|
|
1596
1583
|
var fill = s.fill != null && s.fill != undefined ? s.fill : ((_a = settings === null || settings === void 0 ? void 0 : settings.Fill) !== null && _a !== void 0 ? _a : false);
|
|
1597
1584
|
var series = (settings === null || settings === void 0 ? void 0 : settings.Step) ? new am4charts__namespace.StepLineSeries() : new am4charts__namespace.LineSeries();
|
|
1598
|
-
series.dataFields.valueY = "v" + (singleDataSet ? index : "");
|
|
1585
|
+
series.dataFields.valueY = "v" + (_this.singleDataSet ? index : "");
|
|
1599
1586
|
series.dataFields.dateX = "d";
|
|
1600
1587
|
series.dataFields.measureUnit = s.uom;
|
|
1601
1588
|
series.name = s.name;
|
|
1602
1589
|
series.strokeWidth = (_b = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _b !== void 0 ? _b : 1;
|
|
1603
1590
|
series.connect = !gapsAllowed;
|
|
1604
1591
|
series.minBulletDistance = 10;
|
|
1605
|
-
series.tooltipText = singleDataSet ? "" : "{name}: [bold]{valueY}[/]";
|
|
1592
|
+
series.tooltipText = _this.singleDataSet ? "" : s.name ? "{name}: [bold]{valueY}[/]" : "[bold]{valueY}[/]";
|
|
1606
1593
|
series.tooltip.pointerOrientation = "vertical";
|
|
1607
1594
|
series.tooltip.background.fillOpacity = 0.5;
|
|
1608
1595
|
series.tooltip.label.padding(12, 12, 12, 12);
|
|
@@ -1610,7 +1597,7 @@
|
|
|
1610
1597
|
series.stacked = fill;
|
|
1611
1598
|
//Dataset singolo, i dati sono registrati a livello di chart, creo il tooltip che permette di vederli tutti insieme
|
|
1612
1599
|
//altrimenti assegno i dati della serie direttamente alla serie
|
|
1613
|
-
if (singleDataSet) {
|
|
1600
|
+
if (_this.singleDataSet) {
|
|
1614
1601
|
series.tooltip.getFillFromObject = false;
|
|
1615
1602
|
series.tooltip.background.fill = am4core__namespace.color("#eee");
|
|
1616
1603
|
series.tooltip.label.fill = am4core__namespace.color("#00");
|
|
@@ -1641,7 +1628,7 @@
|
|
|
1641
1628
|
var text = "[bold]{dateX.formatDate()}[/]\n";
|
|
1642
1629
|
_this.ChartInstance.series.each(function (item) {
|
|
1643
1630
|
var uom = " [font-style: italic]" + series.dataFields.measureUnit || "" + "[/]";
|
|
1644
|
-
text += "[" + item.stroke.hex + "]●[/] " + item.name + ": [bold]{" + item.dataFields.valueY + "}[/]" + uom + "\n";
|
|
1631
|
+
text += "[" + item.stroke.hex + "]●[/] " + (item.name ? (item.name + ": ") : "") + "[bold]{" + item.dataFields.valueY + "}[/]" + uom + "\n";
|
|
1645
1632
|
});
|
|
1646
1633
|
return text;
|
|
1647
1634
|
});
|
|
@@ -1700,7 +1687,7 @@
|
|
|
1700
1687
|
//******************************************************************************************************************************
|
|
1701
1688
|
this.ChartInstance.cursor.xAxis = dateAxis;
|
|
1702
1689
|
this.ChartInstance.cursor.yAxis = yAxis;
|
|
1703
|
-
if (singleDataSet)
|
|
1690
|
+
if (this.singleDataSet)
|
|
1704
1691
|
this.ChartInstance.cursor.maxTooltipDistance = -1;
|
|
1705
1692
|
//TODO: Cercare di capire perché è figlio di puttana......
|
|
1706
1693
|
dateAxis.events.on("startchanged", function (t) { return _this.emitSelectionChanged(t, settings); });
|
|
@@ -1709,7 +1696,40 @@
|
|
|
1709
1696
|
};
|
|
1710
1697
|
/** @ignore */
|
|
1711
1698
|
LineChartService.prototype.refreshData = function (data) {
|
|
1712
|
-
|
|
1699
|
+
var dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
|
|
1700
|
+
if (this.singleDataSet) {
|
|
1701
|
+
var data = this.generateSingleDataset(dataConverted);
|
|
1702
|
+
this.ChartInstance.addData(data);
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
throw "Impossibile aggiornare i dati senza unire il dataset. Si prega di impostare [MergeDatasets] a true";
|
|
1706
|
+
};
|
|
1707
|
+
/** Partendo da dati divisi per seriue genera un dataset unito con la data come chiave e i vari valori dopo */
|
|
1708
|
+
LineChartService.prototype.generateSingleDataset = function (data) {
|
|
1709
|
+
var dto = {};
|
|
1710
|
+
data.series.forEach(function (vs, index) {
|
|
1711
|
+
for (var i = 0; i < vs.values.length; i++) {
|
|
1712
|
+
var dataitem = vs.values[i];
|
|
1713
|
+
var indexer = new Date(dataitem.d).valueOf();
|
|
1714
|
+
if (!dto[indexer])
|
|
1715
|
+
dto[indexer] = {};
|
|
1716
|
+
dto[indexer]['v' + index] = dataitem.v;
|
|
1717
|
+
}
|
|
1718
|
+
});
|
|
1719
|
+
var dates = Object.keys(dto);
|
|
1720
|
+
var ret = [];
|
|
1721
|
+
for (var i = 0; i < dates.length; i++) {
|
|
1722
|
+
var values = dto[dates[i]];
|
|
1723
|
+
var item = { d: new Date(parseInt(dates[i])) };
|
|
1724
|
+
var vals = Object.keys(values);
|
|
1725
|
+
for (var ii = 0; ii < vals.length; ii++) {
|
|
1726
|
+
var series = vals[ii];
|
|
1727
|
+
var singleVal = values[series];
|
|
1728
|
+
item[series] = singleVal;
|
|
1729
|
+
}
|
|
1730
|
+
ret.push(item);
|
|
1731
|
+
}
|
|
1732
|
+
return ret;
|
|
1713
1733
|
};
|
|
1714
1734
|
/** @ignore */
|
|
1715
1735
|
LineChartService.prototype.emitSelectionChanged = function (ev, settings) {
|
|
@@ -1772,158 +1792,22 @@
|
|
|
1772
1792
|
}());
|
|
1773
1793
|
|
|
1774
1794
|
/**
|
|
1775
|
-
* Classe il cui unico scopo è gestire il setup e rendering di un
|
|
1795
|
+
* Classe il cui unico scopo è gestire il setup e rendering di un PieChart
|
|
1776
1796
|
*/
|
|
1777
|
-
var
|
|
1797
|
+
var PieChartService = /** @class */ (function () {
|
|
1778
1798
|
/** @ignore */
|
|
1779
|
-
function
|
|
1799
|
+
function PieChartService(Adapter) {
|
|
1780
1800
|
this.Adapter = Adapter;
|
|
1781
|
-
//******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
|
|
1782
|
-
//TODO: spostarla in un metodo di utilità (esfaenza/extensions)
|
|
1783
1801
|
/** @ignore */
|
|
1784
|
-
this.
|
|
1802
|
+
this.ViewAbsoluteValues = true;
|
|
1785
1803
|
}
|
|
1786
1804
|
/**
|
|
1787
|
-
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un
|
|
1805
|
+
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un PieChart
|
|
1788
1806
|
*/
|
|
1789
|
-
|
|
1790
|
-
var
|
|
1791
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1807
|
+
PieChartService.prototype.graphicate = function (data, settings) {
|
|
1808
|
+
var _a, _b, _c, _d;
|
|
1792
1809
|
if (settings.Timeline) {
|
|
1793
|
-
console.error("Timeline not supported for
|
|
1794
|
-
return null;
|
|
1795
|
-
}
|
|
1796
|
-
var dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
|
|
1797
|
-
var showTicks = settings.ShowTicks == null ? true : settings === null || settings === void 0 ? void 0 : settings.ShowTicks;
|
|
1798
|
-
var interval = dataConverted.interval;
|
|
1799
|
-
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
1800
|
-
am4core__namespace.options.autoDispose = true;
|
|
1801
|
-
this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
|
|
1802
|
-
var ChartInstanceCasted = this.ChartInstance;
|
|
1803
|
-
if (settings.Legend) {
|
|
1804
|
-
ChartInstanceCasted.legend = new am4charts__namespace.Legend();
|
|
1805
|
-
ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
|
|
1806
|
-
ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
|
|
1807
|
-
if (settings.LegendPadding) {
|
|
1808
|
-
var template = this.ChartInstance.legend.itemContainers.template;
|
|
1809
|
-
template.paddingTop = (_b = settings.LegendPadding.top) !== null && _b !== void 0 ? _b : 0;
|
|
1810
|
-
template.paddingBottom = (_c = settings.LegendPadding.bottom) !== null && _c !== void 0 ? _c : 0;
|
|
1811
|
-
template.paddingLeft = (_d = settings.LegendPadding.left) !== null && _d !== void 0 ? _d : 0;
|
|
1812
|
-
template.paddingRight = (_e = settings.LegendPadding.right) !== null && _e !== void 0 ? _e : 0;
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
var yAxis = ChartInstanceCasted.yAxes.push(new am4charts__namespace.ValueAxis());
|
|
1816
|
-
yAxis.tooltip.disabled = true;
|
|
1817
|
-
if (settings.YAxisTitle) {
|
|
1818
|
-
yAxis.title.text = settings.YAxisTitle;
|
|
1819
|
-
yAxis.title.fontWeight = "bold";
|
|
1820
|
-
}
|
|
1821
|
-
yAxis.min = 0;
|
|
1822
|
-
var dateAxis = ChartInstanceCasted.xAxes.push(new am4charts__namespace.DateAxis());
|
|
1823
|
-
dateAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 50;
|
|
1824
|
-
dateAxis.startLocation = 0.5;
|
|
1825
|
-
dateAxis.endLocation = 0.5;
|
|
1826
|
-
if (settings.XAxisTitle) {
|
|
1827
|
-
dateAxis.title.text = settings.XAxisTitle;
|
|
1828
|
-
dateAxis.title.fontWeight = "bold";
|
|
1829
|
-
}
|
|
1830
|
-
if (showTicks) {
|
|
1831
|
-
dateAxis.renderer.ticks.template.disabled = false;
|
|
1832
|
-
dateAxis.renderer.ticks.template.strokeOpacity = 1;
|
|
1833
|
-
dateAxis.renderer.ticks.template.stroke = am4core__namespace.color("#495C43");
|
|
1834
|
-
dateAxis.renderer.ticks.template.strokeWidth = 2;
|
|
1835
|
-
dateAxis.renderer.ticks.template.length = 10;
|
|
1836
|
-
dateAxis.renderer.ticks.template.location = 0;
|
|
1837
|
-
}
|
|
1838
|
-
if (!!interval)
|
|
1839
|
-
dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
|
|
1840
|
-
// Unisco il dataset e tiro fuori i dati
|
|
1841
|
-
var chartData = [];
|
|
1842
|
-
var seriesToMakeCache = {};
|
|
1843
|
-
var seriesToMake = [];
|
|
1844
|
-
for (var i = 0; i < dataConverted.groups.length; i++) {
|
|
1845
|
-
var group = dataConverted.groups[i];
|
|
1846
|
-
var dataItem = { date: group.name };
|
|
1847
|
-
for (var ii = 0; ii < group.values.length; ii++) {
|
|
1848
|
-
var val = group.values[ii];
|
|
1849
|
-
dataItem[val.k] = val.v;
|
|
1850
|
-
if (!seriesToMakeCache[val.k]) {
|
|
1851
|
-
seriesToMakeCache[val.k] = true;
|
|
1852
|
-
seriesToMake.push(val.k);
|
|
1853
|
-
}
|
|
1854
|
-
}
|
|
1855
|
-
chartData.push(dataItem);
|
|
1856
|
-
}
|
|
1857
|
-
ChartInstanceCasted.data = chartData;
|
|
1858
|
-
//---------------------------------------------------------
|
|
1859
|
-
seriesToMake.forEach(function (s) { _this.createSeries(ChartInstanceCasted, s); });
|
|
1860
|
-
ChartInstanceCasted.cursor = new am4charts__namespace.XYCursor();
|
|
1861
|
-
ChartInstanceCasted.cursor.xAxis = dateAxis;
|
|
1862
|
-
dateAxis.events.on("startchanged", function (t) { return _this.emitSelectionChanged(t, settings); });
|
|
1863
|
-
dateAxis.events.on("endchanged", function (t) { return _this.emitSelectionChanged(t, settings); });
|
|
1864
|
-
return this;
|
|
1865
|
-
};
|
|
1866
|
-
/** @ignore */
|
|
1867
|
-
AreaChartService.prototype.refreshData = function (data) {
|
|
1868
|
-
//TODO:IMPL
|
|
1869
|
-
};
|
|
1870
|
-
/** @ignore */
|
|
1871
|
-
AreaChartService.prototype.emitSelectionChanged = function (ev, settings) {
|
|
1872
|
-
if (settings.OnSelectionChangedCallback) {
|
|
1873
|
-
this.throttla("selchange", function () {
|
|
1874
|
-
var axis = ev.target;
|
|
1875
|
-
var start = new Date(axis.minZoomed);
|
|
1876
|
-
var end = new Date(axis.maxZoomed);
|
|
1877
|
-
var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
|
|
1878
|
-
settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
|
|
1879
|
-
}, 150);
|
|
1880
|
-
}
|
|
1881
|
-
};
|
|
1882
|
-
/** @ignore */
|
|
1883
|
-
AreaChartService.prototype.createSeries = function (chart, name) {
|
|
1884
|
-
var series = chart.series.push(new am4charts__namespace.LineSeries());
|
|
1885
|
-
series.dataFields.dateX = "date";
|
|
1886
|
-
series.name = name[0].toUpperCase() + name.slice(1);
|
|
1887
|
-
series.dataFields.valueY = name;
|
|
1888
|
-
series.tooltipText = "[#000]{valueY.value}[/]";
|
|
1889
|
-
//series.tooltip.background.fill = am4core.color("#FFF");
|
|
1890
|
-
series.tooltip.getStrokeFromObject = true;
|
|
1891
|
-
series.tooltip.background.strokeWidth = 3;
|
|
1892
|
-
series.tooltip.getFillFromObject = false;
|
|
1893
|
-
series.fillOpacity = 0.6;
|
|
1894
|
-
series.strokeWidth = 2;
|
|
1895
|
-
series.stacked = true;
|
|
1896
|
-
return series;
|
|
1897
|
-
};
|
|
1898
|
-
/** @ignore */
|
|
1899
|
-
AreaChartService.prototype.throttla = function (id, func, throttleTime) {
|
|
1900
|
-
var _this = this;
|
|
1901
|
-
//Se ho la funzione che vuole eseguire ripulisco quel timeout
|
|
1902
|
-
if (this.executionTimers[id])
|
|
1903
|
-
clearTimeout(this.executionTimers[id]);
|
|
1904
|
-
//Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
|
|
1905
|
-
this.executionTimers[id] = setTimeout(function () { func(); _this.executionTimers[id] = null; }, throttleTime);
|
|
1906
|
-
};
|
|
1907
|
-
return AreaChartService;
|
|
1908
|
-
}());
|
|
1909
|
-
|
|
1910
|
-
/**
|
|
1911
|
-
* Classe il cui unico scopo è gestire il setup e rendering di un PieChart
|
|
1912
|
-
*/
|
|
1913
|
-
var PieChartService = /** @class */ (function () {
|
|
1914
|
-
/** @ignore */
|
|
1915
|
-
function PieChartService(Adapter) {
|
|
1916
|
-
this.Adapter = Adapter;
|
|
1917
|
-
/** @ignore */
|
|
1918
|
-
this.ViewAbsoluteValues = true;
|
|
1919
|
-
}
|
|
1920
|
-
/**
|
|
1921
|
-
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un PieChart
|
|
1922
|
-
*/
|
|
1923
|
-
PieChartService.prototype.graphicate = function (data, settings) {
|
|
1924
|
-
var _a, _b, _c, _d;
|
|
1925
|
-
if (settings.Timeline) {
|
|
1926
|
-
console.error("Timeline not supported for pie chart");
|
|
1810
|
+
console.error("Timeline not supported for pie chart");
|
|
1927
1811
|
return null;
|
|
1928
1812
|
}
|
|
1929
1813
|
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
@@ -2018,6 +1902,111 @@
|
|
|
2018
1902
|
return PieChartService;
|
|
2019
1903
|
}());
|
|
2020
1904
|
|
|
1905
|
+
/**
|
|
1906
|
+
* Classe il cui unico scopo è gestire il setup e rendering di un VerticalChart
|
|
1907
|
+
*/
|
|
1908
|
+
var VerticalChartService = /** @class */ (function () {
|
|
1909
|
+
/** @ignore */
|
|
1910
|
+
function VerticalChartService(Adapter) {
|
|
1911
|
+
this.Adapter = Adapter;
|
|
1912
|
+
/** @ignore */
|
|
1913
|
+
this.dangerZone = 50;
|
|
1914
|
+
/** @ignore */
|
|
1915
|
+
this.LabelWidth = 150;
|
|
1916
|
+
/** @ignore */
|
|
1917
|
+
this.LabelRightWhenCompressed = 20;
|
|
1918
|
+
/** @ignore */
|
|
1919
|
+
this.LabelTopWhenCompressed = -5;
|
|
1920
|
+
/** @ignore */
|
|
1921
|
+
this.DefaultColumnWidthPercentage = 85;
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un VerticalChart
|
|
1925
|
+
*/
|
|
1926
|
+
VerticalChartService.prototype.graphicate = function (data, settings) {
|
|
1927
|
+
var _this = this;
|
|
1928
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1929
|
+
if (settings.Timeline) {
|
|
1930
|
+
console.error("Timeline not supported for vertical chart");
|
|
1931
|
+
return null;
|
|
1932
|
+
}
|
|
1933
|
+
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
1934
|
+
am4core__namespace.options.autoDispose = true;
|
|
1935
|
+
this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
|
|
1936
|
+
var ChartInstanceCasted = this.ChartInstance;
|
|
1937
|
+
var dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
|
|
1938
|
+
ChartInstanceCasted.data = dataConverted.values;
|
|
1939
|
+
if (settings.Legend) {
|
|
1940
|
+
ChartInstanceCasted.legend = new am4charts__namespace.Legend();
|
|
1941
|
+
ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
|
|
1942
|
+
ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
|
|
1943
|
+
if (settings.LegendPadding) {
|
|
1944
|
+
var template = this.ChartInstance.legend.itemContainers.template;
|
|
1945
|
+
template.paddingTop = (_b = settings.LegendPadding.top) !== null && _b !== void 0 ? _b : 0;
|
|
1946
|
+
template.paddingBottom = (_c = settings.LegendPadding.bottom) !== null && _c !== void 0 ? _c : 0;
|
|
1947
|
+
template.paddingLeft = (_d = settings.LegendPadding.left) !== null && _d !== void 0 ? _d : 0;
|
|
1948
|
+
template.paddingRight = (_e = settings.LegendPadding.right) !== null && _e !== void 0 ? _e : 0;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
var yAxis = ChartInstanceCasted.yAxes.push(new am4charts__namespace.ValueAxis());
|
|
1952
|
+
if (settings.YAxisTitle) {
|
|
1953
|
+
yAxis.title.text = settings.YAxisTitle;
|
|
1954
|
+
yAxis.title.fontWeight = "bold";
|
|
1955
|
+
}
|
|
1956
|
+
var categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts__namespace.CategoryAxis());
|
|
1957
|
+
if (settings.XAxisTitle) {
|
|
1958
|
+
categoryAxis.title.text = settings.XAxisTitle;
|
|
1959
|
+
categoryAxis.title.fontWeight = "bold";
|
|
1960
|
+
}
|
|
1961
|
+
categoryAxis.dataFields.category = "k";
|
|
1962
|
+
categoryAxis.renderer.grid.template.location = 0;
|
|
1963
|
+
categoryAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 30;
|
|
1964
|
+
var label = categoryAxis.renderer.labels.template;
|
|
1965
|
+
label.truncate = true;
|
|
1966
|
+
label.maxWidth = (_g = settings.LabelWidth) !== null && _g !== void 0 ? _g : this.LabelWidth;
|
|
1967
|
+
label.tooltipText = "{category}";
|
|
1968
|
+
if ((settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) == null ? true : settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) {
|
|
1969
|
+
categoryAxis.events.on("sizechanged", function (ev) {
|
|
1970
|
+
var _a, _b, _c;
|
|
1971
|
+
var axis = ev.target;
|
|
1972
|
+
var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
|
|
1973
|
+
if (cellWidth < axis.renderer.labels.template.maxWidth) {
|
|
1974
|
+
var areWeInDangerZone = cellWidth < ((_a = settings === null || settings === void 0 ? void 0 : settings.LabelVerticalOrientationCutoffWidth) !== null && _a !== void 0 ? _a : _this.dangerZone);
|
|
1975
|
+
axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
|
|
1976
|
+
axis.renderer.labels.template.dx = ((_b = settings.LabelRightWhenCompressed) !== null && _b !== void 0 ? _b : areWeInDangerZone) ? 0 : _this.LabelRightWhenCompressed;
|
|
1977
|
+
axis.renderer.labels.template.dy = (_c = settings.LabelTopWhenCompressed) !== null && _c !== void 0 ? _c : _this.LabelTopWhenCompressed;
|
|
1978
|
+
axis.renderer.labels.template.horizontalCenter = "right";
|
|
1979
|
+
axis.renderer.labels.template.verticalCenter = "middle";
|
|
1980
|
+
}
|
|
1981
|
+
else {
|
|
1982
|
+
axis.renderer.labels.template.rotation = 0;
|
|
1983
|
+
axis.renderer.labels.template.dx = 0;
|
|
1984
|
+
axis.renderer.labels.template.dy = 0;
|
|
1985
|
+
axis.renderer.labels.template.horizontalCenter = "middle";
|
|
1986
|
+
axis.renderer.labels.template.verticalCenter = "top";
|
|
1987
|
+
}
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1990
|
+
// Create series
|
|
1991
|
+
var series = ChartInstanceCasted.series.push(new am4charts__namespace.ColumnSeries());
|
|
1992
|
+
series.dataFields.valueY = "v";
|
|
1993
|
+
series.dataFields.categoryX = "k";
|
|
1994
|
+
series.name = "";
|
|
1995
|
+
series.columns.template.tooltipText = "{categoryX}: [bold]{valueY}[/]";
|
|
1996
|
+
series.columns.template.fillOpacity = .8;
|
|
1997
|
+
series.columns.template.width = am4core__namespace.percent((_h = settings.ColumnWidthPercentage) !== null && _h !== void 0 ? _h : this.DefaultColumnWidthPercentage);
|
|
1998
|
+
var columnTemplate = series.columns.template;
|
|
1999
|
+
columnTemplate.strokeWidth = 2;
|
|
2000
|
+
columnTemplate.strokeOpacity = 1;
|
|
2001
|
+
return this;
|
|
2002
|
+
};
|
|
2003
|
+
/** @ignore */
|
|
2004
|
+
VerticalChartService.prototype.refreshData = function (data) {
|
|
2005
|
+
//TODO:IMPL
|
|
2006
|
+
};
|
|
2007
|
+
return VerticalChartService;
|
|
2008
|
+
}());
|
|
2009
|
+
|
|
2021
2010
|
/**
|
|
2022
2011
|
* Classe il cui unico scopo è gestire il setup e rendering di un Vertical2DChart
|
|
2023
2012
|
*/
|
|
@@ -2182,111 +2171,6 @@
|
|
|
2182
2171
|
return Vertical2DChartService;
|
|
2183
2172
|
}());
|
|
2184
2173
|
|
|
2185
|
-
/**
|
|
2186
|
-
* Classe il cui unico scopo è gestire il setup e rendering di un VerticalChart
|
|
2187
|
-
*/
|
|
2188
|
-
var VerticalChartService = /** @class */ (function () {
|
|
2189
|
-
/** @ignore */
|
|
2190
|
-
function VerticalChartService(Adapter) {
|
|
2191
|
-
this.Adapter = Adapter;
|
|
2192
|
-
/** @ignore */
|
|
2193
|
-
this.dangerZone = 50;
|
|
2194
|
-
/** @ignore */
|
|
2195
|
-
this.LabelWidth = 150;
|
|
2196
|
-
/** @ignore */
|
|
2197
|
-
this.LabelRightWhenCompressed = 20;
|
|
2198
|
-
/** @ignore */
|
|
2199
|
-
this.LabelTopWhenCompressed = -5;
|
|
2200
|
-
/** @ignore */
|
|
2201
|
-
this.DefaultColumnWidthPercentage = 85;
|
|
2202
|
-
}
|
|
2203
|
-
/**
|
|
2204
|
-
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un VerticalChart
|
|
2205
|
-
*/
|
|
2206
|
-
VerticalChartService.prototype.graphicate = function (data, settings) {
|
|
2207
|
-
var _this = this;
|
|
2208
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2209
|
-
if (settings.Timeline) {
|
|
2210
|
-
console.error("Timeline not supported for vertical chart");
|
|
2211
|
-
return null;
|
|
2212
|
-
}
|
|
2213
|
-
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
2214
|
-
am4core__namespace.options.autoDispose = true;
|
|
2215
|
-
this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
|
|
2216
|
-
var ChartInstanceCasted = this.ChartInstance;
|
|
2217
|
-
var dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
|
|
2218
|
-
ChartInstanceCasted.data = dataConverted.values;
|
|
2219
|
-
if (settings.Legend) {
|
|
2220
|
-
ChartInstanceCasted.legend = new am4charts__namespace.Legend();
|
|
2221
|
-
ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
|
|
2222
|
-
ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
|
|
2223
|
-
if (settings.LegendPadding) {
|
|
2224
|
-
var template = this.ChartInstance.legend.itemContainers.template;
|
|
2225
|
-
template.paddingTop = (_b = settings.LegendPadding.top) !== null && _b !== void 0 ? _b : 0;
|
|
2226
|
-
template.paddingBottom = (_c = settings.LegendPadding.bottom) !== null && _c !== void 0 ? _c : 0;
|
|
2227
|
-
template.paddingLeft = (_d = settings.LegendPadding.left) !== null && _d !== void 0 ? _d : 0;
|
|
2228
|
-
template.paddingRight = (_e = settings.LegendPadding.right) !== null && _e !== void 0 ? _e : 0;
|
|
2229
|
-
}
|
|
2230
|
-
}
|
|
2231
|
-
var yAxis = ChartInstanceCasted.yAxes.push(new am4charts__namespace.ValueAxis());
|
|
2232
|
-
if (settings.YAxisTitle) {
|
|
2233
|
-
yAxis.title.text = settings.YAxisTitle;
|
|
2234
|
-
yAxis.title.fontWeight = "bold";
|
|
2235
|
-
}
|
|
2236
|
-
var categoryAxis = ChartInstanceCasted.xAxes.push(new am4charts__namespace.CategoryAxis());
|
|
2237
|
-
if (settings.XAxisTitle) {
|
|
2238
|
-
categoryAxis.title.text = settings.XAxisTitle;
|
|
2239
|
-
categoryAxis.title.fontWeight = "bold";
|
|
2240
|
-
}
|
|
2241
|
-
categoryAxis.dataFields.category = "k";
|
|
2242
|
-
categoryAxis.renderer.grid.template.location = 0;
|
|
2243
|
-
categoryAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 30;
|
|
2244
|
-
var label = categoryAxis.renderer.labels.template;
|
|
2245
|
-
label.truncate = true;
|
|
2246
|
-
label.maxWidth = (_g = settings.LabelWidth) !== null && _g !== void 0 ? _g : this.LabelWidth;
|
|
2247
|
-
label.tooltipText = "{category}";
|
|
2248
|
-
if ((settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) == null ? true : settings === null || settings === void 0 ? void 0 : settings.AdaptLabelSizeAndOrientation) {
|
|
2249
|
-
categoryAxis.events.on("sizechanged", function (ev) {
|
|
2250
|
-
var _a, _b, _c;
|
|
2251
|
-
var axis = ev.target;
|
|
2252
|
-
var cellWidth = axis.pixelWidth / (axis.endIndex - axis.startIndex);
|
|
2253
|
-
if (cellWidth < axis.renderer.labels.template.maxWidth) {
|
|
2254
|
-
var areWeInDangerZone = cellWidth < ((_a = settings === null || settings === void 0 ? void 0 : settings.LabelVerticalOrientationCutoffWidth) !== null && _a !== void 0 ? _a : _this.dangerZone);
|
|
2255
|
-
axis.renderer.labels.template.rotation = areWeInDangerZone ? -90 : -45;
|
|
2256
|
-
axis.renderer.labels.template.dx = ((_b = settings.LabelRightWhenCompressed) !== null && _b !== void 0 ? _b : areWeInDangerZone) ? 0 : _this.LabelRightWhenCompressed;
|
|
2257
|
-
axis.renderer.labels.template.dy = (_c = settings.LabelTopWhenCompressed) !== null && _c !== void 0 ? _c : _this.LabelTopWhenCompressed;
|
|
2258
|
-
axis.renderer.labels.template.horizontalCenter = "right";
|
|
2259
|
-
axis.renderer.labels.template.verticalCenter = "middle";
|
|
2260
|
-
}
|
|
2261
|
-
else {
|
|
2262
|
-
axis.renderer.labels.template.rotation = 0;
|
|
2263
|
-
axis.renderer.labels.template.dx = 0;
|
|
2264
|
-
axis.renderer.labels.template.dy = 0;
|
|
2265
|
-
axis.renderer.labels.template.horizontalCenter = "middle";
|
|
2266
|
-
axis.renderer.labels.template.verticalCenter = "top";
|
|
2267
|
-
}
|
|
2268
|
-
});
|
|
2269
|
-
}
|
|
2270
|
-
// Create series
|
|
2271
|
-
var series = ChartInstanceCasted.series.push(new am4charts__namespace.ColumnSeries());
|
|
2272
|
-
series.dataFields.valueY = "v";
|
|
2273
|
-
series.dataFields.categoryX = "k";
|
|
2274
|
-
series.name = "";
|
|
2275
|
-
series.columns.template.tooltipText = "{categoryX}: [bold]{valueY}[/]";
|
|
2276
|
-
series.columns.template.fillOpacity = .8;
|
|
2277
|
-
series.columns.template.width = am4core__namespace.percent((_h = settings.ColumnWidthPercentage) !== null && _h !== void 0 ? _h : this.DefaultColumnWidthPercentage);
|
|
2278
|
-
var columnTemplate = series.columns.template;
|
|
2279
|
-
columnTemplate.strokeWidth = 2;
|
|
2280
|
-
columnTemplate.strokeOpacity = 1;
|
|
2281
|
-
return this;
|
|
2282
|
-
};
|
|
2283
|
-
/** @ignore */
|
|
2284
|
-
VerticalChartService.prototype.refreshData = function (data) {
|
|
2285
|
-
//TODO:IMPL
|
|
2286
|
-
};
|
|
2287
|
-
return VerticalChartService;
|
|
2288
|
-
}());
|
|
2289
|
-
|
|
2290
2174
|
/**
|
|
2291
2175
|
* Classe il cui unico scopo è gestire il setup e rendering di un VerticalStackedChart
|
|
2292
2176
|
*/
|
|
@@ -2414,6 +2298,142 @@
|
|
|
2414
2298
|
return VerticalStackedChartService;
|
|
2415
2299
|
}());
|
|
2416
2300
|
|
|
2301
|
+
/**
|
|
2302
|
+
* Classe il cui unico scopo è gestire il setup e rendering di un AreaChart
|
|
2303
|
+
*/
|
|
2304
|
+
var AreaChartService = /** @class */ (function () {
|
|
2305
|
+
/** @ignore */
|
|
2306
|
+
function AreaChartService(Adapter) {
|
|
2307
|
+
this.Adapter = Adapter;
|
|
2308
|
+
//******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
|
|
2309
|
+
//TODO: spostarla in un metodo di utilità (esfaenza/extensions)
|
|
2310
|
+
/** @ignore */
|
|
2311
|
+
this.executionTimers = {};
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un AreaChart
|
|
2315
|
+
*/
|
|
2316
|
+
AreaChartService.prototype.graphicate = function (data, settings) {
|
|
2317
|
+
var _this = this;
|
|
2318
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2319
|
+
if (settings.Timeline) {
|
|
2320
|
+
console.error("Timeline not supported for area chart");
|
|
2321
|
+
return null;
|
|
2322
|
+
}
|
|
2323
|
+
var dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
|
|
2324
|
+
var showTicks = settings.ShowTicks == null ? true : settings === null || settings === void 0 ? void 0 : settings.ShowTicks;
|
|
2325
|
+
var interval = dataConverted.interval;
|
|
2326
|
+
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
2327
|
+
am4core__namespace.options.autoDispose = true;
|
|
2328
|
+
this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
|
|
2329
|
+
var ChartInstanceCasted = this.ChartInstance;
|
|
2330
|
+
if (settings.Legend) {
|
|
2331
|
+
ChartInstanceCasted.legend = new am4charts__namespace.Legend();
|
|
2332
|
+
ChartInstanceCasted.legend.position = (_a = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _a !== void 0 ? _a : 'right';
|
|
2333
|
+
ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
|
|
2334
|
+
if (settings.LegendPadding) {
|
|
2335
|
+
var template = this.ChartInstance.legend.itemContainers.template;
|
|
2336
|
+
template.paddingTop = (_b = settings.LegendPadding.top) !== null && _b !== void 0 ? _b : 0;
|
|
2337
|
+
template.paddingBottom = (_c = settings.LegendPadding.bottom) !== null && _c !== void 0 ? _c : 0;
|
|
2338
|
+
template.paddingLeft = (_d = settings.LegendPadding.left) !== null && _d !== void 0 ? _d : 0;
|
|
2339
|
+
template.paddingRight = (_e = settings.LegendPadding.right) !== null && _e !== void 0 ? _e : 0;
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
var yAxis = ChartInstanceCasted.yAxes.push(new am4charts__namespace.ValueAxis());
|
|
2343
|
+
yAxis.tooltip.disabled = true;
|
|
2344
|
+
if (settings.YAxisTitle) {
|
|
2345
|
+
yAxis.title.text = settings.YAxisTitle;
|
|
2346
|
+
yAxis.title.fontWeight = "bold";
|
|
2347
|
+
}
|
|
2348
|
+
yAxis.min = 0;
|
|
2349
|
+
var dateAxis = ChartInstanceCasted.xAxes.push(new am4charts__namespace.DateAxis());
|
|
2350
|
+
dateAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 50;
|
|
2351
|
+
dateAxis.startLocation = 0.5;
|
|
2352
|
+
dateAxis.endLocation = 0.5;
|
|
2353
|
+
if (settings.XAxisTitle) {
|
|
2354
|
+
dateAxis.title.text = settings.XAxisTitle;
|
|
2355
|
+
dateAxis.title.fontWeight = "bold";
|
|
2356
|
+
}
|
|
2357
|
+
if (showTicks) {
|
|
2358
|
+
dateAxis.renderer.ticks.template.disabled = false;
|
|
2359
|
+
dateAxis.renderer.ticks.template.strokeOpacity = 1;
|
|
2360
|
+
dateAxis.renderer.ticks.template.stroke = am4core__namespace.color("#495C43");
|
|
2361
|
+
dateAxis.renderer.ticks.template.strokeWidth = 2;
|
|
2362
|
+
dateAxis.renderer.ticks.template.length = 10;
|
|
2363
|
+
dateAxis.renderer.ticks.template.location = 0;
|
|
2364
|
+
}
|
|
2365
|
+
if (!!interval)
|
|
2366
|
+
dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
|
|
2367
|
+
// Unisco il dataset e tiro fuori i dati
|
|
2368
|
+
var chartData = [];
|
|
2369
|
+
var seriesToMakeCache = {};
|
|
2370
|
+
var seriesToMake = [];
|
|
2371
|
+
for (var i = 0; i < dataConverted.groups.length; i++) {
|
|
2372
|
+
var group = dataConverted.groups[i];
|
|
2373
|
+
var dataItem = { date: group.name };
|
|
2374
|
+
for (var ii = 0; ii < group.values.length; ii++) {
|
|
2375
|
+
var val = group.values[ii];
|
|
2376
|
+
dataItem[val.k] = val.v;
|
|
2377
|
+
if (!seriesToMakeCache[val.k]) {
|
|
2378
|
+
seriesToMakeCache[val.k] = true;
|
|
2379
|
+
seriesToMake.push(val.k);
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
chartData.push(dataItem);
|
|
2383
|
+
}
|
|
2384
|
+
ChartInstanceCasted.data = chartData;
|
|
2385
|
+
//---------------------------------------------------------
|
|
2386
|
+
seriesToMake.forEach(function (s) { _this.createSeries(ChartInstanceCasted, s); });
|
|
2387
|
+
ChartInstanceCasted.cursor = new am4charts__namespace.XYCursor();
|
|
2388
|
+
ChartInstanceCasted.cursor.xAxis = dateAxis;
|
|
2389
|
+
dateAxis.events.on("startchanged", function (t) { return _this.emitSelectionChanged(t, settings); });
|
|
2390
|
+
dateAxis.events.on("endchanged", function (t) { return _this.emitSelectionChanged(t, settings); });
|
|
2391
|
+
return this;
|
|
2392
|
+
};
|
|
2393
|
+
/** @ignore */
|
|
2394
|
+
AreaChartService.prototype.refreshData = function (data) {
|
|
2395
|
+
//TODO:IMPL
|
|
2396
|
+
};
|
|
2397
|
+
/** @ignore */
|
|
2398
|
+
AreaChartService.prototype.emitSelectionChanged = function (ev, settings) {
|
|
2399
|
+
if (settings.OnSelectionChangedCallback) {
|
|
2400
|
+
this.throttla("selchange", function () {
|
|
2401
|
+
var axis = ev.target;
|
|
2402
|
+
var start = new Date(axis.minZoomed);
|
|
2403
|
+
var end = new Date(axis.maxZoomed);
|
|
2404
|
+
var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
|
|
2405
|
+
settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
|
|
2406
|
+
}, 150);
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
/** @ignore */
|
|
2410
|
+
AreaChartService.prototype.createSeries = function (chart, name) {
|
|
2411
|
+
var series = chart.series.push(new am4charts__namespace.LineSeries());
|
|
2412
|
+
series.dataFields.dateX = "date";
|
|
2413
|
+
series.name = name[0].toUpperCase() + name.slice(1);
|
|
2414
|
+
series.dataFields.valueY = name;
|
|
2415
|
+
series.tooltipText = "[#000]{valueY.value}[/]";
|
|
2416
|
+
//series.tooltip.background.fill = am4core.color("#FFF");
|
|
2417
|
+
series.tooltip.getStrokeFromObject = true;
|
|
2418
|
+
series.tooltip.background.strokeWidth = 3;
|
|
2419
|
+
series.tooltip.getFillFromObject = false;
|
|
2420
|
+
series.fillOpacity = 0.6;
|
|
2421
|
+
series.strokeWidth = 2;
|
|
2422
|
+
series.stacked = true;
|
|
2423
|
+
return series;
|
|
2424
|
+
};
|
|
2425
|
+
/** @ignore */
|
|
2426
|
+
AreaChartService.prototype.throttla = function (id, func, throttleTime) {
|
|
2427
|
+
var _this = this;
|
|
2428
|
+
//Se ho la funzione che vuole eseguire ripulisco quel timeout
|
|
2429
|
+
if (this.executionTimers[id])
|
|
2430
|
+
clearTimeout(this.executionTimers[id]);
|
|
2431
|
+
//Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
|
|
2432
|
+
this.executionTimers[id] = setTimeout(function () { func(); _this.executionTimers[id] = null; }, throttleTime);
|
|
2433
|
+
};
|
|
2434
|
+
return AreaChartService;
|
|
2435
|
+
}());
|
|
2436
|
+
|
|
2417
2437
|
/**
|
|
2418
2438
|
* Componente specifico per la graficazione di un qualsiasi tipo di grafico.
|
|
2419
2439
|
*
|
|
@@ -3168,6 +3188,7 @@
|
|
|
3168
3188
|
exports.AreaChartData = AreaChartData;
|
|
3169
3189
|
exports.AreaChartSettings = AreaChartSettings;
|
|
3170
3190
|
exports.BaseAdapter = BaseAdapter;
|
|
3191
|
+
exports.BaseChartComponent = BaseChartComponent;
|
|
3171
3192
|
exports.BaseInterval = BaseInterval;
|
|
3172
3193
|
exports.BaseSettings = BaseSettings;
|
|
3173
3194
|
exports.ChartThemes = ChartThemes;
|
|
@@ -3196,23 +3217,13 @@
|
|
|
3196
3217
|
exports.VerticalChartSettings = VerticalChartSettings;
|
|
3197
3218
|
exports.VerticalStackedChartData = VerticalStackedChartData;
|
|
3198
3219
|
exports.VerticalStackedChartSettings = VerticalStackedChartSettings;
|
|
3199
|
-
exports.ɵa =
|
|
3200
|
-
exports.ɵb =
|
|
3201
|
-
exports.ɵc =
|
|
3202
|
-
exports.ɵd =
|
|
3203
|
-
exports.ɵe =
|
|
3204
|
-
exports.ɵf =
|
|
3205
|
-
exports.ɵg =
|
|
3206
|
-
exports.ɵh = ESC_LOGS;
|
|
3207
|
-
exports.ɵi = BaseAdapter;
|
|
3208
|
-
exports.ɵj = EsChartComponent;
|
|
3209
|
-
exports.ɵk = EsLineChartComponent;
|
|
3210
|
-
exports.ɵl = EsPieChartComponent;
|
|
3211
|
-
exports.ɵm = EsVertical2DChartComponent;
|
|
3212
|
-
exports.ɵn = EsVerticalChartComponent;
|
|
3213
|
-
exports.ɵo = EsVerticalStackedChartComponent;
|
|
3214
|
-
exports.ɵp = PageChartSelector;
|
|
3215
|
-
exports.ɵq = EsAreaChartComponent;
|
|
3220
|
+
exports.ɵa = ChartLoader;
|
|
3221
|
+
exports.ɵb = ChartDispatcher;
|
|
3222
|
+
exports.ɵc = ESC_LOCALE;
|
|
3223
|
+
exports.ɵd = ESC_ANIMATIONS;
|
|
3224
|
+
exports.ɵe = ESC_THEME;
|
|
3225
|
+
exports.ɵf = ESC_LOGS;
|
|
3226
|
+
exports.ɵg = PageChartSelector;
|
|
3216
3227
|
|
|
3217
3228
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3218
3229
|
|