@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.
@@ -6470,7 +6470,13 @@ class WebsyTable3 {
6470
6470
  <div id="${this.elementId}_hScrollContainer" class="websy-h-scroll-container">
6471
6471
  <div id="${this.elementId}_hScrollHandle" class="websy-scroll-handle websy-scroll-handle-x"></div>
6472
6472
  </div>
6473
- <div id="${this.elementId}_touchScroller" class="websy-table-touch-scroller hidden"></div>
6473
+ `
6474
+ if (this.isTouchDevice === true) {
6475
+ html += `
6476
+ <div id="${this.elementId}_touchScroller" class="websy-table-touch-scroller"></div>
6477
+ `
6478
+ }
6479
+ html += `
6474
6480
  </div>
6475
6481
  <div id="${this.elementId}_errorContainer" class='websy-vis-error-container'>
6476
6482
  <div>
@@ -6494,7 +6500,7 @@ class WebsyTable3 {
6494
6500
  el.addEventListener('click', this.handleClick.bind(this))
6495
6501
  el.addEventListener('mousedown', this.handleMouseDown.bind(this))
6496
6502
  el.addEventListener('touchstart', this.handleTouchStart.bind(this))
6497
- window.addEventListener('touchmove', this.handleTouchMove.bind(this))
6503
+ el.addEventListener('touchmove', this.handleTouchMove.bind(this))
6498
6504
  window.addEventListener('touchend', this.handleTouchEnd.bind(this))
6499
6505
  window.addEventListener('mousemove', this.handleMouseMove.bind(this))
6500
6506
  window.addEventListener('mouseup', this.handleMouseUp.bind(this))
@@ -6627,12 +6633,12 @@ class WebsyTable3 {
6627
6633
  }
6628
6634
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
6629
6635
  cell.value = `
6630
- <a href='${cell.value}' target='${sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self'}'>${cell.displayText || sizingColumns[sizeIndex].linkText || cell.value}</a>
6636
+ <a href="${cell.value}" target='${sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self'}'>${cell.displayText || sizingColumns[sizeIndex].linkText || cell.value}</a>
6631
6637
  `
6632
6638
  }
6633
6639
  if (sizingColumns[sizeIndex].showAsRouterLink === true && cell.value.trim() !== '') {
6634
6640
  cell.value = `
6635
- <a data-view='${(cell.link || cell.value).replace(/'/g, '\'')}' class='websy-trigger'>${cell.value}</a>
6641
+ <a data-view="${(cell.link || cell.value).replace(/'/g, '\'')}" class='websy-trigger'>${cell.value}</a>
6636
6642
  `
6637
6643
  }
6638
6644
  if (sizingColumns[sizeIndex].showAsImage === true) {
@@ -7038,8 +7044,8 @@ class WebsyTable3 {
7038
7044
  this.isPerpetual = true
7039
7045
  // this.perpetualScroll()
7040
7046
  this.touchStartTime = null
7041
- const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
7042
- touchScrollEl.classList.add('hidden')
7047
+ // const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
7048
+ // touchScrollEl.classList.add('hidden')
7043
7049
  }
7044
7050
  }
7045
7051
  handleTouchMove (event) {
@@ -7050,6 +7056,12 @@ class WebsyTable3 {
7050
7056
  if (typeof event.targetTouches !== 'undefined' && event.targetTouches.length > 0) {
7051
7057
  let deltaX = (this.mouseXStart - event.targetTouches[0].pageX)
7052
7058
  let deltaY = (this.mouseYStart - event.targetTouches[0].pageY)
7059
+ const hScrollContainerEl = document.getElementById(`${this.elementId}_hScrollContainer`)
7060
+ const vScrollContainerEl = document.getElementById(`${this.elementId}_vScrollContainer`)
7061
+ const hScrollHandleEl = document.getElementById(`${this.elementId}_hScrollHandle`)
7062
+ const vScrollHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
7063
+ let translatedDeltaX = deltaX * (hScrollHandleEl.getBoundingClientRect().width / vScrollContainerEl.getBoundingClientRect().width)
7064
+ let translatedDeltaY = deltaY * (vScrollHandleEl.getBoundingClientRect().height / vScrollContainerEl.getBoundingClientRect().height)
7053
7065
  // need to adjust the delta so that it scrolls at a reasonable speed/distance
7054
7066
  const scrollHandleXEl = document.getElementById(`${this.elementId}_hScrollHandle`)
7055
7067
  const scrollHandleYEl = document.getElementById(`${this.elementId}_vScrollHandle`)
@@ -7059,7 +7071,7 @@ class WebsyTable3 {
7059
7071
  // else {
7060
7072
  // this.isTouchScrolling = false
7061
7073
  // }
7062
- console.log('delta init', deltaY)
7074
+ console.log('delta', this.mouseYStart, event.targetTouches[0].pageY, deltaY)
7063
7075
  // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
7064
7076
  // deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
7065
7077
  // console.log('delta', deltaY)
@@ -7074,11 +7086,13 @@ class WebsyTable3 {
7074
7086
  // delta = Math.max(-10, delta)
7075
7087
  if (this.isTouchScrolling === true) {
7076
7088
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7077
- if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 10) {
7078
- this.scrollX(Math.max(-5, Math.min(5, deltaX)))
7089
+ if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 20) {
7090
+ // this.scrollX(Math.max(-5, Math.min(5, translatedDeltaX)))
7091
+ this.scrollX(translatedDeltaX)
7079
7092
  }
7080
- else {
7081
- this.scrollY(Math.max(-5, Math.min(5, deltaY)))
7093
+ else if (deltaY > 20) {
7094
+ // this.scrollY(Math.max(-5, Math.min(5, translatedDeltaY)))
7095
+ this.scrollY(translatedDeltaY)
7082
7096
  }
7083
7097
  }
7084
7098
  }
@@ -7098,8 +7112,8 @@ class WebsyTable3 {
7098
7112
  this.isPerpetual = false
7099
7113
  this.mouseYStart = event.targetTouches[0].pageY
7100
7114
  this.mouseXStart = event.targetTouches[0].pageX
7101
- const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
7102
- touchScrollEl.classList.remove('hidden')
7115
+ // const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
7116
+ // touchScrollEl.classList.remove('hidden')
7103
7117
  const handleYEl = document.getElementById(`${this.elementId}_vScrollHandle`)
7104
7118
  this.handleYStart = handleYEl.offsetTop
7105
7119
  const handleXEl = document.getElementById(`${this.elementId}_hScrollHandle`)
@@ -7402,7 +7416,8 @@ class WebsyChart {
7402
7416
  brushHeight: 50,
7403
7417
  minBandWidth: 30,
7404
7418
  maxBandWidth: 100,
7405
- allowUnevenBands: true
7419
+ allowUnevenBands: true,
7420
+ balancedMinMax: false
7406
7421
  }
7407
7422
  this.elementId = elementId
7408
7423
  this.options = Object.assign({}, DEFAULTS, options)
@@ -7942,14 +7957,14 @@ else {
7942
7957
  this.options.data.bottom = { data: [] }
7943
7958
  }
7944
7959
  if (this.options.orientation === 'vertical') {
7945
- this.leftAxisLayer.attr('class', 'y-axis')
7946
- this.rightAxisLayer.attr('class', 'y-axis')
7947
- this.bottomAxisLayer.attr('class', 'x-axis')
7960
+ this.leftAxisLayer && this.leftAxisLayer.attr('class', 'y-axis')
7961
+ this.rightAxisLayer && this.rightAxisLayer.attr('class', 'y-axis')
7962
+ this.bottomAxisLayer && this.bottomAxisLayer.attr('class', 'x-axis')
7948
7963
  }
7949
7964
  else {
7950
- this.leftAxisLayer.attr('class', 'x-axis')
7951
- this.rightAxisLayer.attr('class', 'x-axis')
7952
- this.bottomAxisLayer.attr('class', 'y-axis')
7965
+ this.leftAxisLayer && this.leftAxisLayer.attr('class', 'x-axis')
7966
+ this.rightAxisLayer && this.rightAxisLayer.attr('class', 'x-axis')
7967
+ this.bottomAxisLayer && this.bottomAxisLayer.attr('class', 'y-axis')
7953
7968
  }
7954
7969
  const el = document.getElementById(this.elementId)
7955
7970
  if (el) {
@@ -8065,6 +8080,22 @@ else {
8065
8080
  if (this.options.data.right.formatter) {
8066
8081
  this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString()
8067
8082
  }
8083
+ }
8084
+ // Check to see if we need to balance the min and max values
8085
+ if (this.options.balancedMinMax) {
8086
+ if (this.options.orientation === 'horizontal') {
8087
+ let biggestBottom = Math.max(Math.abs(this.options.data.bottom.min, this.options.data.bottom.max))
8088
+ this.options.data.bottom.min = 1 - biggestBottom
8089
+ this.options.data.bottom.max = biggestBottom
8090
+ }
8091
+ else {
8092
+ let biggestLeft = Math.max(Math.abs(this.options.data.left.min, this.options.data.left.max))
8093
+ this.options.data.left.min = 1 - biggestLeft
8094
+ this.options.data.left.max = biggestLeft
8095
+ let biggestRight = Math.max(Math.abs(this.options.data.right.min, this.options.data.right.max))
8096
+ this.options.data.right.min = 1 - biggestRight
8097
+ this.options.data.right.max = biggestRight
8098
+ }
8068
8099
  }
8069
8100
  // establish the space needed for the various axes
8070
8101
  // this.options.margin.axisLeft = this.longestLeft * ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize) * 0.7
@@ -8246,7 +8277,7 @@ else {
8246
8277
  // }
8247
8278
  // }
8248
8279
  // Translate the layers
8249
- const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight + 5 : 0
8280
+ const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0
8250
8281
  this.leftAxisLayer
8251
8282
  .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8252
8283
  .style('font-size', (this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize)
@@ -8263,23 +8294,23 @@ else {
8263
8294
  this.bottomAxisLabel
8264
8295
  .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8265
8296
  this.plotArea
8266
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8297
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8267
8298
  this.areaLayer
8268
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8299
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8269
8300
  this.lineLayer
8270
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8301
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8271
8302
  this.barLayer
8272
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8303
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8273
8304
  this.labelLayer
8274
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8305
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8275
8306
  this.symbolLayer
8276
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8307
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8277
8308
  this.refLineLayer
8278
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8309
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8279
8310
  this.trackingLineLayer
8280
- .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8311
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8281
8312
  this.clip
8282
- .attr('transform', `translate(${(leftBrushAdjustment - 5) + this.options.margin.left + this.options.margin.axisLeft}, 0)`)
8313
+ .attr('transform', `translate(${(leftBrushAdjustment) + this.options.margin.left + this.options.margin.axisLeft}, 0)`)
8283
8314
  .attr('width', this.plotWidth)
8284
8315
  .attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop)
8285
8316
  if (this.options.orientation === 'horizontal') {
@@ -8836,9 +8867,9 @@ function getBarWidth (d, i, yAxis, xAxis) {
8836
8867
  let output
8837
8868
  if (this.options.orientation === 'horizontal') {
8838
8869
  // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8839
- output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8870
+ // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8840
8871
  // output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
8841
- // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
8872
+ output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
8842
8873
  }
8843
8874
  else {
8844
8875
  let x = getBarX.call(this, d, i, yAxis, xAxis)
@@ -8874,11 +8905,21 @@ function getBarX (d, i, yAxis, xAxis) {
8874
8905
  let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, yAxis, xAxis)
8875
8906
  let h = getBarWidth.call(this, d, i, yAxis, xAxis)
8876
8907
  // output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
8877
- output = (this[`${yAxis}Axis`](0)) + ((accH) * (d.y.accumulative > 0 ? 1 : 0))
8908
+ if (d.y.value >= 0) {
8909
+ output = (this[`${yAxis}Axis`](0)) + ((Math.abs(accH)) * (d.y.accumulative > 0 ? 1 : 0))
8910
+ }
8911
+ else {
8912
+ output = (this[`${yAxis}Axis`](0)) - ((Math.abs(accH) + Math.abs(h)) * (d.y.accumulative > 0 ? 1 : 0))
8913
+ }
8878
8914
  }
8879
8915
  else {
8880
8916
  let h = getBarWidth.call(this, d, i, yAxis, xAxis)
8881
- output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value > 0 ? 0 : 1))
8917
+ if (d.y.value >= 0) {
8918
+ output = (this[`${yAxis}Axis`](0))
8919
+ }
8920
+ else {
8921
+ output = (this[`${yAxis}Axis`](0)) + h
8922
+ }
8882
8923
  }
8883
8924
  }
8884
8925
  else {
@@ -9063,27 +9104,28 @@ if (this.options.showLabels === true || series.showLabels === true) {
9063
9104
  if (that.options.grouping === 'stacked' && series.labelPosition !== 'outside') {
9064
9105
  this.setAttribute('text-anchor', 'middle')
9065
9106
  }
9066
- else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
9107
+ else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
9067
9108
  this.setAttribute('text-anchor', 'end')
9068
9109
  this.setAttribute('x', +(this.getAttribute('x')) - 8)
9069
9110
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
9070
9111
  }
9071
- else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
9072
- this.setAttribute('text-anchor', 'end')
9073
- this.setAttribute('x', +(this.getAttribute('x')) - 8)
9074
- this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
9075
- }
9076
- else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
9112
+ else if (d.y.value < 0 && this.getAttribute('x') < 0) {
9077
9113
  this.setAttribute('text-anchor', 'start')
9078
- this.setAttribute('x', +(this.getAttribute('x')) + 8)
9114
+ this.setAttribute('x', Math.max(+(this.getAttribute('x')) + 8, 8))
9079
9115
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
9080
9116
  }
9117
+ else if (d.y.value < 0 && this.getAttribute('x') > 0) {
9118
+ this.setAttribute('text-anchor', 'end')
9119
+ this.setAttribute('x', +(this.getAttribute('x')) - 8)
9120
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
9121
+ }
9081
9122
  else if (series.labelPosition === 'outside') {
9082
9123
  this.setAttribute('text-anchor', 'start')
9083
9124
  this.setAttribute('x', +(this.getAttribute('x')) + 8)
9084
9125
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
9085
9126
  }
9086
- else {
9127
+ else {
9128
+ this.setAttribute('text-anchor', 'start')
9087
9129
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
9088
9130
  }
9089
9131
  }
@@ -9120,16 +9162,16 @@ if (this.options.showLabels === true || series.showLabels === true) {
9120
9162
  this.setAttribute('x', +(this.getAttribute('x')) - 8)
9121
9163
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
9122
9164
  }
9123
- else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
9124
- this.setAttribute('text-anchor', 'end')
9125
- this.setAttribute('x', +(this.getAttribute('x')) - 8)
9126
- this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
9127
- }
9128
- else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
9165
+ else if (d.y.value < 0 && this.getAttribute('x') < 0) {
9129
9166
  this.setAttribute('text-anchor', 'start')
9130
- this.setAttribute('x', +(this.getAttribute('x')) + 8)
9167
+ this.setAttribute('x', Math.max(+(this.getAttribute('x')) + 8, 8))
9131
9168
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
9132
9169
  }
9170
+ else if (d.y.value < 0 && this.getAttribute('x') > 0) {
9171
+ this.setAttribute('text-anchor', 'end')
9172
+ this.setAttribute('x', +(this.getAttribute('x')) - 8)
9173
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
9174
+ }
9133
9175
  else if (series.labelPosition === 'outside') {
9134
9176
  this.setAttribute('text-anchor', 'start')
9135
9177
  this.setAttribute('x', +(this.getAttribute('x')) + 8)
@@ -7118,7 +7118,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
7118
7118
  var el = document.getElementById(this.elementId);
7119
7119
 
7120
7120
  if (el) {
7121
- 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 ");
7121
+ 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 ");
7122
+
7123
+ if (this.isTouchDevice === true) {
7124
+ html += "\n <div id=\"".concat(this.elementId, "_touchScroller\" class=\"websy-table-touch-scroller\"></div>\n ");
7125
+ }
7126
+
7127
+ 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 ");
7122
7128
 
7123
7129
  if (this.options.paging === 'pages') {
7124
7130
  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 ");
@@ -7128,7 +7134,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7128
7134
  el.addEventListener('click', this.handleClick.bind(this));
7129
7135
  el.addEventListener('mousedown', this.handleMouseDown.bind(this));
7130
7136
  el.addEventListener('touchstart', this.handleTouchStart.bind(this));
7131
- window.addEventListener('touchmove', this.handleTouchMove.bind(this));
7137
+ el.addEventListener('touchmove', this.handleTouchMove.bind(this));
7132
7138
  window.addEventListener('touchend', this.handleTouchEnd.bind(this));
7133
7139
  window.addEventListener('mousemove', this.handleMouseMove.bind(this));
7134
7140
  window.addEventListener('mouseup', this.handleMouseUp.bind(this));
@@ -7255,11 +7261,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
7255
7261
  }
7256
7262
 
7257
7263
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
7258
- 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 ");
7264
+ 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 ");
7259
7265
  }
7260
7266
 
7261
7267
  if (sizingColumns[sizeIndex].showAsRouterLink === true && cell.value.trim() !== '') {
7262
- cell.value = "\n <a data-view='".concat((cell.link || cell.value).replace(/'/g, '\''), "' class='websy-trigger'>").concat(cell.value, "</a>\n ");
7268
+ cell.value = "\n <a data-view=\"".concat((cell.link || cell.value).replace(/'/g, '\''), "\" class='websy-trigger'>").concat(cell.value, "</a>\n ");
7263
7269
  }
7264
7270
 
7265
7271
  if (sizingColumns[sizeIndex].showAsImage === true) {
@@ -7714,9 +7720,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
7714
7720
  this.touchEndTime = new Date().getTime();
7715
7721
  this.isPerpetual = true; // this.perpetualScroll()
7716
7722
 
7717
- this.touchStartTime = null;
7718
- var touchScrollEl = document.getElementById("".concat(this.elementId, "_touchScroller"));
7719
- touchScrollEl.classList.add('hidden');
7723
+ this.touchStartTime = null; // const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
7724
+ // touchScrollEl.classList.add('hidden')
7720
7725
  }
7721
7726
  }
7722
7727
  }, {
@@ -7730,7 +7735,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
7730
7735
 
7731
7736
  if (typeof event.targetTouches !== 'undefined' && event.targetTouches.length > 0) {
7732
7737
  var deltaX = this.mouseXStart - event.targetTouches[0].pageX;
7733
- var deltaY = this.mouseYStart - event.targetTouches[0].pageY; // need to adjust the delta so that it scrolls at a reasonable speed/distance
7738
+ var deltaY = this.mouseYStart - event.targetTouches[0].pageY;
7739
+ var hScrollContainerEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
7740
+ var vScrollContainerEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
7741
+ var hScrollHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
7742
+ var vScrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
7743
+ var translatedDeltaX = deltaX * (hScrollHandleEl.getBoundingClientRect().width / vScrollContainerEl.getBoundingClientRect().width);
7744
+ var translatedDeltaY = deltaY * (vScrollHandleEl.getBoundingClientRect().height / vScrollContainerEl.getBoundingClientRect().height); // need to adjust the delta so that it scrolls at a reasonable speed/distance
7734
7745
 
7735
7746
  var scrollHandleXEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
7736
7747
  var scrollHandleYEl = document.getElementById("".concat(this.elementId, "_vScrollHandle")); // if (Math.abs(deltaY) > this.sizes.cellHeight) {
@@ -7740,7 +7751,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7740
7751
  // this.isTouchScrolling = false
7741
7752
  // }
7742
7753
 
7743
- console.log('delta init', deltaY); // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
7754
+ console.log('delta', this.mouseYStart, event.targetTouches[0].pageY, deltaY); // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
7744
7755
  // deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
7745
7756
  // console.log('delta', deltaY)
7746
7757
  // NW
@@ -7755,10 +7766,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
7755
7766
 
7756
7767
  if (this.isTouchScrolling === true) {
7757
7768
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7758
- if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 10) {
7759
- this.scrollX(Math.max(-5, Math.min(5, deltaX)));
7760
- } else {
7761
- this.scrollY(Math.max(-5, Math.min(5, deltaY)));
7769
+ if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 20) {
7770
+ // this.scrollX(Math.max(-5, Math.min(5, translatedDeltaX)))
7771
+ this.scrollX(translatedDeltaX);
7772
+ } else if (deltaY > 20) {
7773
+ // this.scrollY(Math.max(-5, Math.min(5, translatedDeltaY)))
7774
+ this.scrollY(translatedDeltaY);
7762
7775
  }
7763
7776
  }
7764
7777
  }
@@ -7782,9 +7795,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
7782
7795
  this.isTouchScrolling = true;
7783
7796
  this.isPerpetual = false;
7784
7797
  this.mouseYStart = event.targetTouches[0].pageY;
7785
- this.mouseXStart = event.targetTouches[0].pageX;
7786
- var touchScrollEl = document.getElementById("".concat(this.elementId, "_touchScroller"));
7787
- touchScrollEl.classList.remove('hidden');
7798
+ this.mouseXStart = event.targetTouches[0].pageX; // const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
7799
+ // touchScrollEl.classList.remove('hidden')
7800
+
7788
7801
  var handleYEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
7789
7802
  this.handleYStart = handleYEl.offsetTop;
7790
7803
  var handleXEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
@@ -8187,7 +8200,8 @@ var WebsyChart = /*#__PURE__*/function () {
8187
8200
  brushHeight: 50,
8188
8201
  minBandWidth: 30,
8189
8202
  maxBandWidth: 100,
8190
- allowUnevenBands: true
8203
+ allowUnevenBands: true,
8204
+ balancedMinMax: false
8191
8205
  };
8192
8206
  this.elementId = elementId;
8193
8207
  this.options = _extends({}, DEFAULTS, options);
@@ -8790,13 +8804,13 @@ var WebsyChart = /*#__PURE__*/function () {
8790
8804
  }
8791
8805
 
8792
8806
  if (this.options.orientation === 'vertical') {
8793
- this.leftAxisLayer.attr('class', 'y-axis');
8794
- this.rightAxisLayer.attr('class', 'y-axis');
8795
- this.bottomAxisLayer.attr('class', 'x-axis');
8807
+ this.leftAxisLayer && this.leftAxisLayer.attr('class', 'y-axis');
8808
+ this.rightAxisLayer && this.rightAxisLayer.attr('class', 'y-axis');
8809
+ this.bottomAxisLayer && this.bottomAxisLayer.attr('class', 'x-axis');
8796
8810
  } else {
8797
- this.leftAxisLayer.attr('class', 'x-axis');
8798
- this.rightAxisLayer.attr('class', 'x-axis');
8799
- this.bottomAxisLayer.attr('class', 'y-axis');
8811
+ this.leftAxisLayer && this.leftAxisLayer.attr('class', 'x-axis');
8812
+ this.rightAxisLayer && this.rightAxisLayer.attr('class', 'x-axis');
8813
+ this.bottomAxisLayer && this.bottomAxisLayer.attr('class', 'y-axis');
8800
8814
  }
8801
8815
 
8802
8816
  var el = document.getElementById(this.elementId);
@@ -8945,6 +8959,22 @@ var WebsyChart = /*#__PURE__*/function () {
8945
8959
  if (this.options.data.right.formatter) {
8946
8960
  this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString();
8947
8961
  }
8962
+ } // Check to see if we need to balance the min and max values
8963
+
8964
+
8965
+ if (this.options.balancedMinMax) {
8966
+ if (this.options.orientation === 'horizontal') {
8967
+ var biggestBottom = Math.max(Math.abs(this.options.data.bottom.min, this.options.data.bottom.max));
8968
+ this.options.data.bottom.min = 1 - biggestBottom;
8969
+ this.options.data.bottom.max = biggestBottom;
8970
+ } else {
8971
+ var biggestLeft = Math.max(Math.abs(this.options.data.left.min, this.options.data.left.max));
8972
+ this.options.data.left.min = 1 - biggestLeft;
8973
+ this.options.data.left.max = biggestLeft;
8974
+ var biggestRight = Math.max(Math.abs(this.options.data.right.min, this.options.data.right.max));
8975
+ this.options.data.right.min = 1 - biggestRight;
8976
+ this.options.data.right.max = biggestRight;
8977
+ }
8948
8978
  } // establish the space needed for the various axes
8949
8979
  // this.options.margin.axisLeft = this.longestLeft * ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize) * 0.7
8950
8980
  // this.options.margin.axisRight = this.longestRight * ((this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize) * 0.7
@@ -9143,22 +9173,22 @@ var WebsyChart = /*#__PURE__*/function () {
9143
9173
  // Translate the layers
9144
9174
 
9145
9175
 
9146
- var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight + 5 : 0;
9176
+ var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0;
9147
9177
  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);
9148
9178
  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);
9149
9179
  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);
9150
9180
  this.leftAxisLabel.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9151
9181
  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, ")"));
9152
9182
  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, ")"));
