@websy/websy-designs 1.7.8 → 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.
@@ -6987,7 +6987,8 @@ class WebsyChart {
6987
6987
  brushHeight: 50,
6988
6988
  minBandWidth: 30,
6989
6989
  maxBandWidth: 100,
6990
- allowUnevenBands: true
6990
+ allowUnevenBands: true,
6991
+ balancedMinMax: false
6991
6992
  }
6992
6993
  this.elementId = elementId
6993
6994
  this.options = Object.assign({}, DEFAULTS, options)
@@ -7650,6 +7651,22 @@ else {
7650
7651
  if (this.options.data.right.formatter) {
7651
7652
  this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString()
7652
7653
  }
7654
+ }
7655
+ // Check to see if we need to balance the min and max values
7656
+ if (this.options.balancedMinMax) {
7657
+ if (this.options.orientation === 'horizontal') {
7658
+ let biggestBottom = Math.max(Math.abs(this.options.data.bottom.min, this.options.data.bottom.max))
7659
+ this.options.data.bottom.min = 1 - biggestBottom
7660
+ this.options.data.bottom.max = biggestBottom
7661
+ }
7662
+ else {
7663
+ let biggestLeft = Math.max(Math.abs(this.options.data.left.min, this.options.data.left.max))
7664
+ this.options.data.left.min = 1 - biggestLeft
7665
+ this.options.data.left.max = biggestLeft
7666
+ let biggestRight = Math.max(Math.abs(this.options.data.right.min, this.options.data.right.max))
7667
+ this.options.data.right.min = 1 - biggestRight
7668
+ this.options.data.right.max = biggestRight
7669
+ }
7653
7670
  }
7654
7671
  // establish the space needed for the various axes
7655
7672
  // this.options.margin.axisLeft = this.longestLeft * ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize) * 0.7
@@ -7831,7 +7848,7 @@ else {
7831
7848
  // }
7832
7849
  // }
7833
7850
  // Translate the layers
7834
- const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight + 5 : 0
7851
+ const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0
7835
7852
  this.leftAxisLayer
7836
7853
  .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7837
7854
  .style('font-size', (this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize)
@@ -7848,23 +7865,23 @@ else {
7848
7865
  this.bottomAxisLabel
7849
7866
  .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7850
7867
  this.plotArea
7851
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7868
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7852
7869
  this.areaLayer
7853
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7870
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7854
7871
  this.lineLayer
7855
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7872
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7856
7873
  this.barLayer
7857
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7874
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7858
7875
  this.labelLayer
7859
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7876
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7860
7877
  this.symbolLayer
7861
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7878
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7862
7879
  this.refLineLayer
7863
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7880
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7864
7881
  this.trackingLineLayer
7865
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7882
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7866
7883
  this.clip
7867
- .attr('transform', `translate(${(leftBrushAdjustment - 5) + this.options.margin.left + this.options.margin.axisLeft}, 0)`)
7884
+ .attr('transform', `translate(${(leftBrushAdjustment) + this.options.margin.left + this.options.margin.axisLeft}, 0)`)
7868
7885
  .attr('width', this.plotWidth)
7869
7886
  .attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop)
7870
7887
  if (this.options.orientation === 'horizontal') {
@@ -8421,9 +8438,9 @@ function getBarWidth (d, i, yAxis, xAxis) {
8421
8438
  let output
8422
8439
  if (this.options.orientation === 'horizontal') {
8423
8440
  // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8424
- output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8441
+ // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8425
8442
  // output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
8426
- // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
8443
+ output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
8427
8444
  }
8428
8445
  else {
8429
8446
  let x = getBarX.call(this, d, i, yAxis, xAxis)
@@ -8459,11 +8476,21 @@ function getBarX (d, i, yAxis, xAxis) {
8459
8476
  let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, yAxis, xAxis)
8460
8477
  let h = getBarWidth.call(this, d, i, yAxis, xAxis)
8461
8478
  // output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
8462
- output = (this[`${yAxis}Axis`](0)) + ((accH) * (d.y.accumulative > 0 ? 1 : 0))
8479
+ if (d.y.value >= 0) {
8480
+ output = (this[`${yAxis}Axis`](0)) + ((Math.abs(accH)) * (d.y.accumulative > 0 ? 1 : 0))
8481
+ }
8482
+ else {
8483
+ output = (this[`${yAxis}Axis`](0)) - ((Math.abs(accH) + Math.abs(h)) * (d.y.accumulative > 0 ? 1 : 0))
8484
+ }
8463
8485
  }
8464
8486
  else {
8465
8487
  let h = getBarWidth.call(this, d, i, yAxis, xAxis)
8466
- output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value > 0 ? 0 : 1))
8488
+ if (d.y.value >= 0) {
8489
+ output = (this[`${yAxis}Axis`](0))
8490
+ }
8491
+ else {
8492
+ output = (this[`${yAxis}Axis`](0)) + h
8493
+ }
8467
8494
  }
8468
8495
  }
8469
8496
  else {
@@ -8649,26 +8676,30 @@ if (this.options.showLabels === true || series.showLabels === true) {
8649
8676
  this.setAttribute('text-anchor', 'middle')
8650
8677
  }
8651
8678
  else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
8679
+ console.log('anhor end for', d.y.value)
8652
8680
  this.setAttribute('text-anchor', 'end')
8653
8681
  this.setAttribute('x', +(this.getAttribute('x')) - 8)
8654
8682
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
8655
8683
  }
8656
- else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
8657
- this.setAttribute('text-anchor', 'end')
8658
- this.setAttribute('x', +(this.getAttribute('x')) - 8)
8659
- this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
8660
- }
8661
- else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
8684
+ else if (d.y.value < 0 && this.getAttribute('x') < 0) {
8662
8685
  this.setAttribute('text-anchor', 'start')
8663
- this.setAttribute('x', +(this.getAttribute('x')) + 8)
8686
+ this.setAttribute('x', Math.max(+(this.getAttribute('x')) + 8, 8))
8664
8687
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
8665
8688
  }
