@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.
@@ -219,7 +219,9 @@ var ButtonGroup = /*#__PURE__*/function () {
219
219
  subscribers: {},
220
220
  activeItem: -1,
221
221
  tag: 'div',
222
- allowNone: false
222
+ allowNone: false,
223
+ onActivate: function onActivate() {},
224
+ onDeactivate: function onDeactivate() {}
223
225
  };
224
226
  this.options = _extends({}, DEFAULTS, options);
225
227
  var el = document.getElementById(this.elementId);
@@ -233,7 +235,17 @@ var ButtonGroup = /*#__PURE__*/function () {
233
235
  value: function handleClick(event) {
234
236
  if (event.target.classList.contains('websy-button-group-item')) {
235
237
  var index = +event.target.getAttribute('data-index');
236
- if (this.options.activeItem !== index) {
238
+ if (this.options.multiSelect === true) {
239
+ if (event.target.classList.contains('active')) {
240
+ this.options.onDeactivate(this.options.items[index], index, event);
241
+ event.target.classList.remove('active');
242
+ event.target.classList.add('inactive');
243
+ } else {
244
+ this.options.onActivate(this.options.items[index], index, event);
245
+ event.target.classList.add('active');
246
+ event.target.classList.remove('inactive');
247
+ }
248
+ } else if (this.options.activeItem !== index) {
237
249
  var el = document.getElementById(this.elementId);
238
250
  var buttons = Array.from(el.querySelectorAll('.websy-button-group-item'));
239
251
  buttons.forEach(function (el) {
@@ -2528,7 +2540,7 @@ var WebsyForm = /*#__PURE__*/function () {
2528
2540
  var el = document.getElementById(this.elementId);
2529
2541
  var componentsToProcess = [];
2530
2542
  if (el) {
2531
- var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat(this.options.classes || '', "\">\n ");
2543
+ var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat((this.options.classes || []).join(' '), "\">\n ");
2532
2544
  this.options.fields.forEach(function (f, i) {
2533
2545
  _this19.fieldMap[f.field] = f;
2534
2546
  if (f.component) {
@@ -2850,6 +2862,9 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2850
2862
  activeSymbol: 'none',
2851
2863
  enableSearch: false,
2852
2864
  searchProp: 'text',
2865
+ indent: 'padding',
2866
+ 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>",
2867
+ 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>",
2853
2868
  menuIcon: "<svg viewbox=\"0 0 40 40\" width=\"30\" height=\"40\"> \n <rect x=\"0\" y=\"0\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n <rect x=\"0\" y=\"12\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n <rect x=\"0\" y=\"24\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n </svg>",
2854
2869
  searchOptions: {}
2855
2870
  }, options);
@@ -3089,7 +3104,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3089
3104
  if (Array.isArray(items[i].classes)) {
3090
3105
  items[i].classes = items[i].classes.join(' ');
3091
3106
  }
3092
- html += "\n\t\t\t<li class='websy-".concat(this.options.orientation, "-list-item ").concat(items[i].alwaysOpen === true ? 'always-open' : '', "'>\n\t\t\t\t<div class='websy-menu-header websy-menu-level-").concat(level, " ").concat(items[i].classes || '', " ").concat(selected, " ").concat(active, "' \n id='").concat(blockId, "' \n data-id='").concat(currentBlock, "'\n data-path='").concat(items[i].path, "'\n data-menu-id='").concat(this.elementId, "_").concat(currentBlock, "_list'\n data-popout-id='").concat(level > 1 ? block : currentBlock, "'\n data-text='").concat(items[i].isLink !== true ? items[i].text : '', "'\n style='padding-left: ").concat(level * this.options.childIndentation, "px'\n ").concat(items[i].attributes && items[i].attributes.join(' ') || '', "\n >\n ");
3107
+ html += "\n\t\t\t<li class='websy-".concat(this.options.orientation, "-list-item ").concat(items[i].alwaysOpen === true ? 'always-open' : '', "'>\n\t\t\t\t<div class='websy-menu-header websy-menu-level-").concat(level, " ").concat(items[i].classes || '', " ").concat(selected, " ").concat(active, "' \n id='").concat(blockId, "' \n data-id='").concat(currentBlock, "'\n data-path='").concat(items[i].path, "'\n data-menu-id='").concat(this.elementId, "_").concat(currentBlock, "_list'\n data-popout-id='").concat(level > 1 ? block : currentBlock, "'\n data-text='").concat(items[i].isLink !== true ? items[i].text : '', "'\n style='").concat(this.options.indent, "-left: ").concat(level * this.options.childIndentation, "px'\n ").concat(items[i].attributes && items[i].attributes.join(' ') || '', "\n >\n ");
3093
3108
  if (this.options.orientation === 'horizontal') {
3094
3109
  html += items[i].text;
3095
3110
  }
@@ -3112,7 +3127,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3112
3127
  html += "</a>";
3113
3128
  }
3114
3129
  if (items[i].items && items[i].items.length > 0) {
3115
- html += " \n <span class='menu-carat'></span>\n ";
3130
+ html += " \n <div class='websy-menu-expand-collapse-buttons'>".concat(this.options.expandIcon).concat(this.options.collapseIcon, "</div>\n ");
3116
3131
  }
3117
3132
  if (this.options.activeSymbol === 'triangle') {
3118
3133
  html += "\n <span class='active-square'></span>\n ";
@@ -5281,7 +5296,7 @@ var WebsyUtils = {
5281
5296
  if (numOut % 1 > 0) {
5282
5297
  decimals = 1;
5283
5298
  }
5284
- if (numOut < 1) {
5299
+ if (numOut < 1 && decimals === 0) {
5285
5300
  decimals = getZeroDecimals(numOut);
5286
5301
  }
5287
5302
  numOut = (+numOut).toFixed(decimals);
@@ -6200,10 +6215,16 @@ var WebsyTable3 = /*#__PURE__*/function () {
6200
6215
  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>",
6201
6216
  plusIcon: WebsyDesigns.Icons.PlusFilled,
6202
6217
  minusIcon: WebsyDesigns.Icons.MinusFilled,
6203
- disableInternalLoader: false
6218
+ disableInternalLoader: false,
6219
+ disableTouch: false,
6220
+ scrollWidth: 10,
6221
+ touchScrollWidth: 30
6204
6222
  };
6205
6223
  this.options = _extends({}, DEFAULTS, options);
6206
6224
  this.isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
6225
+ if (this.options.disableTouch === true) {
6226
+ this.isTouchDevice = false;
6227
+ }
6207
6228
  this.sizes = {};
6208
6229
  this.currentData = [];
6209
6230
  this.scrollDragging = false;
@@ -6222,12 +6243,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
6222
6243
  return;
6223
6244
  }
6224
6245
  var el = document.getElementById(this.elementId);
6246
+ el.style.position = 'relative';
6225
6247
  if (el) {
6226
- var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table-3 ").concat(this.options.paging === 'pages' ? 'with-paging' : '', " ").concat(this.options.virtualScroll === true ? 'with-virtual-scroll' : '', " ").concat(this.isTouchDevice === true && this.options.virtualScroll === true ? 'touch-device' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <div id=\"").concat(this.elementId, "_tableInner\" class=\"websy-table-inner-container\">\n <table id=\"").concat(this.elementId, "_tableHeader\" class=\"websy-table-header\"></table>\n <table id=\"").concat(this.elementId, "_tableBody\" class=\"websy-table-body\"></table>\n <table id=\"").concat(this.elementId, "_tableFooter\" class=\"websy-table-footer\"></table>\n <div id=\"").concat(this.elementId, "_vScrollContainer\" class=\"websy-v-scroll-container\">\n <div id=\"").concat(this.elementId, "_vScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-y\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_hScrollContainer\" class=\"websy-h-scroll-container\">\n <div id=\"").concat(this.elementId, "_hScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-x\"></div>\n </div>\n ");
6248
+ var html = "\n <div id='".concat(this.elementId, "_tableContainer' style='width: calc(100% - ").concat(this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth, "px); height: calc(100% - ").concat(this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth, "px);' class='websy-vis-table-3 ").concat(this.options.paging === 'pages' ? 'with-paging' : '', " ").concat(this.options.virtualScroll === true ? 'with-virtual-scroll' : '', " ").concat(this.isTouchDevice === true && this.options.virtualScroll === true ? 'touch-device' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <div id=\"").concat(this.elementId, "_tableInner\" class=\"websy-table-inner-container\">\n <table id=\"").concat(this.elementId, "_tableHeader\" class=\"websy-table-header\"></table>\n <table id=\"").concat(this.elementId, "_tableBody\" class=\"websy-table-body\"></table>\n <table id=\"").concat(this.elementId, "_tableFooter\" class=\"websy-table-footer\"></table>\n ");
6227
6249
  if (this.isTouchDevice === true && this.options.virtualScroll === true) {
6228
6250
  html += "\n <div id=\"".concat(this.elementId, "_touchScroller\" class=\"websy-table-touch-scroller\"></div>\n ");
6229
6251
  }
6230
- html += " \n </div> \n <div id=\"".concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_dropdownContainer\" class=\"table-dropdown-container\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
6252
+ html += " \n </div> \n <div id=\"".concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_dropdownContainer\" class=\"table-dropdown-container\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_vScrollContainer\" class=\"websy-v-scroll-container\" style=\"width: ").concat(this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth, "px;\">\n <div id=\"").concat(this.elementId, "_vScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-y\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_hScrollContainer\" class=\"websy-h-scroll-container\" style=\"height: ").concat(this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth, "px;\">\n <div id=\"").concat(this.elementId, "_hScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-x\"></div>\n </div> \n ");
6231
6253
  if (this.options.paging === 'pages') {
6232
6254
  html += "\n <div class=\"websy-table-paging-container\">\n Show <div id=\"".concat(this.elementId, "_pageSizeSelector\" class=\"websy-vis-page-selector\"></div> rows\n <ul id=\"").concat(this.elementId, "_pageList\" class=\"websy-vis-page-list\"></ul>\n </div>\n ");
6233
6255
  }
@@ -6823,50 +6845,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6823
6845
  event.deltaY = 0;
6824
6846
  this.handleScrollWheel(event);
6825
6847
  }
6826
- // let deltaX = (this.mouseXStart - event.targetTouches[0].pageX)
6827
- // let deltaY = (this.mouseYStart - event.targetTouches[0].pageY)
6828
- // const hScrollContainerEl = document.getElementById(`${this.elementId}_hScrollContainer`)
6829
- // const vScrollContainerEl = document.getElementById(`${this.elementId}_vScrollContainer`)
6830
- // const hScrollHandleEl = document.getElementById(`${this.elementId}_hScrollHandle`)
6831
- // const vScrollHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
6832
- // let translatedDeltaX = deltaX * (hScrollHandleEl.getBoundingClientRect().width / vScrollContainerEl.getBoundingClientRect().width)
6833
- // let translatedDeltaY = deltaY * (vScrollHandleEl.getBoundingClientRect().height / vScrollContainerEl.getBoundingClientRect().height)
6834
- // // need to adjust the delta so that it scrolls at a reasonable speed/distance
6835
- // const scrollHandleXEl = document.getElementById(`${this.elementId}_hScrollHandle`)
6836
- // const scrollHandleYEl = document.getElementById(`${this.elementId}_vScrollHandle`)
6837
- // // if (Math.abs(deltaY) > this.sizes.cellHeight) {
6838
- // // this.isTouchScrolling = true
6839
- // // }
6840
- // // else {
6841
- // // this.isTouchScrolling = false
6842
- // // }
6843
- // // console.log('delta', this.mouseYStart, event.targetTouches[0].pageY, deltaY)
6844
- // // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
6845
- // // deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
6846
- // // console.log('delta', deltaY)
6847
- // // NW
6848
- // // else if (Math.abs(deltaX) > 50) {
6849
- // // this.isTouchScrolling = false
6850
- // // }
6851
- // this.currentClientY = event.targetTouches[0].pageY
6852
- // this.currentTouchtime = (new Date()).getTime()
6853
- // // end
6854
- // // delta = Math.min(10, delta)
6855
- // // delta = Math.max(-10, delta)
6856
- // if (this.isTouchScrolling === true) {
6857
- // // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
6858
- // if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 20) {
6859
- // // this.scrollX(Math.max(-5, Math.min(5, translatedDeltaX)))
6860
- // this.scrollX(translatedDeltaX)
6861
- // }
6862
- // else if (deltaY > 20) {
6863
- // // this.scrollY(Math.max(-5, Math.min(5, translatedDeltaY)))
6864
- // this.scrollY(translatedDeltaY)
6865
- // }
6866
- // }
6867
6848
  }
6868
6849
  }
6869
-
6870
6850
  if (this.scrollDragging === true) {
6871
6851
  event.preventDefault();
6872
6852
  if (this.scrollDirection === 'y') {
@@ -7041,6 +7021,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7041
7021
  var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
7042
7022
  if (this.vScrollRequired === true) {
7043
7023
  vScrollEl.style.top = "".concat(this.sizes.header.height + this.sizes.total.height, "px");
7024
+ // vScrollEl.style.left = `${this.sizes.outer.width - (this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
7044
7025
  vScrollEl.style.height = "".concat(this.sizes.bodyHeight, "px");
7045
7026
  if (this.isTouchDevice === true) {
7046
7027
  vScrollEl.style.visibility = "unset";
@@ -7054,8 +7035,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
7054
7035
  var hScrollEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
7055
7036
  var hHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
7056
7037
  if (this.hScrollRequired === true) {
7057
- hScrollEl.style.left = "".concat(this.sizes.table.width - this.sizes.scrollableWidth, "px");
7058
- hScrollEl.style.width = "".concat(this.sizes.scrollableWidth - (this.isTouchDevice ? 30 : 20), "px");
7038
+ hScrollEl.style.right = "".concat(this.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth, "px");
7039
+ // hScrollEl.style.left = `${this.sizes.table.width - this.sizes.scrollableWidth}px`
7040
+ // hScrollEl.style.width = `${this.sizes.scrollableWidth - (this.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
7041
+ hScrollEl.style.width = "".concat(this.sizes.scrollableWidth, "px");
7059
7042
  hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalNonPinnedWidth)) + 'px';
7060
7043
  if (this.isTouchDevice === true) {
7061
7044
  hScrollEl.style.visibility = "unset";
@@ -7362,66 +7345,7 @@ var WebsyChart = /*#__PURE__*/function () {
7362
7345
  that.bottomAxisLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY + that.plotHeight, ")"));
7363
7346
  }
7364
7347
  }
7365
- // that.brushedDomain = []
7366
- // let xAxis = 'bottom'
7367
- // let xAxisCaps = 'Bottom'
7368
- // if (that.options.orientation === 'horizontal') {
7369
- // xAxis = 'left'
7370
- // xAxisCaps = 'Left'
7371
- // }
7372
- // if (!that[`${xAxis}Axis`]) {
7373
- // return
7374
- // }
7375
- // if (!that[`${xAxis}Axis`].invert) {
7376
- // that[`${xAxis}Axis`].invert = that.invertOverride
7377
- // }
7378
- // let s = event.selection || that[`${xAxis}Axis`].range()
7379
- // if (!event.selection || event.selection.length === 0) {
7380
- // that.brushLayer
7381
- // .select('.brush')
7382
- // .call(that.brush)
7383
- // .call(that.brush.move, s)
7384
- // return
7385
- // }
7386
- // if (that.options.data[xAxis].scale && that.options.data[xAxis].scale === 'Time') {
7387
- // that.brushedDomain = s.map(that[`${xAxis}BrushAxis`].invert, that[[`${xAxis}Axis`]])
7388
- // }
7389
- // else {
7390
- // let startEndOrdinal = s.map((a, b) => that.bottomAxis.invert(a, b, true), that.bottomBrushAxis)
7391
- // if (
7392
- // startEndOrdinal &&
7393
- // startEndOrdinal.length === 2 &&
7394
- // typeof startEndOrdinal[0] !== 'undefined' &&
7395
- // typeof startEndOrdinal[1] !== 'undefined'
7396
- // ) {
7397
- // let domain = []
7398
- // let domainValues = [...that[`${xAxis}BrushAxis`].domain()]
7399
- // for (let i = startEndOrdinal[0]; i < startEndOrdinal[1] + 1; i++) {
7400
- // // domain.push(that.xRange[i])
7401
- // that.brushedDomain.push(domainValues[i])
7402
- // }
7403
- // }
7404
- // }
7405
- // if (that.brushedDomain.length > 0) {
7406
- // that[`${xAxis}Axis`].domain(that.brushedDomain)
7407
- // that[`${xAxis}AxisLayer`].call(
7408
- // d3[`axis${xAxisCaps}`](that[`${xAxis}Axis`])
7409
- // )
7410
- // }
7411
- // if (that.leftAxis && that.bottomAxis) {
7412
- // that.renderComponents()
7413
- // if (that.options.orientation === 'vertical') {
7414
- // // that.bottomAxisLayer.call(that.bAxisFunc)
7415
- // if (that.options.data.bottom.rotate) {
7416
- // that.bottomAxisLayer.selectAll('text')
7417
- // .attr('transform', `rotate(${((that.options.data.bottom && that.options.data.bottom.rotate) || 0)})`)
7418
- // .style('text-anchor', `${((that.options.data.bottom && that.options.data.bottom.rotate) || 0) === 0 ? 'middle' : 'end'}`)
7419
- // .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`)
7420
- // }
7421
- // }
7422
- // }
7423
7348
  };
7424
-
7425
7349
  var el = document.getElementById(this.elementId);
7426
7350
  if (el) {
7427
7351
  el.classList.add('websy-chart');
@@ -7524,6 +7448,9 @@ var WebsyChart = /*#__PURE__*/function () {
7524
7448
  value: function handleEventMouseOut(event, d) {
7525
7449
  this.trackingLineLayer.select('.tracking-line').attr('stroke-opacity', 0);
7526
7450
  this.tooltip.hide();
7451
+ if (this.options.onMouseOut) {
7452
+ this.options.onMouseOut();
7453
+ }
7527
7454
  }
7528
7455
  }, {
7529
7456
  key: "handleEventMouseMove",
@@ -7553,6 +7480,9 @@ var WebsyChart = /*#__PURE__*/function () {
7553
7480
  var xDiff;
7554
7481
  if (typeof x0 === 'undefined') {
7555
7482
  this.tooltip.hide();
7483
+ if (this.options.onMouseOut) {
7484
+ this.options.onMouseOut();
7485
+ }
7556
7486
  return;
7557
7487
  }
7558
7488
  var xLabel = this[xAxis].domain()[x0];
@@ -7575,7 +7505,7 @@ var WebsyChart = /*#__PURE__*/function () {
7575
7505
  if (!d.y.color) {
7576
7506
  d.y.color = s.color;
7577
7507
  }
7578
- tooltipData.push(d.y);
7508
+ tooltipData.push(d);
7579
7509
  }
7580
7510
  });
7581
7511
  } else {
@@ -7592,7 +7522,7 @@ var WebsyChart = /*#__PURE__*/function () {
7592
7522
  if (!pointA.y.color) {
7593
7523
  pointA.y.color = s.color;
7594
7524
  }
7595
- tooltipData.push(pointA.y);
7525
+ tooltipData.push(pointA);
7596
7526
  if (typeof pointA.x.value.getTime !== 'undefined') {
7597
7527
  tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointA.x.value);
7598
7528
  }
@@ -7603,7 +7533,7 @@ var WebsyChart = /*#__PURE__*/function () {
7603
7533
  if (!pointB.y.color) {
7604
7534
  pointB.y.color = s.color;
7605
7535
  }
7606
- tooltipData.push(pointB.y);
7536
+ tooltipData.push(pointB);
7607
7537
  if (typeof pointB.x.value.getTime !== 'undefined') {
7608
7538
  tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
7609
7539
  }
@@ -7621,7 +7551,7 @@ var WebsyChart = /*#__PURE__*/function () {
7621
7551
  if (!pointB.y.color) {
7622
7552
  pointB.y.color = s.color;
7623
7553
  }
7624
- tooltipData.push(pointB.y);
7554
+ tooltipData.push(pointB);
7625
7555
  } else {
7626
7556
  xPoint = d0;
7627
7557
  tooltipTitle = pointA.x.value;
@@ -7631,15 +7561,18 @@ var WebsyChart = /*#__PURE__*/function () {
7631
7561
  if (!pointA.y.color) {
7632
7562
  pointA.y.color = s.color;
7633
7563
  }
7634
- tooltipData.push(pointA.y);
7564
+ tooltipData.push(pointA);
7635
7565
  }
7636
7566
  }
7637
7567
  }
7638
7568
  });
7639
7569
  tooltipHTML = " \n <ul>\n ";
7640
7570
  tooltipHTML += tooltipData.map(function (d) {
7641
- return "\n <li>\n <i style='background-color: ".concat(d.color, ";'></i>\n ").concat(d.tooltipLabel || '', "<span>: ").concat(d.tooltipValue || d.value, "</span>\n </li>\n ");
7571
+ return "\n <li>\n <i style='background-color: ".concat(d.y.color, ";'></i>\n ").concat(d.y.tooltipLabel || '', "<span>: ").concat(d.y.tooltipValue || d.value, "</span>\n </li>\n ");
7642
7572
  }).join('');
7573
+ if (this.options.onMouseOver) {
7574
+ this.options.onMouseOver(tooltipData);
7575
+ }
7643
7576
  tooltipHTML += "</ul>";
7644
7577
  var posOptions = {
7645
7578
  width: this.options.tooltipWidth,
@@ -7682,6 +7615,9 @@ var WebsyChart = /*#__PURE__*/function () {
7682
7615
  this.tooltip.setHeight(this.plotHeight);
7683
7616
  if (isNaN(posOptions.left)) {
7684
7617
  this.tooltip.hide();
7618
+ if (this.options.onMouseOut) {
7619
+ this.options.onMouseOut();
7620
+ }
7685
7621
  return;
7686
7622
  }
7687
7623
  this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions);
@@ -7722,9 +7658,9 @@ var WebsyChart = /*#__PURE__*/function () {
7722
7658
  this.rightAxisLabel = this.svg.append('g').attr('class', 'right-axis-label-layer');
7723
7659
  this.bottomAxisLabel = this.svg.append('g').attr('class', 'bottom-axis-label-layer');
7724
7660
  this.plotArea = this.svg.append('g').attr('class', 'plot-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7661
+ this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7725
7662
  this.areaLayer = this.svg.append('g').attr('class', 'area-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7726
7663
  this.lineLayer = this.svg.append('g').attr('class', 'line-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7727
- this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7728
7664
  // this.barLayer.attr('clip-path', `url(#${this.elementId}_clip)`)
7729
7665
  this.labelLayer = this.svg.append('g').attr('class', 'label-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7730
7666
  this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
@@ -7917,23 +7853,23 @@ var WebsyChart = /*#__PURE__*/function () {
7917
7853
  this.options.data.right.max = d3.max(this.options.data.right.data);
7918
7854
  }
7919
7855
  if (this.options.data.right && typeof this.options.data.right.max !== 'undefined') {
7920
- this.longestRight = this.options.data.right.max.toString();
7856
+ 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();
7921
7857
  if (this.options.data.right.formatter) {
7922
- this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString();
7858
+ this.longestRight = this.options.data.right.formatter(this.longestRight).toString();
7923
7859
  }
7924
7860
  }
7925
7861
  // Check to see if we need to balance the min and max values
7926
- if (this.options.balancedMinMax) {
7862
+ if (this.options.balancedMinMax === true) {
7927
7863
  if (this.options.orientation === 'horizontal') {
7928
7864
  var biggestBottom = Math.max(Math.abs(this.options.data.bottom.min), this.options.data.bottom.max);
7929
7865
  this.options.data.bottom.min = 1 - biggestBottom;
7930
7866
  this.options.data.bottom.max = biggestBottom;
7931
7867
  } else {
7932
7868
  var biggestLeft = Math.max(Math.abs(this.options.data.left.min), this.options.data.left.max);
7933
- this.options.data.left.min = 1 - biggestLeft;
7869
+ this.options.data.left.min = biggestLeft * -1;
7934
7870
  this.options.data.left.max = biggestLeft;
7935
7871
  var biggestRight = Math.max(Math.abs(this.options.data.right.min), this.options.data.right.max);
7936
- this.options.data.right.min = 1 - biggestRight;
7872
+ this.options.data.right.min = biggestRight * -1;
7937
7873
  this.options.data.right.max = biggestRight;
7938
7874
  }
7939
7875
  }
@@ -7957,7 +7893,7 @@ var WebsyChart = /*#__PURE__*/function () {
7957
7893
  }
7958
7894
  }
7959
7895
  this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth) + 5; // + 5 to accommodate for space between text and axis line
7960
- this.options.margin.axisRight = longestRightBounds.width;
7896
+ this.options.margin.axisRight = longestRightBounds.width + 10;
7961
7897
  this.options.margin.axisBottom = longestBottomBounds.height + 10;
7962
7898
  this.options.margin.axisTop = 0;
7963
7899
  // adjust axis margins based on title options
@@ -8109,7 +8045,8 @@ var WebsyChart = /*#__PURE__*/function () {
8109
8045
  // }
8110
8046
  // }
8111
8047
  // Translate the layers
8112
- var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0;
8048
+ var leftBrushAdjustment = this.options.orientation === 'horizontal' && this.brushNeeded === true ? this.options.brushHeight : 0;
8049
+ // const bottomBrushAdjustment = this.options.orientation === 'vertical' && this.brushNeeded === true ? this.options.brushHeight : 0
8113
8050
  this.leftAxisLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).style('font-size', this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
8114
8051
  this.rightAxisLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.plotWidth + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).style('font-size', this.options.data.right && this.options.data.right.fontSize || this.options.fontSize);
8115
8052
  this.bottomAxisLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).style('font-size', this.options.data.bottom && this.options.data.bottom.fontSize || this.options.fontSize);
@@ -8127,13 +8064,13 @@ var WebsyChart = /*#__PURE__*/function () {
8127
8064
  this.clip.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", 0)")).attr('width', this.plotWidth).attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop);
8128
8065
  if (this.options.orientation === 'horizontal') {
8129
8066
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8130
- this.yAxisClip.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('width', this.options.margin.axisLeft + 10).attr('height', this.plotHeight);
8131
- this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight).attr('height', longestBottomBounds.height + 10);
8067
+ this.yAxisClip.attr('transform', "translate(".concat(leftBrushAdjustment, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('width', this.options.margin.axisLeft + 10).attr('height', this.plotHeight);
8068
+ this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right).attr('height', longestBottomBounds.height + 10);
8132
8069
  this.brushClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('height', this.plotHeight).attr('width', this.options.brushHeight);
8133
8070
  } else {
8134
8071
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")"));
8135
- this.yAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop - 10, ")")).attr('width', this.options.margin.axisLeft + 10).attr('height', this.plotHeight + 20);
8136
- this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight).attr('height', longestBottomBounds.height + 10);
8072
+ this.yAxisClip.attr('transform', "translate(0, ".concat(this.options.margin.top + this.options.margin.axisTop - 10, ")")).attr('width', this.options.margin.axisLeft + 10).attr('height', this.plotHeight + 20);
8073
+ this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right).attr('height', longestBottomBounds.height + 10);
8137
8074
  this.brushClip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")")).attr('width', this.plotWidth).attr('height', this.options.brushHeight);
8138
8075
  }
8139
8076
  this.eventLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));