@websy/websy-designs 1.4.38 → 1.5.0

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.
@@ -7658,6 +7658,7 @@ var WebsyChart = /*#__PURE__*/function () {
7658
7658
  lineWidth: 2,
7659
7659
  forceZero: true,
7660
7660
  grouping: 'grouped',
7661
+ groupPadding: 3,
7661
7662
  fontSize: 14,
7662
7663
  symbolSize: 20,
7663
7664
  showTrackingLine: true,
@@ -7666,7 +7667,8 @@ var WebsyChart = /*#__PURE__*/function () {
7666
7667
  legendPosition: 'bottom',
7667
7668
  tooltipWidth: 200,
7668
7669
  brushHeight: 50,
7669
- minBandWidth: 30
7670
+ minBandWidth: 30,
7671
+ allowUnevenBands: true
7670
7672
  };
7671
7673
  this.elementId = elementId;
7672
7674
  this.options = _extends({}, DEFAULTS, options);
@@ -7697,24 +7699,39 @@ var WebsyChart = /*#__PURE__*/function () {
7697
7699
  }
7698
7700
 
7699
7701
  xAxis += 'Axis';
7700
-
7701
- var width = _this45[xAxis].step();
7702
-
7703
7702
  var output;
7704
7703
 
7705
- var domain = _toConsumableArray(_this45[xAxis].domain());
7704
+ var width = _this45.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7706
7705
 
7707
- if (_this45.options.orientation === 'horizontal') {
7708
- domain = domain.reverse();
7709
- }
7706
+ if (_this45.customBottomRange) {
7707
+ for (var index = 0; index < _this45.customBottomRange.length; index++) {
7708
+ if (input > _this45.customBottomRange[index]) {
7709
+ if (_this45.customBottomRange[index + 1]) {
7710
+ if (input < _this45.customBottomRange[index + 1]) {
7711
+ output = index;
7712
+ break;
7713
+ }
7714
+ } else {
7715
+ output = index;
7716
+ break;
7717
+ }
7718
+ }
7719
+ }
7720
+ } else {
7721
+ var domain = _toConsumableArray(_this45[xAxis].domain());
7710
7722
 
7711
- for (var j = 0; j < domain.length; j++) {
7712
- var breakA = _this45[xAxis](domain[j]) - width / 2;
7713
- var breakB = breakA + width;
7723
+ if (_this45.options.orientation === 'horizontal') {
7724
+ domain = domain.reverse();
7725
+ }
7714
7726
 
7715
- if (input > breakA && input <= breakB) {
7716
- output = j;
7717
- break;
7727
+ for (var j = 0; j < domain.length; j++) {
7728
+ var breakA = _this45[xAxis](domain[j]) - width / 2;
7729
+ var breakB = breakA + width;
7730
+
7731
+ if (input > breakA && input <= breakB) {
7732
+ output = j;
7733
+ break;
7734
+ }
7718
7735
  }
7719
7736
  }
7720
7737
 
@@ -7734,6 +7751,10 @@ var WebsyChart = /*#__PURE__*/function () {
7734
7751
  xAxisCaps = 'Left';
7735
7752
  }
7736
7753
 
7754
+ if (!that["".concat(xAxis, "Axis")]) {
7755
+ return;
7756
+ }
7757
+
7737
7758
  if (!that["".concat(xAxis, "Axis")].invert) {
7738
7759
  that["".concat(xAxis, "Axis")].invert = that.invertOverride;
7739
7760
  }
@@ -7936,7 +7957,12 @@ var WebsyChart = /*#__PURE__*/function () {
7936
7957
 
7937
7958
  this.options.data.series.forEach(function (s) {
7938
7959
  if (_this46.options.data[xData].scale !== 'Time') {
7939
- xPoint = _this46[xAxis](_this46.parseX(xLabel));
7960
+ if (_this46.customBottomRange && _this46.customBottomRange.length > 0) {
7961
+ xPoint = _this46.customBottomRange[x0] + (_this46.customBottomRange[x0 + 1] - _this46.customBottomRange[x0]) / 2;
7962
+ } else {
7963
+ xPoint = _this46[xAxis](_this46.parseX(xLabel));
7964
+ }
7965
+
7940
7966
  s.data.forEach(function (d) {
7941
7967
  if (d.x.value === xLabel) {
7942
7968
  if (!tooltipTitle) {
@@ -8040,7 +8066,7 @@ var WebsyChart = /*#__PURE__*/function () {
8040
8066
  };
8041
8067
 
8042
8068
  if (xPoint > this.plotWidth / 2) {
8043
- posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15;
8069
+ posOptions.left = xPoint - this.options.tooltipWidth - 15; // + this.options.margin.left + this.options.margin.axisLeft + 15)
8044
8070
 
8045
8071
  if (this.options.data[xData].scale !== 'Time') {
8046
8072
  // posOptions.left -= (this[xAxis].bandwidth())
@@ -8050,7 +8076,7 @@ var WebsyChart = /*#__PURE__*/function () {
8050
8076
  posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15;
8051
8077
 
8052
8078
  if (this.options.data[xData].scale !== 'Time') {
8053
- posOptions.left += this[xAxis].bandwidth() / 2;
8079
+ posOptions.left += this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
8054
8080
  }
8055
8081
  }
8056
8082
 
@@ -8061,7 +8087,7 @@ var WebsyChart = /*#__PURE__*/function () {
8061
8087
  var adjuster = 0;
8062
8088
 
8063
8089
  if (this.options.data[xData].scale !== 'Time') {
8064
- adjuster = this[xAxis].bandwidth() / 2; // - this.options.margin.top
8090
+ adjuster = this.options.data[xAxis.replace('Axis', '')].bandWidth / 2; // - this.options.margin.top
8065
8091
  }
8066
8092
 
8067
8093
  posOptions = {
@@ -8084,8 +8110,8 @@ var WebsyChart = /*#__PURE__*/function () {
8084
8110
  // xPoint = x0
8085
8111
  // }
8086
8112
 
8087
- if (this.options.data[xData].scale !== 'Time') {
8088
- xPoint += this[xAxis].bandwidth() / 2; // - this.options.margin.top
8113
+ if (this.options.data[xData].scale !== 'Time' && this.customBottomRange.length === 0) {
8114
+ xPoint += this.options.data[xAxis.replace('Axis', '')].bandWidth / 2; // - this.options.margin.top
8089
8115
  }
8090
8116
 
8091
8117
  var trackingXStart = xPoint;
@@ -8149,6 +8175,7 @@ var WebsyChart = /*#__PURE__*/function () {
8149
8175
 
8150
8176
  if (!this.options.data) {// tell the user no data has been provided
8151
8177
  } else {
8178
+ this.processedX = {};
8152
8179
  this.transition = d3.transition().duration(this.options.transitionDuration);
8153
8180
 
8154
8181
  if (this.options.data.bottom.scale && this.options.data.bottom.scale === 'Time') {
@@ -8206,12 +8233,18 @@ var WebsyChart = /*#__PURE__*/function () {
8206
8233
  // the legend gets rendered so that we can get its actual size
8207
8234
 
8208
8235
  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
- });
8236
+ var legendData = [];
8237
+
8238
+ if (this.options.legendData && this.options.legendData.length > 0) {
8239
+ legendData = this.options.legendData;
8240
+ } else {
8241
+ this.options.data.series.map(function (s, i) {
8242
+ return {
8243
+ value: s.label || s.key,
8244
+ color: s.color || _this47.options.colors[i % _this47.options.colors.length]
8245
+ };
8246
+ });
8247
+ }
8215
8248
 
8216
8249
  if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
8217
8250
  this.legendArea.style('width', '100%');
@@ -8415,18 +8448,34 @@ var WebsyChart = /*#__PURE__*/function () {
8415
8448
  this.brushNeeded = false;
8416
8449
 
8417
8450
  if (this.options.orientation === 'vertical') {
8451
+ this.options.data.bottom.totalValueCount = this.options.data.bottom.data.reduce(function (a, b) {
8452
+ if (typeof b.valueCount === 'undefined') {
8453
+ return a + 1;
8454
+ }
8455
+
8456
+ return a + b.valueCount;
8457
+ }, 0);
8458
+
8418
8459
  if (this.options.maxBandWidth) {
8419
- this.plotWidth = Math.min(this.plotWidth, (this.options.data.bottom.data || []).length * this.options.maxBandWidth);
8460
+ this.plotWidth = Math.min(this.plotWidth, this.options.data.bottom.totalValueCount * this.options.maxBandWidth);
8420
8461
  } // some if to check if brushing is needed
8421
8462
 
8422
8463
 
8423
- if (this.plotWidth / this.options.data.bottom.data.length < this.options.minBandWidth) {
8464
+ if (this.plotWidth / this.options.data.bottom.totalValueCount < this.options.minBandWidth) {
8424
8465
  this.brushNeeded = true;
8425
8466
  this.plotHeight -= this.options.brushHeight;
8426
8467
  }
8427
8468
  } else {
8428
8469
  // some if to check if brushing is needed
8429
- if (this.plotHeight / this.options.data.left.data.length < this.options.minBandWidth) {
8470
+ this.options.data.left.totalValueCount = this.options.data.left.data.reduce(function (a, b) {
8471
+ if (typeof b.valueCount === 'undefined') {
8472
+ return a + 1;
8473
+ }
8474
+
8475
+ return a + b.valueCount;
8476
+ }, 0);
8477
+
8478
+ if (this.plotHeight / this.options.data.left.totalValueCount < this.options.minBandWidth) {
8430
8479
  this.brushNeeded = true;
8431
8480
  this.plotWidth -= this.options.brushHeight;
8432
8481
  }
@@ -8456,10 +8505,42 @@ var WebsyChart = /*#__PURE__*/function () {
8456
8505
 
8457
8506
  var bottomDomain = this.createDomain('bottom');
8458
8507
  var bottomBrushDomain = this.createDomain('bottom', true);
8459
- this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomDomain).range([0, this.plotWidth]);
8508
+ var bottomRange = [0, this.plotWidth];
8509
+ this.customBottomRange = [];
8510
+
8511
+ if (this.options.allowUnevenBands === true) {
8512
+ 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') {
8513
+ var acc = 0;
8514
+ this.customBottomRange = [0].concat(_toConsumableArray(this.options.data.bottom.data.map(function (d) {
8515
+ acc += d.valueCount;
8516
+ return _this47.plotWidth / _this47.options.data.bottom.totalValueCount * acc;
8517
+ })));
8518
+ }
8519
+ }
8520
+
8521
+ this.options.data.bottom.step = this.plotWidth / this.options.data.bottom.totalValueCount;
8522
+ this.options.data.bottom.bandWidth = this.options.data.bottom.step;
8523
+
8524
+ if (this.options.data.bottom.padding) {
8525
+ this.totalPadding = this.plotWidth * this.options.data.bottom.padding;
8526
+ var rangeLength = bottomDomain.length;
8527
+
8528
+ if (this.customBottomRange.length > 0) {
8529
+ rangeLength = this.customBottomRange.length;
8530
+ }
8531
+
8532
+ this.bandPadding = this.totalPadding / rangeLength / 2;
8533
+ this.options.data.bottom.bandWidth = (this.plotWidth - this.totalPadding) / this.options.data.bottom.totalValueCount;
8534
+ }
8535
+
8536
+ if (this.options.grouping === 'grouped' && this.options.data.series.length > 1) {
8537
+ this.options.data.bottom.bandWidth = this.options.data.bottom.bandWidth - this.options.groupPadding * 2;
8538
+ }
8539
+
8540
+ this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomDomain).range(bottomRange);
8460
8541
 
8461
8542
  if (!this.brushInitialized) {
8462
- this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomBrushDomain).range([0, this.plotWidth]);
8543
+ this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomBrushDomain).range(bottomRange);
8463
8544
  }
8464
8545
 
8465
8546
  if (this.bottomAxis.nice) {// this.bottomAxis.nice()
@@ -8578,6 +8659,12 @@ var WebsyChart = /*#__PURE__*/function () {
8578
8659
  if (this.options.data.bottom.rotate) {
8579
8660
  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
8661
  }
8662
+
8663
+ if (this.customBottomRange.length > 0) {
8664
+ this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8665
+ return "translate(".concat(_this47.customBottomRange[i] + (_this47.customBottomRange[i + 1] - _this47.customBottomRange[i]) / 2, ", 0)");
8666
+ });
8667
+ }
8581
8668
  } // Configure the left axis
8582
8669
 
8583
8670
 
@@ -8695,6 +8782,8 @@ var WebsyChart = /*#__PURE__*/function () {
8695
8782
 
8696
8783
  _this48.renderedKeys[series.key] = series.type;
8697
8784
  });
8785
+ this.refLineLayer.selectAll('.reference-line').remove();
8786
+ this.refLineLayer.selectAll('.reference-line-label').remove();
8698
8787
 
8699
8788
  if (this.options.refLines && this.options.refLines.length > 0) {
8700
8789
  this.options.refLines.forEach(function (l) {
@@ -8710,20 +8799,20 @@ var WebsyChart = /*#__PURE__*/function () {
8710
8799
  /* global d3 series index */
8711
8800
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8712
8801
  return d3.area().x(function (d) {
8713
- return _this49[xAxis](_this49.parseX(d.x.value));
8802
+ return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value));
8714
8803
  }).y0(function (d) {
8715
- return _this49[yAxis](0);
8804
+ return _this49["".concat(yAxis, "Axis")](0);
8716
8805
  }).y1(function (d) {
8717
- return _this49[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
8806
+ return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8718
8807
  }).curve(d3[curveStyle || _this49.options.curveStyle]);
8719
8808
  };
8720
8809
 
8721
- var xAxis = 'bottomAxis';
8722
- var yAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8810
+ var xAxis = 'bottom';
8811
+ var yAxis = series.axis === 'secondary' ? 'right' : 'left';
8723
8812
 
8724
- if (this.options.orienation === 'horizontal') {
8725
- xAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8726
- yAxis = 'bottomAxis';
8813
+ if (this.options.orientation === 'horizontal') {
8814
+ xAxis = series.axis === 'secondary' ? 'right' : 'left';
8815
+ yAxis = 'bottom';
8727
8816
  }
8728
8817
 
8729
8818
  var areas = this.areaLayer.selectAll(".area_".concat(series.key)).data([series.data]); // Exit
@@ -8741,8 +8830,7 @@ var WebsyChart = /*#__PURE__*/function () {
8741
8830
 
8742
8831
  areas.enter().append('path').attr('d', function (d) {
8743
8832
  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)
8833
+ }).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["".concat(xAxis, "Axis")].bandWidth / 2) + ',0)') // .style('stroke-width', series.lineWidth || this.options.lineWidth)
8746
8834
  .attr('fill', series.color) // .style('fill-opacity', 0)
8747
8835
  .attr('stroke', 'transparent') // .transition(this.transition)
8748
8836
  .style('fill-opacity', series.opacity || 0.5);
@@ -8768,14 +8856,14 @@ var WebsyChart = /*#__PURE__*/function () {
8768
8856
 
8769
8857
 
8770
8858
  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
8859
  var output;
8774
8860
 
8775
8861
  if (this.options.orientation === 'horizontal') {
8776
- output = barWidth;
8862
+ output = this.options.data[xAxis.replace('Brush', '')].bandWidth;
8777
8863
  } else {
8778
- if (!getBarX.call(this, d, i, xAxis)) {
8864
+ var x = getBarX.call(this, d, i, xAxis);
8865
+
8866
+ if (typeof x === 'undefined' || x === null) {
8779
8867
  return null;
8780
8868
  }
8781
8869
 
@@ -8790,25 +8878,20 @@ var WebsyChart = /*#__PURE__*/function () {
8790
8878
  }
8791
8879
 
8792
8880
  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
8881
  var output;
8796
8882
 
8797
8883
  if (this.options.orientation === 'horizontal') {
8798
- // let width = this[`${yAxis}Axis`](d.y.value)
8799
8884
  var width = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
8800
8885
  acummulativeY[d.y.index] += width;
8801
8886
  output = width;
8802
8887
  } else {
8803
- if (!getBarX.call(this, d, i, xAxis)) {
8888
+ var x = getBarX.call(this, d, i, xAxis);
8889
+
8890
+ if (typeof x === 'undefined' || x === null) {
8804
8891
  return null;
8805
8892
  }
8806
8893
 
8807
- if (this.options.grouping === 'grouped') {
8808
- output = Math.max(1, groupedBarWidth);
8809
- } else {
8810
- output = Math.max(1, barWidth);
8811
- }
8894
+ output = Math.max(1, this.options.data[xAxis.replace('Brush', '')].bandWidth);
8812
8895
  }
8813
8896
 
8814
8897
  if (isNaN(output)) {
@@ -8819,8 +8902,11 @@ var WebsyChart = /*#__PURE__*/function () {
8819
8902
  }
8820
8903
 
8821
8904
  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;
8905
+ // let barWidth = this.plotWidth / this.options.data[xAxis.replace('Brush', '')].totalValueCount
8906
+ // if (this.options.data[xAxis.replace('Brush', '')].padding) {
8907
+ // barWidth = barWidth - (barWidth * this.options.data[xAxis.replace('Brush', '')].padding)
8908
+ // }
8909
+ // let groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data[xAxis.replace('Brush', '')].totalValueCount
8824
8910
  var output;
8825
8911
 
8826
8912
  if (this.options.orientation === 'horizontal') {
@@ -8839,12 +8925,36 @@ var WebsyChart = /*#__PURE__*/function () {
8839
8925
  output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value < 0 ? 1 : 0);
8840
8926
  }
8841
8927
  } else {
8842
- var _adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this["".concat(xAxis, "Axis")].bandwidth() / 2;
8928
+ // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
8929
+ var _adjustment = this.customBottomRange[i] + i * this.options.data[xAxis.replace('Brush', '')].bandWidth;
8843
8930
 
8844
8931
  if (this.options.grouping === 'grouped') {
8845
- var barAdjustment = groupedBarWidth * index + (xAxis.indexOf('Brush') === -1 ? 5 : 1); // + (index > 0 ? 4 : 0)
8932
+ var xIndex = 0;
8933
+
8934
+ if (this.processedX[d.x.value]) {
8935
+ xIndex = Math.max(0, this.processedX[d.x.value].indexOf(d.y.tooltipLabel));
8936
+ }
8937
+
8938
+ 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 =
8939
+ // (this.options.data[xAxis.replace('Brush', '')].step * xIndex) +
8940
+ // this.options.groupPadding
8941
+ // // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
8942
+
8943
+ if (this.customBottomRange.length > 0) {
8944
+ output = this.customBottomRange[this[xAxis.replace('Brush', '') + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment;
8945
+ } else {
8946
+ output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
8947
+ }
8948
+
8949
+ if (!this.processedX[d.x.value]) {
8950
+ this.processedX[d.x.value] = [];
8951
+ }
8846
8952
 
8847
- output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
8953
+ if (this.processedX[d.x.value].indexOf(d.y.tooltipLabel) === -1) {
8954
+ this.processedX[d.x.value].push(d.y.tooltipLabel);
8955
+ }
8956
+
8957
+ console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output);
8848
8958
  } else {
8849
8959
  // output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + (i * barWidth) + adjustment
8850
8960
  output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)); // + (i * barWidth)
@@ -8859,15 +8969,15 @@ var WebsyChart = /*#__PURE__*/function () {
8859
8969
  }
8860
8970
 
8861
8971
  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;
8972
+ // let barWidth = this[`${xAxis}Axis`].bandwidth()
8973
+ // let groupedBarWidth = (barWidth - 10) / this.options.data.series.length
8864
8974
  var output;
8865
8975
 
8866
8976
  if (this.options.orientation === 'horizontal') {
8867
8977
  if (this.options.grouping !== 'grouped') {
8868
8978
  output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
8869
8979
  } else {
8870
- output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
8980
+ output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth;
8871
8981
  }
8872
8982
  } else {
8873
8983
  if (this.options.grouping === 'stacked') {
@@ -9049,7 +9159,7 @@ var WebsyChart = /*#__PURE__*/function () {
9049
9159
  return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
9050
9160
  }
9051
9161
  } else {
9052
- return this[xAxis](this.parseX(d.x.value)) + this[xAxis].bandwidth() / 2;
9162
+ return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
9053
9163
  }
9054
9164
  }
9055
9165
 
@@ -9057,7 +9167,7 @@ var WebsyChart = /*#__PURE__*/function () {
9057
9167
  var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
9058
9168
 
9059
9169
  if (this.options.orientation === 'horizontal') {
9060
- return this[xAxis](this.parseX(d.x.value)) + this[xAxis].bandwidth() / 2;
9170
+ return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
9061
9171
  } else {
9062
9172
  if (this.options.grouping === 'stacked') {
9063
9173
  return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
@@ -9075,17 +9185,26 @@ var WebsyChart = /*#__PURE__*/function () {
9075
9185
  /* global series index d3 */
9076
9186
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
9077
9187
  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;
9188
+ if (_this52.options.orientation === 'horizontal') {
9189
+ return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9190
+ } else {
9191
+ var adjustment = _this52.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this52["".concat(xAxis, "Axis")].bandwidth() / 2;
9192
+ return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value)) + adjustment;
9193
+ }
9080
9194
  }).y(function (d) {
9081
- return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9195
+ if (_this52.options.orientation === 'horizontal') {
9196
+ var adjustment = _this52.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this52["".concat(xAxis, "Axis")].bandwidth() / 2;
9197
+ return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value)) + adjustment;
9198
+ } else {
9199
+ return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9200
+ }
9082
9201
  }).curve(d3[curveStyle || _this52.options.curveStyle]);
9083
9202
  };
9084
9203
 
9085
9204
  var xAxis = 'bottom';
9086
9205
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
9087
9206
 
9088
- if (this.options.orienation === 'horizontal') {
9207
+ if (this.options.orientation === 'horizontal') {
9089
9208
  xAxis = series.axis === 'secondary' ? 'right' : 'left';
9090
9209
  yAxis = 'bottom';
9091
9210
  }
@@ -9093,7 +9212,7 @@ var WebsyChart = /*#__PURE__*/function () {
9093
9212
  var xBrushAxis = 'bottomBrush';
9094
9213
  var yBrushAxis = 'leftBrush';
9095
9214
 
9096
- if (this.options.orienation === 'horizontal') {
9215
+ if (this.options.orientation === 'horizontal') {
9097
9216
  xBrushAxis = 'leftBrush';
9098
9217
  yBrushAxis = 'bottomBrush';
9099
9218
  }
@@ -9160,8 +9279,6 @@ var WebsyChart = /*#__PURE__*/function () {
9160
9279
  length = this.plotHeight;
9161
9280
  }
9162
9281
 
9163
- this.refLineLayer.selectAll('.reference-line').remove();
9164
- this.refLineLayer.selectAll('.reference-line-label').remove();
9165
9282
  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
9283
 
9167
9284
  if (data.label && data.label !== '') {
@@ -9191,7 +9308,7 @@ var WebsyChart = /*#__PURE__*/function () {
9191
9308
  var xAxis = 'bottom';
9192
9309
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
9193
9310
 
9194
- if (this.options.orienation === 'horizontal') {
9311
+ if (this.options.orientation === 'horizontal') {
9195
9312
  xAxis = series.axis === 'secondary' ? 'right' : 'left';
9196
9313
  yAxis = 'bottom';
9197
9314
  }
@@ -9203,8 +9320,13 @@ var WebsyChart = /*#__PURE__*/function () {
9203
9320
  symbols.attr('d', function (d) {
9204
9321
  return drawSymbol(d.y.size || series.symbolSize)(d);
9205
9322
  }).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), ")");
9323
+ var adjustment = _this53.options.data[xAxis].scale === 'Time' || _this53.options.data[xAxis].scale === 'Linear' ? 0 : _this53["".concat(xAxis, "Axis")].bandwidth() / 2;
9324
+
9325
+ if (_this53.options.orientation === 'horizontal') {
9326
+ 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, ")");
9327
+ } else {
9328
+ 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), ")");
9329
+ }
9208
9330
  }); // Enter
9209
9331
 
9210
9332
  symbols.enter().append('path').attr('d', function (d) {
@@ -9213,8 +9335,13 @@ var WebsyChart = /*#__PURE__*/function () {
9213
9335
  .attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
9214
9336
  return "symbol symbol_".concat(series.key);
9215
9337
  }).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), ")");
9338
+ var adjustment = _this53.options.data[xAxis].scale === 'Time' || _this53.options.data[xAxis].scale === 'Linear' ? 0 : _this53["".concat(xAxis, "Axis")].bandwidth() / 2;
9339
+
9340
+ if (_this53.options.orientation === 'horizontal') {
9341
+ 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, ")");
9342
+ } else {
9343
+ 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), ")");
9344
+ }
9218
9345
  });
9219
9346
  }
9220
9347
  }, {
@@ -9309,11 +9436,12 @@ var WebsyChart = /*#__PURE__*/function () {
9309
9436
 
9310
9437
  if (el) {
9311
9438
  el.classList.remove('has-error');
9312
- } // const chartEl = document.getElementById(`${this.elementId}_chartContainer`)
9313
- // chartEl.classList.remove('hidden')
9439
+ }
9314
9440
 
9441
+ if (this.svg) {
9442
+ this.svg.classed('hidden', false);
9443
+ }
9315
9444
 
9316
- this.svg.classed('hidden', false);
9317
9445
  var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
9318
9446
 
9319
9447
  if (containerEl) {
@@ -9333,10 +9461,13 @@ var WebsyChart = /*#__PURE__*/function () {
9333
9461
  if (el) {
9334
9462
  el.classList.add('has-error');
9335
9463
  } // const chartEl = document.getElementById(`${this.elementId}_chartContainer`)
9336
- // chartEl.classList.add('hidden')
9464
+ // chartEl.classList.add('hidden')
9337
9465
 
9338
9466
 
9339
- this.svg.classed('hidden', true);
9467
+ if (this.svg) {
9468
+ this.svg.classed('hidden', true);
9469
+ }
9470
+
9340
9471
  var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
9341
9472
 
9342
9473
  if (containerEl) {