@websy/websy-designs 1.4.38 → 1.5.1

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.
@@ -6903,7 +6903,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6903
6903
  } // console.log('rowspan', cell.rowspan)
6904
6904
 
6905
6905
 
6906
- bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this40.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.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) {
6906
+ bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this40.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) {
6907
6907
  // bodyHtml += `
6908
6908
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
6909
6909
  // width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
@@ -6981,7 +6981,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6981
6981
  style += col.style;
6982
6982
  }
6983
6983
 
6984
- headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this41.pinnedColumns ? 'pinned' : 'unpinned', "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6984
+ headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this41.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6985
6985
  // headerHtml += `
6986
6986
  // style='width: ${col.width || col.actualWidth}px'
6987
6987
  // width='${col.width || col.actualWidth}'
@@ -7032,7 +7032,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7032
7032
 
7033
7033
  var totalHtml = "<tr class=\"websy-table-row websy-table-total-row\">";
7034
7034
  this.options.totals.forEach(function (col, colIndex) {
7035
- totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
7035
+ totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
7036
7036
 
7037
7037
  if (useWidths === true) {
7038
7038
  totalHtml += "\n style='width: ".concat(_this42.options.columns[_this42.options.columns.length - 1][colIndex].width || _this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
@@ -7061,6 +7061,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
7061
7061
  var outerEl = document.getElementById(this.elementId);
7062
7062
  var tableEl = document.getElementById("".concat(this.elementId, "_tableContainer"));
7063
7063
  var headEl = document.getElementById("".concat(this.elementId, "_tableHeader"));
7064
+
7065
+ if (!headEl) {
7066
+ // something isn't right so exit the function
7067
+ return;
7068
+ }
7069
+
7064
7070
  headEl.style.width = 'auto';
7065
7071
  headEl.innerHTML = this.buildHeaderHtml();
7066
7072
  this.sizes.outer = outerEl.getBoundingClientRect();
@@ -7344,7 +7350,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
7344
7350
  }
7345
7351
 
7346
7352
  var tableEl = document.getElementById("".concat(this.elementId, "_tableInner"));
7347
- tableEl.classList.remove('hidden');
7353
+
7354
+ if (tableEl) {
7355
+ tableEl.classList.remove('hidden');
7356
+ }
7357
+
7348
7358
  var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
7349
7359
 
7350
7360
  if (containerEl) {
@@ -7392,7 +7402,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
7392
7402
  this.appendRows(data);
7393
7403
  }
7394
7404
 
7395
- var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody")); // bodyEl.innerHTML = this.buildBodyHtml(data, true)
7405
+ var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody"));
7406
+
7407
+ if (!bodyEl) {
7408
+ // something isn't right so exit the function
7409
+ return;
7410
+ } // bodyEl.innerHTML = this.buildBodyHtml(data, true)
7396
7411
  // if (this.options.maxHeight) {
7397
7412
  // bodyEl.style.height = `${this.options.maxHeight - this.sizes.header.height - this.sizes.total.height}px`
7398
7413
  // }
@@ -7400,6 +7415,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7400
7415
  // bodyEl.style.height = `calc(100% - ${this.sizes.header.height}px - ${this.sizes.total.height}px)`
7401
7416
  // }
7402
7417
 
7418
+
7403
7419
  bodyEl.style.height = "".concat(this.sizes.bodyHeight, "px");
7404
7420
 
7405
7421
  if (this.options.virtualScroll === true) {
@@ -7658,6 +7674,7 @@ var WebsyChart = /*#__PURE__*/function () {
7658
7674
  lineWidth: 2,
7659
7675
  forceZero: true,
7660
7676
  grouping: 'grouped',
7677
+ groupPadding: 3,
7661
7678
  fontSize: 14,
7662
7679
  symbolSize: 20,
7663
7680
  showTrackingLine: true,
@@ -7666,7 +7683,8 @@ var WebsyChart = /*#__PURE__*/function () {
7666
7683
  legendPosition: 'bottom',
7667
7684
  tooltipWidth: 200,
7668
7685
  brushHeight: 50,
7669
- minBandWidth: 30
7686
+ minBandWidth: 30,
7687
+ allowUnevenBands: true
7670
7688
  };
7671
7689
  this.elementId = elementId;
7672
7690
  this.options = _extends({}, DEFAULTS, options);
@@ -7697,24 +7715,39 @@ var WebsyChart = /*#__PURE__*/function () {
7697
7715
  }
7698
7716
 
7699
7717
  xAxis += 'Axis';
7700
-
7701
- var width = _this45[xAxis].step();
7702
-
7703
7718
  var output;
7704
7719
 
7705
- var domain = _toConsumableArray(_this45[xAxis].domain());
7720
+ var width = _this45.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7706
7721
 
7707
- if (_this45.options.orientation === 'horizontal') {
7708
- domain = domain.reverse();
7709
- }
7722
+ if (_this45.customBottomRange) {
7723
+ for (var index = 0; index < _this45.customBottomRange.length; index++) {
7724
+ if (input > _this45.customBottomRange[index]) {
7725
+ if (_this45.customBottomRange[index + 1]) {
7726
+ if (input < _this45.customBottomRange[index + 1]) {
7727
+ output = index;
7728
+ break;
7729
+ }
7730
+ } else {
7731
+ output = index;
7732
+ break;
7733
+ }
7734
+ }
7735
+ }
7736
+ } else {
7737
+ var domain = _toConsumableArray(_this45[xAxis].domain());
7738
+
7739
+ if (_this45.options.orientation === 'horizontal') {
7740
+ domain = domain.reverse();
7741
+ }
7710
7742
 
7711
- for (var j = 0; j < domain.length; j++) {
7712
- var breakA = _this45[xAxis](domain[j]) - width / 2;
7713
- var breakB = breakA + width;
7743
+ for (var j = 0; j < domain.length; j++) {
7744
+ var breakA = _this45[xAxis](domain[j]) - width / 2;
7745
+ var breakB = breakA + width;
7714
7746
 
7715
- if (input > breakA && input <= breakB) {
7716
- output = j;
7717
- break;
7747
+ if (input > breakA && input <= breakB) {
7748
+ output = j;
7749
+ break;
7750
+ }
7718
7751
  }
7719
7752
  }
7720
7753
 
@@ -7734,6 +7767,10 @@ var WebsyChart = /*#__PURE__*/function () {
7734
7767
  xAxisCaps = 'Left';
7735
7768
  }
7736
7769
 
7770
+ if (!that["".concat(xAxis, "Axis")]) {
7771
+ return;
7772
+ }
7773
+
7737
7774
  if (!that["".concat(xAxis, "Axis")].invert) {
7738
7775
  that["".concat(xAxis, "Axis")].invert = that.invertOverride;
7739
7776
  }
@@ -7936,7 +7973,12 @@ var WebsyChart = /*#__PURE__*/function () {
7936
7973
 
7937
7974
  this.options.data.series.forEach(function (s) {
7938
7975
  if (_this46.options.data[xData].scale !== 'Time') {
7939
- xPoint = _this46[xAxis](_this46.parseX(xLabel));
7976
+ if (_this46.customBottomRange && _this46.customBottomRange.length > 0) {
7977
+ xPoint = _this46.customBottomRange[x0] + (_this46.customBottomRange[x0 + 1] - _this46.customBottomRange[x0]) / 2;
7978
+ } else {
7979
+ xPoint = _this46[xAxis](_this46.parseX(xLabel));
7980
+ }
7981
+
7940
7982
  s.data.forEach(function (d) {
7941
7983
  if (d.x.value === xLabel) {
7942
7984
  if (!tooltipTitle) {
@@ -8040,7 +8082,7 @@ var WebsyChart = /*#__PURE__*/function () {
8040
8082
  };
8041
8083
 
8042
8084
  if (xPoint > this.plotWidth / 2) {
8043
- posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15;
8085
+ posOptions.left = xPoint - this.options.tooltipWidth - 15; // + this.options.margin.left + this.options.margin.axisLeft + 15)
8044
8086
 
8045
8087
  if (this.options.data[xData].scale !== 'Time') {
8046
8088
  // posOptions.left -= (this[xAxis].bandwidth())
@@ -8050,7 +8092,7 @@ var WebsyChart = /*#__PURE__*/function () {
8050
8092
  posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15;
8051
8093
 
8052
8094
  if (this.options.data[xData].scale !== 'Time') {
8053
- posOptions.left += this[xAxis].bandwidth() / 2;
8095
+ posOptions.left += this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
8054
8096
  }
8055
8097
  }
8056
8098
 
@@ -8061,7 +8103,7 @@ var WebsyChart = /*#__PURE__*/function () {
8061
8103
  var adjuster = 0;
8062
8104
 
8063
8105
  if (this.options.data[xData].scale !== 'Time') {
8064
- adjuster = this[xAxis].bandwidth() / 2; // - this.options.margin.top
8106
+ adjuster = this.options.data[xAxis.replace('Axis', '')].bandWidth / 2; // - this.options.margin.top
8065
8107
  }
8066
8108
 
8067
8109
  posOptions = {
@@ -8084,8 +8126,8 @@ var WebsyChart = /*#__PURE__*/function () {
8084
8126
  // xPoint = x0
8085
8127
  // }
8086
8128
 
8087
- if (this.options.data[xData].scale !== 'Time') {
8088
- xPoint += this[xAxis].bandwidth() / 2; // - this.options.margin.top
8129
+ if (this.options.data[xData].scale !== 'Time' && this.customBottomRange.length === 0) {
8130
+ xPoint += this.options.data[xAxis.replace('Axis', '')].bandWidth / 2; // - this.options.margin.top
8089
8131
  }
8090
8132
 
8091
8133
  var trackingXStart = xPoint;
@@ -8149,6 +8191,7 @@ var WebsyChart = /*#__PURE__*/function () {
8149
8191
 
8150
8192
  if (!this.options.data) {// tell the user no data has been provided
8151
8193
  } else {
8194
+ this.processedX = {};
8152
8195
  this.transition = d3.transition().duration(this.options.transitionDuration);
8153
8196
 
8154
8197
  if (this.options.data.bottom.scale && this.options.data.bottom.scale === 'Time') {
@@ -8206,12 +8249,18 @@ var WebsyChart = /*#__PURE__*/function () {
8206
8249
  // the legend gets rendered so that we can get its actual size
8207
8250
 
8208
8251
  if (this.options.showLegend === true) {
8209
- var legendData = this.options.data.series.map(function (s, i) {
8210
- return {
8211
- value: s.label || s.key,
8212
- color: s.color || _this47.options.colors[i % _this47.options.colors.length]
8213
- };
8214
- });
8252
+ var legendData = [];
8253
+
8254
+ if (this.options.legendData && this.options.legendData.length > 0) {
8255
+ legendData = this.options.legendData;
8256
+ } else {
8257
+ this.options.data.series.map(function (s, i) {
8258
+ return {
8259
+ value: s.label || s.key,
8260
+ color: s.color || _this47.options.colors[i % _this47.options.colors.length]
8261
+ };
8262
+ });
8263
+ }
8215
8264
 
8216
8265
  if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
8217
8266
  this.legendArea.style('width', '100%');
@@ -8415,18 +8464,34 @@ var WebsyChart = /*#__PURE__*/function () {
8415
8464
  this.brushNeeded = false;
8416
8465
 
8417
8466
  if (this.options.orientation === 'vertical') {
8467
+ this.options.data.bottom.totalValueCount = this.options.data.bottom.data.reduce(function (a, b) {
8468
+ if (typeof b.valueCount === 'undefined') {
8469
+ return a + 1;
8470
+ }
8471
+
8472
+ return a + b.valueCount;
8473
+ }, 0);
8474
+
8418
8475
  if (this.options.maxBandWidth) {
8419
- this.plotWidth = Math.min(this.plotWidth, (this.options.data.bottom.data || []).length * this.options.maxBandWidth);
8476
+ this.plotWidth = Math.min(this.plotWidth, this.options.data.bottom.totalValueCount * this.options.maxBandWidth);
8420
8477
  } // some if to check if brushing is needed
8421
8478
 
8422
8479
 
8423
- if (this.plotWidth / this.options.data.bottom.data.length < this.options.minBandWidth) {
8480
+ if (this.plotWidth / this.options.data.bottom.totalValueCount < this.options.minBandWidth) {
8424
8481
  this.brushNeeded = true;
8425
8482
  this.plotHeight -= this.options.brushHeight;
8426
8483
  }
8427
8484
  } else {
8428
8485
  // some if to check if brushing is needed
8429
- if (this.plotHeight / this.options.data.left.data.length < this.options.minBandWidth) {
8486
+ this.options.data.left.totalValueCount = this.options.data.left.data.reduce(function (a, b) {
8487
+ if (typeof b.valueCount === 'undefined') {
8488
+ return a + 1;
8489
+ }
8490
+
8491
+ return a + b.valueCount;
8492
+ }, 0);
8493
+
8494
+ if (this.plotHeight / this.options.data.left.totalValueCount < this.options.minBandWidth) {
8430
8495
  this.brushNeeded = true;
8431
8496
  this.plotWidth -= this.options.brushHeight;
8432
8497
  }
@@ -8456,10 +8521,42 @@ var WebsyChart = /*#__PURE__*/function () {
8456
8521
 
8457
8522
  var bottomDomain = this.createDomain('bottom');
8458
8523
  var bottomBrushDomain = this.createDomain('bottom', true);
8459
- this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomDomain).range([0, this.plotWidth]);
8524
+ var bottomRange = [0, this.plotWidth];
8525
+ this.customBottomRange = [];
8526
+
8527
+ if (this.options.allowUnevenBands === true) {
8528
+ if (this.options.data.bottom.data && this.options.data.bottom.data[0] && this.options.data.bottom.data[0].valueCount && this.options.data.bottom.scale === 'Ordinal') {
8529
+ var acc = 0;
8530
+ this.customBottomRange = [0].concat(_toConsumableArray(this.options.data.bottom.data.map(function (d) {
8531
+ acc += d.valueCount;
8532
+ return _this47.plotWidth / _this47.options.data.bottom.totalValueCount * acc;
8533
+ })));
8534
+ }
8535
+ }
8536
+
8537
+ this.options.data.bottom.step = this.plotWidth / this.options.data.bottom.totalValueCount;
8538
+ this.options.data.bottom.bandWidth = this.options.data.bottom.step;
8539
+
8540
+ if (this.options.data.bottom.padding) {
8541
+ this.totalPadding = this.plotWidth * this.options.data.bottom.padding;
8542
+ var rangeLength = bottomDomain.length;
8543
+
8544
+ if (this.customBottomRange.length > 0) {
8545
+ rangeLength = this.customBottomRange.length;
8546
+ }
8547
+
8548
+ this.bandPadding = this.totalPadding / rangeLength / 2;
8549
+ this.options.data.bottom.bandWidth = (this.plotWidth - this.totalPadding) / this.options.data.bottom.totalValueCount;
8550
+ }
8551
+
8552
+ if (this.options.grouping === 'grouped' && this.options.data.series.length > 1) {
8553
+ this.options.data.bottom.bandWidth = this.options.data.bottom.bandWidth - this.options.groupPadding * 2;
8554
+ }
8555
+
8556
+ this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomDomain).range(bottomRange);
8460
8557
 
8461
8558
  if (!this.brushInitialized) {
8462
- this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomBrushDomain).range([0, this.plotWidth]);
8559
+ this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomBrushDomain).range(bottomRange);
8463
8560
  }
8464
8561
 
8465
8562
  if (this.bottomAxis.nice) {// this.bottomAxis.nice()
@@ -8578,6 +8675,12 @@ var WebsyChart = /*#__PURE__*/function () {
8578
8675
  if (this.options.data.bottom.rotate) {
8579
8676
  this.bottomAxisLayer.selectAll('text').attr('transform', "rotate(".concat(this.options.data.bottom && this.options.data.bottom.rotate || 0, ")")).style('text-anchor', "".concat((this.options.data.bottom && this.options.data.bottom.rotate || 0) === 0 ? 'middle' : 'end')).style('transform-origin', (this.options.data.bottom && this.options.data.bottom.rotate || 0) === 0 ? '0 0' : "0 ".concat(this.options.data.bottom && this.options.data.bottom.fontSize || this.options.fontSize, "px"));
8580
8677
  }
8678
+
8679
+ if (this.customBottomRange.length > 0) {
8680
+ this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8681
+ return "translate(".concat(_this47.customBottomRange[i] + (_this47.customBottomRange[i + 1] - _this47.customBottomRange[i]) / 2, ", 0)");
8682
+ });
8683
+ }
8581
8684
  } // Configure the left axis
8582
8685
 
8583
8686
 
@@ -8695,6 +8798,8 @@ var WebsyChart = /*#__PURE__*/function () {
8695
8798
 
8696
8799
  _this48.renderedKeys[series.key] = series.type;
8697
8800
  });
8801
+ this.refLineLayer.selectAll('.reference-line').remove();
8802
+ this.refLineLayer.selectAll('.reference-line-label').remove();
8698
8803
 
8699
8804
  if (this.options.refLines && this.options.refLines.length > 0) {
8700
8805
  this.options.refLines.forEach(function (l) {
@@ -8710,20 +8815,20 @@ var WebsyChart = /*#__PURE__*/function () {
8710
8815
  /* global d3 series index */
8711
8816
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8712
8817
  return d3.area().x(function (d) {
8713
- return _this49[xAxis](_this49.parseX(d.x.value));
8818
+ return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value));
8714
8819
  }).y0(function (d) {
8715
- return _this49[yAxis](0);
8820
+ return _this49["".concat(yAxis, "Axis")](0);
8716
8821
  }).y1(function (d) {
8717
- return _this49[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
8822
+ return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8718
8823
  }).curve(d3[curveStyle || _this49.options.curveStyle]);
8719
8824
  };
8720
8825
 
8721
- var xAxis = 'bottomAxis';
8722
- var yAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8826
+ var xAxis = 'bottom';
8827
+ var yAxis = series.axis === 'secondary' ? 'right' : 'left';
8723
8828
 
8724
- if (this.options.orienation === 'horizontal') {
8725
- xAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8726
- yAxis = 'bottomAxis';
8829
+ if (this.options.orientation === 'horizontal') {
8830
+ xAxis = series.axis === 'secondary' ? 'right' : 'left';
8831
+ yAxis = 'bottom';
8727
8832
  }
8728
8833
 
8729
8834
  var areas = this.areaLayer.selectAll(".area_".concat(series.key)).data([series.data]); // Exit
@@ -8741,8 +8846,7 @@ var WebsyChart = /*#__PURE__*/function () {
8741
8846
 
8742
8847
  areas.enter().append('path').attr('d', function (d) {
8743
8848
  return drawArea(xAxis, yAxis, series.curveStyle)(d);
8744
- }).attr('class', "area_".concat(series.key)).attr('id', "area_".concat(series.key)) // .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
8745
- // .style('stroke-width', series.lineWidth || this.options.lineWidth)
8849
+ }).attr('class', "area_".concat(series.key)).attr('id', "area_".concat(series.key)).attr('transform', 'translate(' + (this.options.data[xAxis].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2) + ',0)') // .style('stroke-width', series.lineWidth || this.options.lineWidth)
8746
8850
  .attr('fill', series.color) // .style('fill-opacity', 0)
8747
8851
  .attr('stroke', 'transparent') // .transition(this.transition)
8748
8852
  .style('fill-opacity', series.opacity || 0.5);
@@ -8768,14 +8872,14 @@ var WebsyChart = /*#__PURE__*/function () {
8768
8872
 
8769
8873
 
8770
8874
  function getBarHeight(d, i, heightBounds, yAxis, xAxis) {
8771
- var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
8772
- var groupedBarWidth = (barWidth - 10) / this.options.data.series.length;
8773
8875
  var output;
8774
8876
 
8775
8877
  if (this.options.orientation === 'horizontal') {
8776
- output = barWidth;
8878
+ output = this.options.data[xAxis.replace('Brush', '')].bandWidth;
8777
8879
  } else {
8778
- if (!getBarX.call(this, d, i, xAxis)) {
8880
+ var x = getBarX.call(this, d, i, xAxis);
8881
+
8882
+ if (typeof x === 'undefined' || x === null) {
8779
8883
  return null;
8780
8884
  }
8781
8885
 
@@ -8790,25 +8894,20 @@ var WebsyChart = /*#__PURE__*/function () {
8790
8894
  }
8791
8895
 
8792
8896
  function getBarWidth(d, i, xAxis) {
8793
- var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
8794
- var groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data.series.length;
8795
8897
  var output;
8796
8898
 
8797
8899
  if (this.options.orientation === 'horizontal') {
8798
- // let width = this[`${yAxis}Axis`](d.y.value)
8799
8900
  var width = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
8800
8901
  acummulativeY[d.y.index] += width;
8801
8902
  output = width;
8802
8903
  } else {
8803
- if (!getBarX.call(this, d, i, xAxis)) {
8904
+ var x = getBarX.call(this, d, i, xAxis);
8905
+
8906
+ if (typeof x === 'undefined' || x === null) {
8804
8907
  return null;
8805
8908
  }
8806
8909
 
8807
- if (this.options.grouping === 'grouped') {
8808
- output = Math.max(1, groupedBarWidth);
8809
- } else {
8810
- output = Math.max(1, barWidth);
8811
- }
8910
+ output = Math.max(1, this.options.data[xAxis.replace('Brush', '')].bandWidth);
8812
8911
  }
8813
8912
 
8814
8913
  if (isNaN(output)) {
@@ -8819,8 +8918,11 @@ var WebsyChart = /*#__PURE__*/function () {
8819
8918
  }
8820
8919
 
8821
8920
  function getBarX(d, i, xAxis) {
8822
- var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
8823
- var groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data.series.length;
8921
+ // let barWidth = this.plotWidth / this.options.data[xAxis.replace('Brush', '')].totalValueCount
8922
+ // if (this.options.data[xAxis.replace('Brush', '')].padding) {
8923
+ // barWidth = barWidth - (barWidth * this.options.data[xAxis.replace('Brush', '')].padding)
8924
+ // }
8925
+ // let groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data[xAxis.replace('Brush', '')].totalValueCount
8824
8926
  var output;
8825
8927
 
8826
8928
  if (this.options.orientation === 'horizontal') {
@@ -8839,12 +8941,36 @@ var WebsyChart = /*#__PURE__*/function () {
8839
8941
  output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value < 0 ? 1 : 0);
8840
8942
  }
8841
8943
  } else {
8842
- var _adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this["".concat(xAxis, "Axis")].bandwidth() / 2;
8944
+ // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
8945
+ var _adjustment = this.customBottomRange[i] + i * this.options.data[xAxis.replace('Brush', '')].bandWidth;
8843
8946
 
8844
8947
  if (this.options.grouping === 'grouped') {
8845
- var barAdjustment = groupedBarWidth * index + (xAxis.indexOf('Brush') === -1 ? 5 : 1); // + (index > 0 ? 4 : 0)
8948
+ var xIndex = 0;
8949
+
8950
+ if (this.processedX[d.x.value]) {
8951
+ xIndex = Math.max(0, this.processedX[d.x.value].indexOf(d.y.tooltipLabel));
8952
+ }
8846
8953
 
8847
- output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
8954
+ var barAdjustment = this.options.data[xAxis.replace('Brush', '')].bandWidth * xIndex + xIndex * this.options.groupPadding * 2 + this.options.groupPadding + (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1); // let barAdjustment =
8955
+ // (this.options.data[xAxis.replace('Brush', '')].step * xIndex) +
8956
+ // this.options.groupPadding
8957
+ // // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
8958
+
8959
+ if (this.customBottomRange.length > 0) {
8960
+ output = this.customBottomRange[this[xAxis.replace('Brush', '') + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment;
8961
+ } else {
8962
+ output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
8963
+ }
8964
+
8965
+ if (!this.processedX[d.x.value]) {
8966
+ this.processedX[d.x.value] = [];
8967
+ }
8968
+
8969
+ if (this.processedX[d.x.value].indexOf(d.y.tooltipLabel) === -1) {
8970
+ this.processedX[d.x.value].push(d.y.tooltipLabel);
8971
+ }
8972
+
8973
+ console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output);
8848
8974
  } else {
8849
8975
  // output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + (i * barWidth) + adjustment
8850
8976
  output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)); // + (i * barWidth)
@@ -8859,15 +8985,15 @@ var WebsyChart = /*#__PURE__*/function () {
8859
8985
  }
8860
8986
 
8861
8987
  function getBarY(d, i, heightBounds, yAxis, xAxis) {
8862
- var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
8863
- var groupedBarWidth = (barWidth - 10) / this.options.data.series.length;
8988
+ // let barWidth = this[`${xAxis}Axis`].bandwidth()
8989
+ // let groupedBarWidth = (barWidth - 10) / this.options.data.series.length
8864
8990
  var output;
8865
8991
 
8866
8992
  if (this.options.orientation === 'horizontal') {
8867
8993
  if (this.options.grouping !== 'grouped') {
8868
8994
  output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
8869
8995
  } else {
8870
- output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
8996
+ output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth;
8871
8997
  }
8872
8998
  } else {
8873
8999
  if (this.options.grouping === 'stacked') {
@@ -9049,7 +9175,7 @@ var WebsyChart = /*#__PURE__*/function () {
9049
9175
  return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
9050
9176
  }
9051
9177
  } else {
9052
- return this[xAxis](this.parseX(d.x.value)) + this[xAxis].bandwidth() / 2;
9178
+ return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
9053
9179
  }
9054
9180
  }
9055
9181
 
@@ -9057,7 +9183,7 @@ var WebsyChart = /*#__PURE__*/function () {
9057
9183
  var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
9058
9184
 
9059
9185
  if (this.options.orientation === 'horizontal') {
9060
- return this[xAxis](this.parseX(d.x.value)) + this[xAxis].bandwidth() / 2;
9186
+ return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
9061
9187
  } else {
9062
9188
  if (this.options.grouping === 'stacked') {
9063
9189
  return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
@@ -9075,17 +9201,26 @@ var WebsyChart = /*#__PURE__*/function () {
9075
9201
  /* global series index d3 */
9076
9202
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
9077
9203
  return d3.line().x(function (d) {
9078
- var adjustment = _this52.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this52["".concat(xAxis, "Axis")].bandwidth() / 2;
9079
- return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value)) + adjustment;
9204
+ if (_this52.options.orientation === 'horizontal') {
9205
+ return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9206
+ } else {
9207
+ var adjustment = _this52.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this52["".concat(xAxis, "Axis")].bandwidth() / 2;
9208
+ return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value)) + adjustment;
9209
+ }
9080
9210
  }).y(function (d) {
9081
- return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9211
+ if (_this52.options.orientation === 'horizontal') {
9212
+ var adjustment = _this52.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this52["".concat(xAxis, "Axis")].bandwidth() / 2;
9213
+ return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value)) + adjustment;
9214
+ } else {
9215
+ return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9216
+ }
9082
9217
  }).curve(d3[curveStyle || _this52.options.curveStyle]);
9083
9218
  };
9084
9219
 
9085
9220
  var xAxis = 'bottom';
9086
9221
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
9087
9222
 
9088
- if (this.options.orienation === 'horizontal') {
9223
+ if (this.options.orientation === 'horizontal') {
9089
9224
  xAxis = series.axis === 'secondary' ? 'right' : 'left';
9090
9225
  yAxis = 'bottom';
9091
9226
  }
@@ -9093,7 +9228,7 @@ var WebsyChart = /*#__PURE__*/function () {
9093
9228
  var xBrushAxis = 'bottomBrush';
9094
9229
  var yBrushAxis = 'leftBrush';
9095
9230
 
9096
- if (this.options.orienation === 'horizontal') {
9231
+ if (this.options.orientation === 'horizontal') {
9097
9232
  xBrushAxis = 'leftBrush';
9098
9233
  yBrushAxis = 'bottomBrush';
9099
9234
  }
@@ -9160,8 +9295,6 @@ var WebsyChart = /*#__PURE__*/function () {
9160
9295
  length = this.plotHeight;
9161
9296
  }
9162
9297
 
9163
- this.refLineLayer.selectAll('.reference-line').remove();
9164
- this.refLineLayer.selectAll('.reference-line-label').remove();
9165
9298
  this.refLineLayer.append('line').attr("".concat(yAttr, "1"), this["".concat(yAxis, "Axis")](data.value)).attr("".concat(yAttr, "2"), this["".concat(yAxis, "Axis")](data.value)).attr("".concat(xAttr, "2"), length).attr('class', "reference-line").style('stroke', data.color).style('stroke-width', "".concat(data.lineWidth, "px")).style('stroke-dasharray', data.lineStyle);
9166
9299
 
9167
9300
  if (data.label && data.label !== '') {
@@ -9191,7 +9324,7 @@ var WebsyChart = /*#__PURE__*/function () {
9191
9324
  var xAxis = 'bottom';
9192
9325
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
9193
9326
 
9194
- if (this.options.orienation === 'horizontal') {
9327
+ if (this.options.orientation === 'horizontal') {
9195
9328
  xAxis = series.axis === 'secondary' ? 'right' : 'left';
9196
9329
  yAxis = 'bottom';
9197
9330
  }
@@ -9203,8 +9336,13 @@ var WebsyChart = /*#__PURE__*/function () {
9203
9336
  symbols.attr('d', function (d) {
9204
9337
  return drawSymbol(d.y.size || series.symbolSize)(d);
9205
9338
  }).transition(this.transition).attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('transform', function (d) {
9206
- var adjustment = _this53.options.data[xAxis].scale === 'Time' ? 0 : _this53["".concat(xAxis, "Axis")].bandwidth() / 2;
9207
- return "translate(".concat(_this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment, ", ").concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9339
+ var adjustment = _this53.options.data[xAxis].scale === 'Time' || _this53.options.data[xAxis].scale === 'Linear' ? 0 : _this53["".concat(xAxis, "Axis")].bandwidth() / 2;
9340
+
9341
+ if (_this53.options.orientation === 'horizontal') {
9342
+ return "translate(".concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(_this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment, ")");
9343
+ } else {
9344
+ return "translate(".concat(_this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment, ", ").concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9345
+ }
9208
9346
  }); // Enter
9209
9347
 
9210
9348
  symbols.enter().append('path').attr('d', function (d) {
@@ -9213,8 +9351,13 @@ var WebsyChart = /*#__PURE__*/function () {
9213
9351
  .attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
9214
9352
  return "symbol symbol_".concat(series.key);
9215
9353
  }).attr('transform', function (d) {
9216
- var adjustment = _this53.options.data[xAxis].scale === 'Time' ? 0 : _this53["".concat(xAxis, "Axis")].bandwidth() / 2;
9217
- return "translate(".concat(_this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment, ", ").concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9354
+ var adjustment = _this53.options.data[xAxis].scale === 'Time' || _this53.options.data[xAxis].scale === 'Linear' ? 0 : _this53["".concat(xAxis, "Axis")].bandwidth() / 2;
9355
+
9356
+ if (_this53.options.orientation === 'horizontal') {
9357
+ return "translate(".concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(_this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment, ")");
9358
+ } else {
9359
+ return "translate(".concat(_this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment, ", ").concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9360
+ }
9218
9361
  });
9219
9362
  }
9220
9363
  }, {
@@ -9309,11 +9452,12 @@ var WebsyChart = /*#__PURE__*/function () {
9309
9452
 
9310
9453
  if (el) {
9311
9454
  el.classList.remove('has-error');
9312
- } // const chartEl = document.getElementById(`${this.elementId}_chartContainer`)
9313
- // chartEl.classList.remove('hidden')
9455
+ }
9314
9456
 
9457
+ if (this.svg) {
9458
+ this.svg.classed('hidden', false);
9459
+ }
9315
9460
 
9316
- this.svg.classed('hidden', false);
9317
9461
  var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
9318
9462
 
9319
9463
  if (containerEl) {
@@ -9333,10 +9477,13 @@ var WebsyChart = /*#__PURE__*/function () {
9333
9477
  if (el) {
9334
9478
  el.classList.add('has-error');
9335
9479
  } // const chartEl = document.getElementById(`${this.elementId}_chartContainer`)
9336
- // chartEl.classList.add('hidden')
9480
+ // chartEl.classList.add('hidden')
9481
+
9337
9482
 
9483
+ if (this.svg) {
9484
+ this.svg.classed('hidden', true);
9485
+ }
9338
9486
 
9339
- this.svg.classed('hidden', true);
9340
9487
  var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
9341
9488
 
9342
9489
  if (containerEl) {