@websy/websy-designs 1.7.8 → 1.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6637,7 +6637,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
6637
6637
  var el = document.getElementById(this.elementId);
6638
6638
 
6639
6639
  if (el) {
6640
- var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table-3 ").concat(this.options.paging === 'pages' ? 'with-paging' : '', " ").concat(this.options.virtualScroll === true ? 'with-virtual-scroll' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <div id=\"").concat(this.elementId, "_tableInner\" class=\"websy-table-inner-container\">\n <table id=\"").concat(this.elementId, "_tableHeader\" class=\"websy-table-header\"></table>\n <table id=\"").concat(this.elementId, "_tableBody\" class=\"websy-table-body\"></table>\n <table id=\"").concat(this.elementId, "_tableFooter\" class=\"websy-table-footer\"></table>\n <div id=\"").concat(this.elementId, "_vScrollContainer\" class=\"websy-v-scroll-container\">\n <div id=\"").concat(this.elementId, "_vScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-y\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_hScrollContainer\" class=\"websy-h-scroll-container\">\n <div id=\"").concat(this.elementId, "_hScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-x\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_touchScroller\" class=\"websy-table-touch-scroller hidden\"></div>\n </div> \n <div id=\"").concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_dropdownContainer\" class=\"table-dropdown-container\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
6640
+ var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table-3 ").concat(this.options.paging === 'pages' ? 'with-paging' : '', " ").concat(this.options.virtualScroll === true ? 'with-virtual-scroll' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <div id=\"").concat(this.elementId, "_tableInner\" class=\"websy-table-inner-container\">\n <table id=\"").concat(this.elementId, "_tableHeader\" class=\"websy-table-header\"></table>\n <table id=\"").concat(this.elementId, "_tableBody\" class=\"websy-table-body\"></table>\n <table id=\"").concat(this.elementId, "_tableFooter\" class=\"websy-table-footer\"></table>\n <div id=\"").concat(this.elementId, "_vScrollContainer\" class=\"websy-v-scroll-container\">\n <div id=\"").concat(this.elementId, "_vScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-y\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_hScrollContainer\" class=\"websy-h-scroll-container\">\n <div id=\"").concat(this.elementId, "_hScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-x\"></div>\n </div>\n ");
6641
+
6642
+ if (this.isTouchDevice === true) {
6643
+ html += "\n <div id=\"".concat(this.elementId, "_touchScroller\" class=\"websy-table-touch-scroller\"></div>\n ");
6644
+ }
6645
+
6646
+ html += " \n </div> \n <div id=\"".concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_dropdownContainer\" class=\"table-dropdown-container\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
6641
6647
 
6642
6648
  if (this.options.paging === 'pages') {
6643
6649
  html += "\n <div class=\"websy-table-paging-container\">\n Show <div id=\"".concat(this.elementId, "_pageSizeSelector\" class=\"websy-vis-page-selector\"></div> rows\n <ul id=\"").concat(this.elementId, "_pageList\" class=\"websy-vis-page-list\"></ul>\n </div>\n ");
@@ -6647,7 +6653,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6647
6653
  el.addEventListener('click', this.handleClick.bind(this));
6648
6654
  el.addEventListener('mousedown', this.handleMouseDown.bind(this));
6649
6655
  el.addEventListener('touchstart', this.handleTouchStart.bind(this));
6650
- window.addEventListener('touchmove', this.handleTouchMove.bind(this));
6656
+ el.addEventListener('touchmove', this.handleTouchMove.bind(this));
6651
6657
  window.addEventListener('touchend', this.handleTouchEnd.bind(this));
6652
6658
  window.addEventListener('mousemove', this.handleMouseMove.bind(this));
6653
6659
  window.addEventListener('mouseup', this.handleMouseUp.bind(this));
@@ -6774,11 +6780,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
6774
6780
  }
6775
6781
 
