@websy/websy-designs 1.7.6 → 1.7.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.
@@ -6675,7 +6675,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
6675
6675
  bodyEl.innerHTML = this.buildBodyHtml(data, true);
6676
6676
  this.currentData = data;
6677
6677
  } else {
6678
- bodyEl.innerHTML += this.buildBodyHtml(data, true);
6678
+ if (bodyEl.querySelector('tbody')) {
6679
+ bodyEl.querySelector('tbody').innerHTML += this.buildBodyHtml(data, true, true);
6680
+ } else {
6681
+ bodyEl.innerHTML += this.buildBodyHtml(data, true);
6682
+ }
6683
+
6679
6684
  this.currentData = this.currentData.concat(data);
6680
6685
  }
6681
6686
  } // this.data = this.data.concat(data)
@@ -7772,39 +7777,50 @@ var WebsyChart = /*#__PURE__*/function () {
7772
7777
  var that = this;
7773
7778
 
7774
7779
  this.brushed = function (event) {
7775
- console.log('brushing', event);
7776
7780
  var newX = that.options.margin.left + that.options.margin.axisLeft + (1 - event.selection[0] / (that.plotWidth / (that.widthForCalc + that.totalBandPadding)));
7781
+ var newY = that.options.margin.top + that.options.margin.axisTop;
7782
+
7783
+ if (that.options.orientation === 'horizontal') {
7784
+ newX = that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft;
7785
+ newY = that.options.margin.top + that.options.margin.axisTop + (1 - event.selection[0] / (that.plotHeight / (that.widthForCalc + that.totalBandPadding)));
7786
+ }
7777
7787
 
7778
7788
  if (that.plotArea) {
7779
- that.plotArea.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7789
+ that.plotArea.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7780
7790
  }
7781
7791
 
7782
7792
  if (that.areaLayer) {
7783
- that.areaLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7793
+ that.areaLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7784
7794
  }
7785
7795
 
7786
7796
  if (that.lineLayer) {
7787
- that.lineLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7797
+ that.lineLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7788
7798
  }
7789
7799
 
7790
7800
  if (that.barLayer) {
7791
- that.barLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7801
+ that.barLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7792
7802
  }
7793
7803
 
7794
7804
  if (that.labelLayer) {
7795
- that.labelLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7805
+ that.labelLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7796
7806
  }
7797
7807
 
7798
7808
  if (that.symbolLayer) {
7799
- that.symbolLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7809
+ that.symbolLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7800
7810
  }
7801
7811
 
7802
7812
  if (that.refLineLayer) {
7803
- that.refLineLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7813
+ that.refLineLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7804
7814
  }
7805
7815
 
7806
- if (that.bottomAxisLayer) {
7807
- that.bottomAxisLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop + that.plotHeight, ")"));
7816
+ if (that.options.orientation === 'horizontal') {
7817
+ if (that.leftAxisLayer) {
7818
+ that.leftAxisLayer.attr('transform', "translate(".concat(that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft, ", ").concat(newY, ")"));
7819
+ }
7820
+ } else {
7821
+ if (that.bottomAxisLayer) {
7822
+ that.bottomAxisLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY + that.plotHeight, ")"));
7823
+ }
7808
7824
  } // that.brushedDomain = []
7809
7825
  // let xAxis = 'bottom'
7810
7826
  // let xAxisCaps = 'Bottom'
