@websy/websy-designs 1.7.7 → 1.7.9

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.
@@ -8187,7 +8187,8 @@ var WebsyChart = /*#__PURE__*/function () {
8187
8187
  brushHeight: 50,
8188
8188
  minBandWidth: 30,
8189
8189
  maxBandWidth: 100,
8190
- allowUnevenBands: true
8190
+ allowUnevenBands: true,
8191
+ balancedMinMax: false
8191
8192
  };
8192
8193
  this.elementId = elementId;
8193
8194
  this.options = _extends({}, DEFAULTS, options);
@@ -8258,39 +8259,50 @@ var WebsyChart = /*#__PURE__*/function () {
8258
8259
  var that = this;
8259
8260
 
8260
8261
  this.brushed = function (event) {
8261
- console.log('brushing', event);
8262
8262
  var newX = that.options.margin.left + that.options.margin.axisLeft + (1 - event.selection[0] / (that.plotWidth / (that.widthForCalc + that.totalBandPadding)));
8263
+ var newY = that.options.margin.top + that.options.margin.axisTop;
8264
+
8265
+ if (that.options.orientation === 'horizontal') {
8266
+ newX = that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft;
8267
+ newY = that.options.margin.top + that.options.margin.axisTop + (1 - event.selection[0] / (that.plotHeight / (that.widthForCalc + that.totalBandPadding)));
8268
+ }
8263
8269
 
8264
8270
  if (that.plotArea) {
8265
- that.plotArea.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
8271
+ that.plotArea.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
8266
8272
  }
8267
8273
 
8268
8274
  if (that.areaLayer) {
8269
- that.areaLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
8275
+ that.areaLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
8270
8276
  }
8271
8277
 
8272
8278
  if (that.lineLayer) {
8273
- that.lineLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
8279
+ that.lineLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
8274
8280
  }
8275
8281
 
8276
8282
  if (that.barLayer) {
8277
- that.barLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
8283
+ that.barLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
8278
8284
  }
8279
8285
 
8280
8286
  if (that.labelLayer) {
8281
- that.labelLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
8287
+ that.labelLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
8282
8288
  }
8283
8289
 
8284
8290
  if (that.symbolLayer) {
8285
- that.symbolLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
8291
+ that.symbolLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
8286
8292
  }
8287
8293
 
8288
8294
  if (that.refLineLayer) {
8289
- that.refLineLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
8295
+ that.refLineLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
8290
8296
  }
8291
8297
 
8292
- if (that.bottomAxisLayer) {
8293
- that.bottomAxisLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop + that.plotHeight, ")"));
8298
+ if (that.options.orientation === 'horizontal') {
8299
+ if (that.leftAxisLayer) {
8300
+ that.leftAxisLayer.attr('transform', "translate(".concat(that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft, ", ").concat(newY, ")"));
8301
+ }
8302
+ } else {
8303
+ if (that.bottomAxisLayer) {
8304
+ that.bottomAxisLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY + that.plotHeight, ")"));
8305
+ }
8294
8306
  } // that.brushedDomain = []
8295
8307
  // let xAxis = 'bottom'
8296
8308
  // let xAxisCaps = 'Bottom'
@@ -8694,8 +8706,7 @@ var WebsyChart = /*#__PURE__*/function () {
8694
8706
  this.xAxisClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_xAxisClip")).append('rect');
8695
8707
  this.yAxisClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_yAxisClip")).append('rect');
8696
8708
  this.brushClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_brushclip")).append('rect');
8697
- this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer'); // .attr('clip-path', `url(#${this.elementId}_yAxisClip)`).append('g')
8698
-
8709
+ this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer').attr('clip-path', "url(#".concat(this.elementId, "_yAxisClip)")).append('g');
8699
8710
  this.rightAxisLayer = this.svg.append('g').attr('class', 'right-axis-layer');
8700
8711
  this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer').attr('clip-path', "url(#".concat(this.elementId, "_xAxisClip)")).append('g');
8701
8712
  this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer');
@@ -8935,6 +8946,22 @@ var WebsyChart = /*#__PURE__*/function () {
8935
8946
  if (this.options.data.right.formatter) {
8936
8947
  this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString();
8937
8948
  }
8949
+ } // Check to see if we need to balance the min and max values
8950
+
8951
+
8952
+ if (this.options.balancedMinMax) {
8953
+ if (this.options.orientation === 'horizontal') {
8954
+ var biggestBottom = Math.max(Math.abs(this.options.data.bottom.min, this.options.data.bottom.max));
8955
+ this.options.data.bottom.min = 1 - biggestBottom;
8956
+ this.options.data.bottom.max = biggestBottom;
8957
+ } else {
8958
+ var biggestLeft = Math.max(Math.abs(this.options.data.left.min, this.options.data.left.max));
8959
+ this.options.data.left.min = 1 - biggestLeft;
8960
+ this.options.data.left.max = biggestLeft;
8961
+ var biggestRight = Math.max(Math.abs(this.options.data.right.min, this.options.data.right.max));
8962
+ this.options.data.right.min = 1 - biggestRight;
8963
+ this.options.data.right.max = biggestRight;
8964
+ }
8938
8965
  } // establish the space needed for the various axes
8939
8966
  // this.options.margin.axisLeft = this.longestLeft * ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize) * 0.7
8940
8967
  // this.options.margin.axisRight = this.longestRight * ((this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize) * 0.7
@@ -9133,28 +9160,31 @@ var WebsyChart = /*#__PURE__*/function () {
9133
9160
  // Translate the layers
9134
9161
 
9135
9162
 
9136
- 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);
9137
- 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);
9138
- 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);
9139
- this.leftAxisLabel.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9140
- 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, ")"));
9141
- 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, ")"));
9142
- this.plotArea.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9143
- this.areaLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9144
- this.lineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9145
- this.barLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9146
- this.labelLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9147
- this.symbolLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9148
- this.refLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9149
- this.trackingLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9150
- 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);
9163
+ var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0;
9164
+ 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);
9165
+ 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);
9166
+ 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);
9167
+ this.leftAxisLabel.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9168
+ 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, ")"));
9169
+ 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, ")"));
9170
+ this.plotArea.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9171
+ this.areaLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9172
+ this.lineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9173
+ this.barLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9174
+ this.labelLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9175
+ this.symbolLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9176
+ this.refLineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9177
+ this.trackingLineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9178
+ this.clip.attr('transform', "translate(".concat(leftBrushAdjustment + 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);
9151
9179
 
9152
9180
  if (this.options.orientation === 'horizontal') {
9153
9181
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9154
- 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);
9182
+ 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);
9183
+ 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);
9155
9184
  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);
