@record-evolution/widget-linechart 1.5.4 → 1.5.5

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.
@@ -23500,7 +23500,7 @@ class WidgetLinechart extends h {
23500
23500
  constructor() {
23501
23501
  super(...arguments);
23502
23502
  this.canvasList = new Map();
23503
- this.version = '1.5.4';
23503
+ this.version = '1.5.5';
23504
23504
  }
23505
23505
  update(changedProperties) {
23506
23506
  if (changedProperties.has('inputData') && this.chartContainer) {
@@ -23572,7 +23572,11 @@ class WidgetLinechart extends h {
23572
23572
  // If the chartName ends with :pivot: then create a seperate chart for each pivoted dataseries
23573
23573
  if (!this.canvasList.has(chartName)) {
23574
23574
  // initialize new charts
23575
- this.canvasList.set(chartName, { chart: undefined, dataSets: [] });
23575
+ this.canvasList.set(chartName, {
23576
+ chartJsInstance: undefined,
23577
+ // @ts-ignore
23578
+ dataSets: []
23579
+ });
23576
23580
  }
23577
23581
  (_m = this.canvasList.get(chartName)) === null || _m === void 0 ? void 0 : _m.dataSets.push(pds);
23578
23582
  });
@@ -23581,19 +23585,29 @@ class WidgetLinechart extends h {
23581
23585
  // this.inputData.dataseries = []
23582
23586
  // console.log('new linechart datasets', this.canvasList)
23583
23587
  }
23584
- applyInputData() {
23588
+ async applyInputData() {
23585
23589
  this.setupCharts();
23586
23590
  this.requestUpdate();
23587
- this.canvasList.forEach(({ chart, dataSets }) => {
23588
- var _a, _b, _c, _d, _e, _f, _g, _h;
23589
- if (chart) {
23590
- chart.data.datasets = dataSets;
23591
- chart.options.scales.x.type = this.xAxisType();
23592
- chart.options.scales.x.title.display = !!((_b = (_a = this.inputData) === null || _a === void 0 ? void 0 : _a.axis) === null || _b === void 0 ? void 0 : _b.xAxisLabel);
23593
- chart.options.scales.x.title.text = (_d = (_c = this.inputData) === null || _c === void 0 ? void 0 : _c.axis) === null || _d === void 0 ? void 0 : _d.xAxisLabel;
23594
- chart.options.scales.y.title.display = !!((_f = (_e = this.inputData) === null || _e === void 0 ? void 0 : _e.axis) === null || _f === void 0 ? void 0 : _f.yAxisLabel);
23595
- chart.options.scales.y.title.text = (_h = (_g = this.inputData) === null || _g === void 0 ? void 0 : _g.axis) === null || _h === void 0 ? void 0 : _h.yAxisLabel;
23596
- chart === null || chart === void 0 ? void 0 : chart.update('resize');
23591
+ await this.updateComplete;
23592
+ this.canvasList.forEach(({ chartJsInstance, dataSets }) => {
23593
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
23594
+ var _o, _p, _q;
23595
+ if (chartJsInstance) {
23596
+ chartJsInstance.data.datasets = dataSets;
23597
+ (_a = chartJsInstance.options) !== null && _a !== void 0 ? _a : (chartJsInstance.options = {});
23598
+ (_b = (_o = chartJsInstance.options).scales) !== null && _b !== void 0 ? _b : (_o.scales = {});
23599
+ (_c = (_p = chartJsInstance.options.scales).x) !== null && _c !== void 0 ? _c : (_p.x = {});
23600
+ (_d = (_q = chartJsInstance.options.scales).y) !== null && _d !== void 0 ? _d : (_q.y = {});
23601
+ chartJsInstance.options.scales.x.type = this.xAxisType();
23602
+ // @ts-ignore
23603
+ chartJsInstance.options.scales.x.title.display = !!((_f = (_e = this.inputData) === null || _e === void 0 ? void 0 : _e.axis) === null || _f === void 0 ? void 0 : _f.xAxisLabel);
23604
+ // @ts-ignore
23605
+ chartJsInstance.options.scales.x.title.text = (_h = (_g = this.inputData) === null || _g === void 0 ? void 0 : _g.axis) === null || _h === void 0 ? void 0 : _h.xAxisLabel;
23606
+ // @ts-ignore
23607
+ chartJsInstance.options.scales.y.title.display = !!((_k = (_j = this.inputData) === null || _j === void 0 ? void 0 : _j.axis) === null || _k === void 0 ? void 0 : _k.yAxisLabel);
23608
+ // @ts-ignore
23609
+ chartJsInstance.options.scales.y.title.text = (_m = (_l = this.inputData) === null || _l === void 0 ? void 0 : _l.axis) === null || _m === void 0 ? void 0 : _m.yAxisLabel;
23610
+ chartJsInstance === null || chartJsInstance === void 0 ? void 0 : chartJsInstance.update('resize');
23597
23611
  }
23598
23612
  });
23599
23613
  }
@@ -23614,7 +23628,7 @@ class WidgetLinechart extends h {
23614
23628
  this.canvasList.delete(chartName);
23615
23629
  return;
23616
23630
  }
23617
- if (chartM.chart)
23631
+ if (chartM.chartJsInstance)
23618
23632
  return;
23619
23633
  if (!this.chartContainer)
23620
23634
  throw new Error('chartContainer not found');
@@ -23628,7 +23642,7 @@ class WidgetLinechart extends h {
23628
23642
  if (!canvas)
23629
23643
  throw new Error('canvas not found');
23630
23644
  // console.log('chartM', canvas, chartM.chart)
23631
- chartM.chart = new Chart(canvas, {
23645
+ chartM.chartJsInstance = new Chart(canvas, {
23632
23646
  type: 'line',
23633
23647
  data: {
23634
23648
  // @ts-ignore
@@ -23676,6 +23690,7 @@ class WidgetLinechart extends h {
23676
23690
  <p class="paging" ?active=${(_c = this.inputData) === null || _c === void 0 ? void 0 : _c.subTitle}>${(_d = this.inputData) === null || _d === void 0 ? void 0 : _d.subTitle}</p>
23677
23691
  </header>
23678
23692
 
23693
+ <div class="paging no-data" ?active=${!this.canvasList.size}>No Data</div>
23679
23694
  <div
23680
23695
  class="chart-container ${((_f = (_e = this === null || this === void 0 ? void 0 : this.inputData) === null || _e === void 0 ? void 0 : _e.axis) === null || _f === void 0 ? void 0 : _f.columnLayout) ? 'columnLayout' : ''}"
23681
23696
  ></div>
@@ -23740,6 +23755,17 @@ WidgetLinechart.styles = i$1 `
23740
23755
  font-size: 14px;
23741
23756
  line-height: 17px;
23742
23757
  }
23758
+
23759
+ .no-data {
23760
+ font-size: 20px;
23761
+ color: var(--re-text-color, #000);
23762
+ display: flex;
23763
+ height: 100%;
23764
+ width: 100%;
23765
+ text-align: center;
23766
+ align-items: center;
23767
+ justify-content: center;
23768
+ }
23743
23769
  `;
23744
23770
  __decorate([
23745
23771
  n({ type: Object })
@@ -23747,7 +23773,7 @@ __decorate([
23747
23773
  __decorate([
23748
23774
  r()
23749
23775
  ], WidgetLinechart.prototype, "canvasList", void 0);
23750
- window.customElements.define('widget-linechart-1.5.4', WidgetLinechart);
23776
+ window.customElements.define('widget-linechart-1.5.5', WidgetLinechart);
23751
23777
  const FORMATS = {
23752
23778
  datetime: 'MMM d, yyyy, h:mm:ss aaaa',
23753
23779
  millisecond: 'h:mm:ss.SSS aaaa',