@esfaenza/es-charts 11.2.9 → 11.2.13

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
  }());
@@ -1439,7 +1441,7 @@
1439
1441
  */
1440
1442
  LineChartService.prototype.graphicate = function (data, settings) {
1441
1443
  var _this = this;
1442
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1444
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1443
1445
  var dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
1444
1446
  var threshold = (_a = settings.DataGroupingThreshold) !== null && _a !== void 0 ? _a : 3000;
1445
1447
  var singleDataSet = (_b = settings.MergeDatasets) !== null && _b !== void 0 ? _b : false;
@@ -1450,7 +1452,6 @@
1450
1452
  var interval = seriesWithInterval ? dataConverted.series.find(function (t) { return t.interval; }).interval : null;
1451
1453
  var gapsAllowed = (settings === null || settings === void 0 ? void 0 : settings.AllowGaps) == null ? seriesWithInterval : settings === null || settings === void 0 ? void 0 : settings.AllowGaps;
1452
1454
  var finalInstant = (_c = settings === null || settings === void 0 ? void 0 : settings.FinalInstants) !== null && _c !== void 0 ? _c : true;
1453
- var fill = (_d = settings === null || settings === void 0 ? void 0 : settings.Fill) !== null && _d !== void 0 ? _d : false;
1454
1455
  //Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
1455
1456
  am4core__namespace.options.autoDispose = true;
1456
1457
  this.ChartInstance = am4core__namespace.create(settings.Name, am4charts__namespace.XYChart);
@@ -1477,11 +1478,11 @@
1477
1478
  dateAxis.renderer.ticks.template.length = 10;
1478
1479
  dateAxis.renderer.ticks.template.location = 0;
1479
1480
  }
1480
- 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;
1481
1482
  dateAxis.renderer.grid.template.location = 0;
1482
1483
  dateAxis.minZoomCount = 5;
1483
1484
  dateAxis.groupData = dataShouldBeGrouped;
1484
- 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;
1485
1486
  //Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
1486
1487
  if (gapsAllowed) {
1487
1488
  if (!seriesWithInterval) {
@@ -1525,7 +1526,7 @@
1525
1526
  }
1526
1527
  //-- Fine generazione
1527
1528
  dataConverted.series.forEach(function (s, index) {
1528
- var _a, _b;
1529
+ var _a, _b, _c;
1529
1530
  if (s.values[0] && !(s.values[0].d instanceof Date)) {
1530
1531
  for (var v = 0; v < s.values.length; v++)
1531
1532
  s.values[v].d = new Date(s.values[v].d);
@@ -1542,12 +1543,13 @@
1542
1543
  }
1543
1544
  if (!correctOrder)
1544
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);
1545
1547
  var series = (settings === null || settings === void 0 ? void 0 : settings.Step) ? new am4charts__namespace.StepLineSeries() : new am4charts__namespace.LineSeries();
1546
1548
  series.dataFields.valueY = "v" + (singleDataSet ? index : "");
1547
1549
  series.dataFields.dateX = "d";
1548
1550
  series.dataFields.measureUnit = s.uom;
1549
1551
  series.name = s.name;
1550
- 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;
1551
1553
  series.connect = !gapsAllowed;
1552
1554
  series.minBulletDistance = 10;
1553
1555
  series.tooltipText = singleDataSet ? "" : "{name}: [bold]{valueY}[/]";
@@ -1598,7 +1600,7 @@
1598
1600
  series.data = s.values;
1599
1601
  var segment = series.segments.template;
1600
1602
  var hoverState = segment.states.create("hover");
1601
- 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;
1602
1604
  var dimmed = segment.states.create("dimmed");
1603
1605
  dimmed.properties.stroke = am4core__namespace.color("#dadada");
1604
1606
  //Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
@@ -1619,17 +1621,17 @@
1619
1621
  });
1620
1622
  if (settings.Legend) {
1621
1623
  this.ChartInstance.legend = new am4charts__namespace.Legend();
1622
- 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';
1623
1625
  this.ChartInstance.legend.scrollable = true;
1624
1626
  this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
1625
- this.ChartInstance.legend.itemContainers.template.events.on("over", function (event) { _this.processOver(event.target.dataItem.dataContext, fill); });
1626
- this.ChartInstance.legend.itemContainers.template.events.on("out", function (event) { _this.processOut(fill); });
1627
+ this.ChartInstance.legend.itemContainers.template.events.on("over", function (event) { _this.processOver(event.target.dataItem.dataContext); });
1628
+ this.ChartInstance.legend.itemContainers.template.events.on("out", function () { _this.processOut(); });
1627
1629
  if (settings.LegendPadding) {
1628
1630
  var template = this.ChartInstance.legend.itemContainers.template;
1629
- template.paddingTop = (_h = settings.LegendPadding.top) !== null && _h !== void 0 ? _h : 0;
1630
- template.paddingBottom = (_j = settings.LegendPadding.bottom) !== null && _j !== void 0 ? _j : 0;
1631
- template.paddingLeft = (_k = settings.LegendPadding.left) !== null && _k !== void 0 ? _k : 0;
1632
- template.paddingRight = (_l = settings.LegendPadding.right) !== null && _l !== void 0 ? _l : 0;
1631
+ template.paddingTop = (_g = settings.LegendPadding.top) !== null && _g !== void 0 ? _g : 0;
1632
+ template.paddingBottom = (_h = settings.LegendPadding.bottom) !== null && _h !== void 0 ? _h : 0;
1633
+ template.paddingLeft = (_j = settings.LegendPadding.left) !== null && _j !== void 0 ? _j : 0;
1634
+ template.paddingRight = (_k = settings.LegendPadding.right) !== null && _k !== void 0 ? _k : 0;
1633
1635
  }
1634
1636
  }
1635
1637
  this.ChartInstance.cursor = new am4charts__namespace.XYCursor();
@@ -1672,9 +1674,10 @@
1672
1674
  }
1673
1675
  };
1674
1676
  /** @ignore */
1675
- LineChartService.prototype.processOver = function (hoveredSeries, fill) {
1677
+ LineChartService.prototype.processOver = function (hoveredSeries) {
1676
1678
  var _this = this;
1677
1679
  hoveredSeries.toFront();
1680
+ var fill = hoveredSeries.stacked;
1678
1681
  hoveredSeries.segments.each(function (segment) {
1679
1682
  segment.setState("hover");
1680
1683
  if (!fill)
@@ -1683,17 +1686,20 @@
1683
1686
  if (!fill)
1684
1687
  hoveredSeries.legendDataItem.marker.children.getIndex(1).fillOpacity = this.OpacityOnSelected;
1685
1688
  this.ChartInstance.series.each(function (series) {
1686
- if (series != hoveredSeries)
1689
+ if (series != hoveredSeries) {
1690
+ var fill_1 = series.stacked;
1687
1691
  series.segments.each(function (segment) {
1688
1692
  segment.setState("dimmed");
1689
- if (!fill)
1693
+ if (!fill_1)
1690
1694
  segment.fillSprite.fillOpacity = 0;
1691
1695
  });
1696
+ }
1692
1697
  });
1693
1698
  };
1694
1699
  /** @ignore */
1695
- LineChartService.prototype.processOut = function (fill) {
1700
+ LineChartService.prototype.processOut = function () {
1696
1701
  this.ChartInstance.series.each(function (series) {
1702
+ var fill = series.stacked;
1697
1703
  series.segments.each(function (segment) {
1698
1704
  segment.setState("default");
1699
1705
  if (!fill)