@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.
@@ -7706,7 +7706,8 @@ var WebsyChart = /*#__PURE__*/function () {
7706
7706
  brushHeight: 50,
7707
7707
  minBandWidth: 30,
7708
7708
  maxBandWidth: 100,
7709
- allowUnevenBands: true
7709
+ allowUnevenBands: true,
7710
+ balancedMinMax: false
7710
7711
  };
7711
7712
  this.elementId = elementId;
7712
7713
  this.options = _extends({}, DEFAULTS, options);
@@ -7777,39 +7778,50 @@ var WebsyChart = /*#__PURE__*/function () {
7777
7778
  var that = this;
7778
7779
 
7779
7780
  this.brushed = function (event) {
7780
- console.log('brushing', event);
7781
7781
  var newX = that.options.margin.left + that.options.margin.axisLeft + (1 - event.selection[0] / (that.plotWidth / (that.widthForCalc + that.totalBandPadding)));
7782
+ var newY = that.options.margin.top + that.options.margin.axisTop;
7783
+
7784
+ if (that.options.orientation === 'horizontal') {
7785
+ newX = that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft;
7786
+ newY = that.options.margin.top + that.options.margin.axisTop + (1 - event.selection[0] / (that.plotHeight / (that.widthForCalc + that.totalBandPadding)));
7787
+ }
7782
7788
 
7783
7789
  if (that.plotArea) {
7784
- that.plotArea.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7790
+ that.plotArea.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7785
7791
  }
7786
7792
 
7787
7793
  if (that.areaLayer) {
7788
- that.areaLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7794
+ that.areaLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7789
7795
  }
7790
7796
 
7791
7797
  if (that.lineLayer) {
7792
- that.lineLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7798
+ that.lineLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7793
7799
  }
7794
7800
 
7795
7801
  if (that.barLayer) {
7796
- that.barLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7802
+ that.barLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7797
7803
  }
7798
7804
 
7799
7805
  if (that.labelLayer) {
7800
- that.labelLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7806
+ that.labelLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7801
7807
  }
7802
7808
 
7803
7809
  if (that.symbolLayer) {
7804
- that.symbolLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7810
+ that.symbolLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7805
7811
  }
7806
7812
 
7807
7813
  if (that.refLineLayer) {
7808
- that.refLineLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop, ")"));
7814
+ that.refLineLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY, ")"));
7809
7815
  }
7810
7816
 
7811
- if (that.bottomAxisLayer) {
7812
- that.bottomAxisLayer.attr('transform', "translate(".concat(newX, ", ").concat(that.options.margin.top + that.options.margin.axisTop + that.plotHeight, ")"));
7817
+ if (that.options.orientation === 'horizontal') {
7818
+ if (that.leftAxisLayer) {
7819
+ that.leftAxisLayer.attr('transform', "translate(".concat(that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft, ", ").concat(newY, ")"));
7820
+ }
7821
+ } else {
7822
+ if (that.bottomAxisLayer) {
7823
+ that.bottomAxisLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY + that.plotHeight, ")"));
7824
+ }
7813
7825
  } // that.brushedDomain = []
7814
7826
  // let xAxis = 'bottom'
7815
7827
  // let xAxisCaps = 'Bottom'
@@ -8213,8 +8225,7 @@ var WebsyChart = /*#__PURE__*/function () {
8213
8225
  this.xAxisClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_xAxisClip")).append('rect');
8214
8226
  this.yAxisClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_yAxisClip")).append('rect');
8215
8227
  this.brushClip = this.defs.append('clipPath').attr('id', "".concat(this.elementId, "_brushclip")).append('rect');
8216
- this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer'); // .attr('clip-path', `url(#${this.elementId}_yAxisClip)`).append('g')
8217
-
8228
+ this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer').attr('clip-path', "url(#".concat(this.elementId, "_yAxisClip)")).append('g');
8218
8229
  this.rightAxisLayer = this.svg.append('g').attr('class', 'right-axis-layer');
8219
8230
  this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer').attr('clip-path', "url(#".concat(this.elementId, "_xAxisClip)")).append('g');
8220
8231
  this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer');
@@ -8454,6 +8465,22 @@ var WebsyChart = /*#__PURE__*/function () {
8454
8465
  if (this.options.data.right.formatter) {
8455
8466
  this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString();
8456
8467
  }
8468
+ } // Check to see if we need to balance the min and max values
8469
+
8470
+
8471
+ if (this.options.balancedMinMax) {
8472
+ if (this.options.orientation === 'horizontal') {
8473
+ var biggestBottom = Math.max(Math.abs(this.options.data.bottom.min, this.options.data.bottom.max));
8474
+ this.options.data.bottom.min = 1 - biggestBottom;
8475
+ this.options.data.bottom.max = biggestBottom;
8476
+ } else {
8477
+ var biggestLeft = Math.max(Math.abs(this.options.data.left.min, this.options.data.left.max));
8478
+ this.options.data.left.min = 1 - biggestLeft;
8479
+ this.options.data.left.max = biggestLeft;
8480
+ var biggestRight = Math.max(Math.abs(this.options.data.right.min, this.options.data.right.max));
8481
+ this.options.data.right.min = 1 - biggestRight;
8482
+ this.options.data.right.max = biggestRight;
8483
+ }
8457
8484
  } // establish the space needed for the various axes
8458
8485
  // this.options.margin.axisLeft = this.longestLeft * ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize) * 0.7
8459
8486
  // this.options.margin.axisRight = this.longestRight * ((this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize) * 0.7
@@ -8652,28 +8679,31 @@ var WebsyChart = /*#__PURE__*/function () {
8652
8679
  // Translate the layers
8653
8680
 
8654
8681
 
8655
- 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);
8656
- 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);
8657
- 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);
8658
- this.leftAxisLabel.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8659
- 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, ")"));
8660
- 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, ")"));
8661
- this.plotArea.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8662
- this.areaLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8663
- this.lineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8664
- this.barLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8665
- this.labelLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8666
- this.symbolLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8667
- this.refLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8668
- this.trackingLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8669
- 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);
8682
+ var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0;
8683
+ 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);
8684
+ 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);
8685
+ 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);
8686
+ this.leftAxisLabel.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8687
+ 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, ")"));
8688
+ 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, ")"));
8689
+ this.plotArea.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8690
+ this.areaLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8691
+ this.lineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8692
+ this.barLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8693
+ this.labelLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8694
+ this.symbolLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8695
+ this.refLineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8696
+ this.trackingLineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8697
+ 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);
8670
8698
 