9153
- 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, ")"));
9154
- 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, ")"));
9155
- 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, ")"));
9156
- 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, ")"));
9157
- 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, ")"));
9158
- 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, ")"));
9159
- 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, ")"));
9160
- 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, ")"));
9161
- 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);
9183
+ this.plotArea.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9184
+ this.areaLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9185
+ this.lineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9186
+ this.barLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9187
+ this.labelLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9188
+ this.symbolLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9189
+ this.refLineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9190
+ this.trackingLineLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
9191
+ 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);
9162
9192
 
9163
9193
  if (this.options.orientation === 'horizontal') {
9164
9194
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
@@ -9669,8 +9699,9 @@ var WebsyChart = /*#__PURE__*/function () {
9669
9699
 
9670
9700
  if (this.options.orientation === 'horizontal') {
9671
9701
  // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
9672
- output = this["".concat(yAxis, "Axis")](Math.abs(d.y.value)); // output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
9673
- // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
9702
+ // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
9703
+ // output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
9704
+ output = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
9674
9705
  } else {
9675
9706
  var x = getBarX.call(this, d, i, yAxis, xAxis);
9676
9707
 
@@ -9717,11 +9748,19 @@ var WebsyChart = /*#__PURE__*/function () {
9717
9748
  }, i, yAxis, xAxis);
9718
9749
  var h = getBarWidth.call(this, d, i, yAxis, xAxis); // output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
9719
9750
 
9720
- output = this["".concat(yAxis, "Axis")](0) + accH * (d.y.accumulative > 0 ? 1 : 0);
9751
+ if (d.y.value >= 0) {
9752
+ output = this["".concat(yAxis, "Axis")](0) + Math.abs(accH) * (d.y.accumulative > 0 ? 1 : 0);
9753
+ } else {
9754
+ output = this["".concat(yAxis, "Axis")](0) - (Math.abs(accH) + Math.abs(h)) * (d.y.accumulative > 0 ? 1 : 0);
9755
+ }
9721
9756
  } else {
9722
9757
  var _h = getBarWidth.call(this, d, i, yAxis, xAxis);
9723
9758
 
9724
- output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value > 0 ? 0 : 1);
9759
+ if (d.y.value >= 0) {
9760
+ output = this["".concat(yAxis, "Axis")](0);
9761
+ } else {
9762
+ output = this["".concat(yAxis, "Axis")](0) + _h;
9763
+ }
9725
9764
  }
