@esfaenza/es-charts 11.2.14 → 11.2.18

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.
@@ -60,10 +60,9 @@ class LineChartData {
60
60
  * @param {LineSerie[]} series Lista di serie da graficare
61
61
  * @param {{upper: lower}}
62
62
  */
63
- constructor(series = [], limit, limitColors) {
63
+ constructor(series = [], limit) {
64
64
  this.series = series;
65
65
  this.limit = limit;
66
- this.limitColors = limitColors;
67
66
  }
68
67
  }
69
68
 
@@ -220,9 +219,13 @@ class LegendPad {
220
219
  */
221
220
  class Limit {
222
221
  /** @ignore */
223
- constructor(upper, lower) {
222
+ constructor(upper, upperLabel, upperColor, lower, lowerLabel, lowerColor) {
224
223
  this.upper = upper;
224
+ this.upperLabel = upperLabel;
225
+ this.upperColor = upperColor;
225
226
  this.lower = lower;
227
+ this.lowerLabel = lowerLabel;
228
+ this.lowerColor = lowerColor;
226
229
  }
227
230
  }
228
231
 
@@ -702,6 +705,11 @@ class BaseChartComponent {
702
705
  * Evento lanciato al termine del caricamento di una nuova pagina del grafico
703
706
  */
704
707
  this.onLoadEnd = new EventEmitter();
708
+ /**
709
+ * Evento lanciato al termine della creazione del grafico referenziando l'istanza nativa del grafico creato in modo da poter effettuare modifiche
710
+ * post inizializzazione lato applicativo
711
+ */
712
+ this.chartLoaded = new EventEmitter();
705
713
  /**
706
714
  * Serve a decidere se sarà presente l'interfaccia di paginazione
707
715
  */
@@ -790,7 +798,7 @@ class BaseChartComponent {
790
798
  this.Chart = this.ChartService.ChartInstance;
791
799
  if (!this.Chart)
792
800
  this.log("Chart " + this.name + ": Could not create graph");
793
- return this.Charter.applyLocale(this.Chart, this.Locale).then(() => this.initDone = true);
801
+ return this.Charter.applyLocale(this.Chart, this.Locale).then(() => { this.initDone = true; this.chartLoaded.emit(this.Chart); });
794
802
  })
795
803
  ]);
796
804
  }
@@ -952,7 +960,8 @@ BaseChartComponent.propDecorators = {
952
960
  onSelectionChanged: [{ type: Output }],
953
961
  onSeriesClicked: [{ type: Output }],
954
962
  onLoadStart: [{ type: Output }],
955
- onLoadEnd: [{ type: Output }]
963
+ onLoadEnd: [{ type: Output }],
964
+ chartLoaded: [{ type: Output }]
956
965
  };
957
966
 
958
967
  /**
@@ -976,7 +985,7 @@ class LineChartService {
976
985
  * Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un LineChart
977
986
  */
