@axdspub/axiom-charts 0.0.29 → 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,6 +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);
87
+ this.legendSettings = Object.assign(Object.assign({}, this.legendSettingsDefaults), props.legendSettings);
83
88
  this.runtime = {};
84
89
  }
85
90
  getAxisSetting(axis) {
@@ -487,7 +492,7 @@ class AxiomLine extends AxiomPlotRoot {
487
492
  const _super = Object.create(null, {
488
493
  onLegendReady: { get: () => super.onLegendReady }
489
494
  });
490
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
495
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
491
496
  return __awaiter(this, void 0, void 0, function* () {
492
497
  const style = this.style !== undefined ? this.style : {};
493
498
  if (this.parsedData === undefined) {
@@ -546,12 +551,17 @@ class AxiomLine extends AxiomPlotRoot {
546
551
  }
547
552
  line$1(this.parsedData);
548
553
  ctx.stroke();
549
- if (((_m = this.axes) === null || _m === void 0 ? void 0 : _m.y) !== undefined) {
550
- _super.onLegendReady.call(this, [{
551
- id: this.axes.y.key,
552
- label: (_o = chart.getAxisLabel(this.axes.y, 'y')) !== null && _o !== void 0 ? _o : this.axes.y.key,
553
- style: { backgroundColor: ctx.strokeStyle }
554
- }]);
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
+ }
555
565
  }
556
566
  this.setupScrubbing();
557
567
  });
@@ -626,7 +636,7 @@ class AxiomArea extends AxiomPlotRoot {
626
636
  const _super = Object.create(null, {
627
637
  onLegendReady: { get: () => super.onLegendReady }
628
638
  });
629
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
639
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
630
640
  return __awaiter(this, void 0, void 0, function* () {
631
641
  const style = this.style !== undefined ? this.style : {};
632
642
  const data = yield this.getData();
@@ -694,10 +704,10 @@ class AxiomArea extends AxiomPlotRoot {
694
704
  ctx.beginPath();
695
705
  area$1(parsedData);
696
706
  ctx.fill();
697
- if (((_m = this.axes) === null || _m === void 0 ? void 0 : _m.y) !== undefined) {
707
+ if (((_m = this.axes) === null || _m === void 0 ? void 0 : _m.y) !== undefined && !((_o = this.legendSettings.hide) !== null && _o !== void 0 ? _o : false)) {
698
708
  _super.onLegendReady.call(this, [{
699
709
  id: this.axes.y.key,
700
- label: (_o = chart.getAxisLabel(this.axes.y, 'y')) !== null && _o !== void 0 ? _o : this.axes.y.key,
710
+ label: (_p = chart.getAxisLabel(this.axes.y, 'y')) !== null && _p !== void 0 ? _p : this.axes.y.key,
701
711
  style: { backgroundColor: ctx.fillStyle }
702
712
  }]);
703
713
  }
@@ -749,7 +759,7 @@ class AxiomScatter extends AxiomPlotRoot {
749
759
  const _super = Object.create(null, {
750
760
  onLegendReady: { get: () => super.onLegendReady }
751
761
  });
752
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
762
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
753
763
  return __awaiter(this, void 0, void 0, function* () {
754
764
  const style = this.style !== undefined ? this.style : {};
755
765
  const data = yield this.getData();
@@ -804,10 +814,10 @@ class AxiomScatter extends AxiomPlotRoot {
804
814
  ctx.fill();
805
815
  }
806
816
  });
807
- if (((_m = this.axes) === null || _m === void 0 ? void 0 : _m.y) !== undefined) {
817
+ if (((_m = this.axes) === null || _m === void 0 ? void 0 : _m.y) !== undefined && !((_o = this.legendSettings.hide) !== null && _o !== void 0 ? _o : false)) {
808
818
  _super.onLegendReady.call(this, [{
809
819
  id: this.axes.y.key,
810
- label: (_o = chart.getAxisLabel(this.axes.y, 'y')) !== null && _o !== void 0 ? _o : this.axes.y.key,
820
+ label: (_p = chart.getAxisLabel(this.axes.y, 'y')) !== null && _p !== void 0 ? _p : this.axes.y.key,
811
821
  style: {
812
822
  backgroundColor: ctx.fillStyle,
813
823
  border: `1px solid ${ctx.strokeStyle}`
@@ -1467,7 +1477,7 @@ class AxiomRadialLine extends AxiomLine {
1467
1477
  const _super = Object.create(null, {
1468
1478
  onLegendReady: { get: () => super.onLegendReady }
1469
1479
  });
1470
- var _a, _b, _c, _d, _e, _f, _g;
1480
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1471
1481
  return __awaiter(this, void 0, void 0, function* () {
1472
1482
  const style = this.style !== undefined ? this.style : {};
1473
1483
  const data = yield this.getData();
@@ -1520,10 +1530,10 @@ class AxiomRadialLine extends AxiomLine {
1520
1530
  .attr('stroke', stroke)
1521
1531
  .attr('stroke-width', style.strokeWidth !== undefined ? style.strokeWidth : 1)
1522
1532
  .attr('d', line(radialData));
1523
- if (((_f = this.axes) === null || _f === void 0 ? void 0 : _f.y) !== undefined) {
1533
+ if (((_f = this.axes) === null || _f === void 0 ? void 0 : _f.y) !== undefined && !((_g = this.legendSettings.hide) !== null && _g !== void 0 ? _g : false)) {
1524
1534
  _super.onLegendReady.call(this, [{
1525
1535
  id: this.axes.y.key,
1526
- label: (_g = chart.getAxisLabel(this.axes.y, 'y')) !== null && _g !== void 0 ? _g : this.axes.y.key,
1536
+ label: (_h = chart.getAxisLabel(this.axes.y, 'y')) !== null && _h !== void 0 ? _h : this.axes.y.key,
1527
1537
  style: { backgroundColor: stroke }
1528
1538
  }]);
1529
1539
  }
@@ -1536,7 +1546,7 @@ class AxiomRadialScatter extends AxiomLine {
1536
1546
  const _super = Object.create(null, {
1537
1547
  onLegendReady: { get: () => super.onLegendReady }
1538
1548
  });
1539
- var _a, _b, _c, _d, _e, _f, _g;
1549
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1540
1550
  return __awaiter(this, void 0, void 0, function* () {
1541
1551
  // const style = this.style !== undefined ? this.style : {}
1542
1552
  const data = yield this.getData();
@@ -1587,10 +1597,10 @@ class AxiomRadialScatter extends AxiomLine {
1587
1597
  .attr('cx', pt[0] + chart.settings.margin.left)
1588
1598
  .attr('cy', pt[1] + chart.settings.margin.top);
1589
1599
  });
1590
- if (((_f = this.axes) === null || _f === void 0 ? void 0 : _f.y) !== undefined) {
1600
+ if (((_f = this.axes) === null || _f === void 0 ? void 0 : _f.y) !== undefined && !((_g = this.legendSettings.hide) !== null && _g !== void 0 ? _g : false)) {
1591
1601
  _super.onLegendReady.call(this, [{
1592
1602
  id: this.axes.y.key,
1593
- label: (_g = chart.getAxisLabel(this.axes.y, 'y')) !== null && _g !== void 0 ? _g : this.axes.y.key,
1603
+ label: (_h = chart.getAxisLabel(this.axes.y, 'y')) !== null && _h !== void 0 ? _h : this.axes.y.key,
1594
1604
  style: {
1595
1605
  backgroundColor: fill,
1596
1606
  border: `1px solid ${stroke}`
@@ -1606,7 +1616,7 @@ class AxiomRadialArea extends AxiomArea {
1606
1616
  const _super = Object.create(null, {
1607
1617
  onLegendReady: { get: () => super.onLegendReady }
1608
1618
  });
1609
- var _a, _b, _c, _d, _e, _f, _g;
1619
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1610
1620
  return __awaiter(this, void 0, void 0, function* () {
1611
1621
  const style = this.style !== undefined ? this.style : {};
1612
1622
  const data = yield this.getData();
@@ -1669,10 +1679,10 @@ class AxiomRadialArea extends AxiomArea {
1669
1679
  .attr('fill', fill)
1670
1680
  .attr('stroke-width', style.strokeWidth !== undefined ? style.strokeWidth : 1)
1671
1681
  .attr('d', area(radialData));
1672
- if (((_f = this.axes) === null || _f === void 0 ? void 0 : _f.y) !== undefined) {
1682
+ if (((_f = this.axes) === null || _f === void 0 ? void 0 : _f.y) !== undefined && !((_g = this.legendSettings.hide) !== null && _g !== void 0 ? _g : false)) {
1673
1683
  _super.onLegendReady.call(this, [{
1674
1684
  id: this.axes.y.key,
1675
- label: (_g = chart.getAxisLabel(this.axes.y, 'y')) !== null && _g !== void 0 ? _g : this.axes.y.key,
1685
+ label: (_h = chart.getAxisLabel(this.axes.y, 'y')) !== null && _h !== void 0 ? _h : this.axes.y.key,
1676
1686
  style: { backgroundColor: fill }
1677
1687
  }]);
1678
1688
  }