@websy/websy-designs 1.7.4 → 1.7.6

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.
@@ -6614,6 +6614,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6614
6614
  minusIcon: WebsyDesigns.Icons.MinusFilled
6615
6615
  };
6616
6616
  this.options = _extends({}, DEFAULTS, options);
6617
+ this.isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
6617
6618
  this.sizes = {};
6618
6619
  this.currentData = [];
6619
6620
  this.scrollDragging = false;
@@ -6636,7 +6637,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6636
6637
  var el = document.getElementById(this.elementId);
6637
6638
 
6638
6639
  if (el) {
6639
- 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' : '', "'>\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 </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\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
6640
+ 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' : '', "'>\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 <div id=\"").concat(this.elementId, "_touchScroller\" class=\"websy-table-touch-scroller hidden\"></div>\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 ");
6640
6641
 
6641
6642
  if (this.options.paging === 'pages') {
6642
6643
  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 ");
@@ -6645,6 +6646,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
6645
6646
  el.innerHTML = html;
6646
6647
  el.addEventListener('click', this.handleClick.bind(this));
6647
6648
  el.addEventListener('mousedown', this.handleMouseDown.bind(this));
6649
+ el.addEventListener('touchstart', this.handleTouchStart.bind(this));
6650
+ window.addEventListener('touchmove', this.handleTouchMove.bind(this));
6651
+ window.addEventListener('touchend', this.handleTouchEnd.bind(this));
6648
6652
  window.addEventListener('mousemove', this.handleMouseMove.bind(this));
6649
6653
  window.addEventListener('mouseup', this.handleMouseUp.bind(this));
6650
6654
  var scrollEl = document.getElementById("".concat(this.elementId, "_tableBody"));
@@ -6711,6 +6715,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6711
6715
  bodyHtml += "<tr class=\"websy-table-row\">";
6712
6716
  row.forEach(function (cell, cellIndex) {
6713
6717
  var sizeIndex = cell.level || cellIndex;
6718
+ var colIndex = cell.index || cellIndex;
6714
6719
 
6715
6720
  if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
6716
6721
  return; // need to revisit this logic
@@ -6746,14 +6751,14 @@ var WebsyTable3 = /*#__PURE__*/function () {
6746
6751
  } // console.log('rowspan', cell.rowspan)
6747
6752
 
6748
6753
 
6749
- bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this39.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(sizeIndex, "'\n "); // if (useWidths === true) {
6754
+ bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this39.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n "); // if (useWidths === true) {
6750
6755
  // bodyHtml += `
6751
6756
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
6752
6757
  // width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
6753
6758
  // `
6754
6759
  // }
6755
6760
 
6756
- bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(sizeIndex, "'\n >");
6761
+ bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n >");
6757
6762
 
6758
6763
  if (cell.expandable === true) {
6759
6764
  bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this39.options.plusIcon, "</i>");
@@ -7149,6 +7154,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
7149
7154
  }, {
7150
7155
  key: "handleMouseDown",
7151
7156
  value: function handleMouseDown(event) {
7157
+ if (this.isTouchDevice === true) {
7158
+ return;
7159
+ }
7160
+
7152
7161
  if (event.target.classList.contains('websy-scroll-handle-y')) {
7153
7162
  // set up the scroll start values
7154
7163
  this.scrollDragging = true;
@@ -7201,8 +7210,99 @@ var WebsyTable3 = /*#__PURE__*/function () {
7201
7210
  if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
7202
7211
  this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
7203
7212
  } else {
7213
+ console.log('delta', event.deltaY);
7204
7214
  this.scrollY(Math.max(-5, Math.min(5, event.deltaY)));
7205
7215
  }
7216
+ } else if (this.options.onNativeScroll) {
7217
+ var el = document.getElementById("".concat(this.elementId, "_tableBody"));
7218
+ this.options.onNativeScroll(el.scrollTop);
7219
+ }
7220
+ }
7221
+ }, {
7222
+ key: "handleTouchEnd",
7223
+ value: function handleTouchEnd(event) {
7224
+ console.log('touch end fired');
7225
+
7226
+ if (typeof event.targetTouches !== 'undefined') {
7227
+ this.isTouchScrolling = false;
7228
+ this.touchEndTime = new Date().getTime();
7229
+ this.isPerpetual = true; // this.perpetualScroll()
7230
+
7231
+ this.touchStartTime = null;
7232
+ var touchScrollEl = document.getElementById("".concat(this.elementId, "_touchScroller"));
7233
+ touchScrollEl.classList.add('hidden');
7234
+ }
7235
+ }
7236
+ }, {
7237
+ key: "handleTouchMove",
7238
+ value: function handleTouchMove(event) {
7239
+ console.log(event.target.classList);
7240
+
7241
+ if (this.isTouchScrolling === true) {
7242
+ event.preventDefault();
7243
+ event.stopPropagation();
7244
+
7245
+ if (typeof event.targetTouches !== 'undefined' && event.targetTouches.length > 0) {
7246
+ var deltaX = this.mouseXStart - event.targetTouches[0].pageX;
7247
+ var deltaY = this.mouseYStart - event.targetTouches[0].pageY; // need to adjust the delta so that it scrolls at a reasonable speed/distance
7248
+
7249
+ var scrollHandleXEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
7250
+ var scrollHandleYEl = document.getElementById("".concat(this.elementId, "_vScrollHandle")); // if (Math.abs(deltaY) > this.sizes.cellHeight) {
7251
+ // this.isTouchScrolling = true
7252
+ // }
7253
+ // else {
7254
+ // this.isTouchScrolling = false
7255
+ // }
7256
+
7257
+ console.log('delta init', deltaY); // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
7258
+ // deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
7259
+ // console.log('delta', deltaY)
7260
+ // NW
7261
+ // else if (Math.abs(deltaX) > 50) {
7262
+ // this.isTouchScrolling = false
7263
+ // }
7264
+
7265
+ this.currentClientY = event.targetTouches[0].pageY;
7266
+ this.currentTouchtime = new Date().getTime(); // end
7267
+ // delta = Math.min(10, delta)
7268
+ // delta = Math.max(-10, delta)
7269
+
7270
+ if (this.isTouchScrolling === true) {
7271
+ // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7272
+ if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 10) {
7273
+ this.scrollX(Math.max(-5, Math.min(5, deltaX)));
7274
+ } else {
7275
+ this.scrollY(Math.max(-5, Math.min(5, deltaY)));
7276
+ }
7277
+ }
7278
+ }
7279
+ }
7280
+ }
7281
+ }, {
7282
+ key: "handleTouchStart",
7283
+ value: function handleTouchStart(event) {
7284
+ if (event.target.classList.contains('websy-table-cell-expand')) {
7285
+ return;
7286
+ }
7287
+
7288
+ if (event.target.classList.contains('websy-table-cell-collapse')) {
7289
+ return;
7290
+ }
7291
+
7292
+ console.log(event.target.classList);
7293
+
7294
+ if (this.options.virtualScroll === true) {
7295
+ this.touchStartTime = new Date().getTime();
7296
+ this.isTouchScrolling = true;
7297
+ this.isPerpetual = false;
7298
+ this.mouseYStart = event.targetTouches[0].pageY;
7299
+ this.mouseXStart = event.targetTouches[0].pageX;
7300
+ var touchScrollEl = document.getElementById("".concat(this.elementId, "_touchScroller"));
7301
+ touchScrollEl.classList.remove('hidden');
7302
+ var handleYEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
7303
+ this.handleYStart = handleYEl.offsetTop;
7304
+ var handleXEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
7305
+ this.handleXStart = handleXEl.offsetLeft;
7206
7306
  }
7207
7307
  }
7208
7308
  }, {
@@ -7231,6 +7331,52 @@ var WebsyTable3 = /*#__PURE__*/function () {
7231
7331
  value: function hideLoading() {
7232
7332
  this.loadingDialog.hide();
7233
7333
  }
7334
+ }, {
7335
+ key: "perpetualScroll",
7336
+ value: function perpetualScroll() {
7337
+ var _this44 = this;
7338
+
7339
+ // if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
7340
+ if (this.touchEndTime - this.currentTouchtime > 300) {
7341
+ return;
7342
+ } // get the difference in time between when the touch initially started and when it ended
7343
+ // the longer the touch duration, the slower the scroll
7344
+
7345
+
7346
+ var touchDuration = this.touchEndTime - this.touchStartTime; // get the distance moved between when the touch initially started and when it ended
7347
+
7348
+ var touchDistance = this.currentClientY - this.mouseYStart; // the bigger the distance, the more we scroll
7349
+ // use the duration and distance to calculate the duration of the perpetual scroll
7350
+
7351
+ var perpetualDistance = Math.abs(touchDistance * (1 / (touchDuration / 1000)));
7352
+ var perpetualDuration = touchDuration * 1.5 / 1000;
7353
+ var requiredFrames = Math.abs(Math.ceil(perpetualDistance / this.sizes.cellHeight));
7354
+ var fps = requiredFrames / perpetualDuration;
7355
+ var direction = touchDistance > 0 ? -1 : 1;
7356
+
7357
+ var _loop2 = function _loop2(i) {
7358
+ setTimeout(function () {
7359
+ var delta = _this44.mouseYStart - _this44.currentClientY + _this44.sizes.cellHeight * (i + 1) * direction;
7360
+ delta = Math.min(10, delta);
7361
+ delta = Math.max(-10, delta); // only run this if isPerpetual === true
7362
+ // this value is reset to false on touchStart
7363
+
7364
+ if (_this44.isPerpetual === true) {
7365
+ // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7366
+ // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
7367
+ _this44.scrollY(Math.max(-5, Math.min(5, delta)));
7368
+
7369
+ if (_this44.scrollTimeout) {
7370
+ clearTimeout(_this44.scrollTimeout);
7371
+ }
7372
+ }
7373
+ }, 1000 / fps * i);
7374
+ };
7375
+
7376
+ for (var i = 0; i < requiredFrames; i++) {
7377
+ _loop2(i);
7378
+ }
7379
+ }
7234
7380
  }, {
7235
7381
  key: "render",
7236
7382
  value: function render(data) {
@@ -7245,9 +7391,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
7245
7391
  console.log("No columns provided for table with ID ".concat(this.elementId));
7246
7392
  return;
7247
7393
  } // this.data = []
7248
- // Adjust the sizing of the header/body/footer
7249
7394
 
7250
7395
 
7396
+ this.currentData = []; // Adjust the sizing of the header/body/footer
7397
+
7251
7398
  if (calcSizes === true) {
7252
7399
  var sample = this.createSample(data);
7253
7400
  this.calculateSizes(sample, data.length, (data[0] || []).length, 0);
@@ -7516,7 +7663,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7516
7663
 
7517
7664
  var WebsyChart = /*#__PURE__*/function () {
7518
7665
  function WebsyChart(elementId, options) {
7519
- var _this44 = this;
7666
+ var _this45 = this;
7520
7667
 
7521
7668
  _classCallCheck(this, WebsyChart);
7522
7669
 
@@ -7576,7 +7723,7 @@ var WebsyChart = /*#__PURE__*/function () {
7576
7723
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7577
7724
  var xAxis = 'bottom';
7578
7725
 
7579
- if (_this44.options.orientation === 'horizontal') {
7726
+ if (_this45.options.orientation === 'horizontal') {
7580
7727
  xAxis = 'left';
7581
7728
  }
7582
7729
 
@@ -7587,13 +7734,13 @@ var WebsyChart = /*#__PURE__*/function () {
7587
7734
  xAxis += 'Axis';
7588
7735
  var output;
7589
7736
 
7590
- var width = _this44.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
7737
+ var width = _this45.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
7591
7738
 
7592
7739
 
7593
- for (var index = 0; index < _this44.customBottomRange.length; index++) {
7594
- if (input > _this44.customBottomRange[index]) {
7595
- if (_this44.customBottomRange[index + 1]) {
7596
- if (input < _this44.customBottomRange[index + 1]) {
7740
+ for (var index = 0; index < _this45.customBottomRange.length; index++) {
7741
+ if (input > _this45.customBottomRange[index]) {
7742
+ if (_this45.customBottomRange[index + 1]) {
7743
+ if (input < _this45.customBottomRange[index + 1]) {
7597
7744
  output = index;
7598
7745
  break;
7599
7746
  }
@@ -7831,10 +7978,10 @@ var WebsyChart = /*#__PURE__*/function () {
7831
7978
  }, {
7832
7979
  key: "handleEventMouseMove",
7833
7980
  value: function handleEventMouseMove(event, d) {
7834
- var _this45 = this;
7981
+ var _this46 = this;
7835
7982
 
7836
7983
  var bisectDate = d3.bisector(function (d) {
7837
- return _this45.parseX(d.x.value);
7984
+ return _this46.parseX(d.x.value);
7838
7985
  }).left;
7839
7986
 
7840
7987
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
@@ -7873,9 +8020,9 @@ var WebsyChart = /*#__PURE__*/function () {
7873
8020
  }
7874
8021
 
7875
8022
  this.options.data.series.forEach(function (s) {
7876
- if (_this45.options.data[xData].scale !== 'Time') {
8023
+ if (_this46.options.data[xData].scale !== 'Time') {
7877
8024
  // if (this.customBottomRange && this.customBottomRange.length > 0) {
7878
- xPoint = _this45.customBottomRange[x0] + (_this45.customBottomRange[x0 + 1] - _this45.customBottomRange[x0]) / 2; // }
8025
+ xPoint = _this46.customBottomRange[x0] + (_this46.customBottomRange[x0 + 1] - _this46.customBottomRange[x0]) / 2; // }
7879
8026
  // else {
7880
8027
  // xPoint = this[xAxis](this.parseX(xLabel))
7881
8028
  // }
@@ -7898,13 +8045,13 @@ var WebsyChart = /*#__PURE__*/function () {
7898
8045
  var pointA = s.data[index - 1];
7899
8046
  var pointB = s.data[index];
7900
8047
 
7901
- if (_this45.options.orientation === 'horizontal') {
8048
+ if (_this46.options.orientation === 'horizontal') {
7902
8049
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
7903
8050
  pointB = _toConsumableArray(s.data).reverse()[index];
7904
8051
  }
7905
8052
 
7906
8053
  if (pointA && !pointB) {
7907
- xPoint = _this45[xAxis](_this45.parseX(pointA.x.value));
8054
+ xPoint = _this46[xAxis](_this46.parseX(pointA.x.value));
7908
8055
  tooltipTitle = pointA.x.value;
7909
8056
 
7910
8057
  if (!pointA.y.color) {
@@ -7914,12 +8061,12 @@ var WebsyChart = /*#__PURE__*/function () {
7914
8061
  tooltipData.push(pointA.y);
7915
8062
 
7916
8063
  if (typeof pointA.x.value.getTime !== 'undefined') {
7917
- tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointA.x.value);
8064
+ tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointA.x.value);
7918
8065
  }
7919
8066
  }
7920
8067
 
7921
8068
  if (pointB && !pointA) {
7922
- xPoint = _this45[xAxis](_this45.parseX(pointB.x.value));
8069
+ xPoint = _this46[xAxis](_this46.parseX(pointB.x.value));
7923
8070
  tooltipTitle = pointB.x.value;
7924
8071
 
7925
8072
  if (!pointB.y.color) {
@@ -7929,14 +8076,14 @@ var WebsyChart = /*#__PURE__*/function () {
7929
8076
  tooltipData.push(pointB.y);
7930
8077
 
7931
8078
  if (typeof pointB.x.value.getTime !== 'undefined') {
7932
- tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
8079
+ tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
7933
8080
  }
7934
8081
  }
7935
8082
 
7936
8083
  if (pointA && pointB) {
7937
- var d0 = _this45[xAxis](_this45.parseX(pointA.x.value));
8084
+ var d0 = _this46[xAxis](_this46.parseX(pointA.x.value));
7938
8085
 
7939
- var d1 = _this45[xAxis](_this45.parseX(pointB.x.value));
8086
+ var d1 = _this46[xAxis](_this46.parseX(pointB.x.value));
7940
8087
 
7941
8088
  var mid = Math.abs(d0 - d1) / 2;
7942
8089
 
@@ -7945,7 +8092,7 @@ var WebsyChart = /*#__PURE__*/function () {
7945
8092
  tooltipTitle = pointB.x.value;
7946
8093
 
7947
8094
  if (typeof pointB.x.value.getTime !== 'undefined') {
7948
- tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
8095
+ tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
7949
8096
  }
7950
8097
 
7951
8098
  if (!pointB.y.color) {
@@ -7958,7 +8105,7 @@ var WebsyChart = /*#__PURE__*/function () {
7958
8105
  tooltipTitle = pointA.x.value;
7959
8106
 
7960
8107
  if (typeof pointB.x.value.getTime !== 'undefined') {
7961
- tooltipTitle = d3.timeFormat(_this45.options.dateFormat || _this45.options.calculatedTimeFormatPattern)(pointB.x.value);
8108
+ tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
7962
8109
  }
7963
8110
 
7964
8111
  if (!pointA.y.color) {
@@ -8093,7 +8240,7 @@ var WebsyChart = /*#__PURE__*/function () {
8093
8240
  }, {
8094
8241
  key: "render",
8095
8242
  value: function render(options) {
8096
- var _this46 = this;
8243
+ var _this47 = this;
8097
8244
 
8098
8245
  /* global d3 options WebsyUtils */
8099
8246
  if (typeof options !== 'undefined') {
@@ -8172,7 +8319,7 @@ var WebsyChart = /*#__PURE__*/function () {
8172
8319
  this.options.data.series.map(function (s, i) {
8173
8320
  return {
8174
8321
  value: s.label || s.key,
8175
- color: s.color || _this46.options.colors[i % _this46.options.colors.length]
8322
+ color: s.color || _this47.options.colors[i % _this47.options.colors.length]
8176
8323
  };
8177
8324
  });
8178
8325
  }
@@ -8565,28 +8712,28 @@ var WebsyChart = /*#__PURE__*/function () {
8565
8712
  if (this.options.data[customRangeSideLC].data && this.options.data[customRangeSideLC].data[0] && (this.options.data[customRangeSideLC].data[0].valueCount || 1) && this.options.data[customRangeSideLC].scale === 'Ordinal') {
8566
8713
  var acc = 0;
8567
8714
  this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8568
- var adjustment = _this46.bandPadding * index + _this46.bandPadding; // if (this.options.data.bottom.padding) {
8715
+ var adjustment = _this47.bandPadding * index + _this47.bandPadding; // if (this.options.data.bottom.padding) {
8569
8716
  // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
8570
8717
  // }
8571
8718
 
8572
- var start = _this46.widthForCalc / noOfPoints * acc;
8719
+ var start = _this47.widthForCalc / noOfPoints * acc;
8573
8720
 
8574
8721
  for (var i = 0; i < (d.valueCount || 1); i++) {
8575
8722
  var pos = i * proposedBandWidth;
8576
8723
 
8577
- _this46["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8724
+ _this47["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8578
8725
  }
8579
8726
 
8580
- acc += _this46.options.grouping !== 'stacked' && _this46.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8581
- var end = _this46.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8727
+ acc += _this47.options.grouping !== 'stacked' && _this47.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8728
+ var end = _this47.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8582
8729
 
8583
8730
  return end + adjustment;
8584
8731
  })));
8585
8732
  acc = 0;
8586
8733
  this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8587
- var adjustment = _this46.brushBandPadding * index + _this46.brushBandPadding;
8588
- acc += _this46.options.grouping !== 'stacked' && _this46.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8589
- return (_this46.options.orientation === 'vertical' ? _this46.plotWidth : _this46.plotHeight) / noOfPoints * acc;
8734
+ var adjustment = _this47.brushBandPadding * index + _this47.brushBandPadding;
8735
+ acc += _this47.options.grouping !== 'stacked' && _this47.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8736
+ return (_this47.options.orientation === 'vertical' ? _this47.plotWidth : _this47.plotHeight) / noOfPoints * acc;
8590
8737
  })));
8591
8738
  } // }
8592
8739
 
@@ -8768,7 +8915,7 @@ var WebsyChart = /*#__PURE__*/function () {
8768
8915
 
8769
8916
  if (this.options.data.bottom.formatter) {
8770
8917
  this.bAxisFunc.tickFormat(function (d) {
8771
- return _this46.options.data.bottom.formatter(d);
8918
+ return _this47.options.data.bottom.formatter(d);
8772
8919
  });
8773
8920
  }
8774
8921
 
@@ -8780,7 +8927,7 @@ var WebsyChart = /*#__PURE__*/function () {
8780
8927
 
8781
8928
  if (this.customBottomRange.length > 0) {
8782
8929
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8783
- return "translate(".concat(_this46.customBottomRange[i] + (_this46.customBottomRange[i + 1] - _this46.customBottomRange[i]) / 2, ", 0)");
8930
+ return "translate(".concat(_this47.customBottomRange[i] + (_this47.customBottomRange[i + 1] - _this47.customBottomRange[i]) / 2, ", 0)");
8784
8931
  });
8785
8932
  }
8786
8933
  } // Configure the left axis
@@ -8802,8 +8949,8 @@ var WebsyChart = /*#__PURE__*/function () {
8802
8949
 
8803
8950
  if (this.options.margin.axisLeft > 0) {
8804
8951
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
8805
- if (_this46.options.data.left.formatter) {
8806
- d = _this46.options.data.left.formatter(d);
8952
+ if (_this47.options.data.left.formatter) {
8953
+ d = _this47.options.data.left.formatter(d);
8807
8954
  }
8808
8955
 
8809
8956
  return d;
@@ -8811,7 +8958,7 @@ var WebsyChart = /*#__PURE__*/function () {
8811
8958
 
8812
8959
  if (this.customLeftRange.length > 0) {
8813
8960
  this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8814
- return "translate(0, ".concat(_this46.customLeftRange[i] + (_this46.customLeftRange[i + 1] - _this46.customLeftRange[i]) / 2, ")");
8961
+ return "translate(0, ".concat(_this47.customLeftRange[i] + (_this47.customLeftRange[i + 1] - _this47.customLeftRange[i]) / 2, ")");
8815
8962
  });
8816
8963
  }
8817
8964
  }
@@ -8844,8 +8991,8 @@ var WebsyChart = /*#__PURE__*/function () {
8844
8991
 
8845
8992
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
8846
8993
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
8847
- if (_this46.options.data.right.formatter) {
8848
- d = _this46.options.data.right.formatter(d);
8994
+ if (_this47.options.data.right.formatter) {
8995
+ d = _this47.options.data.right.formatter(d);
8849
8996
  }
8850
8997
 
8851
8998
  return d;
@@ -8891,60 +9038,60 @@ var WebsyChart = /*#__PURE__*/function () {
8891
9038
  }, {
8892
9039
  key: "renderComponents",
8893
9040
  value: function renderComponents() {
8894
- var _this47 = this;
9041
+ var _this48 = this;
8895
9042
 
8896
9043
  // Draw the series data
8897
9044
  this.renderedKeys = {};
8898
9045
  this.options.data.series.forEach(function (series, index) {
8899
9046
  if (!series.key) {
8900
- series.key = _this47.createIdentity();
9047
+ series.key = _this48.createIdentity();
8901
9048
  }
8902
9049
 
8903
9050
  if (!series.color) {
8904
- series.color = _this47.options.colors[index % _this47.options.colors.length];
9051
+ series.color = _this48.options.colors[index % _this48.options.colors.length];
8905
9052
  }
8906
9053
 
8907
- _this47["render".concat(series.type || 'bar')](series, index);
9054
+ _this48["render".concat(series.type || 'bar')](series, index);
8908
9055
 
8909
- _this47.renderLabels(series, index);
9056
+ _this48.renderLabels(series, index);
8910
9057
 
8911
- _this47.renderedKeys[series.key] = series.type;
9058
+ _this48.renderedKeys[series.key] = series.type;
8912
9059
  });
8913
9060
  this.refLineLayer.selectAll('.reference-line').remove();
8914
9061
  this.refLineLayer.selectAll('.reference-line-label').remove();
8915
9062
 
8916
9063
  if (this.options.refLines && this.options.refLines.length > 0) {
8917
9064
  this.options.refLines.forEach(function (l) {
8918
- return _this47.renderRefLine(l);
9065
+ return _this48.renderRefLine(l);
8919
9066
  });
8920
9067
  }
8921
9068
  }
8922
9069
  }, {
8923
9070
  key: "renderarea",
8924
9071
  value: function renderarea(series, index) {
8925
- var _this48 = this;
9072
+ var _this49 = this;
8926
9073
 
8927
9074
  /* global d3 series index */
8928
9075
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8929
9076
  return d3.area().x(function (d) {
8930
- if (_this48.options.data[xAxis].scale === 'Time') {
8931
- return _this48["".concat(xAxis, "Axis")](_this48.parseX(d.x.value));
9077
+ if (_this49.options.data[xAxis].scale === 'Time') {
9078
+ return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value));
8932
9079
  } else {
8933
- var xIndex = _this48[xAxis + 'Axis'].domain().indexOf(d.x.value);
9080
+ var xIndex = _this49[xAxis + 'Axis'].domain().indexOf(d.x.value);
8934
9081
 
8935
- var xPos = _this48["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9082
+ var xPos = _this49["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8936
9083
 
8937
- if (_this48["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8938
- xPos = xPos + (_this48["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9084
+ if (_this49["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9085
+ xPos = xPos + (_this49["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8939
9086
  }
8940
9087
 
8941
9088
  return xPos;
8942
9089
  }
8943
9090
  }).y0(function (d) {
8944
- return _this48["".concat(yAxis, "Axis")](0);
9091
+ return _this49["".concat(yAxis, "Axis")](0);
8945
9092
  }).y1(function (d) {
8946
- return _this48["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8947
- }).curve(d3[curveStyle || _this48.options.curveStyle]);
9093
+ return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9094
+ }).curve(d3[curveStyle || _this49.options.curveStyle]);
8948
9095
  };
8949
9096
 
8950
9097
  var xAxis = 'bottom';
@@ -8982,7 +9129,7 @@ var WebsyChart = /*#__PURE__*/function () {
8982
9129
  }, {
8983
9130
  key: "renderbar",
8984
9131
  value: function renderbar(series, index) {
8985
- var _this49 = this;
9132
+ var _this50 = this;
8986
9133
 
8987
9134
  /* global series index d3 */
8988
9135
  var xAxis = 'bottom';
@@ -9160,25 +9307,25 @@ var WebsyChart = /*#__PURE__*/function () {
9160
9307
 
9161
9308
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9162
9309
  bars.attr('width', function (d, i) {
9163
- return Math.abs(getBarWidth.call(_this49, d, i, xAxis));
9310
+ return Math.abs(getBarWidth.call(_this50, d, i, xAxis));
9164
9311
  }).attr('height', function (d, i) {
9165
- return getBarHeight.call(_this49, d, i, yAxis, xAxis);
9312
+ return getBarHeight.call(_this50, d, i, yAxis, xAxis);
9166
9313
  }).attr('x', function (d, i) {
9167
- return getBarX.call(_this49, d, i, xAxis);
9314
+ return getBarX.call(_this50, d, i, xAxis);
9168
9315
  }).attr('y', function (d, i) {
9169
- return getBarY.call(_this49, d, i, yAxis, xAxis);
9316
+ return getBarY.call(_this50, d, i, yAxis, xAxis);
9170
9317
  }) // .transition(this.transition)
9171
9318
  .attr('fill', function (d) {
9172
9319
  return d.y.color || d.color || series.color;
9173
9320
  });
9174
9321
  bars.enter().append('rect').attr('width', function (d, i) {
9175
- return Math.abs(getBarWidth.call(_this49, d, i, xAxis));
9322
+ return Math.abs(getBarWidth.call(_this50, d, i, xAxis));
9176
9323
  }).attr('height', function (d, i) {
9177
- return getBarHeight.call(_this49, d, i, yAxis, xAxis);
9324
+ return getBarHeight.call(_this50, d, i, yAxis, xAxis);
9178
9325
  }).attr('x', function (d, i) {
9179
- return getBarX.call(_this49, d, i, xAxis);
9326
+ return getBarX.call(_this50, d, i, xAxis);
9180
9327
  }).attr('y', function (d, i) {
9181
- return getBarY.call(_this49, d, i, yAxis, xAxis);
9328
+ return getBarY.call(_this50, d, i, yAxis, xAxis);
9182
9329
  }) // .transition(this.transition)
9183
9330
  .attr('fill', function (d) {
9184
9331
  return d.y.color || d.color || series.color;
@@ -9190,25 +9337,25 @@ var WebsyChart = /*#__PURE__*/function () {
9190
9337
  this.brushBarsInitialized[series.key] = true;
9191
9338
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9192
9339
  brushBars.attr('width', function (d, i) {
9193
- return Math.abs(getBarWidth.call(_this49, d, i, "".concat(xAxis, "Brush")));
9340
+ return Math.abs(getBarWidth.call(_this50, d, i, "".concat(xAxis, "Brush")));
9194
9341
  }).attr('height', function (d, i) {
9195
- return getBarHeight.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9342
+ return getBarHeight.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9196
9343
  }).attr('x', function (d, i) {
9197
- return getBarX.call(_this49, d, i, "".concat(xAxis, "Brush"));
9344
+ return getBarX.call(_this50, d, i, "".concat(xAxis, "Brush"));
9198
9345
  }).attr('y', function (d, i) {
9199
- return getBarY.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9346
+ return getBarY.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9200
9347
  }) // .transition(this.transition)
9201
9348
  .attr('fill', function (d) {
9202
9349
  return d.y.color || d.color || series.color;
9203
9350
  });
9204
9351
  brushBars.enter().append('rect').attr('width', function (d, i) {
9205
- return Math.abs(getBarWidth.call(_this49, d, i, "".concat(xAxis, "Brush")));
9352
+ return Math.abs(getBarWidth.call(_this50, d, i, "".concat(xAxis, "Brush")));
9206
9353
  }).attr('height', function (d, i) {
9207
- return getBarHeight.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9354
+ return getBarHeight.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9208
9355
  }).attr('x', function (d, i) {
9209
- return getBarX.call(_this49, d, i, "".concat(xAxis, "Brush"));
9356
+ return getBarX.call(_this50, d, i, "".concat(xAxis, "Brush"));
9210
9357
  }).attr('y', function (d, i) {
9211
- return getBarY.call(_this49, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9358
+ return getBarY.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9212
9359
  }) // .transition(this.transition)
9213
9360
  .attr('fill', function (d) {
9214
9361
  return d.y.color || d.color || series.color;
@@ -9226,7 +9373,7 @@ var WebsyChart = /*#__PURE__*/function () {
9226
9373
  }, {
9227
9374
  key: "renderLabels",
9228
9375
  value: function renderLabels(series, index) {
9229
- var _this50 = this;
9376
+ var _this51 = this;
9230
9377
 
9231
9378
  /* global series index d3 WebsyDesigns */
9232
9379
  var xAxis = 'bottom';
@@ -9245,15 +9392,15 @@ var WebsyChart = /*#__PURE__*/function () {
9245
9392
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
9246
9393
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
9247
9394
  labels.attr('x', function (d) {
9248
- return getLabelX.call(_this50, d, series.labelPosition);
9395
+ return getLabelX.call(_this51, d, series.labelPosition);
9249
9396
  }).attr('y', function (d) {
9250
- return getLabelY.call(_this50, d, series.labelPosition);
9397
+ return getLabelY.call(_this51, d, series.labelPosition);
9251
9398
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
9252
- if (_this50.options.grouping === 'stacked' && d.y.value === 0) {
9399
+ if (_this51.options.grouping === 'stacked' && d.y.value === 0) {
9253
9400
  return 'transparent';
9254
9401
  }
9255
9402
 
9256
- return _this50.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9403
+ return _this51.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9257
9404
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
9258
9405
  return d.y.label || d.y.value;
9259
9406
  }).each(function (d, i) {
@@ -9278,15 +9425,15 @@ var WebsyChart = /*#__PURE__*/function () {
9278
9425
  }
9279
9426
  });
9280
9427
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
9281
- return getLabelX.call(_this50, d, series.labelPosition);
9428
+ return getLabelX.call(_this51, d, series.labelPosition);
9282
9429
  }).attr('y', function (d) {
9283
- return getLabelY.call(_this50, d, series.labelPosition);
9430
+ return getLabelY.call(_this51, d, series.labelPosition);
9284
9431
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
9285
- if (_this50.options.grouping === 'stacked' && d.y.value === 0) {
9432
+ if (_this51.options.grouping === 'stacked' && d.y.value === 0) {
9286
9433
  return 'transparent';
9287
9434
  }
9288
9435
 
9289
- return _this50.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9436
+ return _this51.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9290
9437
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
9291
9438
  return d.y.label || d.y.value;
9292
9439
  }).each(function (d, i) {
@@ -9364,36 +9511,36 @@ var WebsyChart = /*#__PURE__*/function () {
9364
9511
  }, {
9365
9512
  key: "renderline",
9366
9513
  value: function renderline(series, index) {
9367
- var _this51 = this;
9514
+ var _this52 = this;
9368
9515
 
9369
9516
  /* global series index d3 */
9370
9517
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
9371
9518
  return d3.line().x(function (d) {
9372
- if (_this51.options.orientation === 'horizontal') {
9373
- return _this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9519
+ if (_this52.options.orientation === 'horizontal') {
9520
+ return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9374
9521
  } else {
9375
- if (_this51.options.data[xAxis].scale === 'Time') {
9376
- return _this51["".concat(xAxis, "Axis")](_this51.parseX(d.x.value));
9522
+ if (_this52.options.data[xAxis].scale === 'Time') {
9523
+ return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value));
9377
9524
  } else {
9378
- var xIndex = _this51[xAxis + 'Axis'].domain().indexOf(d.x.value);
9525
+ var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
9379
9526
 
9380
- var xPos = _this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9527
+ var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9381
9528
 
9382
- if (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9383
- xPos = xPos + (_this51["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9529
+ if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9530
+ xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9384
9531
  }
9385
9532
 
9386
9533
  return xPos;
9387
9534
  }
9388
9535
  }
9389
9536
  }).y(function (d) {
9390
- if (_this51.options.orientation === 'horizontal') {
9391
- var adjustment = _this51.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this51.options.data[xAxis].bandWidth / 2;
9392
- return _this51["".concat(xAxis, "Axis")](_this51.parseX(d.x.value)) + adjustment;
9537
+ if (_this52.options.orientation === 'horizontal') {
9538
+ var adjustment = _this52.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this52.options.data[xAxis].bandWidth / 2;
9539
+ return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value)) + adjustment;
9393
9540
  } else {
9394
- return _this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9541
+ return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9395
9542
  }
9396
- }).curve(d3[curveStyle || _this51.options.curveStyle]);
9543
+ }).curve(d3[curveStyle || _this52.options.curveStyle]);
9397
9544
  };
9398
9545
 
9399
9546
  var xAxis = 'bottom';
@@ -9507,14 +9654,14 @@ var WebsyChart = /*#__PURE__*/function () {
9507
9654
  }, {
9508
9655
  key: "rendersymbol",
9509
9656
  value: function rendersymbol(series, index) {
9510
- var _this52 = this;
9657
+ var _this53 = this;
9511
9658
 
9512
9659
  /* global d3 series index series.key */
9513
9660
  var drawSymbol = function drawSymbol(size) {
9514
9661
  return d3.symbol() // .type(d => {
9515
9662
  // return d3.symbols[0]
9516
9663
  // })
9517
- .size(size || _this52.options.symbolSize);
9664
+ .size(size || _this53.options.symbolSize);
9518
9665
  };
9519
9666
 
9520
9667
  var xAxis = 'bottom';
@@ -9543,25 +9690,25 @@ var WebsyChart = /*#__PURE__*/function () {
9543
9690
  // else {
9544
9691
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9545
9692
  // }
9546
- var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
9693
+ var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
9547
9694
 
9548
- var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9695
+ var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9549
9696
 
9550
- if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9551
- xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9697
+ if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9698
+ xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9552
9699
  }
9553
9700
 
9554
- var adjustment = _this52.options.data[xAxis].scale === 'Time' || _this52.options.data[xAxis].scale === 'Linear' ? 0 : _this52.options.data[xAxis].bandWidth / 2;
9701
+ var adjustment = _this53.options.data[xAxis].scale === 'Time' || _this53.options.data[xAxis].scale === 'Linear' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
9555
9702
 
9556
- if (_this52.options.orientation === 'horizontal') {
9557
- return "translate(".concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9703
+ if (_this53.options.orientation === 'horizontal') {
9704
+ return "translate(".concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9558
9705
  } else {
9559
- if (_this52.options.data[xAxis].scale === 'Time') {
9560
- xPos = _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value));
9706
+ if (_this53.options.data[xAxis].scale === 'Time') {
9707
+ xPos = _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value));
9561
9708
  } // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9562
9709
 
9563
9710
 
9564
- return "translate(".concat(xPos, ", ").concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9711
+ return "translate(".concat(xPos, ", ").concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9565
9712
  }
9566
9713
  }); // Enter
9567
9714
 
@@ -9575,25 +9722,25 @@ var WebsyChart = /*#__PURE__*/function () {
9575
9722
  }).attr('class', function (d) {
9576
9723
  return "symbol symbol_".concat(series.key);
9577
9724
  }).attr('transform', function (d) {
9578
- var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
9725
+ var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
9579
9726
 
9580
- var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9727
+ var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9581
9728
 
9582
- if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9583
- xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9729
+ if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9730
+ xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9584
9731
  }
9585
9732
 
9586
- var adjustment = _this52.options.data[xAxis].scale === 'Time' || _this52.options.data[xAxis].scale === 'Linear' ? 0 : _this52.options.data[xAxis].bandWidth / 2;
9733
+ var adjustment = _this53.options.data[xAxis].scale === 'Time' || _this53.options.data[xAxis].scale === 'Linear' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
9587
9734
 
9588
- if (_this52.options.orientation === 'horizontal') {
9589
- return "translate(".concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9735
+ if (_this53.options.orientation === 'horizontal') {
9736
+ return "translate(".concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9590
9737
  } else {
9591
- if (_this52.options.data[xAxis].scale === 'Time') {
9592
- xPos = _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value));
9738
+ if (_this53.options.data[xAxis].scale === 'Time') {
9739
+ xPos = _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value));
9593
9740
  } // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9594
9741
 
9595
9742
 
9596
- return "translate(".concat(xPos, ", ").concat(_this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9743
+ return "translate(".concat(xPos, ", ").concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9597
9744
  }
9598
9745
  });
9599
9746
  }
@@ -9815,7 +9962,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9815
9962
  }, {
9816
9963
  key: "resize",
9817
9964
  value: function resize() {
9818
- var _this53 = this;
9965
+ var _this54 = this;
9819
9966
 
9820
9967
  var el = document.getElementById(this.elementId);
9821
9968
 
@@ -9828,7 +9975,7 @@ var WebsyLegend = /*#__PURE__*/function () {
9828
9975
  // }
9829
9976
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
9830
9977
  html += this._data.map(function (d, i) {
9831
- return _this53.getLegendItemHTML(d);
9978
+ return _this54.getLegendItemHTML(d);
9832
9979
  }).join('');
9833
9980
  html += "\n <div>\n ";
9834
9981
  el.innerHTML = html;
@@ -10005,7 +10152,7 @@ var WebsyMap = /*#__PURE__*/function () {
10005
10152
  }, {
10006
10153
  key: "render",
10007
10154
  value: function render() {
10008
- var _this54 = this;
10155
+ var _this55 = this;
10009
10156
 
10010
10157
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
10011
10158
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -10014,7 +10161,7 @@ var WebsyMap = /*#__PURE__*/function () {
10014
10161
  var legendData = this.options.data.polygons.map(function (s, i) {
10015
10162
  return {
10016
10163
  value: s.label || s.key,
10017
- color: s.color || _this54.options.colors[i % _this54.options.colors.length]
10164
+ color: s.color || _this55.options.colors[i % _this55.options.colors.length]
10018
10165
  };
10019
10166
  });
10020
10167
  var longestValue = legendData.map(function (s) {
@@ -10078,7 +10225,7 @@ var WebsyMap = /*#__PURE__*/function () {
10078
10225
 
10079
10226
  if (this.polygons) {
10080
10227
  this.polygons.forEach(function (p) {
10081
- return _this54.map.removeLayer(p);
10228
+ return _this55.map.removeLayer(p);
10082
10229
  });
10083
10230
  }
10084
10231
 
@@ -10136,18 +10283,18 @@ var WebsyMap = /*#__PURE__*/function () {
10136
10283
  }
10137
10284
 
10138
10285
  if (!p.options.color) {
10139
- p.options.color = _this54.options.colors[i % _this54.options.colors.length];
10286
+ p.options.color = _this55.options.colors[i % _this55.options.colors.length];
10140
10287
  }
10141
10288
 
10142
10289
  var pol = L.polygon(p.data.map(function (c) {
10143
10290
  return c.map(function (d) {
10144
10291
  return [d.Latitude, d.Longitude];
10145
10292
  });
10146
- }), p.options).addTo(_this54.map);
10293
+ }), p.options).addTo(_this55.map);
10147
10294
 
10148
- _this54.polygons.push(pol);
10295
+ _this55.polygons.push(pol);
10149
10296
 
10150
- _this54.map.fitBounds(pol.getBounds());
10297
+ _this55.map.fitBounds(pol.getBounds());
10151
10298
  });
10152
10299
  } // if (this.data.markers.length > 0) {
10153
10300
  // el.classList.remove('hidden')