@esfaenza/es-charts 11.2.8 → 11.2.12

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.
@@ -640,15 +640,17 @@
640
640
  * @param {string} name Nome della serie
641
641
  * @param {DateValue[]} values Valori della serie
642
642
  * @param {BaseInterval} interval Intervallo della serie. Viene utilizzato per gestire Gap e date in Istante Finale
643
- * @param {string} color Colore della serie, verrà usato sia per la lineaa base che eventualmente per il riempimento (in caso si utilizzi l'Input **Fill** nel grafico)
643
+ * @param {string} color Colore della serie, verrà usato sia per la linea base che eventualmente per il riempimento (in caso si utilizzi l'Input **Fill** nel grafico)
644
644
  * @param {string} uom Unità di misura da presentare nell'asse delle Y
645
+ * @param {boolean} fill Override della proprietà **Fill** del grafico, specifico per ogni serie
645
646
  */
646
- function LineSerie(name, values, interval, color, uom) {
647
+ function LineSerie(name, values, interval, color, uom, fill) {
647
648
  this.name = name;
648
649
  this.values = values;
649
650
  this.interval = interval;
650
651
  this.color = color;
651
652
  this.uom = uom;
653
+ this.fill = fill;
652
654
  }
653
655
  return LineSerie;
654
656
  }());
@@ -911,7 +913,6 @@
911
913
  * 4) Creazione grafico 2
912
914
  *
913
915
  */