8689
+ else if (d.y.value < 0 && this.getAttribute('x') > 0) {
8690
+ console.log('anhor end for', d.y.value)
8691
+ this.setAttribute('text-anchor', 'end')
8692
+ this.setAttribute('x', +(this.getAttribute('x')) - 8)
8693
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
8694
+ }
8666
8695
  else if (series.labelPosition === 'outside') {
8667
8696
  this.setAttribute('text-anchor', 'start')
8668
8697
  this.setAttribute('x', +(this.getAttribute('x')) + 8)
8669
8698
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
8670
8699
  }
8671
- else {
8700
+ else {
8701
+ console.log('anhor end for', d.y.value)
8702
+ this.setAttribute('text-anchor', 'start')
8672
8703
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
8673
8704
  }
8674
8705
  }
@@ -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);
@@ -8464,6 +8465,22 @@ var WebsyChart = /*#__PURE__*/function () {
8464
8465
  if (this.options.data.right.formatter) {
8465
8466
  this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString();
8466
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
+ }
8467
8484
  } // establish the space needed for the various axes
8468
8485
  // this.options.margin.axisLeft = this.longestLeft * ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize) * 0.7
8469
8486
  // this.options.margin.axisRight = this.longestRight * ((this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize) * 0.7
@@ -8662,22 +8679,22 @@ var WebsyChart = /*#__PURE__*/function () {
8662
8679
  // Translate the layers
8663
8680
 
8664
8681
 
8665
- var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight + 5 : 0;
8682
+ var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0;
8666
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);
8667
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);
8668
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);
8669
8686
  this.leftAxisLabel.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8670
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, ")"));
8671
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, ")"));
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);
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);
8681
8698
 
8682
8699
  if (this.options.orientation === 'horizontal') {
8683
8700
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
@@ -9188,8 +9205,9 @@ var WebsyChart = /*#__PURE__*/function () {
9188
9205
 
9189
9206
  if (this.options.orientation === 'horizontal') {
9190
9207
  // 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))
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));
9193
9211
  } else {
9194
9212
  var x = getBarX.call(this, d, i, yAxis, xAxis);
9195
9213
 
@@ -9236,11 +9254,19 @@ var WebsyChart = /*#__PURE__*/function () {
9236
9254
  }, i, yAxis, xAxis);
9237
9255
  var h = getBarWidth.call(this, d, i, yAxis, xAxis); // output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
9238
9256
 
9239
- output = this["".concat(yAxis, "Axis")](0) + accH * (d.y.accumulative > 0 ? 1 : 0);
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
+ }
9240
9262
  } else {
9241
9263
  var _h = getBarWidth.call(this, d, i, yAxis, xAxis);
9242
9264
 
9243
- 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
+ }
9244
9270
  }
9245
9271
  } else {
9246
9272
  // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
@@ -9440,22 +9466,26 @@ var WebsyChart = /*#__PURE__*/function () {
9440
9466
  if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
9441
9467
  this.setAttribute('text-anchor', 'middle');
9442
9468
  } else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
9469
+ console.log('anhor end for', d.y.value);
9443
9470
  this.setAttribute('text-anchor', 'end');
9444
9471
  this.setAttribute('x', +this.getAttribute('x') - 8);
9445
9472
  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) {
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);
9447
9479
  this.setAttribute('text-anchor', 'end');
9448
9480
  this.setAttribute('x', +this.getAttribute('x') - 8);
9449
9481
  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));
9454
9482
  } else if (series.labelPosition === 'outside') {
9455
9483
  this.setAttribute('text-anchor', 'start');
9456
9484
  this.setAttribute('x', +this.getAttribute('x') + 8);
9457
9485
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9458
9486
  } else {
9487
+ console.log('anhor end for', d.y.value);
9488
+ this.setAttribute('text-anchor', 'start');
9459
9489
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9460
9490
  }
9461
9491
  } else {