9726
9765
  } else {
9727
9766
  // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
@@ -9924,19 +9963,20 @@ var WebsyChart = /*#__PURE__*/function () {
9924
9963
  this.setAttribute('text-anchor', 'end');
9925
9964
  this.setAttribute('x', +this.getAttribute('x') - 8);
9926
9965
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9927
- } else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
9966
+ } else if (d.y.value < 0 && this.getAttribute('x') < 0) {
9967
+ this.setAttribute('text-anchor', 'start');
9968
+ this.setAttribute('x', Math.max(+this.getAttribute('x') + 8, 8));
9969
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9970
+ } else if (d.y.value < 0 && this.getAttribute('x') > 0) {
9928
9971
  this.setAttribute('text-anchor', 'end');
9929
9972
  this.setAttribute('x', +this.getAttribute('x') - 8);
9930
9973
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9931
- } else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
9932
- this.setAttribute('text-anchor', 'start');
9933
- this.setAttribute('x', +this.getAttribute('x') + 8);
9934
- this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9935
9974
  } else if (series.labelPosition === 'outside') {
9936
9975
  this.setAttribute('text-anchor', 'start');
9937
9976
  this.setAttribute('x', +this.getAttribute('x') + 8);
9938
9977
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9939
9978
  } else {
9979
+ this.setAttribute('text-anchor', 'start');
9940
9980
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9941
9981
  }
9942
9982
  } else {
@@ -9965,14 +10005,14 @@ var WebsyChart = /*#__PURE__*/function () {
9965
10005
  this.setAttribute('text-anchor', 'end');
9966
10006
  this.setAttribute('x', +this.getAttribute('x') - 8);
9967
10007
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9968
- } else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
10008
+ } else if (d.y.value < 0 && this.getAttribute('x') < 0) {
10009
+ this.setAttribute('text-anchor', 'start');
10010
+ this.setAttribute('x', Math.max(+this.getAttribute('x') + 8, 8));
10011
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
10012
+ } else if (d.y.value < 0 && this.getAttribute('x') > 0) {
9969
10013
  this.setAttribute('text-anchor', 'end');
9970
10014
  this.setAttribute('x', +this.getAttribute('x') - 8);
9971
10015
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
9972
- } else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
9973
- this.setAttribute('text-anchor', 'start');
9974
- this.setAttribute('x', +this.getAttribute('x') + 8);
9975
- this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
9976
10016
  } else if (series.labelPosition === 'outside') {
9977
10017
  this.setAttribute('text-anchor', 'start');
9978
10018
  this.setAttribute('x', +this.getAttribute('x') + 8);