@@ -7899,18 +7915,18 @@ var WebsyChart = /*#__PURE__*/function () {
7899
7915
  _createClass(WebsyChart, [{
7900
7916
  key: "close",
7901
7917
  value: function close() {
7902
- this.leftAxisLayer.selectAll('*').remove();
7903
- this.rightAxisLayer.selectAll('*').remove();
7904
- this.bottomAxisLayer.selectAll('*').remove();
7905
- this.leftAxisLabel.selectAll('*').remove();
7906
- this.rightAxisLabel.selectAll('*').remove();
7907
- this.bottomAxisLabel.selectAll('*').remove();
7908
- this.plotArea.selectAll('*').remove();
7909
- this.areaLayer.selectAll('*').remove();
7910
- this.lineLayer.selectAll('*').remove();
7911
- this.barLayer.selectAll('*').remove();
7912
- this.labelLayer.selectAll('*').remove();
7913
- this.symbolLayer.selectAll('*').remove();
7918
+ this.leftAxisLayer && this.leftAxisLayer.selectAll('*').remove();
7919
+ this.rightAxisLayer && this.rightAxisLayer.selectAll('*').remove();
7920
+ this.bottomAxisLayer && this.bottomAxisLayer.selectAll('*').remove();
7921
+ this.leftAxisLabel && this.leftAxisLabel.selectAll('*').remove();
7922
+ this.rightAxisLabel && this.rightAxisLabel.selectAll('*').remove();
7923
+ this.bottomAxisLabel && this.bottomAxisLabel.selectAll('*').remove();
7924
+ this.plotArea && this.plotArea.selectAll('*').remove();
7925
+ this.areaLayer && this.areaLayer.selectAll('*').remove();
7926
+ this.lineLayer && this.lineLayer.selectAll('*').remove();
7927
+ this.barLayer && this.barLayer.selectAll('*').remove();
7928
+ this.labelLayer && this.labelLayer.selectAll('*').remove();
7929
+ this.symbolLayer && this.symbolLayer.selectAll('*').remove();
7914
7930
  }
7915
7931
  }, {
7916
7932
  key: "createDomain",
@@ -8208,8 +8224,7 @@ var WebsyChart = /*#__PURE__*/function () {
8208
8224
  this.xAxisClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_xAxisClip")).append('rect');
8209
8225
  this.yAxisClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_yAxisClip")).append('rect');
8210
8226
  this.brushClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_brushclip")).append('rect');
8211
- this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer'); // .attr('clip-path', `url(#${this.elementId}_yAxisClip)`).append('g')
8212
-
8227
+ this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer').attr('clip-path', "url(#".concat(this.elementId, "_yAxisClip)")).append('g');
8213
8228
  this.rightAxisLayer = this.svg.append('g').attr('class', 'right-axis-layer');
8214
8229
  this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer').attr('clip-path', "url(#".concat(this.elementId, "_xAxisClip)")).append('g');
8215
8230
  this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer');
@@ -8647,28 +8662,31 @@ var WebsyChart = /*#__PURE__*/function () {
8647
8662
  // Translate the layers
8648
8663
 
8649
8664
 
8650
- this.leftAxisLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).style('font-size', this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
8651
- this.rightAxisLayer.attr('transform', "translate(".concat(this.options.margin.left + this.plotWidth + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).style('font-size', this.options.data.right && this.options.data.right.fontSize || this.options.fontSize);
8652
- this.bottomAxisLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).style('font-size', this.options.data.bottom && this.options.data.bottom.fontSize || this.options.fontSize);
8653
- this.leftAxisLabel.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8654
- this.rightAxisLabel.attr('transform', "translate(".concat(this.options.margin.left + this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8655
- this.bottomAxisLabel.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")"));
8656
- this.plotArea.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8657
- this.areaLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8658
- this.lineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8659
- this.barLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8660
- this.labelLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8661
- this.symbolLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8662
- this.refLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8663
- this.trackingLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8664
- this.clip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", 0)")).attr('width', this.plotWidth).attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop);
8665
+ var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight + 5 : 0;
8666
+ this.leftAxisLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).style('font-size', this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
8667
+ this.rightAxisLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.plotWidth + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).style('font-size', this.options.data.right && this.options.data.right.fontSize || this.options.fontSize);
8668
+ this.bottomAxisLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).style('font-size', this.options.data.bottom && this.options.data.bottom.fontSize || this.options.fontSize);
8669
+ this.leftAxisLabel.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8670
+ this.rightAxisLabel.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8671
+ this.bottomAxisLabel.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")"));
8672
+ this.plotArea.attr('transform', "translate(".concat(leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8673
+ this.areaLayer.attr('transform', "translate(".concat(leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8674
+ this.lineLayer.attr('transform', "translate(".concat(leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8675
+ this.barLayer.attr('transform', "translate(".concat(leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8676
+ this.labelLayer.attr('transform', "translate(".concat(leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8677
+ this.symbolLayer.attr('transform', "translate(".concat(leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8678
+ this.refLineLayer.attr('transform', "translate(".concat(leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8679
+ this.trackingLineLayer.attr('transform', "translate(".concat(leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8680
+ this.clip.attr('transform', "translate(".concat(leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft, ", 0)")).attr('width', this.plotWidth).attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop);
8665
8681
 
8666
8682
  if (this.options.orientation === 'horizontal') {
8667
8683
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8668
- this.yAxisClip.attr('transform', "translate(".concat(this.options.brushHeight + this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('width', this.options.margin.axisLeft - this.options.brushHeight).attr('height', this.plotHeight);
8684
+ this.yAxisClip.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('width', this.options.margin.axisLeft + 10).attr('height', this.plotHeight);
8685
+ this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight).attr('height', longestBottomBounds.height + 10);
8669
8686
  this.brushClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('height', this.plotHeight).attr('width', this.options.brushHeight);
8670
8687
  } else {
8671
8688
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")"));
8689
+ this.yAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop - 10, ")")).attr('width', this.options.margin.axisLeft + 10).attr('height', this.plotHeight + 20);
8672
8690
  this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight).attr('height', longestBottomBounds.height + 10);
8673
8691
  this.brushClip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")")).attr('width', this.plotWidth).attr('height', this.options.brushHeight);
8674
8692
  }
@@ -9149,7 +9167,7 @@ var WebsyChart = /*#__PURE__*/function () {
9149
9167
  if (this.options.orientation === 'horizontal') {
9150
9168
  output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2));
9151
9169
  } else {
9152
- var x = getBarX.call(this, d, i, xAxis);
9170
+ var x = getBarX.call(this, d, i, yAxis, xAxis);
9153
9171
 
9154
9172
  if (typeof x === 'undefined' || x === null) {
9155
9173
  return null;
@@ -9165,13 +9183,15 @@ var WebsyChart = /*#__PURE__*/function () {
9165
9183
  return output;
9166
9184
  }
9167
9185
 
9168
- function getBarWidth(d, i, xAxis) {
9186
+ function getBarWidth(d, i, yAxis, xAxis) {
9169
9187
  var output;
9170
9188
 
9171
9189
  if (this.options.orientation === 'horizontal') {
9172
- output = this["".concat(yAxis, "Axis")](Math.abs(d.y.value)); // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
9190
+ // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
9191
+ output = this["".concat(yAxis, "Axis")](Math.abs(d.y.value)); // output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
9192
+ // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
9173
9193
  } else {
9174
- var x = getBarX.call(this, d, i, xAxis);
9194
+ var x = getBarX.call(this, d, i, yAxis, xAxis);
9175
9195
 
9176
9196
  if (typeof x === 'undefined' || x === null) {
9177
9197
  return null;
@@ -9187,28 +9207,40 @@ var WebsyChart = /*#__PURE__*/function () {
9187
9207
  return output;
9188
9208
  }
9189
9209
 
9190
- function getBarX(d, i, xAxis) {
9210
+ function getBarX(d, i, yAxis, xAxis) {
9191
9211
  var output;
9192
9212
 
9193
9213
  if (this.options.orientation === 'horizontal') {
9214
+ // if (this.options.grouping === 'stacked') {
9215
+ // // let h = getBarWidth.call(this, d, i, xAxis)
9216
+ // // let adjustment = 0
9217
+ // // if (d.y.accumulative && d.y.accumulative !== 0) {
9218
+ // // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
9219
+ // // }
9220
+ // // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
9221
+ // let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
9222
+ // // let h = getBarWidth.call(this, d, i, xAxis)
9223
+ // output = (accH * (d.y.accumulative < 0 ? 0 : 1))
9224
+ // }
9225
+ // else {
9226
+ // let h = getBarWidth.call(this, d, i, xAxis)
9227
+ // output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value < 0 ? 1 : 0))
9228
+ // }
9194
9229
  if (this.options.grouping === 'stacked') {
9195
- // let h = getBarWidth.call(this, d, i, xAxis)
9196
- // let adjustment = 0
9197
- // if (d.y.accumulative && d.y.accumulative !== 0) {
9198
- // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
9199
- // }
9200
- // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
9230
+ // no support for stacks yet
9201
9231
  var accH = getBarWidth.call(this, {
9202
9232
  x: d.x,
9203
9233
  y: {
9204
9234
  value: d.y.accumulative
9205
9235
  }
9206
- }, i, xAxis); // let h = getBarWidth.call(this, d, i, xAxis)
9236
+ }, i, yAxis, xAxis);
9237
+ var h = getBarWidth.call(this, d, i, yAxis, xAxis); // output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
9207
9238
 
9208
- output = accH * (d.y.accumulative < 0 ? 0 : 1);
9239
+ output = this["".concat(yAxis, "Axis")](0) + accH * (d.y.accumulative > 0 ? 1 : 0);
9209
9240
  } else {
9210
- var h = getBarWidth.call(this, d, i, xAxis);
9211
- output = this["".concat(yAxis, "Axis")](0) + h * (d.y.value < 0 ? 1 : 0);
9241
+ var _h = getBarWidth.call(this, d, i, yAxis, xAxis);
9242
+
9243
+ output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value > 0 ? 0 : 1);
9212
9244
  }
9213
9245
  } else {
9214
9246
  // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
@@ -9292,9 +9324,9 @@ var WebsyChart = /*#__PURE__*/function () {
9292
9324
  var h = getBarHeight.call(this, d, i, yAxis, xAxis);
9293
9325
  output = this["".concat(yAxis, "Axis")](0) - (accH + h) * (d.y.accumulative < 0 ? 0 : 1);
9294
9326
  } else {
9295
- var _h = getBarHeight.call(this, d, i, yAxis, xAxis);
9327
+ var _h2 = getBarHeight.call(this, d, i, yAxis, xAxis);
9296
9328
 
9297
- output = this["".concat(yAxis, "Axis")](0) - _h * (d.y.value < 0 ? 0 : 1);
9329
+ output = this["".concat(yAxis, "Axis")](0) - _h2 * (d.y.value < 0 ? 0 : 1);
9298
9330
  }
9299
9331
  }
9300
9332
 
@@ -9307,11 +9339,11 @@ var WebsyChart = /*#__PURE__*/function () {
9307
9339
 
9308
9340
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9309
9341
  bars.attr('width', function (d, i) {
9310
- return Math.abs(getBarWidth.call(_this50, d, i, xAxis));
9342
+ return Math.abs(getBarWidth.call(_this50, d, i, yAxis, xAxis));
9311
9343
  }).attr('height', function (d, i) {
9312
9344
  return getBarHeight.call(_this50, d, i, yAxis, xAxis);
9313
9345
  }).attr('x', function (d, i) {
9314
- return getBarX.call(_this50, d, i, xAxis);
9346
+ return getBarX.call(_this50, d, i, yAxis, xAxis);
9315
9347
  }).attr('y', function (d, i) {
9316
9348
  return getBarY.call(_this50, d, i, yAxis, xAxis);
9317
9349
  }) // .transition(this.transition)
@@ -9319,11 +9351,11 @@ var WebsyChart = /*#__PURE__*/function () {
9319
9351
  return d.y.color || d.color || series.color;
9320
9352
  });
9321
9353
  bars.enter().append('rect').attr('width', function (d, i) {
9322
- return Math.abs(getBarWidth.call(_this50, d, i, xAxis));
9354
+ return Math.abs(getBarWidth.call(_this50, d, i, yAxis, xAxis));
9323
9355
  }).attr('height', function (d, i) {
9324
9356
  return getBarHeight.call(_this50, d, i, yAxis, xAxis);
9325
9357
  }).attr('x', function (d, i) {
9326
- return getBarX.call(_this50, d, i, xAxis);
9358
+ return getBarX.call(_this50, d, i, yAxis, xAxis);
9327
9359
  }).attr('y', function (d, i) {
9328
9360
  return getBarY.call(_this50, d, i, yAxis, xAxis);
9329
9361
  }) // .transition(this.transition)
@@ -9337,11 +9369,11 @@ var WebsyChart = /*#__PURE__*/function () {
9337
9369
  this.brushBarsInitialized[series.key] = true;
9338
9370
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9339
9371
  brushBars.attr('width', function (d, i) {
9340
- return Math.abs(getBarWidth.call(_this50, d, i, "".concat(xAxis, "Brush")));
9372
+ return Math.abs(getBarWidth.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9341
9373
  }).attr('height', function (d, i) {
9342
9374
  return getBarHeight.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9343
9375
  }).attr('x', function (d, i) {
9344
- return getBarX.call(_this50, d, i, "".concat(xAxis, "Brush"));
9376
+ return getBarX.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9345
9377
  }).attr('y', function (d, i) {
9346
9378
  return getBarY.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9347
9379
  }) // .transition(this.transition)
@@ -9349,11 +9381,11 @@ var WebsyChart = /*#__PURE__*/function () {
9349
9381
  return d.y.color || d.color || series.color;
9350
9382
  });
9351
9383
  brushBars.enter().append('rect').attr('width', function (d, i) {
9352
- return Math.abs(getBarWidth.call(_this50, d, i, "".concat(xAxis, "Brush")));
9384
+ return Math.abs(getBarWidth.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9353
9385
  }).attr('height', function (d, i) {
9354
9386
  return getBarHeight.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9355
9387
  }).attr('x', function (d, i) {
9356
- return getBarX.call(_this50, d, i, "".concat(xAxis, "Brush"));
9388
+ return getBarX.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9357
9389
  }).attr('y', function (d, i) {
9358
9390
  return getBarY.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9359
9391
  }) // .transition(this.transition)
@@ -9411,6 +9443,14 @@ var WebsyChart = /*#__PURE__*/function () {
9411
9443
  this.setAttribute('text-anchor', 'end');
9412
9444
  this.setAttribute('x', +this.getAttribute('x') - 8);
9413
9445
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9446
+ } else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
9447
+ this.setAttribute('text-anchor', 'end');
9448
+ this.setAttribute('x', +this.getAttribute('x') - 8);
9449
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9450
+ } else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
9451
+ this.setAttribute('text-anchor', 'start');
9452
+ this.setAttribute('x', +this.getAttribute('x') + 8);
9453
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9414
9454
  } else if (series.labelPosition === 'outside') {
9415
9455
  this.setAttribute('text-anchor', 'start');
9416
9456
  this.setAttribute('x', +this.getAttribute('x') + 8);
@@ -9444,6 +9484,14 @@ var WebsyChart = /*#__PURE__*/function () {
9444
9484
  this.setAttribute('text-anchor', 'end');
9445
9485
  this.setAttribute('x', +this.getAttribute('x') - 8);
9446
9486
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9487
+ } else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
9488
+ this.setAttribute('text-anchor', 'end');
9489
+ this.setAttribute('x', +this.getAttribute('x') - 8);
9490
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9491
+ } else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
9492
+ this.setAttribute('text-anchor', 'start');
9493
+ this.setAttribute('x', +this.getAttribute('x') + 8);
9494
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9447
9495
  } else if (series.labelPosition === 'outside') {
9448
9496
  this.setAttribute('text-anchor', 'start');
9449
9497
  this.setAttribute('x', +this.getAttribute('x') + 8);