@websy/websy-designs 1.7.3 → 1.7.5

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.
@@ -6435,6 +6435,7 @@ class WebsyTable3 {
6435
6435
  minusIcon: WebsyDesigns.Icons.MinusFilled
6436
6436
  }
6437
6437
  this.options = Object.assign({}, DEFAULTS, options)
6438
+ this.isTouchDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
6438
6439
  this.sizes = {}
6439
6440
  this.currentData = []
6440
6441
  this.scrollDragging = false
@@ -6469,6 +6470,7 @@ class WebsyTable3 {
6469
6470
  <div id="${this.elementId}_hScrollContainer" class="websy-h-scroll-container">
6470
6471
  <div id="${this.elementId}_hScrollHandle" class="websy-scroll-handle websy-scroll-handle-x"></div>
6471
6472
  </div>
6473
+ <div id="${this.elementId}_touchScroller" class="websy-table-touch-scroller hidden"></div>
6472
6474
  </div>
6473
6475
  <div id="${this.elementId}_errorContainer" class='websy-vis-error-container'>
6474
6476
  <div>
@@ -6491,6 +6493,9 @@ class WebsyTable3 {
6491
6493
  el.innerHTML = html
6492
6494
  el.addEventListener('click', this.handleClick.bind(this))
6493
6495
  el.addEventListener('mousedown', this.handleMouseDown.bind(this))
6496
+ el.addEventListener('touchstart', this.handleTouchStart.bind(this))
6497
+ window.addEventListener('touchmove', this.handleTouchMove.bind(this))
6498
+ window.addEventListener('touchend', this.handleTouchEnd.bind(this))
6494
6499
  window.addEventListener('mousemove', this.handleMouseMove.bind(this))
6495
6500
  window.addEventListener('mouseup', this.handleMouseUp.bind(this))
6496
6501
  let scrollEl = document.getElementById(`${this.elementId}_tableBody`)
@@ -6549,7 +6554,8 @@ class WebsyTable3 {
6549
6554
  data.forEach((row, rowIndex) => {
6550
6555
  bodyHtml += `<tr class="websy-table-row">`
6551
6556
  row.forEach((cell, cellIndex) => {
6552
- let sizeIndex = cell.level || cellIndex
6557
+ let sizeIndex = cell.level || cellIndex
6558
+ let colIndex = cell.index || cellIndex
6553
6559
  if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
6554
6560
  return // need to revisit this logic
6555
6561
  }
@@ -6584,7 +6590,7 @@ class WebsyTable3 {
6584
6590
  rowspan='${cell.rowspan || 1}'
6585
6591
  data-row-index='${rowIndex}'
6586
6592
  data-cell-index='${cellIndex}'
6587
- data-col-index='${sizeIndex}'
6593
+ data-col-index='${colIndex}'
6588
6594
  `
6589
6595
  // if (useWidths === true) {
6590
6596
  // bodyHtml += `
@@ -6598,7 +6604,7 @@ class WebsyTable3 {
6598
6604
  class='websy-table-cell-content'
6599
6605
  data-row-index='${rowIndex}'
6600
6606
  data-cell-index='${cellIndex}'
6601
- data-col-index='${sizeIndex}'
6607
+ data-col-index='${colIndex}'
6602
6608
  >`
6603
6609
  if (cell.expandable === true) {
6604
6610
  bodyHtml += `<i
@@ -6960,6 +6966,9 @@ class WebsyTable3 {
6960
6966
  }
6961
6967
  }
6962
6968
  handleMouseDown (event) {
6969
+ if (this.isTouchDevice === true) {
6970
+ return
6971
+ }
6963
6972
  if (event.target.classList.contains('websy-scroll-handle-y')) {
6964
6973
  // set up the scroll start values
6965
6974
  this.scrollDragging = true
@@ -7007,8 +7016,89 @@ class WebsyTable3 {
7007
7016
  this.scrollX(Math.max(-5, Math.min(5, event.deltaX)))
7008
7017
  }
7009
7018
  else {
7019
+ console.log('delta', event.deltaY)
7010
7020
  this.scrollY(Math.max(-5, Math.min(5, event.deltaY)))
7011
7021
  }
7022
+ }
7023
+ else if (this.options.onNativeScroll) {
7024
+ const el = document.getElementById(`${this.elementId}_tableBody`)
7025
+ this.options.onNativeScroll(el.scrollTop)
7026
+ }
7027
+ }
7028
+ handleTouchEnd (event) {
7029
+ console.log('touch end fired')
7030
+ if (typeof event.targetTouches !== 'undefined') {
7031
+ this.isTouchScrolling = false
7032
+ this.touchEndTime = (new Date()).getTime()
7033
+ this.isPerpetual = true
7034
+ // this.perpetualScroll()
7035
+ this.touchStartTime = null
7036
+ const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
7037
+ touchScrollEl.classList.add('hidden')
7038
+ }
7039
+ }
7040
+ handleTouchMove (event) {
7041
+ console.log(event.target.classList)
7042
+ if (this.isTouchScrolling === true) {
7043
+ event.preventDefault()
7044
+ event.stopPropagation()
7045
+ if (typeof event.targetTouches !== 'undefined' && event.targetTouches.length > 0) {
7046
+ let deltaX = (this.mouseXStart - event.targetTouches[0].pageX)
7047
+ let deltaY = (this.mouseYStart - event.targetTouches[0].pageY)
7048
+ // need to adjust the delta so that it scrolls at a reasonable speed/distance
7049
+ const scrollHandleXEl = document.getElementById(`${this.elementId}_hScrollHandle`)
7050
+ const scrollHandleYEl = document.getElementById(`${this.elementId}_vScrollHandle`)
7051
+ // if (Math.abs(deltaY) > this.sizes.cellHeight) {
7052
+ // this.isTouchScrolling = true
7053
+ // }
7054
+ // else {
7055
+ // this.isTouchScrolling = false
7056
+ // }
7057
+ console.log('delta init', deltaY)
7058
+ // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
7059
+ // deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
7060
+ // console.log('delta', deltaY)
7061
+ // NW
7062
+ // else if (Math.abs(deltaX) > 50) {
7063
+ // this.isTouchScrolling = false
7064
+ // }
7065
+ this.currentClientY = event.targetTouches[0].pageY
7066
+ this.currentTouchtime = (new Date()).getTime()
7067
+ // end
7068
+ // delta = Math.min(10, delta)
7069
+ // delta = Math.max(-10, delta)
7070
+ if (this.isTouchScrolling === true) {
7071
+ // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7072
+ if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 10) {
7073
+ this.scrollX(Math.max(-5, Math.min(5, deltaX)))
7074
+ }
7075
+ else {
7076
+ this.scrollY(Math.max(-5, Math.min(5, deltaY)))
7077
+ }
7078
+ }
7079
+ }
7080
+ }
7081
+ }
7082
+ handleTouchStart (event) {
7083
+ if (event.target.classList.contains('websy-table-cell-expand')) {
7084
+ return
7085
+ }
7086
+ if (event.target.classList.contains('websy-table-cell-collapse')) {
7087
+ return
7088
+ }
7089
+ console.log(event.target.classList)
7090
+ if (this.options.virtualScroll === true) {
7091
+ this.touchStartTime = (new Date()).getTime()
7092
+ this.isTouchScrolling = true
7093
+ this.isPerpetual = false
7094
+ this.mouseYStart = event.targetTouches[0].pageY
7095
+ this.mouseXStart = event.targetTouches[0].pageX
7096
+ const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
7097
+ touchScrollEl.classList.remove('hidden')
7098
+ const handleYEl = document.getElementById(`${this.elementId}_vScrollHandle`)
7099
+ this.handleYStart = handleYEl.offsetTop
7100
+ const handleXEl = document.getElementById(`${this.elementId}_hScrollHandle`)
7101
+ this.handleXStart = handleXEl.offsetLeft
7012
7102
  }
7013
7103
  }
7014
7104
  hideError () {
@@ -7028,6 +7118,41 @@ class WebsyTable3 {
7028
7118
  hideLoading () {
7029
7119
  this.loadingDialog.hide()
7030
7120
  }
7121
+ perpetualScroll () {
7122
+ // if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
7123
+ if (this.touchEndTime - this.currentTouchtime > 300) {
7124
+ return
7125
+ }
7126
+ // get the difference in time between when the touch initially started and when it ended
7127
+ // the longer the touch duration, the slower the scroll
7128
+ let touchDuration = this.touchEndTime - this.touchStartTime
7129
+ // get the distance moved between when the touch initially started and when it ended
7130
+ let touchDistance = this.currentClientY - this.mouseYStart
7131
+ // the bigger the distance, the more we scroll
7132
+ // use the duration and distance to calculate the duration of the perpetual scroll
7133
+ let perpetualDistance = Math.abs(touchDistance * (1 / (touchDuration / 1000)))
7134
+ let perpetualDuration = touchDuration * 1.5 / 1000
7135
+ let requiredFrames = Math.abs(Math.ceil(perpetualDistance / this.sizes.cellHeight))
7136
+ let fps = requiredFrames / perpetualDuration
7137
+ let direction = touchDistance > 0 ? -1 : 1
7138
+ for (let i = 0; i < requiredFrames; i++) {
7139
+ setTimeout(() => {
7140
+ let delta = (this.mouseYStart - this.currentClientY + (this.sizes.cellHeight * (i + 1)) * direction)
7141
+ delta = Math.min(10, delta)
7142
+ delta = Math.max(-10, delta)
7143
+ // only run this if isPerpetual === true
7144
+ // this value is reset to false on touchStart
7145
+ if (this.isPerpetual === true) {
7146
+ // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7147
+ // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
7148
+ this.scrollY(Math.max(-5, Math.min(5, delta)))
7149
+ if (this.scrollTimeout) {
7150
+ clearTimeout(this.scrollTimeout)
7151
+ }
7152
+ }
7153
+ }, (1000 / fps) * i)
7154
+ }
7155
+ }
7031
7156
  render (data, calcSizes = true) {
7032
7157
  if (!this.options.columns) {
7033
7158
  console.log(`No columns provided for table with ID ${this.elementId}`)
@@ -7723,8 +7848,9 @@ else {
7723
7848
  this.defs = this.svg.append('defs')
7724
7849
  this.clip = this.defs.append('clipPath').attr('id', `${this.elementId}_clip`).append('rect')
7725
7850
  this.xAxisClip = this.defs.append('clipPath').attr('id', `${this.elementId}_xAxisClip`).append('rect')
7851
+ this.yAxisClip = this.defs.append('clipPath').attr('id', `${this.elementId}_yAxisClip`).append('rect')
7726
7852
  this.brushClip = this.defs.append('clipPath').attr('id', `${this.elementId}_brushclip`).append('rect')
7727
- this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer')
7853
+ this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer') // .attr('clip-path', `url(#${this.elementId}_yAxisClip)`).append('g')
7728
7854
  this.rightAxisLayer = this.svg.append('g').attr('class', 'right-axis-layer')
7729
7855
  this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer').attr('clip-path', `url(#${this.elementId}_xAxisClip)`).append('g')
7730
7856
  this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer')
@@ -8134,20 +8260,34 @@ else {
8134
8260
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8135
8261
  this.trackingLineLayer
8136
8262
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8137
- this.brushLayer
8138
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
8139
8263
  this.clip
8140
8264
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, 0)`)
8141
8265
  .attr('width', this.plotWidth)
8142
8266
  .attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop)
8143
- this.xAxisClip
8144
- .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8145
- .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
8146
- .attr('height', longestBottomBounds.height + 10)
8147
- this.brushClip
8148
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
8149
- .attr('width', this.plotWidth)
8150
- .attr('height', this.options.brushHeight)
8267
+ if (this.options.orientation === 'horizontal') {
8268
+ this.brushLayer
8269
+ .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8270
+ this.yAxisClip
8271
+ .attr('transform', `translate(${this.options.brushHeight + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8272
+ .attr('width', this.options.margin.axisLeft - this.options.brushHeight)
8273
+ .attr('height', this.plotHeight)
8274
+ this.brushClip
8275
+ .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8276
+ .attr('height', this.plotHeight)
8277
+ .attr('width', this.options.brushHeight)
8278
+ }
8279
+ else {
8280
+ this.brushLayer
8281
+ .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
8282
+ this.xAxisClip
8283
+ .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8284
+ .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
8285
+ .attr('height', longestBottomBounds.height + 10)
8286
+ this.brushClip
8287
+ .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
8288
+ .attr('width', this.plotWidth)
8289
+ .attr('height', this.options.brushHeight)
8290
+ }
8151
8291
  this.eventLayer
8152
8292
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8153
8293
  let that = this
@@ -8165,9 +8305,10 @@ else {
8165
8305
  let bottomRange = [0, this.plotWidth]
8166
8306
  let bottomBrushRange = [0, this.plotWidth]
8167
8307
  let leftRange = [this.plotHeight, 0]
8168
- let leftBrushRange = [this.options.brushHeight, 0]
8308
+ let leftBrushRange = [this.options.brushHeight, 0]
8169
8309
  if (this.options.orientation === 'horizontal') {
8170
8310
  leftBrushRange = [this.plotHeight, 0]
8311
+ bottomBrushRange = [0, this.options.brushHeight]
8171
8312
  }
8172
8313
  this.widthForCalc = (proposedBandWidth * noOfPoints) // + totalPadding
8173
8314
  this.customBottomRange = []
@@ -8250,10 +8391,13 @@ else {
8250
8391
  brushMethod = 'brushY'
8251
8392
  brushLength = this.options.brushHeight
8252
8393
  brushThickness = this.plotHeight
8394
+ if (this.brushNeeded) {
8395
+ brushEnd = this.plotHeight * (this.plotHeight / (this.widthForCalc + this.totalBandPadding))
8396
+ }
8253
8397
  }
8254
8398
  else {
8255
- if (this.brushNeeded) {
8256
- brushEnd = this.plotWidth * (this.plotWidth / (this.widthForCalc + this.totalBandPadding))
8399
+ if (this.brushNeeded) {
8400
+ brushEnd = this.plotWidth * (this.plotWidth / (this.widthForCalc + this.totalBandPadding))
8257
8401
  }
8258
8402
  }
8259
8403
  this.brush = d3[brushMethod]()
@@ -8415,7 +8559,7 @@ else {
8415
8559
  }
8416
8560
  // Configure the left axis
8417
8561
  let leftDomain = this.createDomain('left')
8418
- let leftBrushDomain = this.createDomain('left', true)
8562
+ let leftBrushDomain = this.createDomain('left')
8419
8563
  let rightDomain = this.createDomain('right')
8420
8564
  this.leftAxis = d3[`scale${this.options.data.left.scale || 'Linear'}`]()
8421
8565
  .domain(leftDomain)
@@ -8578,13 +8722,17 @@ const drawArea = (xAxis, yAxis, curveStyle) => {
8578
8722
  return d3
8579
8723
  .area()
8580
8724
  .x(d => {
8581
- // return this[`${xAxis}Axis`](this.parseX(d.x.value))
8582
- let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
8583
- let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
8584
- if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
8585
- xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
8725
+ if (this.options.data[xAxis].scale === 'Time') {
8726
+ return this[`${xAxis}Axis`](this.parseX(d.x.value))
8727
+ }
8728
+ else {
8729
+ let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
8730
+ let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
8731
+ if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
8732
+ xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
8733
+ }
8734
+ return xPos
8586
8735
  }
8587
- return xPos
8588
8736
  })
8589
8737
  .y0(d => {
8590
8738
  return this[`${yAxis}Axis`](0)
@@ -8662,6 +8810,7 @@ function getBarWidth (d, i, xAxis) {
8662
8810
  let output
8663
8811
  if (this.options.orientation === 'horizontal') {
8664
8812
  output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8813
+ // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
8665
8814
  }
8666
8815
  else {
8667
8816
  let x = getBarX.call(this, d, i, xAxis)
@@ -8701,15 +8850,7 @@ function getBarX (d, i, xAxis) {
8701
8850
  let xIndex = 0
8702
8851
  if (this.processedX[d.x.value]) {
8703
8852
  xIndex = Math.max(0, this.processedX[d.x.value].indexOf(d.y.tooltipLabel))
8704
- }
8705
- // let barAdjustment =
8706
- // (this.options.data[xAxis].bandWidth * xIndex) +
8707
- // (xIndex * this.options.groupPadding * 2) + this.options.groupPadding +
8708
- // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
8709
- // let barAdjustment =
8710
- // (this.options.data[xAxis.replace('Brush', '')].step * xIndex) +
8711
- // this.options.groupPadding
8712
- // // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
8853
+ }
8713
8854
  let barAdjustment = (this.options.data[xAxis].bandWidth * xIndex) + ((xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2) + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding)
8714
8855
  if (this[`custom${xAxis.toInitialCaps()}Range`].length > 0) {
8715
8856
  output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment
@@ -8744,7 +8885,25 @@ function getBarY (d, i, yAxis, xAxis) {
8744
8885
  output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment
8745
8886
  }
8746
8887
  else {
8747
- output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + ((d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth)
8888
+ // output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + ((d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth)
8889
+ let xIndex = 0
8890
+ if (this.processedX[d.x.value]) {
8891
+ xIndex = Math.max(0, this.processedX[d.x.value].indexOf(d.y.tooltipLabel))
8892
+ }
8893
+ let barAdjustment = (this.options.data[xAxis].bandWidth * xIndex) + ((xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2) + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding)
8894
+ if (this[`custom${xAxis.toInitialCaps()}Range`].length > 0) {
8895
+ output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment
8896
+ // output = this[`custom${xAxis.toInitialCaps().replace('Brush', '')}DetailRange`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)]
8897
+ }
8898
+ else {
8899
+ output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + barAdjustment
8900
+ }
8901
+ if (!this.processedX[d.x.value]) {
8902
+ this.processedX[d.x.value] = []
8903
+ }
8904
+ if (this.processedX[d.x.value].indexOf(d.y.tooltipLabel) === -1) {
8905
+ this.processedX[d.x.value].push(d.y.tooltipLabel)
8906
+ }
8748
8907
  }
8749
8908
  }
8750
8909
  else {
@@ -8985,14 +9144,17 @@ const drawLine = (xAxis, yAxis, curveStyle) => {
8985
9144
  return this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)
8986
9145
  }
8987
9146
  else {
8988
- let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
8989
- let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
8990
- if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
8991
- xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
9147
+ if (this.options.data[xAxis].scale === 'Time') {
9148
+ return this[`${xAxis}Axis`](this.parseX(d.x.value))
8992
9149
  }
8993
- // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis].bandWidth / 2
8994
- // return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
8995
- return xPos
9150
+ else {
9151
+ let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
9152
+ let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
9153
+ if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
9154
+ xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
9155
+ }
9156
+ return xPos
9157
+ }
8996
9158
  }
8997
9159
  })
8998
9160
  .y(d => {
@@ -9203,6 +9365,9 @@ symbols
9203
9365
  return `translate(${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)}, ${xPos})`
9204
9366
  }
9205
9367
  else {
9368
+ if (this.options.data[xAxis].scale === 'Time') {
9369
+ xPos = this[`${xAxis}Axis`](this.parseX(d.x.value))
9370
+ }
9206
9371
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9207
9372
  return `translate(${xPos}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9208
9373
  }
@@ -9226,6 +9391,9 @@ symbols.enter()
9226
9391
  return `translate(${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)}, ${xPos})`
9227
9392
  }
9228
9393
  else {
9394
+ if (this.options.data[xAxis].scale === 'Time') {
9395
+ xPos = this[`${xAxis}Axis`](this.parseX(d.x.value))
9396
+ }
9229
9397
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9230
9398
  return `translate(${xPos}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9231
9399
  }