@axdspub/axiom-charts 0.0.30 → 0.0.31

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.
@@ -71,6 +71,10 @@ class PlotRoot extends RequestItem {
71
71
  enabled: true,
72
72
  axis: EChartAxes.x
73
73
  };
74
+ this.legendSettingsDefaults = {
75
+ hide: false,
76
+ axis: EChartAxes.y
77
+ };
74
78
  this.id = props.id;
75
79
  this.type = props.type;
76
80
  this.chart = props.chart;
@@ -80,7 +84,7 @@ class PlotRoot extends RequestItem {
80
84
  this.onDataLoad = props.onDataLoad;
81
85
  this.axisSettings = props.axisSettings;
82
86
  this.scrubSettings = Object.assign(Object.assign({}, this.scrubSettingsDefaults), props.scrubSettings);
83
- this.legendSettings = Object.assign({ hide: false }, props.legendSettings);
87
+ this.legendSettings = Object.assign(Object.assign({}, this.legendSettingsDefaults), props.legendSettings);
84
88
  this.runtime = {};
85
89
  }
86
90
  getAxisSetting(axis) {
@@ -547,12 +551,17 @@ class AxiomLine extends AxiomPlotRoot {
547
551
  }
548
552
  line$1(this.parsedData);
549
553
  ctx.stroke();
550
- if (((_m = this.axes) === null || _m === void 0 ? void 0 : _m.y) !== undefined && !((_o = this.legendSettings.hide) !== null && _o !== void 0 ? _o : false)) {
551
- _super.onLegendReady.call(this, [{
552
- id: this.axes.y.key,
553
- label: (_p = chart.getAxisLabel(this.axes.y, 'y')) !== null && _p !== void 0 ? _p : this.axes.y.key,
554
- style: { backgroundColor: ctx.strokeStyle }
555
- }]);
554
+ if (this.legendSettings.axis !== undefined &&
555
+ this.axes !== undefined &&
556
+ !((_m = this.legendSettings.hide) !== null && _m !== void 0 ? _m : false)) {
557
+ const legendAxis = this.axes[this.legendSettings.axis];
558
+ if (legendAxis !== undefined) {
559
+ _super.onLegendReady.call(this, [{
560
+ id: legendAxis.key,
561
+ label: (_p = (_o = chart.getAxisLabel(legendAxis, this.legendSettings.axis)) !== null && _o !== void 0 ? _o : legendAxis.label) !== null && _p !== void 0 ? _p : legendAxis.key,
562
+ style: { backgroundColor: ctx.strokeStyle }
563
+ }]);
564
+ }
556
565
  }
557
566
  this.setupScrubbing();
558
567
  });