8671
8699
  if (this.options.orientation === 'horizontal') {
8672
8700
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8673
- 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);
8701
+ 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);
8702
+ 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);
8674
8703
  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);
8675
8704
  } else {
8676
8705
  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, ")"));
8706
+ 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);
8677
8707
  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);
8678
8708
  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);
8679
8709
  }
@@ -9154,7 +9184,7 @@ var WebsyChart = /*#__PURE__*/function () {
9154
9184
  if (this.options.orientation === 'horizontal') {
9155
9185
  output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2));
9156
9186
  } else {
9157
- var x = getBarX.call(this, d, i, xAxis);
9187
+ var x = getBarX.call(this, d, i, yAxis, xAxis);
9158
9188
 
9159
9189
  if (typeof x === 'undefined' || x === null) {
9160
9190
  return null;
@@ -9170,14 +9200,16 @@ var WebsyChart = /*#__PURE__*/function () {
9170
9200
  return output;
9171
9201
  }
9172
9202
 
9173
- function getBarWidth(d, i, xAxis) {
9203
+ function getBarWidth(d, i, yAxis, xAxis) {
9174
9204
  var output;
9175
9205
 
9176
9206
  if (this.options.orientation === 'horizontal') {
9177
9207
  // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
9178
- 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))
9208
+ // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
9209
+ // output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
9210
+ output = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
9179
9211
  } else {
9180
- var x = getBarX.call(this, d, i, xAxis);
9212
+ var x = getBarX.call(this, d, i, yAxis, xAxis);
9181
9213
 
9182
9214
  if (typeof x === 'undefined' || x === null) {
9183
9215
  return null;
@@ -9193,7 +9225,7 @@ var WebsyChart = /*#__PURE__*/function () {
9193
9225
  return output;
9194
9226
  }
9195
9227
 
9196
- function getBarX(d, i, xAxis) {
9228
+ function getBarX(d, i, yAxis, xAxis) {
9197
9229
  var output;
9198
9230
 
9199
9231
  if (this.options.orientation === 'horizontal') {
@@ -9219,13 +9251,22 @@ var WebsyChart = /*#__PURE__*/function () {
9219
9251
  y: {
9220
9252
  value: d.y.accumulative
9221
9253
  }
9222
- }, i, xAxis);
9223
- var h = getBarWidth.call(this, d, i, xAxis);
9224
- output = this["".concat(yAxis, "Axis")](0) + (accH + h) * (d.y.accumulative > 0 ? 0 : 1);
9254
+ }, i, yAxis, xAxis);
9255
+ var h = getBarWidth.call(this, d, i, yAxis, xAxis); // output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
9256
+
9257
+ if (d.y.value >= 0) {
9258
+ output = this["".concat(yAxis, "Axis")](0) + Math.abs(accH) * (d.y.accumulative > 0 ? 1 : 0);
9259
+ } else {
9260
+ output = this["".concat(yAxis, "Axis")](0) - (Math.abs(accH) + Math.abs(h)) * (d.y.accumulative > 0 ? 1 : 0);
9261
+ }
9225
9262
  } else {
9226
- var _h = getBarWidth.call(this, d, i, xAxis);
9263
+ var _h = getBarWidth.call(this, d, i, yAxis, xAxis);
9227
9264
 
9228
- output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value > 0 ? 0 : 1);
9265
+ if (d.y.value >= 0) {
9266
+ output = this["".concat(yAxis, "Axis")](0);
9267
+ } else {
9268
+ output = this["".concat(yAxis, "Axis")](0) + _h;
9269
+ }
9229
9270
  }
9230
9271
  } else {
9231
9272
  // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
@@ -9324,11 +9365,11 @@ var WebsyChart = /*#__PURE__*/function () {
9324
9365
 
9325
9366
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9326
9367
  bars.attr('width', function (d, i) {
9327
- return Math.abs(getBarWidth.call(_this50, d, i, xAxis));
9368
+ return Math.abs(getBarWidth.call(_this50, d, i, yAxis, xAxis));
9328
9369
  }).attr('height', function (d, i) {
9329
9370
  return getBarHeight.call(_this50, d, i, yAxis, xAxis);
9330
9371
  }).attr('x', function (d, i) {
9331
- return getBarX.call(_this50, d, i, xAxis);
9372
+ return getBarX.call(_this50, d, i, yAxis, xAxis);
9332
9373
  }).attr('y', function (d, i) {
9333
9374
  return getBarY.call(_this50, d, i, yAxis, xAxis);
9334
9375
  }) // .transition(this.transition)
@@ -9336,11 +9377,11 @@ var WebsyChart = /*#__PURE__*/function () {
9336
9377
  return d.y.color || d.color || series.color;
9337
9378
  });
9338
9379
  bars.enter().append('rect').attr('width', function (d, i) {
9339
- return Math.abs(getBarWidth.call(_this50, d, i, xAxis));
9380
+ return Math.abs(getBarWidth.call(_this50, d, i, yAxis, xAxis));
9340
9381
  }).attr('height', function (d, i) {
9341
9382
  return getBarHeight.call(_this50, d, i, yAxis, xAxis);
9342
9383
  }).attr('x', function (d, i) {
9343
- return getBarX.call(_this50, d, i, xAxis);
9384
+ return getBarX.call(_this50, d, i, yAxis, xAxis);
9344
9385
  }).attr('y', function (d, i) {
9345
9386
  return getBarY.call(_this50, d, i, yAxis, xAxis);
9346
9387
  }) // .transition(this.transition)
@@ -9354,11 +9395,11 @@ var WebsyChart = /*#__PURE__*/function () {
9354
9395
  this.brushBarsInitialized[series.key] = true;
9355
9396
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9356
9397
  brushBars.attr('width', function (d, i) {
9357
- return Math.abs(getBarWidth.call(_this50, d, i, "".concat(xAxis, "Brush")));
9398
+ return Math.abs(getBarWidth.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9358
9399
  }).attr('height', function (d, i) {
9359
9400
  return getBarHeight.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9360
9401
  }).attr('x', function (d, i) {
9361
- return getBarX.call(_this50, d, i, "".concat(xAxis, "Brush"));
9402
+ return getBarX.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9362
9403
  }).attr('y', function (d, i) {
9363
9404
  return getBarY.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9364
9405
  }) // .transition(this.transition)
@@ -9366,11 +9407,11 @@ var WebsyChart = /*#__PURE__*/function () {
9366
9407
  return d.y.color || d.color || series.color;
9367
9408
  });
9368
9409
  brushBars.enter().append('rect').attr('width', function (d, i) {
9369
- return Math.abs(getBarWidth.call(_this50, d, i, "".concat(xAxis, "Brush")));
9410
+ return Math.abs(getBarWidth.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9370
9411
  }).attr('height', function (d, i) {
9371
9412
  return getBarHeight.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9372
9413
  }).attr('x', function (d, i) {
9373
- return getBarX.call(_this50, d, i, "".concat(xAxis, "Brush"));
9414
+ return getBarX.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9374
9415
  }).attr('y', function (d, i) {
9375
9416
  return getBarY.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9376
9417
  }) // .transition(this.transition)
@@ -9425,22 +9466,26 @@ var WebsyChart = /*#__PURE__*/function () {
9425
9466
  if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
9426
9467
  this.setAttribute('text-anchor', 'middle');
9427
9468
  } else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
9469
+ console.log('anhor end for', d.y.value);
9428
9470
  this.setAttribute('text-anchor', 'end');
9429
9471
  this.setAttribute('x', +this.getAttribute('x') - 8);
9430
9472
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9431
- } else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
9473
+ } else if (d.y.value < 0 && this.getAttribute('x') < 0) {
9474
+ this.setAttribute('text-anchor', 'start');
9475
+ this.setAttribute('x', Math.max(+this.getAttribute('x') + 8, 8));
9476
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9477
+ } else if (d.y.value < 0 && this.getAttribute('x') > 0) {
9478
+ console.log('anhor end for', d.y.value);
9432
9479
  this.setAttribute('text-anchor', 'end');
9433
9480
  this.setAttribute('x', +this.getAttribute('x') - 8);
9434
9481
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9435
- } else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
9436
- this.setAttribute('text-anchor', 'start');
9437
- this.setAttribute('x', +this.getAttribute('x') + 8);
9438
- this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9439
9482
  } else if (series.labelPosition === 'outside') {
9440
9483
  this.setAttribute('text-anchor', 'start');
9441
9484
  this.setAttribute('x', +this.getAttribute('x') + 8);
9442
9485
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9443
9486
  } else {
9487
+ console.log('anhor end for', d.y.value);
9488
+ this.setAttribute('text-anchor', 'start');
9444
9489
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9445
9490
  }
9446
9491
  } else {