914
- //@Injectable()
915
916
  var ChartLoader = /** @class */ (function () {
916
917
  /**
917
918
  * @ignore
@@ -1440,7 +1441,7 @@
1440
1441
  */
1441
1442
  LineChartService.prototype.graphicate = function (data, settings) {
1442
1443
  var _this = this;
1443
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1444
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1444
1445
  var dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
1445
1446
  var threshold = (_a = settings.DataGroupingThreshold) !== null && _a !== void 0 ? _a : 3000;
1446
1447
  var singleDataSet = (_b = settings.MergeDatasets) !== null && _b !== void 0 ? _b : false;
@@ -1451,7 +1452,6 @@
1451
1452
  var interval = seriesWithInterval ? dataConverted.series.find(function (t) { return t.interval; }).interval : null;
1452
1453
  var gapsAllowed = (settings === null || settings === void 0 ? void 0 : settings.AllowGaps) == null ? seriesWithInterval : settings === null || settings === void 0 ? void 0 : settings.AllowGaps;
1453
1454
  var finalInstant = (_c = settings === null || settings === void 0 ? void 0 : settings.FinalInstants) !== null && _c !== void 0 ? _c : true;
1454
- var fill = (_d = settings === null || settings === void 0 ? void 0 : settings.Fill) !== null && _d !== void 0 ? _d : false;
1455
1455
  //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1456
1456
  am4core__namespace.options.autoDispose = true;
1457
1457
  this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
@@ -1478,11 +1478,11 @@
1478
1478
  dateAxis.renderer.ticks.template.length = 10;
1479
1479
  dateAxis.renderer.ticks.template.location = 0;
1480
1480
  }
1481
- dateAxis.renderer.minGridDistance = (_e = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _e !== void 0 ? _e : 50;
1481
+ dateAxis.renderer.minGridDistance = (_d = settings === null || settings === void 0 ? void 0 : settings.MinGridDistance) !== null && _d !== void 0 ? _d : 50;
1482
1482
  dateAxis.renderer.grid.template.location = 0;
1483
1483
  dateAxis.minZoomCount = 5;
1484
1484
  dateAxis.groupData = dataShouldBeGrouped;
1485
- dateAxis.groupCount = (_f = settings.DataGroupBucketSize) !== null && _f !== void 0 ? _f : this.DataGroupBucketSize;
1485
+ dateAxis.groupCount = (_e = settings.DataGroupBucketSize) !== null && _e !== void 0 ? _e : this.DataGroupBucketSize;
1486
1486
  //Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
1487
1487
  if (gapsAllowed) {
1488
1488
  if (!seriesWithInterval) {
@@ -1526,7 +1526,7 @@
1526
1526
  }
1527
1527
  //-- Fine generazione
1528
1528
  dataConverted.series.forEach(function (s, index) {
1529
- var _a, _b;
1529
+ var _a, _b, _c;
1530
1530
  if (s.values[0] && !(s.values[0].d instanceof Date)) {
1531
1531
  for (var v = 0; v < s.values.length; v++)
1532
1532
  s.values[v].d = new Date(s.values[v].d);
@@ -1543,12 +1543,13 @@
1543
1543
  }
1544
1544
  if (!correctOrder)
1545
1545
  s.values.sort(function (d1, d2) { return d1.d.getTime() - d2.d.getTime(); });
1546
+ 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);
1546
1547
  var series = (settings === null || settings === void 0 ? void 0 : settings.Step) ? new am4charts__namespace.StepLineSeries() : new am4charts__namespace.LineSeries();
1547
1548
  series.dataFields.valueY = "v" + (singleDataSet ? index : "");
1548
1549
  series.dataFields.dateX = "d";
1549
1550
  series.dataFields.measureUnit = s.uom;
1550
1551
  series.name = s.name;
1551
- series.strokeWidth = (_a = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _a !== void 0 ? _a : 1;
1552
+ series.strokeWidth = (_b = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _b !== void 0 ? _b : 1;
1552
1553
  series.connect = !gapsAllowed;
1553
1554
  series.minBulletDistance = 10;
1554
1555
  series.tooltipText = singleDataSet ? "" : "{name}: [bold]{valueY}[/]";
@@ -1599,7 +1600,7 @@
1599
1600
  series.data = s.values;
1600
1601
  var segment = series.segments.template;
1601
1602
  var hoverState = segment.states.create("hover");
1602
- hoverState.properties.strokeWidth = ((_b = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _b !== void 0 ? _b : 1) + 1;
1603
+ hoverState.properties.strokeWidth = ((_c = settings === null || settings === void 0 ? void 0 : settings.StrokeSize) !== null && _c !== void 0 ? _c : 1) + 1;
1603
1604
  var dimmed = segment.states.create("dimmed");
1604
1605
  dimmed.properties.stroke = am4core__namespace.color("#dadada");
1605
1606
  //Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
@@ -1620,17 +1621,25 @@
1620
1621
  });
1621
1622
  if (settings.Legend) {
1622
1623
  this.ChartInstance.legend = new am4charts__namespace.Legend();
1623
- this.ChartInstance.legend.position = (_g = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _g !== void 0 ? _g : 'right';
1624
+ this.ChartInstance.legend.position = (_f = settings === null || settings === void 0 ? void 0 : settings.LegendPosition) !== null && _f !== void 0 ? _f : 'right';
1624
1625
  this.ChartInstance.legend.scrollable = true;
1625
1626
  this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
1626
- this.ChartInstance.legend.itemContainers.template.events.on("over", function (event) { _this.processOver(event.target.dataItem.dataContext, fill); });
1627
- this.ChartInstance.legend.itemContainers.template.events.on("out", function (event) { _this.processOut(fill); });
1627
+ this.ChartInstance.legend.itemContainers.template.events.on("over", function (event) {
1628
+ var series = event.target.dataItem.dataContext;
1629
+ var fill = series.stacked;
1630
+ _this.processOver(series, fill);
1631
+ });
1632
+ this.ChartInstance.legend.itemContainers.template.events.on("out", function (event) {
1633
+ var series = event.target.dataItem.dataContext;
1634
+ var fill = series.stacked;
1635
+ _this.processOut(fill);
1636
+ });
1628
1637
  if (settings.LegendPadding) {
1629
1638
  var template = this.ChartInstance.legend.itemContainers.template;
1630
- template.paddingTop = (_h = settings.LegendPadding.top) !== null && _h !== void 0 ? _h : 0;
1631
- template.paddingBottom = (_j = settings.LegendPadding.bottom) !== null && _j !== void 0 ? _j : 0;
1632
- template.paddingLeft = (_k = settings.LegendPadding.left) !== null && _k !== void 0 ? _k : 0;
1633
- template.paddingRight = (_l = settings.LegendPadding.right) !== null && _l !== void 0 ? _l : 0;
1639
+ template.paddingTop = (_g = settings.LegendPadding.top) !== null && _g !== void 0 ? _g : 0;
1640
+ template.paddingBottom = (_h = settings.LegendPadding.bottom) !== null && _h !== void 0 ? _h : 0;
1641
+ template.paddingLeft = (_j = settings.LegendPadding.left) !== null && _j !== void 0 ? _j : 0;
1642
+ template.paddingRight = (_k = settings.LegendPadding.right) !== null && _k !== void 0 ? _k : 0;
1634
1643
  }
1635
1644
  }
1636
1645
  this.ChartInstance.cursor = new am4charts__namespace.XYCursor();
@@ -3086,6 +3095,7 @@
3086
3095
  { provide: ESC_THEME, useValue: (config === null || config === void 0 ? void 0 : config.theme) || 'spiritedaway' },
3087
3096
  { provide: ESC_LOGS, useValue: (config === null || config === void 0 ? void 0 : config.debugMode) == null ? false : config === null || config === void 0 ? void 0 : config.debugMode },
3088
3097
  { provide: BaseAdapter, useClass: (config === null || config === void 0 ? void 0 : config.adapter) || BaseAdapter },
3098
+ // Singleton cattiva by Ema. Verificare strade migliori
3089
3099
  { provide: ChartLoader, useValue: new ChartLoader((config === null || config === void 0 ? void 0 : config.debugMode) == null ? false : config === null || config === void 0 ? void 0 : config.debugMode) }
3090
3100
  ]
3091
3101
  };