@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.
@@ -193,7 +193,13 @@ function ShopRoutes (dbHelper, engine, app) {
193
193
  }
194
194
  catch (error) {
195
195
  if (basket.items) {
196
- basket.items = JSON.parse(basket.items)
196
+ try {
197
+ basket.items = JSON.parse(basket.items)
198
+ }
199
+ catch (error) {
200
+ console.log('Unable to parse basket')
201
+ console.log(basket.items)
202
+ }
197
203
  }
198
204
  else {
199
205
  basket.items = {}
@@ -221,6 +227,9 @@ function ShopRoutes (dbHelper, engine, app) {
221
227
  else {
222
228
  resolve({items: {}, meta: {}})
223
229
  }
230
+ }, err => {
231
+ console.log('unable to get sql:', sql)
232
+ console.log(err)
224
233
  })
225
234
  }
226
235
  else {
@@ -176,7 +176,9 @@ class ButtonGroup {
176
176
  subscribers: {},
177
177
  activeItem: -1,
178
178
  tag: 'div',
179
- allowNone: false
179
+ allowNone: false,
180
+ onActivate: () => {},
181
+ onDeactivate: () => {}
180
182
  }
181
183
  this.options = Object.assign({}, DEFAULTS, options)
182
184
  const el = document.getElementById(this.elementId)
@@ -188,7 +190,19 @@ class ButtonGroup {
188
190
  handleClick (event) {
189
191
  if (event.target.classList.contains('websy-button-group-item')) {
190
192
  const index = +event.target.getAttribute('data-index')
191
- if (this.options.activeItem !== index) {
193
+ if (this.options.multiSelect === true) {
194
+ if (event.target.classList.contains('active')) {
195
+ this.options.onDeactivate(this.options.items[index], index, event)
196
+ event.target.classList.remove('active')
197
+ event.target.classList.add('inactive')
198
+ }
199
+ else {
200
+ this.options.onActivate(this.options.items[index], index, event)
201
+ event.target.classList.add('active')
202
+ event.target.classList.remove('inactive')
203
+ }
204
+ }
205
+ else if (this.options.activeItem !== index) {
192
206
  const el = document.getElementById(this.elementId)
193
207
  let buttons = Array.from(el.querySelectorAll('.websy-button-group-item'))
194
208
  buttons.forEach(el => {
@@ -2321,7 +2335,7 @@ class WebsyForm {
2321
2335
  let componentsToProcess = []
2322
2336
  if (el) {
2323
2337
  let html = `
2324
- <form id="${this.elementId}Form" class="websy-form ${this.options.classes || ''}">
2338
+ <form id="${this.elementId}Form" class="websy-form ${(this.options.classes || []).join(' ')}">
2325
2339
  `
2326
2340
  this.options.fields.forEach((f, i) => {
2327
2341
  this.fieldMap[f.field] = f
@@ -2776,6 +2790,9 @@ class WebsyNavigationMenu {
2776
2790
  activeSymbol: 'none',
2777
2791
  enableSearch: false,
2778
2792
  searchProp: 'text',
2793
+ indent: 'padding',
2794
+ 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>`,
2795
+ 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>`,
2779
2796
  menuIcon: `<svg viewbox="0 0 40 40" width="30" height="40">
2780
2797
  <rect x="0" y="0" width="30" height="4" rx="2"></rect>
2781
2798
  <rect x="0" y="12" width="30" height="4" rx="2"></rect>
@@ -3020,7 +3037,7 @@ class WebsyNavigationMenu {
3020
3037
  data-menu-id='${this.elementId}_${currentBlock}_list'
3021
3038
  data-popout-id='${level > 1 ? block : currentBlock}'
3022
3039
  data-text='${items[i].isLink !== true ? items[i].text : ''}'
3023
- style='padding-left: ${level * this.options.childIndentation}px'
3040
+ style='${this.options.indent}-left: ${level * this.options.childIndentation}px'
3024
3041
  ${(items[i].attributes && items[i].attributes.join(' ')) || ''}
3025
3042
  >
3026
3043
  `
@@ -3050,8 +3067,8 @@ class WebsyNavigationMenu {
3050
3067
  html += `</a>`
3051
3068
  }
3052
3069
  if (items[i].items && items[i].items.length > 0) {
3053
- html += `
3054
- <span class='menu-carat'></span>
3070
+ html += `
3071
+ <div class='websy-menu-expand-collapse-buttons'>${this.options.expandIcon}${this.options.collapseIcon}</div>
3055
3072
  `
3056
3073
  }
3057
3074
  if (this.options.activeSymbol === 'triangle') {
@@ -5030,7 +5047,7 @@ const WebsyUtils = {
5030
5047
  if (numOut % 1 > 0) {
5031
5048
  decimals = 1
5032
5049
  }
5033
- if (numOut < 1) {
5050
+ if (numOut < 1 && decimals === 0) {
5034
5051
  decimals = getZeroDecimals(numOut)
5035
5052
  }
5036
5053
  numOut = (+numOut).toFixed(decimals)
@@ -6071,10 +6088,16 @@ class WebsyTable3 {
6071
6088
  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>`,
6072
6089
  plusIcon: WebsyDesigns.Icons.PlusFilled,
6073
6090
  minusIcon: WebsyDesigns.Icons.MinusFilled,
6074
- disableInternalLoader: false
6091
+ disableInternalLoader: false,
6092
+ disableTouch: false,
6093
+ scrollWidth: 10,
6094
+ touchScrollWidth: 30
6075
6095
  }
6076
6096
  this.options = Object.assign({}, DEFAULTS, options)
6077
6097
  this.isTouchDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
6098
+ if (this.options.disableTouch === true) {
6099
+ this.isTouchDevice = false
6100
+ }
6078
6101
  this.sizes = {}
6079
6102
  this.currentData = []
6080
6103
  this.scrollDragging = false
@@ -6092,10 +6115,11 @@ class WebsyTable3 {
6092
6115
  console.log('No element Id provided for Websy Table')
6093
6116
  return
6094
6117
  }
6095
- const el = document.getElementById(this.elementId)
6118
+ const el = document.getElementById(this.elementId)
6119
+ el.style.position = 'relative'
6096
6120
  if (el) {
6097
6121
  let html = `
6098
- <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' : ''}'>
6122
+ <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' : ''}'>
6099
6123
  <!--<div class="download-button">
6100
6124
  <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>
6101
6125
  </div>-->
@@ -6103,20 +6127,14 @@ class WebsyTable3 {
6103
6127
  <table id="${this.elementId}_tableHeader" class="websy-table-header"></table>
6104
6128
  <table id="${this.elementId}_tableBody" class="websy-table-body"></table>
6105
6129
  <table id="${this.elementId}_tableFooter" class="websy-table-footer"></table>
6106
- <div id="${this.elementId}_vScrollContainer" class="websy-v-scroll-container">
6107
- <div id="${this.elementId}_vScrollHandle" class="websy-scroll-handle websy-scroll-handle-y"></div>
6108
- </div>
6109
- <div id="${this.elementId}_hScrollContainer" class="websy-h-scroll-container">
6110
- <div id="${this.elementId}_hScrollHandle" class="websy-scroll-handle websy-scroll-handle-x"></div>
6111
- </div>
6112
6130
  `
6113
6131
  if (this.isTouchDevice === true && this.options.virtualScroll === true) {
6114
6132
  html += `
6115
6133
  <div id="${this.elementId}_touchScroller" class="websy-table-touch-scroller"></div>
6116
6134
  `
6117
6135
  }
6118
- html += `
6119
- </div>
6136
+ html += `
6137
+ </div>
6120
6138
  <div id="${this.elementId}_errorContainer" class='websy-vis-error-container'>
6121
6139
  <div>
6122
6140
  <div id="${this.elementId}_errorTitle"></div>
@@ -6126,6 +6144,12 @@ class WebsyTable3 {
6126
6144
  <div id="${this.elementId}_dropdownContainer" class="table-dropdown-container"></div>
6127
6145
  <div id="${this.elementId}_loadingContainer"></div>
6128
6146
  </div>
6147
+ <div id="${this.elementId}_vScrollContainer" class="websy-v-scroll-container" style="width: ${this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth}px;">
6148
+ <div id="${this.elementId}_vScrollHandle" class="websy-scroll-handle websy-scroll-handle-y"></div>
6149
+ </div>
6150
+ <div id="${this.elementId}_hScrollContainer" class="websy-h-scroll-container" style="height: ${this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth}px;">
6151
+ <div id="${this.elementId}_hScrollHandle" class="websy-scroll-handle websy-scroll-handle-x"></div>
6152
+ </div>
6129
6153
  `
6130
6154
  if (this.options.paging === 'pages') {
6131
6155
  html += `
@@ -6472,7 +6496,7 @@ class WebsyTable3 {
6472
6496
  // this.sizes.scrollableWidth -= col.actualWidth
6473
6497
  // }
6474
6498
  // })
6475
- this.sizes.totalWidth = columnsForSizing.reduce((a, b) => a + (b.width || b.actualWidth), 0)
6499
+ this.sizes.totalWidth = columnsForSizing.reduce((a, b) => a + (b.width || b.actualWidth), 0)
6476
6500
  this.sizes.totalNonPinnedWidth = columnsForSizing.filter((c, i) => i >= this.pinnedColumns).reduce((a, b) => a + (b.width || b.actualWidth), 0)
6477
6501
  this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth
6478
6502
  // const outerSize = outerEl.getBoundingClientRect()
@@ -6739,48 +6763,7 @@ class WebsyTable3 {
6739
6763
  else if (Math.abs(event.deltaX) > 50) {
6740
6764
  event.deltaY = 0
6741
6765
  this.handleScrollWheel(event)
6742
- }
6743
- // let deltaX = (this.mouseXStart - event.targetTouches[0].pageX)
6744
- // let deltaY = (this.mouseYStart - event.targetTouches[0].pageY)
6745
- // const hScrollContainerEl = document.getElementById(`${this.elementId}_hScrollContainer`)
6746
- // const vScrollContainerEl = document.getElementById(`${this.elementId}_vScrollContainer`)
6747
- // const hScrollHandleEl = document.getElementById(`${this.elementId}_hScrollHandle`)
6748
- // const vScrollHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
6749
- // let translatedDeltaX = deltaX * (hScrollHandleEl.getBoundingClientRect().width / vScrollContainerEl.getBoundingClientRect().width)
6750
- // let translatedDeltaY = deltaY * (vScrollHandleEl.getBoundingClientRect().height / vScrollContainerEl.getBoundingClientRect().height)
6751
- // // need to adjust the delta so that it scrolls at a reasonable speed/distance
6752
- // const scrollHandleXEl = document.getElementById(`${this.elementId}_hScrollHandle`)
6753
- // const scrollHandleYEl = document.getElementById(`${this.elementId}_vScrollHandle`)
6754
- // // if (Math.abs(deltaY) > this.sizes.cellHeight) {
6755
- // // this.isTouchScrolling = true
6756
- // // }
6757
- // // else {
6758
- // // this.isTouchScrolling = false
6759
- // // }
6760
- // // console.log('delta', this.mouseYStart, event.targetTouches[0].pageY, deltaY)
6761
- // // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
6762
- // // deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
6763
- // // console.log('delta', deltaY)
6764
- // // NW
6765
- // // else if (Math.abs(deltaX) > 50) {
6766
- // // this.isTouchScrolling = false
6767
- // // }
6768
- // this.currentClientY = event.targetTouches[0].pageY
6769
- // this.currentTouchtime = (new Date()).getTime()
6770
- // // end
6771
- // // delta = Math.min(10, delta)
6772
- // // delta = Math.max(-10, delta)
6773
- // if (this.isTouchScrolling === true) {
6774
- // // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
6775
- // if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 20) {
6776
- // // this.scrollX(Math.max(-5, Math.min(5, translatedDeltaX)))
6777
- // this.scrollX(translatedDeltaX)
6778
- // }
6779
- // else if (deltaY > 20) {
6780
- // // this.scrollY(Math.max(-5, Math.min(5, translatedDeltaY)))
6781
- // this.scrollY(translatedDeltaY)
6782
- // }
6783
- // }
6766
+ }
6784
6767
  }
6785
6768
  }
6786
6769
  if (this.scrollDragging === true) {
@@ -6944,6 +6927,7 @@ class WebsyTable3 {
6944
6927
  let vHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
6945
6928
  if (this.vScrollRequired === true) {
6946
6929
  vScrollEl.style.top = `${this.sizes.header.height + this.sizes.total.height}px`
6930
+ // vScrollEl.style.left = `${this.sizes.outer.width - (this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
6947
6931
  vScrollEl.style.height = `${this.sizes.bodyHeight}px`
6948
6932
  if (this.isTouchDevice === true) {
6949
6933
  vScrollEl.style.visibility = `unset`
@@ -6958,8 +6942,10 @@ class WebsyTable3 {
6958
6942
  let hScrollEl = document.getElementById(`${this.elementId}_hScrollContainer`)
6959
6943
  let hHandleEl = document.getElementById(`${this.elementId}_hScrollHandle`)
6960
6944
  if (this.hScrollRequired === true) {
6961
- hScrollEl.style.left = `${this.sizes.table.width - this.sizes.scrollableWidth}px`
6962
- hScrollEl.style.width = `${this.sizes.scrollableWidth - (this.isTouchDevice ? 30 : 20)}px`
6945
+ hScrollEl.style.right = `${(this.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
6946
+ // hScrollEl.style.left = `${this.sizes.table.width - this.sizes.scrollableWidth}px`
6947
+ // hScrollEl.style.width = `${this.sizes.scrollableWidth - (this.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
6948
+ hScrollEl.style.width = `${this.sizes.scrollableWidth}px`
6963
6949
  hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalNonPinnedWidth)) + 'px'
6964
6950
  if (this.isTouchDevice === true) {
6965
6951
  hScrollEl.style.visibility = `unset`
@@ -7255,65 +7241,7 @@ class WebsyChart {
7255
7241
  if (that.bottomAxisLayer) {
7256
7242
  that.bottomAxisLayer.attr('transform', `translate(${newX}, ${newY + that.plotHeight})`)
7257
7243
  }
7258
- }
7259
- // that.brushedDomain = []
7260
- // let xAxis = 'bottom'
7261
- // let xAxisCaps = 'Bottom'
7262
- // if (that.options.orientation === 'horizontal') {
7263
- // xAxis = 'left'
7264
- // xAxisCaps = 'Left'
7265
- // }
7266
- // if (!that[`${xAxis}Axis`]) {
7267
- // return
7268
- // }
7269
- // if (!that[`${xAxis}Axis`].invert) {
7270
- // that[`${xAxis}Axis`].invert = that.invertOverride
7271
- // }
7272
- // let s = event.selection || that[`${xAxis}Axis`].range()
7273
- // if (!event.selection || event.selection.length === 0) {
7274
- // that.brushLayer
7275
- // .select('.brush')
7276
- // .call(that.brush)
7277
- // .call(that.brush.move, s)
7278
- // return
7279
- // }
7280
- // if (that.options.data[xAxis].scale && that.options.data[xAxis].scale === 'Time') {
7281
- // that.brushedDomain = s.map(that[`${xAxis}BrushAxis`].invert, that[[`${xAxis}Axis`]])
7282
- // }
7283
- // else {
7284
- // let startEndOrdinal = s.map((a, b) => that.bottomAxis.invert(a, b, true), that.bottomBrushAxis)
7285
- // if (
7286
- // startEndOrdinal &&
7287
- // startEndOrdinal.length === 2 &&
7288
- // typeof startEndOrdinal[0] !== 'undefined' &&
7289
- // typeof startEndOrdinal[1] !== 'undefined'
7290
- // ) {
7291
- // let domain = []
7292
- // let domainValues = [...that[`${xAxis}BrushAxis`].domain()]
7293
- // for (let i = startEndOrdinal[0]; i < startEndOrdinal[1] + 1; i++) {
7294
- // // domain.push(that.xRange[i])
7295
- // that.brushedDomain.push(domainValues[i])
7296
- // }
7297
- // }
7298
- // }
7299
- // if (that.brushedDomain.length > 0) {
7300
- // that[`${xAxis}Axis`].domain(that.brushedDomain)
7301
- // that[`${xAxis}AxisLayer`].call(
7302
- // d3[`axis${xAxisCaps}`](that[`${xAxis}Axis`])
7303
- // )
7304
- // }
7305
- // if (that.leftAxis && that.bottomAxis) {
7306
- // that.renderComponents()
7307
- // if (that.options.orientation === 'vertical') {
7308
- // // that.bottomAxisLayer.call(that.bAxisFunc)
7309
- // if (that.options.data.bottom.rotate) {
7310
- // that.bottomAxisLayer.selectAll('text')
7311
- // .attr('transform', `rotate(${((that.options.data.bottom && that.options.data.bottom.rotate) || 0)})`)
7312
- // .style('text-anchor', `${((that.options.data.bottom && that.options.data.bottom.rotate) || 0) === 0 ? 'middle' : 'end'}`)
7313
- // .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`)
7314
- // }
7315
- // }
7316
- // }
7244
+ }
7317
7245
  }
7318
7246
  const el = document.getElementById(this.elementId)
7319
7247
  if (el) {
@@ -7421,6 +7349,9 @@ else {
7421
7349
  .select('.tracking-line')
7422
7350
  .attr('stroke-opacity', 0)
7423
7351
  this.tooltip.hide()
7352
+ if (this.options.onMouseOut) {
7353
+ this.options.onMouseOut()
7354
+ }
7424
7355
  }
7425
7356
  handleEventMouseMove (event, d) {
7426
7357
  let bisectDate = d3.bisector(d => {
@@ -7447,6 +7378,9 @@ else {
7447
7378
  let xDiff
7448
7379
  if (typeof x0 === 'undefined') {
7449
7380
  this.tooltip.hide()
7381
+ if (this.options.onMouseOut) {
7382
+ this.options.onMouseOut()
7383
+ }
7450
7384
  return
7451
7385
  }
7452
7386
  let xLabel = this[xAxis].domain()[x0]
@@ -7469,7 +7403,7 @@ else {
7469
7403
  if (!d.y.color) {
7470
7404
  d.y.color = s.color
7471
7405
  }
7472
- tooltipData.push(d.y)
7406
+ tooltipData.push(d)
7473
7407
  }
7474
7408
  })
7475
7409
  }
@@ -7487,7 +7421,7 @@ else {
7487
7421
  if (!pointA.y.color) {
7488
7422
  pointA.y.color = s.color
7489
7423
  }
7490
- tooltipData.push(pointA.y)
7424
+ tooltipData.push(pointA)
7491
7425
  if (typeof pointA.x.value.getTime !== 'undefined') {
7492
7426
  tooltipTitle = d3.timeFormat(this.options.dateFormat || this.options.calculatedTimeFormatPattern)(pointA.x.value)
7493
7427
  }
@@ -7498,7 +7432,7 @@ else {
7498
7432
  if (!pointB.y.color) {
7499
7433
  pointB.y.color = s.color
7500
7434
  }
7501
- tooltipData.push(pointB.y)
7435
+ tooltipData.push(pointB)
7502
7436
  if (typeof pointB.x.value.getTime !== 'undefined') {
7503
7437
  tooltipTitle = d3.timeFormat(this.options.dateFormat || this.options.calculatedTimeFormatPattern)(pointB.x.value)
7504
7438
  }
@@ -7516,7 +7450,7 @@ else {
7516
7450
  if (!pointB.y.color) {
7517
7451
  pointB.y.color = s.color
7518
7452
  }
7519
- tooltipData.push(pointB.y)
7453
+ tooltipData.push(pointB)
7520
7454
  }
7521
7455
  else {
7522
7456
  xPoint = d0
@@ -7527,7 +7461,7 @@ else {
7527
7461
  if (!pointA.y.color) {
7528
7462
  pointA.y.color = s.color
7529
7463
  }
7530
- tooltipData.push(pointA.y)
7464
+ tooltipData.push(pointA)
7531
7465
  }
7532
7466
  }
7533
7467
  }
@@ -7537,10 +7471,13 @@ else {
7537
7471
  `
7538
7472
  tooltipHTML += tooltipData.map(d => `
7539
7473
  <li>
7540
- <i style='background-color: ${d.color};'></i>
7541
- ${d.tooltipLabel || ''}<span>: ${d.tooltipValue || d.value}</span>
7474
+ <i style='background-color: ${d.y.color};'></i>
7475
+ ${d.y.tooltipLabel || ''}<span>: ${d.y.tooltipValue || d.value}</span>
7542
7476
  </li>
7543
7477
  `).join('')
7478
+ if (this.options.onMouseOver) {
7479
+ this.options.onMouseOver(tooltipData)
7480
+ }
7544
7481
  tooltipHTML += `</ul>`
7545
7482
  let posOptions = {
7546
7483
  width: this.options.tooltipWidth,
@@ -7584,6 +7521,9 @@ else {
7584
7521
  this.tooltip.setHeight(this.plotHeight)
7585
7522
  if (isNaN(posOptions.left)) {
7586
7523
  this.tooltip.hide()
7524
+ if (this.options.onMouseOut) {
7525
+ this.options.onMouseOut()
7526
+ }
7587
7527
  return
7588
7528
  }
7589
7529
  this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions)
@@ -7630,9 +7570,9 @@ this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer')
7630
7570
  this.rightAxisLabel = this.svg.append('g').attr('class', 'right-axis-label-layer')
7631
7571
  this.bottomAxisLabel = this.svg.append('g').attr('class', 'bottom-axis-label-layer')
7632
7572
  this.plotArea = this.svg.append('g').attr('class', 'plot-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
7573
+ this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
7633
7574
  this.areaLayer = this.svg.append('g').attr('class', 'area-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
7634
7575
  this.lineLayer = this.svg.append('g').attr('class', 'line-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
7635
- this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
7636
7576
  // this.barLayer.attr('clip-path', `url(#${this.elementId}_clip)`)
7637
7577
  this.labelLayer = this.svg.append('g').attr('class', 'label-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
7638
7578
  this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
@@ -7817,13 +7757,13 @@ else {
7817
7757
  this.options.data.right.max = d3.max(this.options.data.right.data)
7818
7758
  }
7819
7759
  if (this.options.data.right && typeof this.options.data.right.max !== 'undefined') {
7820
- this.longestRight = this.options.data.right.max.toString()
7760
+ 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()
7821
7761
  if (this.options.data.right.formatter) {
7822
- this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString()
7762
+ this.longestRight = this.options.data.right.formatter(this.longestRight).toString()
7823
7763
  }
7824
7764
  }
7825
7765
  // Check to see if we need to balance the min and max values
7826
- if (this.options.balancedMinMax) {
7766
+ if (this.options.balancedMinMax === true) {
7827
7767
  if (this.options.orientation === 'horizontal') {
7828
7768
  let biggestBottom = Math.max(Math.abs(this.options.data.bottom.min), this.options.data.bottom.max)
7829
7769
  this.options.data.bottom.min = 1 - biggestBottom
@@ -7831,13 +7771,13 @@ else {
7831
7771
  }
7832
7772
  else {
7833
7773
  let biggestLeft = Math.max(Math.abs(this.options.data.left.min), this.options.data.left.max)
7834
- this.options.data.left.min = 1 - biggestLeft
7774
+ this.options.data.left.min = biggestLeft * -1
7835
7775
  this.options.data.left.max = biggestLeft
7836
7776
  let biggestRight = Math.max(Math.abs(this.options.data.right.min), this.options.data.right.max)
7837
- this.options.data.right.min = 1 - biggestRight
7777
+ this.options.data.right.min = biggestRight * -1
7838
7778
  this.options.data.right.max = biggestRight
7839
7779
  }
7840
- }
7780
+ }
7841
7781
  // establish the space needed for the various axes
7842
7782
  // this.options.margin.axisLeft = this.longestLeft * ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize) * 0.7
7843
7783
  // this.options.margin.axisRight = this.longestRight * ((this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize) * 0.7
@@ -7859,7 +7799,7 @@ else {
7859
7799
  }
7860
7800
  }
7861
7801
  this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth) + 5 // + 5 to accommodate for space between text and axis line
7862
- this.options.margin.axisRight = longestRightBounds.width
7802
+ this.options.margin.axisRight = longestRightBounds.width + 10
7863
7803
  this.options.margin.axisBottom = longestBottomBounds.height + 10
7864
7804
  this.options.margin.axisTop = 0
7865
7805
  // adjust axis margins based on title options
@@ -7924,7 +7864,8 @@ else {
7924
7864
  this.totalBrushBandPadding = 0
7925
7865
  let noOfPoints = 0
7926
7866
  let noOfGroups = 0
7927
- let plotable = 0
7867
+ let plotable = 0
7868
+
7928
7869
  if (this.options.maxBandWidth) {
7929
7870
  if (this.options.orientation === 'horizontal') {
7930
7871
  this.options.data.left.totalValueCount = this.options.data.left.data.reduce((a, b) => {
@@ -8018,7 +7959,8 @@ else {
8018
7959
  // }
8019
7960
  // }
8020
7961
  // Translate the layers
8021
- const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0
7962
+ const leftBrushAdjustment = this.options.orientation === 'horizontal' && this.brushNeeded === true ? this.options.brushHeight : 0
7963
+ // const bottomBrushAdjustment = this.options.orientation === 'vertical' && this.brushNeeded === true ? this.options.brushHeight : 0
8022
7964
  this.leftAxisLayer
8023
7965
  .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8024
7966
  .style('font-size', (this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize)
@@ -8058,12 +8000,12 @@ else {
8058
8000
  this.brushLayer
8059
8001
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8060
8002
  this.yAxisClip
8061
- .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8003
+ .attr('transform', `translate(${leftBrushAdjustment}, ${this.options.margin.top + this.options.margin.axisTop})`)
8062
8004
  .attr('width', this.options.margin.axisLeft + 10)
8063
8005
  .attr('height', this.plotHeight)
8064
8006
  this.xAxisClip
8065
8007
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8066
- .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
8008
+ .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right)
8067
8009
  .attr('height', longestBottomBounds.height + 10)
8068
8010
  this.brushClip
8069
8011
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
@@ -8074,12 +8016,12 @@ else {
8074
8016
  this.brushLayer
8075
8017
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
8076
8018
  this.yAxisClip
8077
- .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop - 10})`)
8019
+ .attr('transform', `translate(0, ${this.options.margin.top + this.options.margin.axisTop - 10})`)
8078
8020
  .attr('width', this.options.margin.axisLeft + 10)
8079
8021
  .attr('height', this.plotHeight + 20)
8080
8022
  this.xAxisClip
8081
8023
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8082
- .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
8024
+ .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right)
8083
8025
  .attr('height', longestBottomBounds.height + 10)
8084
8026
  this.brushClip
8085
8027
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
@@ -8168,7 +8110,7 @@ else {
8168
8110
  }
8169
8111
  this.bottomAxis = d3[`scale${this.options.data.bottom.scale || 'Ordinal'}`]()
8170
8112
  .domain(bottomDomain)
8171
- .range(bottomRange)
8113
+ .range(bottomRange)
8172
8114
  if (!this.brushInitialized) {
8173
8115
  this.bottomBrushAxis = d3[`scale${this.options.data.bottom.scale || 'Ordinal'}`]()
8174
8116
  .domain(bottomBrushDomain)