6776
6782
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
6777
- cell.value = "\n <a href='".concat(cell.value, "' target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
6783
+ cell.value = "\n <a href=\"".concat(cell.value, "\" target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
6778
6784
  }
6779
6785
 
6780
6786
  if (sizingColumns[sizeIndex].showAsRouterLink === true && cell.value.trim() !== '') {
6781
- cell.value = "\n <a data-view='".concat((cell.link || cell.value).replace(/'/g, '\''), "' class='websy-trigger'>").concat(cell.value, "</a>\n ");
6787
+ cell.value = "\n <a data-view=\"".concat((cell.link || cell.value).replace(/'/g, '\''), "\" class='websy-trigger'>").concat(cell.value, "</a>\n ");
6782
6788
  }
6783
6789
 
6784
6790
  if (sizingColumns[sizeIndex].showAsImage === true) {
@@ -7233,9 +7239,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
7233
7239
  this.touchEndTime = new Date().getTime();
7234
7240
  this.isPerpetual = true; // this.perpetualScroll()
7235
7241
 
7236
- this.touchStartTime = null;
7237
- var touchScrollEl = document.getElementById("".concat(this.elementId, "_touchScroller"));
7238
- touchScrollEl.classList.add('hidden');
7242
+ this.touchStartTime = null; // const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
7243
+ // touchScrollEl.classList.add('hidden')
7239
7244
  }
7240
7245
  }
7241
7246
  }, {
@@ -7249,7 +7254,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
7249
7254
 
7250
7255
  if (typeof event.targetTouches !== 'undefined' && event.targetTouches.length > 0) {
7251
7256
  var deltaX = this.mouseXStart - event.targetTouches[0].pageX;
7252
- var deltaY = this.mouseYStart - event.targetTouches[0].pageY; // need to adjust the delta so that it scrolls at a reasonable speed/distance
7257
+ var deltaY = this.mouseYStart - event.targetTouches[0].pageY;
7258
+ var hScrollContainerEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
7259
+ var vScrollContainerEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
7260
+ var hScrollHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
7261
+ var vScrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
7262
+ var translatedDeltaX = deltaX * (hScrollHandleEl.getBoundingClientRect().width / vScrollContainerEl.getBoundingClientRect().width);
7263
+ var translatedDeltaY = deltaY * (vScrollHandleEl.getBoundingClientRect().height / vScrollContainerEl.getBoundingClientRect().height); // need to adjust the delta so that it scrolls at a reasonable speed/distance
7253
7264
 
7254
7265
  var scrollHandleXEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
7255
7266
  var scrollHandleYEl = document.getElementById("".concat(this.elementId, "_vScrollHandle")); // if (Math.abs(deltaY) > this.sizes.cellHeight) {
@@ -7259,7 +7270,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7259
7270
  // this.isTouchScrolling = false
7260
7271
  // }
7261
7272
 
7262
- console.log('delta init', deltaY); // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
7273
+ console.log('delta', this.mouseYStart, event.targetTouches[0].pageY, deltaY); // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
7263
7274
  // deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
7264
7275
  // console.log('delta', deltaY)
7265
7276
  // NW
@@ -7274,10 +7285,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
7274
7285
 
7275
7286
  if (this.isTouchScrolling === true) {
7276
7287
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7277
- if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 10) {
7278
- this.scrollX(Math.max(-5, Math.min(5, deltaX)));
7279
- } else {
7280
- this.scrollY(Math.max(-5, Math.min(5, deltaY)));
7288
+ if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 20) {
7289
+ // this.scrollX(Math.max(-5, Math.min(5, translatedDeltaX)))
7290
+ this.scrollX(translatedDeltaX);
7291
+ } else if (deltaY > 20) {
7292
+ // this.scrollY(Math.max(-5, Math.min(5, translatedDeltaY)))
7293
+ this.scrollY(translatedDeltaY);
7281
7294
  }
7282
7295
  }
7283
7296
  }
@@ -7301,9 +7314,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
7301
7314
  this.isTouchScrolling = true;
7302
7315
  this.isPerpetual = false;
7303
7316
  this.mouseYStart = event.targetTouches[0].pageY;
7304
- this.mouseXStart = event.targetTouches[0].pageX;
7305
- var touchScrollEl = document.getElementById("".concat(this.elementId, "_touchScroller"));
7306
- touchScrollEl.classList.remove('hidden');
7317
+ this.mouseXStart = event.targetTouches[0].pageX; // const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
7318
+ // touchScrollEl.classList.remove('hidden')
7319
+
7307
7320
  var handleYEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
