@websy/websy-designs 1.9.2 → 1.9.4

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.
@@ -181,7 +181,9 @@ class ButtonGroup {
181
181
  subscribers: {},
182
182
  activeItem: -1,
183
183
  tag: 'div',
184
- allowNone: false
184
+ allowNone: false,
185
+ onActivate: () => {},
186
+ onDeactivate: () => {}
185
187
  }
186
188
  this.options = Object.assign({}, DEFAULTS, options)
187
189
  const el = document.getElementById(this.elementId)
@@ -193,7 +195,19 @@ class ButtonGroup {
193
195
  handleClick (event) {
194
196
  if (event.target.classList.contains('websy-button-group-item')) {
195
197
  const index = +event.target.getAttribute('data-index')
196
- if (this.options.activeItem !== index) {
198
+ if (this.options.multiSelect === true) {
199
+ if (event.target.classList.contains('active')) {
200
+ this.options.onDeactivate(this.options.items[index], index, event)
201
+ event.target.classList.remove('active')
202
+ event.target.classList.add('inactive')
203
+ }
204
+ else {
205
+ this.options.onActivate(this.options.items[index], index, event)
206
+ event.target.classList.add('active')
207
+ event.target.classList.remove('inactive')
208
+ }
209
+ }
210
+ else if (this.options.activeItem !== index) {
197
211
  const el = document.getElementById(this.elementId)
198
212
  let buttons = Array.from(el.querySelectorAll('.websy-button-group-item'))
199
213
  buttons.forEach(el => {
@@ -2520,7 +2534,7 @@ class WebsyForm {
2520
2534
  let componentsToProcess = []
2521
2535
  if (el) {
2522
2536
  let html = `
2523
- <form id="${this.elementId}Form" class="websy-form ${this.options.classes || ''}">
2537
+ <form id="${this.elementId}Form" class="websy-form ${(this.options.classes || []).join(' ')}">
2524
2538
  `
2525
2539
  this.options.fields.forEach((f, i) => {
2526
2540
  this.fieldMap[f.field] = f
@@ -3039,6 +3053,9 @@ class WebsyNavigationMenu {
3039
3053
  activeSymbol: 'none',
3040
3054
  enableSearch: false,
3041
3055
  searchProp: 'text',
3056
+ indent: 'padding',
3057
+ expandIcon: `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 512 512"><polyline points="112 184 256 328 400 184" style="fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/></svg>`,
3058
+ collapseIcon: `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 512 512"><polyline points="328 112 184 256 328 400" style="fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/></svg>`,
3042
3059
  menuIcon: `<svg viewbox="0 0 40 40" width="30" height="40">
3043
3060
  <rect x="0" y="0" width="30" height="4" rx="2"></rect>
3044
3061
  <rect x="0" y="12" width="30" height="4" rx="2"></rect>
@@ -3283,7 +3300,7 @@ class WebsyNavigationMenu {
3283
3300
  data-menu-id='${this.elementId}_${currentBlock}_list'
3284
3301
  data-popout-id='${level > 1 ? block : currentBlock}'
3285
3302
  data-text='${items[i].isLink !== true ? items[i].text : ''}'
3286
- style='padding-left: ${level * this.options.childIndentation}px'
3303
+ style='${this.options.indent}-left: ${level * this.options.childIndentation}px'
3287
3304
  ${(items[i].attributes && items[i].attributes.join(' ')) || ''}
3288
3305
  >
3289
3306
  `
@@ -3313,8 +3330,8 @@ class WebsyNavigationMenu {
3313
3330
  html += `</a>`
3314
3331
  }
3315
3332
  if (items[i].items && items[i].items.length > 0) {
3316
- html += `
3317
- <span class='menu-carat'></span>
3333
+ html += `
3334
+ <div class='websy-menu-expand-collapse-buttons'>${this.options.expandIcon}${this.options.collapseIcon}</div>
3318
3335
  `
3319
3336
  }
3320
3337
  if (this.options.activeSymbol === 'triangle') {
@@ -5446,7 +5463,7 @@ const WebsyUtils = {
5446
5463
  if (numOut % 1 > 0) {
5447
5464
  decimals = 1
5448
5465
  }
5449
- if (numOut < 1) {
5466
+ if (numOut < 1 && decimals === 0) {
5450
5467
  decimals = getZeroDecimals(numOut)
5451
5468
  }
5452
5469
  numOut = (+numOut).toFixed(decimals)
@@ -6487,10 +6504,16 @@ class WebsyTable3 {
6487
6504
  searchIcon: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 512 512"><title>ionicons-v5-f</title><path d="M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z" style="fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px"/><line x1="338.29" y1="338.29" x2="448" y2="448" style="fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px"/></svg>`,
6488
6505
  plusIcon: WebsyDesigns.Icons.PlusFilled,
6489
6506
  minusIcon: WebsyDesigns.Icons.MinusFilled,
6490
- disableInternalLoader: false
6507
+ disableInternalLoader: false,
6508
+ disableTouch: false,
6509
+ scrollWidth: 10,
6510
+ touchScrollWidth: 30
6491
6511
  }
6492
6512
  this.options = Object.assign({}, DEFAULTS, options)
6493
6513
  this.isTouchDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
6514
+ if (this.options.disableTouch === true) {
6515
+ this.isTouchDevice = false
6516
+ }
6494
6517
  this.sizes = {}
6495
6518
  this.currentData = []
6496
6519
  this.scrollDragging = false
@@ -6508,10 +6531,11 @@ class WebsyTable3 {
6508
6531
  console.log('No element Id provided for Websy Table')
6509
6532
  return
6510
6533
  }
6511
- const el = document.getElementById(this.elementId)
6534
+ const el = document.getElementById(this.elementId)
6535
+ el.style.position = 'relative'
6512
6536
  if (el) {
6513
6537
  let html = `
6514
- <div id='${this.elementId}_tableContainer' class='websy-vis-table-3 ${this.options.paging === 'pages' ? 'with-paging' : ''} ${this.options.virtualScroll === true ? 'with-virtual-scroll' : ''} ${this.isTouchDevice === true && this.options.virtualScroll === true ? 'touch-device' : ''}'>
6538
+ <div id='${this.elementId}_tableContainer' style='width: calc(100% - ${this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth}px); height: calc(100% - ${this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth}px);' class='websy-vis-table-3 ${this.options.paging === 'pages' ? 'with-paging' : ''} ${this.options.virtualScroll === true ? 'with-virtual-scroll' : ''} ${this.isTouchDevice === true && this.options.virtualScroll === true ? 'touch-device' : ''}'>
6515
6539
  <!--<div class="download-button">
6516
6540
  <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>
6517
6541
  </div>-->
@@ -6519,20 +6543,14 @@ class WebsyTable3 {
6519
6543
  <table id="${this.elementId}_tableHeader" class="websy-table-header"></table>
6520
6544
  <table id="${this.elementId}_tableBody" class="websy-table-body"></table>
6521
6545
  <table id="${this.elementId}_tableFooter" class="websy-table-footer"></table>
6522
- <div id="${this.elementId}_vScrollContainer" class="websy-v-scroll-container">
6523
- <div id="${this.elementId}_vScrollHandle" class="websy-scroll-handle websy-scroll-handle-y"></div>
6524
- </div>
6525
- <div id="${this.elementId}_hScrollContainer" class="websy-h-scroll-container">
6526
- <div id="${this.elementId}_hScrollHandle" class="websy-scroll-handle websy-scroll-handle-x"></div>
6527
- </div>
6528
6546
  `
6529
6547
  if (this.isTouchDevice === true && this.options.virtualScroll === true) {
6530
6548
  html += `
6531
6549
  <div id="${this.elementId}_touchScroller" class="websy-table-touch-scroller"></div>
6532
6550
  `
6533
6551
  }
6534
- html += `
6535
- </div>
6552
+ html += `
6553
+ </div>
6536
6554
  <div id="${this.elementId}_errorContainer" class='websy-vis-error-container'>
6537
6555
  <div>
6538
6556
  <div id="${this.elementId}_errorTitle"></div>
@@ -6542,6 +6560,12 @@ class WebsyTable3 {
6542
6560
  <div id="${this.elementId}_dropdownContainer" class="table-dropdown-container"></div>
6543
6561
  <div id="${this.elementId}_loadingContainer"></div>
6544
6562
  </div>
6563
+ <div id="${this.elementId}_vScrollContainer" class="websy-v-scroll-container" style="width: ${this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth}px;">
6564
+ <div id="${this.elementId}_vScrollHandle" class="websy-scroll-handle websy-scroll-handle-y"></div>
6565
+ </div>
6566
+ <div id="${this.elementId}_hScrollContainer" class="websy-h-scroll-container" style="height: ${this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth}px;">
6567
+ <div id="${this.elementId}_hScrollHandle" class="websy-scroll-handle websy-scroll-handle-x"></div>
6568
+ </div>
6545
6569
  `
6546
6570
  if (this.options.paging === 'pages') {
6547
6571
  html += `
@@ -6888,7 +6912,7 @@ class WebsyTable3 {
6888
6912
  // this.sizes.scrollableWidth -= col.actualWidth
6889
6913
  // }
6890
6914
  // })
6891
- this.sizes.totalWidth = columnsForSizing.reduce((a, b) => a + (b.width || b.actualWidth), 0)
6915
+ this.sizes.totalWidth = columnsForSizing.reduce((a, b) => a + (b.width || b.actualWidth), 0)
6892
6916
  this.sizes.totalNonPinnedWidth = columnsForSizing.filter((c, i) => i >= this.pinnedColumns).reduce((a, b) => a + (b.width || b.actualWidth), 0)
6893
6917
  this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth
6894
6918
  // const outerSize = outerEl.getBoundingClientRect()
@@ -7155,48 +7179,7 @@ class WebsyTable3 {
7155
7179
  else if (Math.abs(event.deltaX) > 50) {
7156
7180
  event.deltaY = 0
7157
7181
  this.handleScrollWheel(event)
7158
- }
7159
- // let deltaX = (this.mouseXStart - event.targetTouches[0].pageX)
7160
- // let deltaY = (this.mouseYStart - event.targetTouches[0].pageY)
7161
- // const hScrollContainerEl = document.getElementById(`${this.elementId}_hScrollContainer`)
7162
- // const vScrollContainerEl = document.getElementById(`${this.elementId}_vScrollContainer`)
7163
- // const hScrollHandleEl = document.getElementById(`${this.elementId}_hScrollHandle`)
7164
- // const vScrollHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
7165
- // let translatedDeltaX = deltaX * (hScrollHandleEl.getBoundingClientRect().width / vScrollContainerEl.getBoundingClientRect().width)
7166
- // let translatedDeltaY = deltaY * (vScrollHandleEl.getBoundingClientRect().height / vScrollContainerEl.getBoundingClientRect().height)
7167
- // // need to adjust the delta so that it scrolls at a reasonable speed/distance
7168
- // const scrollHandleXEl = document.getElementById(`${this.elementId}_hScrollHandle`)
7169
- // const scrollHandleYEl = document.getElementById(`${this.elementId}_vScrollHandle`)
7170
- // // if (Math.abs(deltaY) > this.sizes.cellHeight) {
7171
- // // this.isTouchScrolling = true
7172
- // // }
7173
- // // else {
7174
- // // this.isTouchScrolling = false
7175
- // // }
7176
- // // console.log('delta', this.mouseYStart, event.targetTouches[0].pageY, deltaY)
7177
- // // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
7178
- // // deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
7179
- // // console.log('delta', deltaY)
7180
- // // NW
7181
- // // else if (Math.abs(deltaX) > 50) {
7182
- // // this.isTouchScrolling = false
7183
- // // }
7184
- // this.currentClientY = event.targetTouches[0].pageY
7185
- // this.currentTouchtime = (new Date()).getTime()
7186
- // // end
7187
- // // delta = Math.min(10, delta)
7188
- // // delta = Math.max(-10, delta)
7189
- // if (this.isTouchScrolling === true) {
7190
- // // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7191
- // if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 20) {
7192
- // // this.scrollX(Math.max(-5, Math.min(5, translatedDeltaX)))
7193
- // this.scrollX(translatedDeltaX)
7194
- // }
7195
- // else if (deltaY > 20) {
7196
- // // this.scrollY(Math.max(-5, Math.min(5, translatedDeltaY)))
7197
- // this.scrollY(translatedDeltaY)
7198
- // }
7199
- // }
7182
+ }
7200
7183
  }
7201
7184
  }
7202
7185
  if (this.scrollDragging === true) {
@@ -7360,6 +7343,7 @@ class WebsyTable3 {
7360
7343
  let vHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
7361
7344
  if (this.vScrollRequired === true) {
7362
7345
  vScrollEl.style.top = `${this.sizes.header.height + this.sizes.total.height}px`
7346
+ // vScrollEl.style.left = `${this.sizes.outer.width - (this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
7363
7347
  vScrollEl.style.height = `${this.sizes.bodyHeight}px`
7364
7348
  if (this.isTouchDevice === true) {
7365
7349
  vScrollEl.style.visibility = `unset`
@@ -7374,8 +7358,10 @@ class WebsyTable3 {
7374
7358
  let hScrollEl = document.getElementById(`${this.elementId}_hScrollContainer`)
7375
7359
  let hHandleEl = document.getElementById(`${this.elementId}_hScrollHandle`)
7376
7360
  if (this.hScrollRequired === true) {
7377
- hScrollEl.style.left = `${this.sizes.table.width - this.sizes.scrollableWidth}px`
7378
- hScrollEl.style.width = `${this.sizes.scrollableWidth - (this.isTouchDevice ? 30 : 20)}px`
7361
+ hScrollEl.style.right = `${(this.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
7362
+ // hScrollEl.style.left = `${this.sizes.table.width - this.sizes.scrollableWidth}px`
7363
+ // hScrollEl.style.width = `${this.sizes.scrollableWidth - (this.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
7364
+ hScrollEl.style.width = `${this.sizes.scrollableWidth}px`
7379
7365
  hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalNonPinnedWidth)) + 'px'
7380
7366
  if (this.isTouchDevice === true) {
7381
7367
  hScrollEl.style.visibility = `unset`
@@ -7671,65 +7657,7 @@ class WebsyChart {
7671
7657
  if (that.bottomAxisLayer) {
7672
7658
  that.bottomAxisLayer.attr('transform', `translate(${newX}, ${newY + that.plotHeight})`)
7673
7659
  }
7674
- }
7675
- // that.brushedDomain = []
7676
- // let xAxis = 'bottom'
7677
- // let xAxisCaps = 'Bottom'
7678
- // if (that.options.orientation === 'horizontal') {
7679
- // xAxis = 'left'
7680
- // xAxisCaps = 'Left'
7681
- // }
7682
- // if (!that[`${xAxis}Axis`]) {
7683
- // return
7684
- // }
7685
- // if (!that[`${xAxis}Axis`].invert) {
7686
- // that[`${xAxis}Axis`].invert = that.invertOverride
7687
- // }
7688
- // let s = event.selection || that[`${xAxis}Axis`].range()
7689
- // if (!event.selection || event.selection.length === 0) {
7690
- // that.brushLayer
7691
- // .select('.brush')
7692
- // .call(that.brush)
7693
- // .call(that.brush.move, s)
7694
- // return
7695
- // }
7696
- // if (that.options.data[xAxis].scale && that.options.data[xAxis].scale === 'Time') {
7697
- // that.brushedDomain = s.map(that[`${xAxis}BrushAxis`].invert, that[[`${xAxis}Axis`]])
7698
- // }
7699
- // else {
7700
- // let startEndOrdinal = s.map((a, b) => that.bottomAxis.invert(a, b, true), that.bottomBrushAxis)
7701
- // if (
7702
- // startEndOrdinal &&
7703
- // startEndOrdinal.length === 2 &&
7704
- // typeof startEndOrdinal[0] !== 'undefined' &&
7705
- // typeof startEndOrdinal[1] !== 'undefined'
7706
- // ) {
7707
- // let domain = []
7708
- // let domainValues = [...that[`${xAxis}BrushAxis`].domain()]
7709
- // for (let i = startEndOrdinal[0]; i < startEndOrdinal[1] + 1; i++) {
7710
- // // domain.push(that.xRange[i])
7711
- // that.brushedDomain.push(domainValues[i])
7712
- // }
7713
- // }
7714
- // }
7715
- // if (that.brushedDomain.length > 0) {
7716
- // that[`${xAxis}Axis`].domain(that.brushedDomain)
7717
- // that[`${xAxis}AxisLayer`].call(
7718
- // d3[`axis${xAxisCaps}`](that[`${xAxis}Axis`])
7719
- // )
7720
- // }
7721
- // if (that.leftAxis && that.bottomAxis) {
7722
- // that.renderComponents()
7723
- // if (that.options.orientation === 'vertical') {
7724
- // // that.bottomAxisLayer.call(that.bAxisFunc)
7725
- // if (that.options.data.bottom.rotate) {
7726
- // that.bottomAxisLayer.selectAll('text')
7727
- // .attr('transform', `rotate(${((that.options.data.bottom && that.options.data.bottom.rotate) || 0)})`)
7728
- // .style('text-anchor', `${((that.options.data.bottom && that.options.data.bottom.rotate) || 0) === 0 ? 'middle' : 'end'}`)
7729
- // .style('transform-origin', ((that.options.data.bottom && that.options.data.bottom.rotate) || 0) === 0 ? '0 0' : `0 ${((that.options.data.bottom && that.options.data.bottom.fontSize) || that.options.fontSize)}px`)
7730
- // }
7731
- // }
7732
- // }
7660
+ }
7733
7661
  }
7734
7662
  const el = document.getElementById(this.elementId)
7735
7663
  if (el) {
@@ -7837,6 +7765,9 @@ else {
7837
7765
  .select('.tracking-line')
7838
7766
  .attr('stroke-opacity', 0)
7839
7767
  this.tooltip.hide()
7768
+ if (this.options.onMouseOut) {
7769
+ this.options.onMouseOut()
7770
+ }
7840
7771
  }
7841
7772
  handleEventMouseMove (event, d) {
7842
7773
  let bisectDate = d3.bisector(d => {
@@ -7863,6 +7794,9 @@ else {
7863
7794
  let xDiff
7864
7795
  if (typeof x0 === 'undefined') {
7865
7796
  this.tooltip.hide()
7797
+ if (this.options.onMouseOut) {
7798
+ this.options.onMouseOut()
7799
+ }
7866
7800
  return
7867
7801
  }
7868
7802
  let xLabel = this[xAxis].domain()[x0]
@@ -7885,7 +7819,7 @@ else {
7885
7819
  if (!d.y.color) {
7886
7820
  d.y.color = s.color
7887
7821
  }
7888
- tooltipData.push(d.y)
7822
+ tooltipData.push(d)
7889
7823
  }
7890
7824
  })
7891
7825
  }
@@ -7903,7 +7837,7 @@ else {
7903
7837
  if (!pointA.y.color) {
7904
7838
  pointA.y.color = s.color
7905
7839
  }
7906
- tooltipData.push(pointA.y)
7840
+ tooltipData.push(pointA)
7907
7841
  if (typeof pointA.x.value.getTime !== 'undefined') {
7908
7842
  tooltipTitle = d3.timeFormat(this.options.dateFormat || this.options.calculatedTimeFormatPattern)(pointA.x.value)
7909
7843
  }
@@ -7914,7 +7848,7 @@ else {
7914
7848
  if (!pointB.y.color) {
7915
7849
  pointB.y.color = s.color
7916
7850
  }
7917
- tooltipData.push(pointB.y)
7851
+ tooltipData.push(pointB)
7918
7852
  if (typeof pointB.x.value.getTime !== 'undefined') {
7919
7853
  tooltipTitle = d3.timeFormat(this.options.dateFormat || this.options.calculatedTimeFormatPattern)(pointB.x.value)
7920
7854
  }
@@ -7932,7 +7866,7 @@ else {
7932
7866
  if (!pointB.y.color) {
7933
7867
  pointB.y.color = s.color
7934
7868
  }
7935
- tooltipData.push(pointB.y)
7869
+ tooltipData.push(pointB)
7936
7870
  }
7937
7871
  else {
7938
7872
  xPoint = d0
@@ -7943,7 +7877,7 @@ else {
7943
7877
  if (!pointA.y.color) {
7944
7878
  pointA.y.color = s.color
7945
7879
  }
7946
- tooltipData.push(pointA.y)
7880
+ tooltipData.push(pointA)
7947
7881
  }
7948
7882
  }
7949
7883
  }
@@ -7953,10 +7887,13 @@ else {
7953
7887
  `
7954
7888
  tooltipHTML += tooltipData.map(d => `
7955
7889
  <li>
7956
- <i style='background-color: ${d.color};'></i>
7957
- ${d.tooltipLabel || ''}<span>: ${d.tooltipValue || d.value}</span>
7890
+ <i style='background-color: ${d.y.color};'></i>
7891
+ ${d.y.tooltipLabel || ''}<span>: ${d.y.tooltipValue || d.value}</span>
7958
7892
  </li>
7959
7893
  `).join('')
7894
+ if (this.options.onMouseOver) {
7895
+ this.options.onMouseOver(tooltipData)
7896
+ }
7960
7897
  tooltipHTML += `</ul>`
7961
7898
  let posOptions = {
7962
7899
  width: this.options.tooltipWidth,
@@ -8000,6 +7937,9 @@ else {
8000
7937
  this.tooltip.setHeight(this.plotHeight)
8001
7938
  if (isNaN(posOptions.left)) {
8002
7939
  this.tooltip.hide()
7940
+ if (this.options.onMouseOut) {
7941
+ this.options.onMouseOut()
7942
+ }
8003
7943
  return
8004
7944
  }
8005
7945
  this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions)
@@ -8046,9 +7986,9 @@ this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer')
8046
7986
  this.rightAxisLabel = this.svg.append('g').attr('class', 'right-axis-label-layer')
8047
7987
  this.bottomAxisLabel = this.svg.append('g').attr('class', 'bottom-axis-label-layer')
8048
7988
  this.plotArea = this.svg.append('g').attr('class', 'plot-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
7989
+ this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8049
7990
  this.areaLayer = this.svg.append('g').attr('class', 'area-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8050
7991
  this.lineLayer = this.svg.append('g').attr('class', 'line-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8051
- this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8052
7992
  // this.barLayer.attr('clip-path', `url(#${this.elementId}_clip)`)
8053
7993
  this.labelLayer = this.svg.append('g').attr('class', 'label-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8054
7994
  this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
@@ -8233,13 +8173,13 @@ else {
8233
8173
  this.options.data.right.max = d3.max(this.options.data.right.data)
8234
8174
  }
8235
8175
  if (this.options.data.right && typeof this.options.data.right.max !== 'undefined') {
8236
- this.longestRight = this.options.data.right.max.toString()
8176
+ this.longestRight = this.options.data.right.max.length > this.options.data.right.min.length ? this.options.data.right.max.toString() : this.options.data.right.min.toString()
8237
8177
  if (this.options.data.right.formatter) {
8238
- this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString()
8178
+ this.longestRight = this.options.data.right.formatter(this.longestRight).toString()
8239
8179
  }
8240
8180
  }
8241
8181
  // Check to see if we need to balance the min and max values
8242
- if (this.options.balancedMinMax) {
8182
+ if (this.options.balancedMinMax === true) {
8243
8183
  if (this.options.orientation === 'horizontal') {
8244
8184
  let biggestBottom = Math.max(Math.abs(this.options.data.bottom.min), this.options.data.bottom.max)
8245
8185
  this.options.data.bottom.min = 1 - biggestBottom
@@ -8247,13 +8187,13 @@ else {
8247
8187
  }
8248
8188
  else {
8249
8189
  let biggestLeft = Math.max(Math.abs(this.options.data.left.min), this.options.data.left.max)
8250
- this.options.data.left.min = 1 - biggestLeft
8190
+ this.options.data.left.min = biggestLeft * -1
8251
8191
  this.options.data.left.max = biggestLeft
8252
8192
  let biggestRight = Math.max(Math.abs(this.options.data.right.min), this.options.data.right.max)
8253
- this.options.data.right.min = 1 - biggestRight
8193
+ this.options.data.right.min = biggestRight * -1
8254
8194
  this.options.data.right.max = biggestRight
8255
8195
  }
8256
- }
8196
+ }
8257
8197
  // establish the space needed for the various axes
8258
8198
  // this.options.margin.axisLeft = this.longestLeft * ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize) * 0.7
8259
8199
  // this.options.margin.axisRight = this.longestRight * ((this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize) * 0.7
@@ -8275,7 +8215,7 @@ else {
8275
8215
  }
8276
8216
  }
8277
8217
  this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth) + 5 // + 5 to accommodate for space between text and axis line
8278
- this.options.margin.axisRight = longestRightBounds.width
8218
+ this.options.margin.axisRight = longestRightBounds.width + 10
8279
8219
  this.options.margin.axisBottom = longestBottomBounds.height + 10
8280
8220
  this.options.margin.axisTop = 0
8281
8221
  // adjust axis margins based on title options
@@ -8340,7 +8280,8 @@ else {
8340
8280
  this.totalBrushBandPadding = 0
8341
8281
  let noOfPoints = 0
8342
8282
  let noOfGroups = 0
8343
- let plotable = 0
8283
+ let plotable = 0
8284
+
8344
8285
  if (this.options.maxBandWidth) {
8345
8286
  if (this.options.orientation === 'horizontal') {
8346
8287
  this.options.data.left.totalValueCount = this.options.data.left.data.reduce((a, b) => {
@@ -8434,7 +8375,8 @@ else {
8434
8375
  // }
8435
8376
  // }
8436
8377
  // Translate the layers
8437
- const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0
8378
+ const leftBrushAdjustment = this.options.orientation === 'horizontal' && this.brushNeeded === true ? this.options.brushHeight : 0
8379
+ // const bottomBrushAdjustment = this.options.orientation === 'vertical' && this.brushNeeded === true ? this.options.brushHeight : 0
8438
8380
  this.leftAxisLayer
8439
8381
  .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8440
8382
  .style('font-size', (this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize)
@@ -8474,12 +8416,12 @@ else {
8474
8416
  this.brushLayer
8475
8417
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8476
8418
  this.yAxisClip
8477
- .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8419
+ .attr('transform', `translate(${leftBrushAdjustment}, ${this.options.margin.top + this.options.margin.axisTop})`)
8478
8420
  .attr('width', this.options.margin.axisLeft + 10)
8479
8421
  .attr('height', this.plotHeight)
8480
8422
  this.xAxisClip
8481
8423
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8482
- .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
8424
+ .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right)
8483
8425
  .attr('height', longestBottomBounds.height + 10)
8484
8426
  this.brushClip
8485
8427
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
@@ -8490,12 +8432,12 @@ else {
8490
8432
  this.brushLayer
8491
8433
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
8492
8434
  this.yAxisClip
8493
- .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop - 10})`)
8435
+ .attr('transform', `translate(0, ${this.options.margin.top + this.options.margin.axisTop - 10})`)
8494
8436
  .attr('width', this.options.margin.axisLeft + 10)
8495
8437
  .attr('height', this.plotHeight + 20)
8496
8438
  this.xAxisClip
8497
8439
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8498
- .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
8440
+ .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right)
8499
8441
  .attr('height', longestBottomBounds.height + 10)
8500
8442
  this.brushClip
8501
8443
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
@@ -8584,7 +8526,7 @@ else {
8584
8526
  }
8585
8527
  this.bottomAxis = d3[`scale${this.options.data.bottom.scale || 'Ordinal'}`]()
8586
8528
  .domain(bottomDomain)
8587
- .range(bottomRange)
8529
+ .range(bottomRange)
8588
8530
  if (!this.brushInitialized) {
8589
8531
  this.bottomBrushAxis = d3[`scale${this.options.data.bottom.scale || 'Ordinal'}`]()
8590
8532
  .domain(bottomBrushDomain)