@esfaenza/es-charts 15.2.7 → 15.2.8

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.
@@ -1220,7 +1220,7 @@ class LineChartService {
1220
1220
  console.error("Per utilizzare la funzionalità dei gap è obbligatorio definire un intervallo nelle serie del grafico");
1221
1221
  return null;
1222
1222
  }
1223
- dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
1223
+ dateAxis.baseInterval = { count: interval.count, timeUnit: this.fixTimeUnit(interval.timeunit) };
1224
1224
  }
1225
1225
  if (showTimeline)
1226
1226
  ChartInstanceCasted.scrollbarX = new am4charts.XYChartScrollbar();
@@ -1369,6 +1369,26 @@ class LineChartService {
1369
1369
  dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
1370
1370
  return this;
1371
1371
  }
1372
+ fixTimeUnit(tu) {
1373
+ if (tu === 0)
1374
+ return "millisecond";
1375
+ else if (tu === 1)
1376
+ return "second";
1377
+ else if (tu === 2)
1378
+ return "minute";
1379
+ else if (tu === 3)
1380
+ return "hour";
1381
+ else if (tu === 4)
1382
+ return "day";
1383
+ else if (tu === 5)
1384
+ return "week";
1385
+ else if (tu === 6)
1386
+ return "month";
1387
+ else if (tu === 7)
1388
+ return "year";
1389
+ else
1390
+ return tu;
1391
+ }
1372
1392
  /** @ignore */
1373
1393
  setSelection(from, to) {
1374
1394
  this.dateAxis.zoomToDates(from, to, true, true);
@@ -2041,7 +2061,7 @@ class AreaChartService {
2041
2061
  dateAxis.renderer.ticks.template.location = 0;
2042
2062
  }
2043
2063
  if (!!interval)
2044
- dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
2064
+ dateAxis.baseInterval = { count: interval.count, timeUnit: this.fixTimeUnit(interval.timeunit) };
2045
2065
  // Unisco il dataset e tiro fuori i dati
2046
2066
  let chartData = [];
2047
2067
  let seriesToMakeCache = {};
@@ -2068,6 +2088,26 @@ class AreaChartService {
2068
2088
  dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
2069
2089
  return this;
2070
2090
  }
2091
+ fixTimeUnit(tu) {
2092
+ if (tu === 0)
2093
+ return "millisecond";
2094
+ else if (tu === 1)
2095
+ return "second";
2096
+ else if (tu === 2)
2097
+ return "minute";
2098
+ else if (tu === 3)
2099
+ return "hour";
2100
+ else if (tu === 4)
2101
+ return "day";
2102
+ else if (tu === 5)
2103
+ return "week";
2104
+ else if (tu === 6)
2105
+ return "month";
2106
+ else if (tu === 7)
2107
+ return "year";
2108
+ else
2109
+ return tu;
2110
+ }
2071
2111
  /** @ignore */
2072
2112
  setSelection(from, to) {
2073
2113
  }