7308
7321
  this.handleYStart = handleYEl.offsetTop;
7309
7322
  var handleXEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
@@ -7706,7 +7719,8 @@ var WebsyChart = /*#__PURE__*/function () {
7706
7719
  brushHeight: 50,
7707
7720
  minBandWidth: 30,
7708
7721
  maxBandWidth: 100,
7709
- allowUnevenBands: true
7722
+ allowUnevenBands: true,
7723
+ balancedMinMax: false
7710
7724
  };
7711
7725
  this.elementId = elementId;
7712
7726
  this.options = _extends({}, DEFAULTS, options);
@@ -8309,13 +8323,13 @@ var WebsyChart = /*#__PURE__*/function () {
8309
8323
  }
8310
8324
 
8311
8325
  if (this.options.orientation === 'vertical') {
8312
- this.leftAxisLayer.attr('class', 'y-axis');
8313
- this.rightAxisLayer.attr('class', 'y-axis');
8314
- this.bottomAxisLayer.attr('class', 'x-axis');
8326
+ this.leftAxisLayer && this.leftAxisLayer.attr('class', 'y-axis');
8327
+ this.rightAxisLayer && this.rightAxisLayer.attr('class', 'y-axis');
8328
+ this.bottomAxisLayer && this.bottomAxisLayer.attr('class', 'x-axis');
8315
8329
  } else {
8316
- this.leftAxisLayer.attr('class', 'x-axis');
8317
- this.rightAxisLayer.attr('class', 'x-axis');
8318
- this.bottomAxisLayer.attr('class', 'y-axis');
8330
+ this.leftAxisLayer && this.leftAxisLayer.attr('class', 'x-axis');
8331
+ this.rightAxisLayer && this.rightAxisLayer.attr('class', 'x-axis');
8332
+ this.bottomAxisLayer && this.bottomAxisLayer.attr('class', 'y-axis');
8319
8333
  }
8320
8334
 
8321
8335
  var el = document.getElementById(this.elementId);
@@ -8464,6 +8478,22 @@ var WebsyChart = /*#__PURE__*/function () {
8464
8478
  if (this.options.data.right.formatter) {
8465
8479
  this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString();
8466
8480
  }
8481
+ } // Check to see if we need to balance the min and max values
8482
+
8483
+
8484
+ if (this.options.balancedMinMax) {
8485
+ if (this.options.orientation === 'horizontal') {
8486
+ var biggestBottom = Math.max(Math.abs(this.options.data.bottom.min, this.options.data.bottom.max));
8487
+ this.options.data.bottom.min = 1 - biggestBottom;
8488
+ this.options.data.bottom.max = biggestBottom;
8489
+ } else {
8490
+ var biggestLeft = Math.max(Math.abs(this.options.data.left.min, this.options.data.left.max));
8491
+ this.options.data.left.min = 1 - biggestLeft;
8492
+ this.options.data.left.max = biggestLeft;
8493
+ var biggestRight = Math.max(Math.abs(this.options.data.right.min, this.options.data.right.max));
8494
+ this.options.data.right.min = 1 - biggestRight;
8495
+ this.options.data.right.max = biggestRight;
8496
+ }
8467
8497
  } // establish the space needed for the various axes
8468
8498
  // this.options.margin.axisLeft = this.longestLeft * ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize) * 0.7
8469
8499
  // this.options.margin.axisRight = this.longestRight * ((this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize) * 0.7
@@ -8662,22 +8692,22 @@ var WebsyChart = /*#__PURE__*/function () {
8662
8692
  // Translate the layers
8663
8693
 
8664
8694
 
8665
- var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight + 5 : 0;
8695
+ var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0;
8666
8696
  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
8697
  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
8698
  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
8699
  this.leftAxisLabel.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8670
8700
  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
8701
  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);
8702
+ this.plotArea.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8703
+ this.areaLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8704
+ this.lineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8705
+ this.barLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8706
+ this.labelLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8707
+ this.symbolLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8708
+ this.refLineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8709
+ this.trackingLineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8710
+ 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
8711
 
