@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) {
@@ -2351,7 +2363,7 @@ var WebsyForm = /*#__PURE__*/function () {
2351
2363
  var el = document.getElementById(this.elementId);
2352
2364
  var componentsToProcess = [];
2353
2365
  if (el) {
2354
- var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat(this.options.classes || '', "\">\n ");
2366
+ var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat((this.options.classes || []).join(' '), "\">\n ");
2355
2367
  this.options.fields.forEach(function (f, i) {
2356
2368
  _this17.fieldMap[f.field] = f;
2357
2369
  if (f.component) {
@@ -2610,6 +2622,9 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2610
2622
  activeSymbol: 'none',
2611
2623
  enableSearch: false,
2612
2624
  searchProp: 'text',
2625
+ indent: 'padding',
2626
+ 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>",
2627
+ 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>",
2613
2628
  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>",
2614
2629
  searchOptions: {}
2615
2630
  }, options);
@@ -2849,7 +2864,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2849
2864
  if (Array.isArray(items[i].classes)) {
2850
2865
  items[i].classes = items[i].classes.join(' ');
2851
2866
  }
2852
- 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 ");
2867
+ 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 ");
2853
2868
  if (this.options.orientation === 'horizontal') {
2854
2869
  html += items[i].text;
2855
2870
  }
@@ -2872,7 +2887,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2872
2887
  html += "</a>";
2873
2888
  }
2874
2889
  if (items[i].items && items[i].items.length > 0) {
2875
- html += " \n <span class='menu-carat'></span>\n ";
2890
+ html += " \n <div class='websy-menu-expand-collapse-buttons'>".concat(this.options.expandIcon).concat(this.options.collapseIcon, "</div>\n ");
2876
2891
  }
2877
2892
  if (this.options.activeSymbol === 'triangle') {
2878
2893
  html += "\n <span class='active-square'></span>\n ";
@@ -4888,7 +4903,7 @@ var WebsyUtils = {
4888
4903
  if (numOut % 1 > 0) {
4889
4904
  decimals = 1;
4890
4905
  }
4891
- if (numOut < 1) {
4906
+ if (numOut < 1 && decimals === 0) {
4892
4907
  decimals = getZeroDecimals(numOut);
4893
4908
  }
4894
4909
  numOut = (+numOut).toFixed(decimals);
@@ -5807,10 +5822,16 @@ var WebsyTable3 = /*#__PURE__*/function () {
5807
5822
  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>",
5808
5823
  plusIcon: WebsyDesigns.Icons.PlusFilled,
5809
5824
  minusIcon: WebsyDesigns.Icons.MinusFilled,
5810
- disableInternalLoader: false
5825
+ disableInternalLoader: false,
5826
+ disableTouch: false,
5827
+ scrollWidth: 10,
5828
+ touchScrollWidth: 30
5811
5829
  };
5812
5830
  this.options = _extends({}, DEFAULTS, options);
5813
5831
  this.isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
5832
+ if (this.options.disableTouch === true) {
5833
+ this.isTouchDevice = false;
5834
+ }
5814
5835
  this.sizes = {};
5815
5836
  this.currentData = [];
5816
5837
  this.scrollDragging = false;
@@ -5829,12 +5850,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
5829
5850
  return;
5830
5851
  }
5831
5852
  var el = document.getElementById(this.elementId);
5853
+ el.style.position = 'relative';
5832
5854
  if (el) {
5833
- 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 ");
5855
+ 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 ");
5834
5856
  if (this.isTouchDevice === true && this.options.virtualScroll === true) {
5835
5857
  html += "\n <div id=\"".concat(this.elementId, "_touchScroller\" class=\"websy-table-touch-scroller\"></div>\n ");
5836
5858
  }
5837
- 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 ");
5859
+ 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 ");
5838
5860
  if (this.options.paging === 'pages') {
5839
5861
  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 ");
5840
5862
  }
@@ -6430,50 +6452,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6430
6452
  event.deltaY = 0;
6431
6453
  this.handleScrollWheel(event);
6432
6454
  }
6433
- // let deltaX = (this.mouseXStart - event.targetTouches[0].pageX)
6434
- // let deltaY = (this.mouseYStart - event.targetTouches[0].pageY)
6435
- // const hScrollContainerEl = document.getElementById(`${this.elementId}_hScrollContainer`)
6436
- // const vScrollContainerEl = document.getElementById(`${this.elementId}_vScrollContainer`)
6437
- // const hScrollHandleEl = document.getElementById(`${this.elementId}_hScrollHandle`)
6438
- // const vScrollHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
6439
- // let translatedDeltaX = deltaX * (hScrollHandleEl.getBoundingClientRect().width / vScrollContainerEl.getBoundingClientRect().width)
6440
- // let translatedDeltaY = deltaY * (vScrollHandleEl.getBoundingClientRect().height / vScrollContainerEl.getBoundingClientRect().height)
6441
- // // need to adjust the delta so that it scrolls at a reasonable speed/distance
6442
- // const scrollHandleXEl = document.getElementById(`${this.elementId}_hScrollHandle`)
6443
- // const scrollHandleYEl = document.getElementById(`${this.elementId}_vScrollHandle`)
6444
- // // if (Math.abs(deltaY) > this.sizes.cellHeight) {
6445
- // // this.isTouchScrolling = true
6446
- // // }
6447
- // // else {
6448
- // // this.isTouchScrolling = false
6449
- // // }
6450
- // // console.log('delta', this.mouseYStart, event.targetTouches[0].pageY, deltaY)
6451
- // // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
6452
- // // deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
6453
- // // console.log('delta', deltaY)
6454
- // // NW
6455
- // // else if (Math.abs(deltaX) > 50) {
6456
- // // this.isTouchScrolling = false
6457
- // // }
6458
- // this.currentClientY = event.targetTouches[0].pageY
6459
- // this.currentTouchtime = (new Date()).getTime()
6460
- // // end
6461
- // // delta = Math.min(10, delta)
6462
- // // delta = Math.max(-10, delta)
6463
- // if (this.isTouchScrolling === true) {
6464
- // // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
6465
- // if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 20) {
6466
- // // this.scrollX(Math.max(-5, Math.min(5, translatedDeltaX)))
6467
- // this.scrollX(translatedDeltaX)
6468
- // }
6469
- // else if (deltaY > 20) {
6470
- // // this.scrollY(Math.max(-5, Math.min(5, translatedDeltaY)))
6471
- // this.scrollY(translatedDeltaY)
6472
- // }
6473
- // }
6474
6455
  }
6475
6456
  }
6476
-
6477
6457
  if (this.scrollDragging === true) {
6478
6458
  event.preventDefault();
6479
6459
  if (this.scrollDirection === 'y') {
@@ -6648,6 +6628,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6648
6628
  var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
6649
6629
  if (this.vScrollRequired === true) {
6650
6630
  vScrollEl.style.top = "".concat(this.sizes.header.height + this.sizes.total.height, "px");
6631
+ // vScrollEl.style.left = `${this.sizes.outer.width - (this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
6651
6632
  vScrollEl.style.height = "".concat(this.sizes.bodyHeight, "px");
6652
6633
  if (this.isTouchDevice === true) {
6653
6634
  vScrollEl.style.visibility = "unset";
@@ -6661,8 +6642,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6661
6642
  var hScrollEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
6662
6643
  var hHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
6663
6644
  if (this.hScrollRequired === true) {
6664
- hScrollEl.style.left = "".concat(this.sizes.table.width - this.sizes.scrollableWidth, "px");
6665
- hScrollEl.style.width = "".concat(this.sizes.scrollableWidth - (this.isTouchDevice ? 30 : 20), "px");
6645
+ hScrollEl.style.right = "".concat(this.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth, "px");
6646
+ // hScrollEl.style.left = `${this.sizes.table.width - this.sizes.scrollableWidth}px`
6647
+ // hScrollEl.style.width = `${this.sizes.scrollableWidth - (this.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
6648
+ hScrollEl.style.width = "".concat(this.sizes.scrollableWidth, "px");
6666
6649
  hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalNonPinnedWidth)) + 'px';
6667
6650
  if (this.isTouchDevice === true) {
6668
6651
  hScrollEl.style.visibility = "unset";
@@ -6969,66 +6952,7 @@ var WebsyChart = /*#__PURE__*/function () {
6969
6952
  that.bottomAxisLayer.attr('transform', "translate(".concat(newX, ", ").concat(newY + that.plotHeight, ")"));
6970
6953
  }
6971
6954
  }
6972
- // that.brushedDomain = []
6973
- // let xAxis = 'bottom'
6974
- // let xAxisCaps = 'Bottom'
6975
- // if (that.options.orientation === 'horizontal') {
6976
- // xAxis = 'left'
6977
- // xAxisCaps = 'Left'
6978
- // }
6979
- // if (!that[`${xAxis}Axis`]) {
6980
- // return
6981
- // }
6982
- // if (!that[`${xAxis}Axis`].invert) {
6983
- // that[`${xAxis}Axis`].invert = that.invertOverride
6984
- // }
6985
- // let s = event.selection || that[`${xAxis}Axis`].range()
6986
- // if (!event.selection || event.selection.length === 0) {
6987
- // that.brushLayer
6988
- // .select('.brush')
6989
- // .call(that.brush)
6990
- // .call(that.brush.move, s)
6991
- // return
6992
- // }
6993
- // if (that.options.data[xAxis].scale && that.options.data[xAxis].scale === 'Time') {
6994
- // that.brushedDomain = s.map(that[`${xAxis}BrushAxis`].invert, that[[`${xAxis}Axis`]])
6995
- // }
6996
- // else {
6997
- // let startEndOrdinal = s.map((a, b) => that.bottomAxis.invert(a, b, true), that.bottomBrushAxis)
6998
- // if (
6999
- // startEndOrdinal &&
7000
- // startEndOrdinal.length === 2 &&
7001
- // typeof startEndOrdinal[0] !== 'undefined' &&
7002
- // typeof startEndOrdinal[1] !== 'undefined'
7003
- // ) {
7004
- // let domain = []
7005
- // let domainValues = [...that[`${xAxis}BrushAxis`].domain()]
7006
- // for (let i = startEndOrdinal[0]; i < startEndOrdinal[1] + 1; i++) {
7007
- // // domain.push(that.xRange[i])
7008
- // that.brushedDomain.push(domainValues[i])
7009
- // }
7010
- // }
7011
- // }
7012
- // if (that.brushedDomain.length > 0) {
7013
- // that[`${xAxis}Axis`].domain(that.brushedDomain)
7014
- // that[`${xAxis}AxisLayer`].call(
7015
- // d3[`axis${xAxisCaps}`](that[`${xAxis}Axis`])
7016
- // )
7017
- // }
7018
- // if (that.leftAxis && that.bottomAxis) {
7019
- // that.renderComponents()
7020
- // if (that.options.orientation === 'vertical') {
7021
- // // that.bottomAxisLayer.call(that.bAxisFunc)
7022
- // if (that.options.data.bottom.rotate) {
7023
- // that.bottomAxisLayer.selectAll('text')
7024
- // .attr('transform', `rotate(${((that.options.data.bottom && that.options.data.bottom.rotate) || 0)})`)
7025
- // .style('text-anchor', `${((that.options.data.bottom && that.options.data.bottom.rotate) || 0) === 0 ? 'middle' : 'end'}`)
7026
- // .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`)
7027
- // }
7028
- // }
7029
- // }
7030
6955
  };
7031
-
7032
6956
  var el = document.getElementById(this.elementId);
7033
6957
  if (el) {
7034
6958
  el.classList.add('websy-chart');
@@ -7131,6 +7055,9 @@ var WebsyChart = /*#__PURE__*/function () {
7131
7055
  value: function handleEventMouseOut(event, d) {
7132
7056
  this.trackingLineLayer.select('.tracking-line').attr('stroke-opacity', 0);
7133
7057
  this.tooltip.hide();
7058
+ if (this.options.onMouseOut) {
7059
+ this.options.onMouseOut();
7060
+ }
7134
7061
  }
7135
7062
  }, {
7136
7063
  key: "handleEventMouseMove",
@@ -7160,6 +7087,9 @@ var WebsyChart = /*#__PURE__*/function () {
7160
7087
  var xDiff;
7161
7088
  if (typeof x0 === 'undefined') {
7162
7089
  this.tooltip.hide();
7090
+ if (this.options.onMouseOut) {
7091
+ this.options.onMouseOut();
7092
+ }
7163
7093
  return;
7164
7094
  }
7165
7095
  var xLabel = this[xAxis].domain()[x0];
@@ -7182,7 +7112,7 @@ var WebsyChart = /*#__PURE__*/function () {
7182
7112
  if (!d.y.color) {
7183
7113
  d.y.color = s.color;
7184
7114
  }
7185
- tooltipData.push(d.y);
7115
+ tooltipData.push(d);
7186
7116
  }
7187
7117
  });
7188
7118
  } else {
@@ -7199,7 +7129,7 @@ var WebsyChart = /*#__PURE__*/function () {
7199
7129
  if (!pointA.y.color) {
7200
7130
  pointA.y.color = s.color;
7201
7131
  }
7202
- tooltipData.push(pointA.y);
7132
+ tooltipData.push(pointA);
7203
7133
  if (typeof pointA.x.value.getTime !== 'undefined') {
7204
7134
  tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointA.x.value);
7205
7135
  }
@@ -7210,7 +7140,7 @@ var WebsyChart = /*#__PURE__*/function () {
7210
7140
  if (!pointB.y.color) {
7211
7141
  pointB.y.color = s.color;
7212
7142
  }
7213
- tooltipData.push(pointB.y);
7143
+ tooltipData.push(pointB);
7214
7144
  if (typeof pointB.x.value.getTime !== 'undefined') {
7215
7145
  tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
7216
7146
  }
@@ -7228,7 +7158,7 @@ var WebsyChart = /*#__PURE__*/function () {
7228
7158
  if (!pointB.y.color) {
7229
7159
  pointB.y.color = s.color;
7230
7160
  }
7231
- tooltipData.push(pointB.y);
7161
+ tooltipData.push(pointB);
7232
7162
  } else {
7233
7163
  xPoint = d0;
7234
7164
  tooltipTitle = pointA.x.value;
@@ -7238,15 +7168,18 @@ var WebsyChart = /*#__PURE__*/function () {
7238
7168
  if (!pointA.y.color) {
7239
7169
  pointA.y.color = s.color;
7240
7170
  }
7241
- tooltipData.push(pointA.y);
7171
+ tooltipData.push(pointA);
7242
7172
  }
7243
7173
  }
7244
7174
  }
7245
7175
  });
7246
7176
  tooltipHTML = " \n <ul>\n ";
7247
7177
  tooltipHTML += tooltipData.map(function (d) {
7248
- 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 ");
7178
+ 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 ");
7249
7179
  }).join('');
7180
+ if (this.options.onMouseOver) {
7181
+ this.options.onMouseOver(tooltipData);
7182
+ }
7250
7183
  tooltipHTML += "</ul>";
7251
7184
  var posOptions = {
7252
7185
  width: this.options.tooltipWidth,
@@ -7289,6 +7222,9 @@ var WebsyChart = /*#__PURE__*/function () {
7289
7222
  this.tooltip.setHeight(this.plotHeight);
7290
7223
  if (isNaN(posOptions.left)) {
7291
7224
  this.tooltip.hide();
7225
+ if (this.options.onMouseOut) {
7226
+ this.options.onMouseOut();
7227
+ }
7292
7228
  return;
7293
7229
  }
7294
7230
  this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions);
@@ -7329,9 +7265,9 @@ var WebsyChart = /*#__PURE__*/function () {
7329
7265
  this.rightAxisLabel = this.svg.append('g').attr('class', 'right-axis-label-layer');
7330
7266
  this.bottomAxisLabel = this.svg.append('g').attr('class', 'bottom-axis-label-layer');
7331
7267
  this.plotArea = this.svg.append('g').attr('class', 'plot-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7268
+ this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7332
7269
  this.areaLayer = this.svg.append('g').attr('class', 'area-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7333
7270
  this.lineLayer = this.svg.append('g').attr('class', 'line-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7334
- this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7335
7271
  // this.barLayer.attr('clip-path', `url(#${this.elementId}_clip)`)
7336
7272
  this.labelLayer = this.svg.append('g').attr('class', 'label-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7337
7273
  this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
@@ -7524,23 +7460,23 @@ var WebsyChart = /*#__PURE__*/function () {
7524
7460
  this.options.data.right.max = d3.max(this.options.data.right.data);
7525
7461
  }
7526
7462
  if (this.options.data.right && typeof this.options.data.right.max !== 'undefined') {
7527
- this.longestRight = this.options.data.right.max.toString();
7463
+ 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();
7528
7464
  if (this.options.data.right.formatter) {
7529
- this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString();
7465
+ this.longestRight = this.options.data.right.formatter(this.longestRight).toString();
7530
7466
  }
7531
7467
  }
7532
7468
  // Check to see if we need to balance the min and max values
7533
- if (this.options.balancedMinMax) {
7469
+ if (this.options.balancedMinMax === true) {
7534
7470
  if (this.options.orientation === 'horizontal') {
7535
7471
  var biggestBottom = Math.max(Math.abs(this.options.data.bottom.min), this.options.data.bottom.max);
7536
7472
  this.options.data.bottom.min = 1 - biggestBottom;
7537
7473
  this.options.data.bottom.max = biggestBottom;
7538
7474
  } else {
7539
7475
  var biggestLeft = Math.max(Math.abs(this.options.data.left.min), this.options.data.left.max);
7540
- this.options.data.left.min = 1 - biggestLeft;
7476
+ this.options.data.left.min = biggestLeft * -1;
7541
7477
  this.options.data.left.max = biggestLeft;
7542
7478
  var biggestRight = Math.max(Math.abs(this.options.data.right.min), this.options.data.right.max);
7543
- this.options.data.right.min = 1 - biggestRight;
7479
+ this.options.data.right.min = biggestRight * -1;
7544
7480
  this.options.data.right.max = biggestRight;
7545
7481
  }
7546
7482
  }
@@ -7564,7 +7500,7 @@ var WebsyChart = /*#__PURE__*/function () {
7564
7500
  }
7565
7501
  }
7566
7502
  this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth) + 5; // + 5 to accommodate for space between text and axis line
7567
- this.options.margin.axisRight = longestRightBounds.width;
7503
+ this.options.margin.axisRight = longestRightBounds.width + 10;
7568
7504
  this.options.margin.axisBottom = longestBottomBounds.height + 10;
7569
7505
  this.options.margin.axisTop = 0;
7570
7506
  // adjust axis margins based on title options
@@ -7716,7 +7652,8 @@ var WebsyChart = /*#__PURE__*/function () {
7716
7652
  // }
7717
7653
  // }
7718
7654
  // Translate the layers
7719
- var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0;
7655
+ var leftBrushAdjustment = this.options.orientation === 'horizontal' && this.brushNeeded === true ? this.options.brushHeight : 0;
7656
+ // const bottomBrushAdjustment = this.options.orientation === 'vertical' && this.brushNeeded === true ? this.options.brushHeight : 0
7720
7657
  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);
7721
7658
  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);
7722
7659
  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);
@@ -7734,13 +7671,13 @@ var WebsyChart = /*#__PURE__*/function () {
7734
7671
  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);
7735
7672
  if (this.options.orientation === 'horizontal') {
7736
7673
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
7737
- 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);
7738
- 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);
7674
+ 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);
7675
+ 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);
7739
7676
  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);
7740
7677
  } else {
7741
7678
  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, ")"));
7742
- 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);
7743
- 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);
7679
+ 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);
7680
+ 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);
7744
7681
  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);
7745
7682
  }
7746
7683
  this.eventLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));