@axdspub/axiom-charts 0.0.9 → 0.0.10

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.
@@ -434,6 +434,7 @@ var ChartRoot = /** @class */ (function () {
434
434
  case 1:
435
435
  _a.sent();
436
436
  this.showYAxes(yAxes);
437
+ this.showYLabels(yAxes, this.plots);
437
438
  yAxesWidth = this.getYAxesWidth();
438
439
  chartWidth = this.getChartWidth();
439
440
  xRange = this.getXRange(chartWidth);
@@ -491,6 +492,8 @@ var ChartRoot = /** @class */ (function () {
491
492
  };
492
493
  ChartRoot.prototype.showYAxes = function (yAxes) {
493
494
  };
495
+ ChartRoot.prototype.showYLabels = function (yAxes, plots) {
496
+ };
494
497
  ChartRoot.prototype.showXAxes = function (xAxes) {
495
498
  };
496
499
  ChartRoot.prototype.draw = function () {
@@ -945,6 +948,29 @@ var AxiomChart = /** @class */ (function (_super) {
945
948
  }
946
949
  });
947
950
  };
951
+ AxiomChart.prototype.showYLabels = function (axes, plots) {
952
+ var _a;
953
+ if (plots.length > 1) {
954
+ return;
955
+ }
956
+ if (plots[0].type !== EPlotTypes.line) {
957
+ return;
958
+ }
959
+ var chartElements = this.getChartElements();
960
+ var label = (_a = axes[0].plots[0].dimensions.y.label) !== null && _a !== void 0 ? _a : '';
961
+ if (chartElements === undefined) {
962
+ return undefined;
963
+ }
964
+ var svg = chartElements.svg;
965
+ var axisSelection = svg.select('.y-axis').size() > 0 ? svg.select('.y-axis') : svg.append('g').attr('class', 'y-axis axis');
966
+ axisSelection.append('text')
967
+ .attr('class', 'y-label')
968
+ .attr('text-anchor', 'end')
969
+ .attr('dy', '.75rem')
970
+ .attr('font-size', '.75rem')
971
+ .attr('transform', 'rotate(-90)')
972
+ .text(label);
973
+ };
948
974
  AxiomChart.prototype.getXAxisOffset = function (axis) {
949
975
  return __assign({ x: this.settings.margin.left, y: this.settings.height - this.settings.margin.bottom }, axis.offset);
950
976
  };