8682
8712
  if (this.options.orientation === 'horizontal') {
8683
8713
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
@@ -9188,8 +9218,9 @@ var WebsyChart = /*#__PURE__*/function () {
9188
9218
 
9189
9219
  if (this.options.orientation === 'horizontal') {
9190
9220
  // 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))
9221
+ // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
9222
+ // output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
9223
+ output = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
9193
9224
  } else {
9194
9225
  var x = getBarX.call(this, d, i, yAxis, xAxis);
9195
9226
 
@@ -9236,11 +9267,19 @@ var WebsyChart = /*#__PURE__*/function () {
9236
9267
  }, i, yAxis, xAxis);
9237
9268
  var h = getBarWidth.call(this, d, i, yAxis, xAxis); // output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
9238
9269
 
9239
- output = this["".concat(yAxis, "Axis")](0) + accH * (d.y.accumulative > 0 ? 1 : 0);
9270
+ if (d.y.value >= 0) {
9271
+ output = this["".concat(yAxis, "Axis")](0) + Math.abs(accH) * (d.y.accumulative > 0 ? 1 : 0);
9272
+ } else {
9273
+ output = this["".concat(yAxis, "Axis")](0) - (Math.abs(accH) + Math.abs(h)) * (d.y.accumulative > 0 ? 1 : 0);
9274
+ }
9240
9275
  } else {
9241
9276
  var _h = getBarWidth.call(this, d, i, yAxis, xAxis);
9242
9277
 
9243
- output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value > 0 ? 0 : 1);
9278
+ if (d.y.value >= 0) {
9279
+ output = this["".concat(yAxis, "Axis")](0);
9280
+ } else {
9281
+ output = this["".concat(yAxis, "Axis")](0) + _h;
9282
+ }
9244
9283
  }
9245
9284
  } else {
9246
9285
  // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
@@ -9443,19 +9482,20 @@ var WebsyChart = /*#__PURE__*/function () {
9443
9482
  this.setAttribute('text-anchor', 'end');
9444
9483
  this.setAttribute('x', +this.getAttribute('x') - 8);
9445
9484
  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) {
9485
+ } else if (d.y.value < 0 && this.getAttribute('x') < 0) {
9486
+ this.setAttribute('text-anchor', 'start');
9487
+ this.setAttribute('x', Math.max(+this.getAttribute('x') + 8, 8));
9488
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9489
+ } else if (d.y.value < 0 && this.getAttribute('x') > 0) {
9447
9490
  this.setAttribute('text-anchor', 'end');
9448
9491
  this.setAttribute('x', +this.getAttribute('x') - 8);
9449
9492
  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
9493
  } else if (series.labelPosition === 'outside') {
9455
9494
  this.setAttribute('text-anchor', 'start');
9456
9495
  this.setAttribute('x', +this.getAttribute('x') + 8);
9457
9496
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9458
9497
  } else {
9498
+ this.setAttribute('text-anchor', 'start');
9459
9499
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9460
9500
  }
9461
9501
  } else {
@@ -9484,14 +9524,14 @@ var WebsyChart = /*#__PURE__*/function () {
9484
9524
  this.setAttribute('text-anchor', 'end');
9485
9525
  this.setAttribute('x', +this.getAttribute('x') - 8);
9486
9526
  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) {
9527
+ } else if (d.y.value < 0 && this.getAttribute('x') < 0) {
9528
+ this.setAttribute('text-anchor', 'start');
9529
+ this.setAttribute('x', Math.max(+this.getAttribute('x') + 8, 8));
9530
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9531
+ } else if (d.y.value < 0 && this.getAttribute('x') > 0) {
9488
9532
  this.setAttribute('text-anchor', 'end');
9489
9533
  this.setAttribute('x', +this.getAttribute('x') - 8);
9490
9534
  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));
9495
9535
  } else if (series.labelPosition === 'outside') {
9496
9536
  this.setAttribute('text-anchor', 'start');
9497
9537
  this.setAttribute('x', +this.getAttribute('x') + 8);