978
987
  graphicate(data, settings) {
979
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
988
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
980
989
  let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
981
990
  let threshold = (_a = settings.DataGroupingThreshold) !== null && _a !== void 0 ? _a : 3000;
982
991
  let singleDataSet = (_b = settings.MergeDatasets) !== null && _b !== void 0 ? _b : false;
@@ -1004,14 +1013,24 @@ class LineChartService {
1004
1013
  if (dataConverted.limit.upper != null && dataConverted.limit.upper != undefined) {
1005
1014
  let range = yAxis.axisRanges.create();
1006
1015
  range.value = dataConverted.limit.upper;
1007
- range.grid.stroke = am4core.color(((_d = dataConverted === null || dataConverted === void 0 ? void 0 : dataConverted.limitColors) === null || _d === void 0 ? void 0 : _d.upper) || "#F92200");
1016
+ range.label.inside = true;
1017
+ range.label.text = dataConverted.limit.upperLabel;
1018
+ range.label.fill = range.grid.stroke;
1019
+ range.label.verticalCenter = "bottom";
1020
+ range.label.stroke = am4core.color(dataConverted.limit.upperColor || "#F92200");
1021
+ range.grid.stroke = am4core.color(dataConverted.limit.upperColor || "#F92200");
1008
1022
  range.grid.strokeWidth = 2;
1009
1023
  range.grid.strokeOpacity = 1;
1010
1024
  }
1011
1025
  if (dataConverted.limit.lower != null && dataConverted.limit.lower != undefined) {
1012
1026
  let range = yAxis.axisRanges.create();
1013
1027
  range.value = dataConverted.limit.lower;
1014
- range.grid.stroke = am4core.color(((_e = dataConverted === null || dataConverted === void 0 ? void 0 : dataConverted.limitColors) === null || _e === void 0 ? void 0 : _e.lower) || "#F92200");
1028
+ range.label.inside = true;
1029
+ range.label.text = dataConverted.limit.lowerLabel;
1030
+ range.label.fill = range.grid.stroke;
1031
+ range.label.verticalCenter = "bottom";
1032
+ range.label.stroke = am4core.color(dataConverted.limit.lowerColor || "#F92200");
1033
+ range.grid.stroke = am4core.color(dataConverted.limit.lowerColor || "#F92200");
1015
1034
  range.grid.strokeWidth = 2;
1016
1035
  range.grid.strokeOpacity = 1;
1017
1036
  }
@@ -1029,11 +1048,11 @@ class LineChartService {
1029
1048
  dateAxis.renderer.ticks.template.length = 10;
1030
1049
  dateAxis.renderer.ticks.template.location = 0;
1031
1050
  }
1032
- dateAxis.renderer.minGridDistance = (_f = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _f !== void 0 ? _f : 50;
1051
+ dateAxis.renderer.minGridDistance = (_d = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _d !== void 0 ? _d : 50;
1033
1052
  dateAxis.renderer.grid.template.location = 0;
1034
1053
  dateAxis.minZoomCount = 5;
1035
1054
  dateAxis.groupData = dataShouldBeGrouped;
1036
- dateAxis.groupCount = (_g = settings.DataGroupBucketSize) !== null && _g !== void 0 ? _g : this.DataGroupBucketSize;
1055
+ dateAxis.groupCount = (_e = settings.DataGroupBucketSize) !== null && _e !== void 0 ? _e : this.DataGroupBucketSize;
1037
1056
  //Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
1038
1057
  if (gapsAllowed) {
1039
1058
  if (!seriesWithInterval) {
@@ -1172,17 +1191,17 @@ class LineChartService {
1172
1191
  });
1173
1192
  if (settings.Legend) {
1174
1193
  this.ChartInstance.legend = new am4charts.Legend();
1175
- this.ChartInstance.legend.position = (_h = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _h !== void 0 ? _h : 'right';
1194
+ this.ChartInstance.legend.position = (_f = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _f !== void 0 ? _f : 'right';
1176
1195
  this.ChartInstance.legend.scrollable = true;
1177
1196
  this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
1178
1197
  this.ChartInstance.legend.itemContainers.template.events.on("over", (event) => { this.processOver(event.target.dataItem.dataContext); });
1179
1198
  this.ChartInstance.legend.itemContainers.template.events.on("out", () => { this.processOut(); });
1180
1199
  if (settings.LegendPadding) {
1181
1200
  let template = this.ChartInstance.legend.itemContainers.template;
1182
- template.paddingTop = (_j = settings.LegendPadding.top) !== null && _j !== void 0 ? _j : 0;
1183
- template.paddingBottom = (_k = settings.LegendPadding.bottom) !== null && _k !== void 0 ? _k : 0;
1184
- template.paddingLeft = (_l = settings.LegendPadding.left) !== null && _l !== void 0 ? _l : 0;
1185
- template.paddingRight = (_m = settings.LegendPadding.right) !== null && _m !== void 0 ? _m : 0;
1201
+ template.paddingTop = (_g = settings.LegendPadding.top) !== null && _g !== void 0 ? _g : 0;
1202
+ template.paddingBottom = (_h = settings.LegendPadding.bottom) !== null && _h !== void 0 ? _h : 0;
1203
+ template.paddingLeft = (_j = settings.LegendPadding.left) !== null && _j !== void 0 ? _j : 0;
1204
+ template.paddingRight = (_k = settings.LegendPadding.right) !== null && _k !== void 0 ? _k : 0;
1186
1205
  }
1187
1206
  }
1188
1207
  this.ChartInstance.cursor = new am4charts.XYCursor();