@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.
@@ -6020,6 +6020,7 @@ class WebsyTable3 {
6020
6020
  minusIcon: WebsyDesigns.Icons.MinusFilled
6021
6021
  }
6022
6022
  this.options = Object.assign({}, DEFAULTS, options)
6023
+ this.isTouchDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
6023
6024
  this.sizes = {}
6024
6025
  this.currentData = []
6025
6026
  this.scrollDragging = false
@@ -6054,6 +6055,7 @@ class WebsyTable3 {
6054
6055
  <div id="${this.elementId}_hScrollContainer" class="websy-h-scroll-container">
6055
6056
  <div id="${this.elementId}_hScrollHandle" class="websy-scroll-handle websy-scroll-handle-x"></div>
6056
6057
  </div>
6058
+ <div id="${this.elementId}_touchScroller" class="websy-table-touch-scroller hidden"></div>
6057
6059
  </div>
6058
6060
  <div id="${this.elementId}_errorContainer" class='websy-vis-error-container'>
6059
6061
  <div>
@@ -6076,6 +6078,9 @@ class WebsyTable3 {
6076
6078
  el.innerHTML = html
6077
6079
  el.addEventListener('click', this.handleClick.bind(this))
6078
6080
  el.addEventListener('mousedown', this.handleMouseDown.bind(this))
6081
+ el.addEventListener('touchstart', this.handleTouchStart.bind(this))
6082
+ window.addEventListener('touchmove', this.handleTouchMove.bind(this))
6083
+ window.addEventListener('touchend', this.handleTouchEnd.bind(this))
6079
6084
  window.addEventListener('mousemove', this.handleMouseMove.bind(this))
6080
6085
  window.addEventListener('mouseup', this.handleMouseUp.bind(this))
6081
6086
  let scrollEl = document.getElementById(`${this.elementId}_tableBody`)
@@ -6134,7 +6139,8 @@ class WebsyTable3 {
6134
6139
  data.forEach((row, rowIndex) => {
6135
6140
  bodyHtml += `<tr class="websy-table-row">`
6136
6141
  row.forEach((cell, cellIndex) => {
6137
- let sizeIndex = cell.level || cellIndex
6142
+ let sizeIndex = cell.level || cellIndex
6143
+ let colIndex = cell.index || cellIndex
6138
6144
  if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
6139
6145
  return // need to revisit this logic
6140
6146
  }
@@ -6169,7 +6175,7 @@ class WebsyTable3 {
6169
6175
  rowspan='${cell.rowspan || 1}'
6170
6176
  data-row-index='${rowIndex}'
6171
6177
  data-cell-index='${cellIndex}'
6172
- data-col-index='${sizeIndex}'
6178
+ data-col-index='${colIndex}'
6173
6179
  `
6174
6180
  // if (useWidths === true) {
6175
6181
  // bodyHtml += `
@@ -6183,7 +6189,7 @@ class WebsyTable3 {
6183
6189
  class='websy-table-cell-content'
6184
6190
  data-row-index='${rowIndex}'
6185
6191
  data-cell-index='${cellIndex}'
6186
- data-col-index='${sizeIndex}'
6192
+ data-col-index='${colIndex}'
6187
6193
  >`
6188
6194
  if (cell.expandable === true) {
6189
6195
  bodyHtml += `<i
@@ -6545,6 +6551,9 @@ class WebsyTable3 {
6545
6551
  }
6546
6552
  }
6547
6553
  handleMouseDown (event) {
6554
+ if (this.isTouchDevice === true) {
6555
+ return
6556
+ }
6548
6557
  if (event.target.classList.contains('websy-scroll-handle-y')) {
6549
6558
  // set up the scroll start values
6550
6559
  this.scrollDragging = true
@@ -6592,8 +6601,89 @@ class WebsyTable3 {
6592
6601
  this.scrollX(Math.max(-5, Math.min(5, event.deltaX)))
6593
6602
  }
6594
6603
  else {
6604
+ console.log('delta', event.deltaY)
6595
6605
  this.scrollY(Math.max(-5, Math.min(5, event.deltaY)))
6596
6606
  }
6607
+ }
6608
+ else if (this.options.onNativeScroll) {
6609
+ const el = document.getElementById(`${this.elementId}_tableBody`)
6610
+ this.options.onNativeScroll(el.scrollTop)
6611
+ }
6612
+ }
6613
+ handleTouchEnd (event) {
6614
+ console.log('touch end fired')
6615
+ if (typeof event.targetTouches !== 'undefined') {
6616
+ this.isTouchScrolling = false
6617
+ this.touchEndTime = (new Date()).getTime()
6618
+ this.isPerpetual = true
6619
+ // this.perpetualScroll()
6620
+ this.touchStartTime = null
6621
+ const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
6622
+ touchScrollEl.classList.add('hidden')
6623
+ }
6624
+ }
6625
+ handleTouchMove (event) {
6626
+ console.log(event.target.classList)
6627
+ if (this.isTouchScrolling === true) {
6628
+ event.preventDefault()
6629
+ event.stopPropagation()
6630
+ if (typeof event.targetTouches !== 'undefined' && event.targetTouches.length > 0) {
6631
+ let deltaX = (this.mouseXStart - event.targetTouches[0].pageX)
6632
+ let deltaY = (this.mouseYStart - event.targetTouches[0].pageY)
6633
+ // need to adjust the delta so that it scrolls at a reasonable speed/distance
6634
+ const scrollHandleXEl = document.getElementById(`${this.elementId}_hScrollHandle`)
6635
+ const scrollHandleYEl = document.getElementById(`${this.elementId}_vScrollHandle`)
6636
+ // if (Math.abs(deltaY) > this.sizes.cellHeight) {
6637
+ // this.isTouchScrolling = true
6638
+ // }
6639
+ // else {
6640
+ // this.isTouchScrolling = false
6641
+ // }
6642
+ console.log('delta init', deltaY)
6643
+ // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
6644
+ // deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
6645
+ // console.log('delta', deltaY)
6646
+ // NW
6647
+ // else if (Math.abs(deltaX) > 50) {
6648
+ // this.isTouchScrolling = false
6649
+ // }
6650
+ this.currentClientY = event.targetTouches[0].pageY
6651
+ this.currentTouchtime = (new Date()).getTime()
6652
+ // end
6653
+ // delta = Math.min(10, delta)
6654
+ // delta = Math.max(-10, delta)
6655
+ if (this.isTouchScrolling === true) {
6656
+ // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
6657
+ if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 10) {
6658
+ this.scrollX(Math.max(-5, Math.min(5, deltaX)))
6659
+ }
6660
+ else {
6661
+ this.scrollY(Math.max(-5, Math.min(5, deltaY)))
6662
+ }
6663
+ }
6664
+ }
6665
+ }
6666
+ }
6667
+ handleTouchStart (event) {
6668
+ if (event.target.classList.contains('websy-table-cell-expand')) {
6669
+ return
6670
+ }
6671
+ if (event.target.classList.contains('websy-table-cell-collapse')) {
6672
+ return
6673
+ }
6674
+ console.log(event.target.classList)
6675
+ if (this.options.virtualScroll === true) {
6676
+ this.touchStartTime = (new Date()).getTime()
6677
+ this.isTouchScrolling = true
6678
+ this.isPerpetual = false
6679
+ this.mouseYStart = event.targetTouches[0].pageY
6680
+ this.mouseXStart = event.targetTouches[0].pageX
6681
+ const touchScrollEl = document.getElementById(`${this.elementId}_touchScroller`)
6682
+ touchScrollEl.classList.remove('hidden')
6683
+ const handleYEl = document.getElementById(`${this.elementId}_vScrollHandle`)
6684
+ this.handleYStart = handleYEl.offsetTop
6685
+ const handleXEl = document.getElementById(`${this.elementId}_hScrollHandle`)
6686
+ this.handleXStart = handleXEl.offsetLeft
6597
6687
  }
6598
6688
  }
6599
6689
  hideError () {
@@ -6613,6 +6703,41 @@ class WebsyTable3 {
6613
6703
  hideLoading () {
6614
6704
  this.loadingDialog.hide()
6615
6705
  }
6706
+ perpetualScroll () {
6707
+ // if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
6708
+ if (this.touchEndTime - this.currentTouchtime > 300) {
6709
+ return
6710
+ }
6711
+ // get the difference in time between when the touch initially started and when it ended
6712
+ // the longer the touch duration, the slower the scroll
6713
+ let touchDuration = this.touchEndTime - this.touchStartTime
6714
+ // get the distance moved between when the touch initially started and when it ended
6715
+ let touchDistance = this.currentClientY - this.mouseYStart
6716
+ // the bigger the distance, the more we scroll
6717
+ // use the duration and distance to calculate the duration of the perpetual scroll
6718
+ let perpetualDistance = Math.abs(touchDistance * (1 / (touchDuration / 1000)))
6719
+ let perpetualDuration = touchDuration * 1.5 / 1000
6720
+ let requiredFrames = Math.abs(Math.ceil(perpetualDistance / this.sizes.cellHeight))
6721
+ let fps = requiredFrames / perpetualDuration
6722
+ let direction = touchDistance > 0 ? -1 : 1
6723
+ for (let i = 0; i < requiredFrames; i++) {
6724
+ setTimeout(() => {
6725
+ let delta = (this.mouseYStart - this.currentClientY + (this.sizes.cellHeight * (i + 1)) * direction)
6726
+ delta = Math.min(10, delta)
6727
+ delta = Math.max(-10, delta)
6728
+ // only run this if isPerpetual === true
6729
+ // this value is reset to false on touchStart
6730
+ if (this.isPerpetual === true) {
6731
+ // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
6732
+ // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
6733
+ this.scrollY(Math.max(-5, Math.min(5, delta)))
6734
+ if (this.scrollTimeout) {
6735
+ clearTimeout(this.scrollTimeout)
6736
+ }
6737
+ }
6738
+ }, (1000 / fps) * i)
6739
+ }
6740
+ }
6616
6741
  render (data, calcSizes = true) {
6617
6742
  if (!this.options.columns) {
6618
6743
  console.log(`No columns provided for table with ID ${this.elementId}`)
@@ -7308,8 +7433,9 @@ else {
7308
7433
  this.defs = this.svg.append('defs')
7309
7434
  this.clip = this.defs.append('clipPath').attr('id', `${this.elementId}_clip`).append('rect')
7310
7435
  this.xAxisClip = this.defs.append('clipPath').attr('id', `${this.elementId}_xAxisClip`).append('rect')
7436
+ this.yAxisClip = this.defs.append('clipPath').attr('id', `${this.elementId}_yAxisClip`).append('rect')
7311
7437
  this.brushClip = this.defs.append('clipPath').attr('id', `${this.elementId}_brushclip`).append('rect')
7312
- this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer')
7438
+ this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer') // .attr('clip-path', `url(#${this.elementId}_yAxisClip)`).append('g')
7313
7439
  this.rightAxisLayer = this.svg.append('g').attr('class', 'right-axis-layer')
7314
7440
  this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer').attr('clip-path', `url(#${this.elementId}_xAxisClip)`).append('g')
7315
7441
  this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer')
@@ -7719,20 +7845,34 @@ else {
7719
7845
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7720
7846
  this.trackingLineLayer
7721
7847
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7722
- this.brushLayer
7723
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
7724
7848
  this.clip
7725
7849
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, 0)`)
7726
7850
  .attr('width', this.plotWidth)
7727
7851
  .attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop)
7728
- this.xAxisClip
7729
- .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7730
- .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
7731
- .attr('height', longestBottomBounds.height + 10)
7732
- this.brushClip
7733
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
7734
- .attr('width', this.plotWidth)
7735
- .attr('height', this.options.brushHeight)
7852
+ if (this.options.orientation === 'horizontal') {
7853
+ this.brushLayer
7854
+ .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
7855
+ this.yAxisClip
7856
+ .attr('transform', `translate(${this.options.brushHeight + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
7857
+ .attr('width', this.options.margin.axisLeft - this.options.brushHeight)
7858
+ .attr('height', this.plotHeight)
7859
+ this.brushClip
7860
+ .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
7861
+ .attr('height', this.plotHeight)
7862
+ .attr('width', this.options.brushHeight)
7863
+ }
7864
+ else {
7865
+ this.brushLayer
7866
+ .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
7867
+ this.xAxisClip
7868
+ .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7869
+ .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
7870
+ .attr('height', longestBottomBounds.height + 10)
7871
+ this.brushClip
7872
+ .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
7873
+ .attr('width', this.plotWidth)
7874
+ .attr('height', this.options.brushHeight)
7875
+ }
7736
7876
  this.eventLayer
7737
7877
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7738
7878
  let that = this
@@ -7750,9 +7890,10 @@ else {
7750
7890
  let bottomRange = [0, this.plotWidth]
7751
7891
  let bottomBrushRange = [0, this.plotWidth]
7752
7892
  let leftRange = [this.plotHeight, 0]
7753
- let leftBrushRange = [this.options.brushHeight, 0]
7893
+ let leftBrushRange = [this.options.brushHeight, 0]
7754
7894
  if (this.options.orientation === 'horizontal') {
7755
7895
  leftBrushRange = [this.plotHeight, 0]
7896
+ bottomBrushRange = [0, this.options.brushHeight]
7756
7897
  }
7757
7898
  this.widthForCalc = (proposedBandWidth * noOfPoints) // + totalPadding
7758
7899
  this.customBottomRange = []
@@ -7835,10 +7976,13 @@ else {
7835
7976
  brushMethod = 'brushY'
7836
7977
  brushLength = this.options.brushHeight
7837
7978
  brushThickness = this.plotHeight
7979
+ if (this.brushNeeded) {
7980
+ brushEnd = this.plotHeight * (this.plotHeight / (this.widthForCalc + this.totalBandPadding))
7981
+ }
7838
7982
  }
7839
7983
  else {
7840
- if (this.brushNeeded) {
7841
- brushEnd = this.plotWidth * (this.plotWidth / (this.widthForCalc + this.totalBandPadding))
7984
+ if (this.brushNeeded) {
7985
+ brushEnd = this.plotWidth * (this.plotWidth / (this.widthForCalc + this.totalBandPadding))
7842
7986
  }
7843
7987
  }
7844
7988
  this.brush = d3[brushMethod]()
@@ -8000,7 +8144,7 @@ else {
8000
8144
  }
8001
8145
  // Configure the left axis
8002
8146
  let leftDomain = this.createDomain('left')
8003
- let leftBrushDomain = this.createDomain('left', true)
8147
+ let leftBrushDomain = this.createDomain('left')
8004
8148
  let rightDomain = this.createDomain('right')
8005
8149
  this.leftAxis = d3[`scale${this.options.data.left.scale || 'Linear'}`]()
8006
8150
  .domain(leftDomain)
@@ -8163,13 +8307,17 @@ const drawArea = (xAxis, yAxis, curveStyle) => {
8163
8307
  return d3
8164
8308
  .area()
8165
8309
  .x(d => {
8166
- // return this[`${xAxis}Axis`](this.parseX(d.x.value))
8167
- let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
8168
- let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
8169
- if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
8170
- xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
8310
+ if (this.options.data[xAxis].scale === 'Time') {
8311
+ return this[`${xAxis}Axis`](this.parseX(d.x.value))
8312
+ }
8313
+ else {
8314
+ let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
8315
+ let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
8316
+ if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
8317
+ xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
8318
+ }
8319
+ return xPos
8171
8320
  }
8172
- return xPos
8173
8321
  })
8174
8322
  .y0(d => {
8175
8323
  return this[`${yAxis}Axis`](0)
@@ -8247,6 +8395,7 @@ function getBarWidth (d, i, xAxis) {
8247
8395
  let output
8248
8396
  if (this.options.orientation === 'horizontal') {
8249
8397
  output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8398
+ // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
8250
8399
  }
8251
8400
  else {
8252
8401
  let x = getBarX.call(this, d, i, xAxis)
@@ -8286,15 +8435,7 @@ function getBarX (d, i, xAxis) {
8286
8435
  let xIndex = 0
8287
8436
  if (this.processedX[d.x.value]) {
8288
8437
  xIndex = Math.max(0, this.processedX[d.x.value].indexOf(d.y.tooltipLabel))
8289
- }
8290
- // let barAdjustment =
8291
- // (this.options.data[xAxis].bandWidth * xIndex) +
8292
- // (xIndex * this.options.groupPadding * 2) + this.options.groupPadding +
8293
- // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
8294
- // let barAdjustment =
8295
- // (this.options.data[xAxis.replace('Brush', '')].step * xIndex) +
8296
- // this.options.groupPadding
8297
- // // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
8438
+ }
8298
8439
  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)
8299
8440
  if (this[`custom${xAxis.toInitialCaps()}Range`].length > 0) {
8300
8441
  output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment
@@ -8329,7 +8470,25 @@ function getBarY (d, i, yAxis, xAxis) {
8329
8470
  output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment
8330
8471
  }
8331
8472
  else {
8332
- output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + ((d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth)
8473
+ // output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + ((d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth)
8474
+ let xIndex = 0
8475
+ if (this.processedX[d.x.value]) {
8476
+ xIndex = Math.max(0, this.processedX[d.x.value].indexOf(d.y.tooltipLabel))
8477
+ }
8478
+ 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)
8479
+ if (this[`custom${xAxis.toInitialCaps()}Range`].length > 0) {
8480
+ output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment
8481
+ // output = this[`custom${xAxis.toInitialCaps().replace('Brush', '')}DetailRange`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)]
8482
+ }
8483
+ else {
8484
+ output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + barAdjustment
8485
+ }
8486
+ if (!this.processedX[d.x.value]) {
8487
+ this.processedX[d.x.value] = []
8488
+ }
8489
+ if (this.processedX[d.x.value].indexOf(d.y.tooltipLabel) === -1) {
8490
+ this.processedX[d.x.value].push(d.y.tooltipLabel)
8491
+ }
8333
8492
  }
8334
8493
  }
8335
8494
  else {
@@ -8570,14 +8729,17 @@ const drawLine = (xAxis, yAxis, curveStyle) => {
8570
8729
  return this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)
8571
8730
  }
8572
8731
  else {
8573
- let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
8574
- let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
8575
- if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
8576
- xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
8732
+ if (this.options.data[xAxis].scale === 'Time') {
8733
+ return this[`${xAxis}Axis`](this.parseX(d.x.value))
8577
8734
  }
8578
- // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis].bandWidth / 2
8579
- // return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
8580
- return xPos
8735
+ else {
8736
+ let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
8737
+ let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
8738
+ if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
8739
+ xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
8740
+ }
8741
+ return xPos
8742
+ }
8581
8743
  }
8582
8744
  })
8583
8745
  .y(d => {
@@ -8788,6 +8950,9 @@ symbols
8788
8950
  return `translate(${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)}, ${xPos})`
8789
8951
  }
8790
8952
  else {
8953
+ if (this.options.data[xAxis].scale === 'Time') {
8954
+ xPos = this[`${xAxis}Axis`](this.parseX(d.x.value))
8955
+ }
8791
8956
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8792
8957
  return `translate(${xPos}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8793
8958
  }
@@ -8811,6 +8976,9 @@ symbols.enter()
8811
8976
  return `translate(${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)}, ${xPos})`
8812
8977
  }
8813
8978
  else {
8979
+ if (this.options.data[xAxis].scale === 'Time') {
8980
+ xPos = this[`${xAxis}Axis`](this.parseX(d.x.value))
8981
+ }
8814
8982
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8815
8983
  return `translate(${xPos}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8816
8984
  }