9156
9185
  } else {
9157
9186
  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, ")"));
9187
+ 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);
9158
9188
  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);
9159
9189
  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);
9160
9190
  }
@@ -9635,7 +9665,7 @@ var WebsyChart = /*#__PURE__*/function () {
9635
9665
  if (this.options.orientation === 'horizontal') {
9636
9666
  output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2));
9637
9667
  } else {
9638
- var x = getBarX.call(this, d, i, xAxis);
9668
+ var x = getBarX.call(this, d, i, yAxis, xAxis);
9639
9669
 
9640
9670
  if (typeof x === 'undefined' || x === null) {
9641
9671
  return null;
@@ -9651,14 +9681,16 @@ var WebsyChart = /*#__PURE__*/function () {
9651
9681
  return output;
9652
9682
  }
9653
9683
 
9654
- function getBarWidth(d, i, xAxis) {
9684
+ function getBarWidth(d, i, yAxis, xAxis) {
9655
9685
  var output;
9656
9686
 
9657
9687
  if (this.options.orientation === 'horizontal') {
9658
9688
  // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
9659
- output = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value)); // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
9689
+ // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
9690
+ // output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
9691
+ output = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
9660
9692
  } else {
9661
- var x = getBarX.call(this, d, i, xAxis);
9693
+ var x = getBarX.call(this, d, i, yAxis, xAxis);
9662
9694
 
9663
9695
  if (typeof x === 'undefined' || x === null) {
9664
9696
  return null;
@@ -9674,7 +9706,7 @@ var WebsyChart = /*#__PURE__*/function () {
9674
9706
  return output;
9675
9707
  }
9676
9708
 
9677
- function getBarX(d, i, xAxis) {
9709
+ function getBarX(d, i, yAxis, xAxis) {
9678
9710
  var output;
9679
9711
 
9680
9712
  if (this.options.orientation === 'horizontal') {
@@ -9700,13 +9732,22 @@ var WebsyChart = /*#__PURE__*/function () {
9700
9732
  y: {
9701
9733
  value: d.y.accumulative
9702
9734
  }
9703
- }, i, xAxis);
9704
- var h = getBarWidth.call(this, d, i, xAxis);
9705
- output = this["".concat(yAxis, "Axis")](0) + (accH + h) * (d.y.accumulative > 0 ? 0 : 1);
9735
+ }, i, yAxis, xAxis);
9736
+ var h = getBarWidth.call(this, d, i, yAxis, xAxis); // output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
9737
+
9738
+ if (d.y.value >= 0) {
9739
+ output = this["".concat(yAxis, "Axis")](0) + Math.abs(accH) * (d.y.accumulative > 0 ? 1 : 0);
9740
+ } else {
9741
+ output = this["".concat(yAxis, "Axis")](0) - (Math.abs(accH) + Math.abs(h)) * (d.y.accumulative > 0 ? 1 : 0);
9742
+ }
9706
9743
  } else {
9707
- var _h = getBarWidth.call(this, d, i, xAxis);
9744
+ var _h = getBarWidth.call(this, d, i, yAxis, xAxis);
9708
9745
 
9709
- output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value > 0 ? 0 : 1);
9746
+ if (d.y.value >= 0) {
9747
+ output = this["".concat(yAxis, "Axis")](0);
9748
+ } else {
9749
+ output = this["".concat(yAxis, "Axis")](0) + _h;
9750
+ }
9710
9751
  }
9711
9752
  } else {
9712
9753
  // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
@@ -9805,11 +9846,11 @@ var WebsyChart = /*#__PURE__*/function () {
9805
9846
 
9806
9847
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9807
9848
  bars.attr('width', function (d, i) {
9808
- return Math.abs(getBarWidth.call(_this53, d, i, xAxis));
9849
+ return Math.abs(getBarWidth.call(_this53, d, i, yAxis, xAxis));
9809
9850
  }).attr('height', function (d, i) {
9810
9851
  return getBarHeight.call(_this53, d, i, yAxis, xAxis);
9811
9852
  }).attr('x', function (d, i) {
9812
- return getBarX.call(_this53, d, i, xAxis);
9853
+ return getBarX.call(_this53, d, i, yAxis, xAxis);
9813
9854
  }).attr('y', function (d, i) {
9814
9855
  return getBarY.call(_this53, d, i, yAxis, xAxis);
9815
9856
  }) // .transition(this.transition)
@@ -9817,11 +9858,11 @@ var WebsyChart = /*#__PURE__*/function () {
9817
9858
  return d.y.color || d.color || series.color;
9818
9859
  });
9819
9860
  bars.enter().append('rect').attr('width', function (d, i) {
9820
- return Math.abs(getBarWidth.call(_this53, d, i, xAxis));
9861
+ return Math.abs(getBarWidth.call(_this53, d, i, yAxis, xAxis));
9821
9862
  }).attr('height', function (d, i) {
9822
9863
  return getBarHeight.call(_this53, d, i, yAxis, xAxis);
9823
9864
  }).attr('x', function (d, i) {
9824
- return getBarX.call(_this53, d, i, xAxis);
9865
+ return getBarX.call(_this53, d, i, yAxis, xAxis);
9825
9866
  }).attr('y', function (d, i) {
9826
9867
  return getBarY.call(_this53, d, i, yAxis, xAxis);
9827
9868
  }) // .transition(this.transition)
@@ -9835,11 +9876,11 @@ var WebsyChart = /*#__PURE__*/function () {
9835
9876
  this.brushBarsInitialized[series.key] = true;
9836
9877
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9837
9878
  brushBars.attr('width', function (d, i) {
9838
- return Math.abs(getBarWidth.call(_this53, d, i, "".concat(xAxis, "Brush")));
9879
+ return Math.abs(getBarWidth.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9839
9880
  }).attr('height', function (d, i) {
9840
9881
  return getBarHeight.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9841
9882
  }).attr('x', function (d, i) {
9842
- return getBarX.call(_this53, d, i, "".concat(xAxis, "Brush"));
9883
+ return getBarX.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9843
9884
  }).attr('y', function (d, i) {
9844
9885
  return getBarY.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9845
9886
  }) // .transition(this.transition)
@@ -9847,11 +9888,11 @@ var WebsyChart = /*#__PURE__*/function () {
9847
9888
  return d.y.color || d.color || series.color;
9848
9889
  });
9849
9890
  brushBars.enter().append('rect').attr('width', function (d, i) {
9850
- return Math.abs(getBarWidth.call(_this53, d, i, "".concat(xAxis, "Brush")));
9891
+ return Math.abs(getBarWidth.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9851
9892
  }).attr('height', function (d, i) {
9852
9893
  return getBarHeight.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9853
9894
  }).attr('x', function (d, i) {
9854
- return getBarX.call(_this53, d, i, "".concat(xAxis, "Brush"));
9895
+ return getBarX.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9855
9896
  }).attr('y', function (d, i) {
9856
9897
  return getBarY.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9857
9898
  }) // .transition(this.transition)
@@ -9906,22 +9947,26 @@ var WebsyChart = /*#__PURE__*/function () {
9906
9947
  if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
9907
9948
  this.setAttribute('text-anchor', 'middle');
9908
9949
  } else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
9950
+ console.log('anhor end for', d.y.value);
9909
9951
  this.setAttribute('text-anchor', 'end');
9910
9952
  this.setAttribute('x', +this.getAttribute('x') - 8);
9911
9953
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9912
- } else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
9954
+ } else if (d.y.value < 0 && this.getAttribute('x') < 0) {
9955
+ this.setAttribute('text-anchor', 'start');
9956
+ this.setAttribute('x', Math.max(+this.getAttribute('x') + 8, 8));
9957
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9958
+ } else if (d.y.value < 0 && this.getAttribute('x') > 0) {
9959
+ console.log('anhor end for', d.y.value);
9913
9960
  this.setAttribute('text-anchor', 'end');
9914
9961
  this.setAttribute('x', +this.getAttribute('x') - 8);
9915
9962
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9916
- } else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
9917
- this.setAttribute('text-anchor', 'start');
9918
- this.setAttribute('x', +this.getAttribute('x') + 8);
9919
- this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9920
9963
  } else if (series.labelPosition === 'outside') {
9921
9964
  this.setAttribute('text-anchor', 'start');
9922
9965
  this.setAttribute('x', +this.getAttribute('x') + 8);
9923
9966
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9924
9967
  } else {
9968
+ console.log('anhor end for', d.y.value);
9969
+ this.setAttribute('text-anchor', 'start');
9925
9970
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9926
9971
  }
9927
9972
  } else {