@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.
@@ -7182,6 +7182,7 @@ var WebsyChart = /*#__PURE__*/function () {
7182
7182
  lineWidth: 2,
7183
7183
  forceZero: true,
7184
7184
  grouping: 'grouped',
7185
+ groupPadding: 3,
7185
7186
  fontSize: 14,
7186
7187
  symbolSize: 20,
7187
7188
  showTrackingLine: true,
@@ -7190,7 +7191,8 @@ var WebsyChart = /*#__PURE__*/function () {
7190
7191
  legendPosition: 'bottom',
7191
7192
  tooltipWidth: 200,
7192
7193
  brushHeight: 50,
7193
- minBandWidth: 30
7194
+ minBandWidth: 30,
7195
+ allowUnevenBands: true
7194
7196
  };
7195
7197
  this.elementId = elementId;
7196
7198
  this.options = _extends({}, DEFAULTS, options);
@@ -7221,24 +7223,39 @@ var WebsyChart = /*#__PURE__*/function () {
7221
7223
  }
7222
7224
 
7223
7225
  xAxis += 'Axis';
7224
-
7225
- var width = _this42[xAxis].step();
7226
-
7227
7226
  var output;
7228
7227
 
7229
- var domain = _toConsumableArray(_this42[xAxis].domain());
7228
+ var width = _this42.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7230
7229
 
7231
- if (_this42.options.orientation === 'horizontal') {
7232
- domain = domain.reverse();
7233
- }
7230
+ if (_this42.customBottomRange) {
7231
+ for (var index = 0; index < _this42.customBottomRange.length; index++) {
7232
+ if (input > _this42.customBottomRange[index]) {
7233
+ if (_this42.customBottomRange[index + 1]) {
7234
+ if (input < _this42.customBottomRange[index + 1]) {
7235
+ output = index;
7236
+ break;
7237
+ }
7238
+ } else {
7239
+ output = index;
7240
+ break;
7241
+ }
7242
+ }
7243
+ }
7244
+ } else {
7245
+ var domain = _toConsumableArray(_this42[xAxis].domain());
7234
7246
 
7235
- for (var j = 0; j < domain.length; j++) {
7236
- var breakA = _this42[xAxis](domain[j]) - width / 2;
7237
- var breakB = breakA + width;
7247
+ if (_this42.options.orientation === 'horizontal') {
7248
+ domain = domain.reverse();
7249
+ }
7238
7250
 
7239
- if (input > breakA && input <= breakB) {
7240
- output = j;
7241
- break;
7251
+ for (var j = 0; j < domain.length; j++) {
7252
+ var breakA = _this42[xAxis](domain[j]) - width / 2;
7253
+ var breakB = breakA + width;
7254
+
7255
+ if (input > breakA && input <= breakB) {
7256
+ output = j;
7257
+ break;
7258
+ }
7242
7259
  }
7243
7260
  }
7244
7261
 
@@ -7258,6 +7275,10 @@ var WebsyChart = /*#__PURE__*/function () {
7258
7275
  xAxisCaps = 'Left';
7259
7276
  }
7260
7277
 
7278
+ if (!that["".concat(xAxis, "Axis")]) {
7279
+ return;
7280
+ }
7281
+
7261
7282
  if (!that["".concat(xAxis, "Axis")].invert) {
7262
7283
  that["".concat(xAxis, "Axis")].invert = that.invertOverride;
7263
7284
  }
@@ -7460,7 +7481,12 @@ var WebsyChart = /*#__PURE__*/function () {
7460
7481
 
7461
7482
  this.options.data.series.forEach(function (s) {
7462
7483
  if (_this43.options.data[xData].scale !== 'Time') {
7463
- xPoint = _this43[xAxis](_this43.parseX(xLabel));
7484
+ if (_this43.customBottomRange && _this43.customBottomRange.length > 0) {
7485
+ xPoint = _this43.customBottomRange[x0] + (_this43.customBottomRange[x0 + 1] - _this43.customBottomRange[x0]) / 2;
7486
+ } else {
7487
+ xPoint = _this43[xAxis](_this43.parseX(xLabel));
7488
+ }
7489
+
7464
7490
  s.data.forEach(function (d) {
7465
7491
  if (d.x.value === xLabel) {
7466
7492
  if (!tooltipTitle) {
@@ -7564,7 +7590,7 @@ var WebsyChart = /*#__PURE__*/function () {
7564
7590
  };
7565
7591
 
7566
7592
  if (xPoint > this.plotWidth / 2) {
7567
- posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15;
7593
+ posOptions.left = xPoint - this.options.tooltipWidth - 15; // + this.options.margin.left + this.options.margin.axisLeft + 15)
7568
7594
 
7569
7595
  if (this.options.data[xData].scale !== 'Time') {
7570
7596
  // posOptions.left -= (this[xAxis].bandwidth())
@@ -7574,7 +7600,7 @@ var WebsyChart = /*#__PURE__*/function () {
7574
7600
  posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15;
7575
7601
 
7576
7602
  if (this.options.data[xData].scale !== 'Time') {
7577
- posOptions.left += this[xAxis].bandwidth() / 2;
7603
+ posOptions.left += this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
7578
7604
  }
7579
7605
  }
7580
7606
 
@@ -7585,7 +7611,7 @@ var WebsyChart = /*#__PURE__*/function () {
7585
7611
  var adjuster = 0;
7586
7612
 
7587
7613
  if (this.options.data[xData].scale !== 'Time') {
7588
- adjuster = this[xAxis].bandwidth() / 2; // - this.options.margin.top
7614
+ adjuster = this.options.data[xAxis.replace('Axis', '')].bandWidth / 2; // - this.options.margin.top
7589
7615
  }
7590
7616
 
7591
7617
  posOptions = {
@@ -7608,8 +7634,8 @@ var WebsyChart = /*#__PURE__*/function () {
7608
7634
  // xPoint = x0
7609
7635
  // }
7610
7636
 
7611
- if (this.options.data[xData].scale !== 'Time') {
7612
- xPoint += this[xAxis].bandwidth() / 2; // - this.options.margin.top
7637
+ if (this.options.data[xData].scale !== 'Time' && this.customBottomRange.length === 0) {
7638
+ xPoint += this.options.data[xAxis.replace('Axis', '')].bandWidth / 2; // - this.options.margin.top
7613
7639
  }
7614
7640
 
7615
7641
  var trackingXStart = xPoint;
@@ -7673,6 +7699,7 @@ var WebsyChart = /*#__PURE__*/function () {
7673
7699
 
7674
7700
  if (!this.options.data) {// tell the user no data has been provided
7675
7701
  } else {
7702
+ this.processedX = {};
7676
7703
  this.transition = d3.transition().duration(this.options.transitionDuration);
7677
7704
 
7678
7705
  if (this.options.data.bottom.scale && this.options.data.bottom.scale === 'Time') {
@@ -7730,12 +7757,18 @@ var WebsyChart = /*#__PURE__*/function () {
7730
7757
  // the legend gets rendered so that we can get its actual size
7731
7758
 
7732
7759
  if (this.options.showLegend === true) {
7733
- var legendData = this.options.data.series.map(function (s, i) {
7734
- return {
7735
- value: s.label || s.key,
7736
- color: s.color || _this44.options.colors[i % _this44.options.colors.length]
7737
- };
7738
- });
7760
+ var legendData = [];
7761
+
7762
+ if (this.options.legendData && this.options.legendData.length > 0) {
7763
+ legendData = this.options.legendData;
7764
+ } else {
7765
+ this.options.data.series.map(function (s, i) {
7766
+ return {
7767
+ value: s.label || s.key,
7768
+ color: s.color || _this44.options.colors[i % _this44.options.colors.length]
7769
+ };
7770
+ });
7771
+ }
7739
7772
 
7740
7773
  if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
7741
7774
  this.legendArea.style('width', '100%');
@@ -7939,18 +7972,34 @@ var WebsyChart = /*#__PURE__*/function () {
7939
7972
  this.brushNeeded = false;
7940
7973
 
7941
7974
  if (this.options.orientation === 'vertical') {
7975
+ this.options.data.bottom.totalValueCount = this.options.data.bottom.data.reduce(function (a, b) {
7976
+ if (typeof b.valueCount === 'undefined') {
7977
+ return a + 1;
7978
+ }
7979
+
7980
+ return a + b.valueCount;
7981
+ }, 0);
7982
+
7942
7983
  if (this.options.maxBandWidth) {
7943
- this.plotWidth = Math.min(this.plotWidth, (this.options.data.bottom.data || []).length * this.options.maxBandWidth);
7984
+ this.plotWidth = Math.min(this.plotWidth, this.options.data.bottom.totalValueCount * this.options.maxBandWidth);
7944
7985
  } // some if to check if brushing is needed
7945
7986
 
7946
7987
 
7947
- if (this.plotWidth / this.options.data.bottom.data.length < this.options.minBandWidth) {
7988
+ if (this.plotWidth / this.options.data.bottom.totalValueCount < this.options.minBandWidth) {
7948
7989
  this.brushNeeded = true;
7949
7990
  this.plotHeight -= this.options.brushHeight;
7950
7991
  }
7951
7992
  } else {
7952
7993
  // some if to check if brushing is needed
7953
- if (this.plotHeight / this.options.data.left.data.length < this.options.minBandWidth) {
7994
+ this.options.data.left.totalValueCount = this.options.data.left.data.reduce(function (a, b) {
7995
+ if (typeof b.valueCount === 'undefined') {
7996
+ return a + 1;
7997
+ }
7998
+
7999
+ return a + b.valueCount;
8000
+ }, 0);
8001
+
8002
+ if (this.plotHeight / this.options.data.left.totalValueCount < this.options.minBandWidth) {
7954
8003
  this.brushNeeded = true;
7955
8004
  this.plotWidth -= this.options.brushHeight;
7956
8005
  }
@@ -7980,10 +8029,42 @@ var WebsyChart = /*#__PURE__*/function () {
7980
8029
 
7981
8030
  var bottomDomain = this.createDomain('bottom');
7982
8031
  var bottomBrushDomain = this.createDomain('bottom', true);
7983
- this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomDomain).range([0, this.plotWidth]);
8032
+ var bottomRange = [0, this.plotWidth];
8033
+ this.customBottomRange = [];
8034
+
8035
+ if (this.options.allowUnevenBands === true) {
8036
+ 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') {
8037
+ var acc = 0;
8038
+ this.customBottomRange = [0].concat(_toConsumableArray(this.options.data.bottom.data.map(function (d) {
8039
+ acc += d.valueCount;
8040
+ return _this44.plotWidth / _this44.options.data.bottom.totalValueCount * acc;
8041
+ })));
8042
+ }
8043
+ }
8044
+
8045
+ this.options.data.bottom.step = this.plotWidth / this.options.data.bottom.totalValueCount;
8046
+ this.options.data.bottom.bandWidth = this.options.data.bottom.step;
8047
+
8048
+ if (this.options.data.bottom.padding) {
8049
+ this.totalPadding = this.plotWidth * this.options.data.bottom.padding;
8050
+ var rangeLength = bottomDomain.length;
8051
+
8052
+ if (this.customBottomRange.length > 0) {
8053
+ rangeLength = this.customBottomRange.length;
8054
+ }
8055
+
8056
+ this.bandPadding = this.totalPadding / rangeLength / 2;
8057
+ this.options.data.bottom.bandWidth = (this.plotWidth - this.totalPadding) / this.options.data.bottom.totalValueCount;
8058
+ }
8059
+
8060
+ if (this.options.grouping === 'grouped' && this.options.data.series.length > 1) {
8061
+ this.options.data.bottom.bandWidth = this.options.data.bottom.bandWidth - this.options.groupPadding * 2;
8062
+ }
8063
+
8064
+ this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomDomain).range(bottomRange);
7984
8065
 
7985
8066
  if (!this.brushInitialized) {
7986
- this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomBrushDomain).range([0, this.plotWidth]);
8067
+ this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomBrushDomain).range(bottomRange);
7987
8068
  }
7988
8069
 
7989
8070
  if (this.bottomAxis.nice) {// this.bottomAxis.nice()
@@ -8102,6 +8183,12 @@ var WebsyChart = /*#__PURE__*/function () {
8102
8183
  if (this.options.data.bottom.rotate) {
8103
8184
  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"));
8104
8185
  }
8186
+
8187
+ if (this.customBottomRange.length > 0) {
8188
+ this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8189
+ return "translate(".concat(_this44.customBottomRange[i] + (_this44.customBottomRange[i + 1] - _this44.customBottomRange[i]) / 2, ", 0)");
8190
+ });
8191
+ }
8105
8192
  } // Configure the left axis
8106
8193
 
8107
8194
 
@@ -8219,6 +8306,8 @@ var WebsyChart = /*#__PURE__*/function () {
8219
8306
 
8220
8307
  _this45.renderedKeys[series.key] = series.type;
8221
8308
  });
8309
+ this.refLineLayer.selectAll('.reference-line').remove();
8310
+ this.refLineLayer.selectAll('.reference-line-label').remove();
8222
8311
 
8223
8312
  if (this.options.refLines && this.options.refLines.length > 0) {
8224
8313
  this.options.refLines.forEach(function (l) {
@@ -8234,20 +8323,20 @@ var WebsyChart = /*#__PURE__*/function () {
8234
8323
  /* global d3 series index */
8235
8324
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8236
8325
  return d3.area().x(function (d) {
8237
- return _this46[xAxis](_this46.parseX(d.x.value));
8326
+ return _this46["".concat(xAxis, "Axis")](_this46.parseX(d.x.value));
8238
8327
  }).y0(function (d) {
8239
- return _this46[yAxis](0);
8328
+ return _this46["".concat(yAxis, "Axis")](0);
8240
8329
  }).y1(function (d) {
8241
- return _this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
8330
+ return _this46["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8242
8331
  }).curve(d3[curveStyle || _this46.options.curveStyle]);
8243
8332
  };
8244
8333
 
8245
- var xAxis = 'bottomAxis';
8246
- var yAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8334
+ var xAxis = 'bottom';
8335
+ var yAxis = series.axis === 'secondary' ? 'right' : 'left';
8247
8336
 
8248
- if (this.options.orienation === 'horizontal') {
8249
- xAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8250
- yAxis = 'bottomAxis';
8337
+ if (this.options.orientation === 'horizontal') {
8338
+ xAxis = series.axis === 'secondary' ? 'right' : 'left';
8339
+ yAxis = 'bottom';
8251
8340
  }
8252
8341
 
8253
8342
  var areas = this.areaLayer.selectAll(".area_".concat(series.key)).data([series.data]); // Exit
@@ -8265,8 +8354,7 @@ var WebsyChart = /*#__PURE__*/function () {
8265
8354
 
8266
8355
  areas.enter().append('path').attr('d', function (d) {
8267
8356
  return drawArea(xAxis, yAxis, series.curveStyle)(d);
8268
- }).attr('class', "area_".concat(series.key)).attr('id', "area_".concat(series.key)) // .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
8269
- // .style('stroke-width', series.lineWidth || this.options.lineWidth)
8357
+ }).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)
8270
8358
  .attr('fill', series.color) // .style('fill-opacity', 0)
8271
8359
  .attr('stroke', 'transparent') // .transition(this.transition)
8272
8360
  .style('fill-opacity', series.opacity || 0.5);
@@ -8292,14 +8380,14 @@ var WebsyChart = /*#__PURE__*/function () {
8292
8380
 
8293
8381
 
8294
8382
  function getBarHeight(d, i, heightBounds, yAxis, xAxis) {
8295
- var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
8296
- var groupedBarWidth = (barWidth - 10) / this.options.data.series.length;
8297
8383
  var output;
8298
8384
 
8299
8385
  if (this.options.orientation === 'horizontal') {
8300
- output = barWidth;
8386
+ output = this.options.data[xAxis.replace('Brush', '')].bandWidth;
8301
8387
  } else {
8302
- if (!getBarX.call(this, d, i, xAxis)) {
8388
+ var x = getBarX.call(this, d, i, xAxis);
8389
+
8390
+ if (typeof x === 'undefined' || x === null) {
8303
8391
  return null;
8304
8392
  }
8305
8393
 
@@ -8314,25 +8402,20 @@ var WebsyChart = /*#__PURE__*/function () {
8314
8402
  }
8315
8403
 
8316
8404
  function getBarWidth(d, i, xAxis) {
8317
- var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
8318
- var groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data.series.length;
8319
8405
  var output;
8320
8406
 
8321
8407
  if (this.options.orientation === 'horizontal') {
8322
- // let width = this[`${yAxis}Axis`](d.y.value)
8323
8408
  var width = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
8324
8409
  acummulativeY[d.y.index] += width;
8325
8410
  output = width;
8326
8411
  } else {
8327
- if (!getBarX.call(this, d, i, xAxis)) {
8412
+ var x = getBarX.call(this, d, i, xAxis);
8413
+
8414
+ if (typeof x === 'undefined' || x === null) {
8328
8415
  return null;
8329
8416
  }
8330
8417
 
8331
- if (this.options.grouping === 'grouped') {
8332
- output = Math.max(1, groupedBarWidth);
8333
- } else {
8334
- output = Math.max(1, barWidth);
8335
- }
8418
+ output = Math.max(1, this.options.data[xAxis.replace('Brush', '')].bandWidth);
8336
8419
  }
8337
8420
 
8338
8421
  if (isNaN(output)) {
@@ -8343,8 +8426,11 @@ var WebsyChart = /*#__PURE__*/function () {
8343
8426
  }
8344
8427
 
8345
8428
  function getBarX(d, i, xAxis) {
8346
- var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
8347
- var groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data.series.length;
8429
+ // let barWidth = this.plotWidth / this.options.data[xAxis.replace('Brush', '')].totalValueCount
8430
+ // if (this.options.data[xAxis.replace('Brush', '')].padding) {
8431
+ // barWidth = barWidth - (barWidth * this.options.data[xAxis.replace('Brush', '')].padding)
8432
+ // }
8433
+ // let groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data[xAxis.replace('Brush', '')].totalValueCount
8348
8434
  var output;
8349
8435
 
8350
8436
  if (this.options.orientation === 'horizontal') {
@@ -8363,12 +8449,36 @@ var WebsyChart = /*#__PURE__*/function () {
8363
8449
  output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value < 0 ? 1 : 0);
8364
8450
  }
8365
8451
  } else {
8366
- var _adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this["".concat(xAxis, "Axis")].bandwidth() / 2;
8452
+ // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
8453
+ var _adjustment = this.customBottomRange[i] + i * this.options.data[xAxis.replace('Brush', '')].bandWidth;
8367
8454
 
8368
8455
  if (this.options.grouping === 'grouped') {
8369
- var barAdjustment = groupedBarWidth * index + (xAxis.indexOf('Brush') === -1 ? 5 : 1); // + (index > 0 ? 4 : 0)
8456
+ var xIndex = 0;
8457
+
8458
+ if (this.processedX[d.x.value]) {
8459
+ xIndex = Math.max(0, this.processedX[d.x.value].indexOf(d.y.tooltipLabel));
8460
+ }
8461
+
8462
+ 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 =
8463
+ // (this.options.data[xAxis.replace('Brush', '')].step * xIndex) +
8464
+ // this.options.groupPadding
8465
+ // // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
8466
+
8467
+ if (this.customBottomRange.length > 0) {
8468
+ output = this.customBottomRange[this[xAxis.replace('Brush', '') + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment;
8469
+ } else {
8470
+ output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
8471
+ }
8472
+
8473
+ if (!this.processedX[d.x.value]) {
8474
+ this.processedX[d.x.value] = [];
8475
+ }
8370
8476
 
8371
- output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
8477
+ if (this.processedX[d.x.value].indexOf(d.y.tooltipLabel) === -1) {
8478
+ this.processedX[d.x.value].push(d.y.tooltipLabel);
8479
+ }
8480
+
8481
+ console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output);
8372
8482
  } else {
8373
8483
  // output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + (i * barWidth) + adjustment
8374
8484
  output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)); // + (i * barWidth)
@@ -8383,15 +8493,15 @@ var WebsyChart = /*#__PURE__*/function () {
8383
8493
  }
8384
8494
 
8385
8495
  function getBarY(d, i, heightBounds, yAxis, xAxis) {
8386
- var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
8387
- var groupedBarWidth = (barWidth - 10) / this.options.data.series.length;
8496
+ // let barWidth = this[`${xAxis}Axis`].bandwidth()
8497
+ // let groupedBarWidth = (barWidth - 10) / this.options.data.series.length
8388
8498
  var output;
8389
8499
 
8390
8500
  if (this.options.orientation === 'horizontal') {
8391
8501
  if (this.options.grouping !== 'grouped') {
8392
8502
  output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
8393
8503
  } else {
8394
- output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
8504
+ output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth;
8395
8505
  }
8396
8506
  } else {
8397
8507
  if (this.options.grouping === 'stacked') {
@@ -8573,7 +8683,7 @@ var WebsyChart = /*#__PURE__*/function () {
8573
8683
  return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
8574
8684
  }
8575
8685
  } else {
8576
- return this[xAxis](this.parseX(d.x.value)) + this[xAxis].bandwidth() / 2;
8686
+ return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
8577
8687
  }
8578
8688
  }
8579
8689
 
@@ -8581,7 +8691,7 @@ var WebsyChart = /*#__PURE__*/function () {
8581
8691
  var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
8582
8692
 
8583
8693
  if (this.options.orientation === 'horizontal') {
8584
- return this[xAxis](this.parseX(d.x.value)) + this[xAxis].bandwidth() / 2;
8694
+ return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
8585
8695
  } else {
8586
8696
  if (this.options.grouping === 'stacked') {
8587
8697
  return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
@@ -8599,17 +8709,26 @@ var WebsyChart = /*#__PURE__*/function () {
8599
8709
  /* global series index d3 */
8600
8710
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
8601
8711
  return d3.line().x(function (d) {
8602
- var adjustment = _this49.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this49["".concat(xAxis, "Axis")].bandwidth() / 2;
8603
- return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value)) + adjustment;
8712
+ if (_this49.options.orientation === 'horizontal') {
8713
+ return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8714
+ } else {
8715
+ var adjustment = _this49.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this49["".concat(xAxis, "Axis")].bandwidth() / 2;
8716
+ return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value)) + adjustment;
8717
+ }
8604
8718
  }).y(function (d) {
8605
- return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8719
+ if (_this49.options.orientation === 'horizontal') {
8720
+ var adjustment = _this49.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this49["".concat(xAxis, "Axis")].bandwidth() / 2;
8721
+ return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value)) + adjustment;
8722
+ } else {
8723
+ return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8724
+ }
8606
8725
  }).curve(d3[curveStyle || _this49.options.curveStyle]);
8607
8726
  };
8608
8727
 
8609
8728
  var xAxis = 'bottom';
8610
8729
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
8611
8730
 
8612
- if (this.options.orienation === 'horizontal') {
8731
+ if (this.options.orientation === 'horizontal') {
8613
8732
  xAxis = series.axis === 'secondary' ? 'right' : 'left';
8614
8733
  yAxis = 'bottom';
8615
8734
  }
@@ -8617,7 +8736,7 @@ var WebsyChart = /*#__PURE__*/function () {
8617
8736
  var xBrushAxis = 'bottomBrush';
8618
8737
  var yBrushAxis = 'leftBrush';
8619
8738
 
8620
- if (this.options.orienation === 'horizontal') {
8739
+ if (this.options.orientation === 'horizontal') {
8621
8740
  xBrushAxis = 'leftBrush';
8622
8741
  yBrushAxis = 'bottomBrush';
8623
8742
  }
@@ -8684,8 +8803,6 @@ var WebsyChart = /*#__PURE__*/function () {
8684
8803
  length = this.plotHeight;
8685
8804
  }
8686
8805
 
8687
- this.refLineLayer.selectAll('.reference-line').remove();
8688
- this.refLineLayer.selectAll('.reference-line-label').remove();
8689
8806
  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);
8690
8807
 
8691
8808
  if (data.label && data.label !== '') {
@@ -8715,7 +8832,7 @@ var WebsyChart = /*#__PURE__*/function () {
8715
8832
  var xAxis = 'bottom';
8716
8833
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
8717
8834
 
8718
- if (this.options.orienation === 'horizontal') {
8835
+ if (this.options.orientation === 'horizontal') {
8719
8836
  xAxis = series.axis === 'secondary' ? 'right' : 'left';
8720
8837
  yAxis = 'bottom';
8721
8838
  }
@@ -8727,8 +8844,13 @@ var WebsyChart = /*#__PURE__*/function () {
8727
8844
  symbols.attr('d', function (d) {
8728
8845
  return drawSymbol(d.y.size || series.symbolSize)(d);
8729
8846
  }).transition(this.transition).attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('transform', function (d) {
8730
- var adjustment = _this50.options.data[xAxis].scale === 'Time' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
8731
- return "translate(".concat(_this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment, ", ").concat(_this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
8847
+ var adjustment = _this50.options.data[xAxis].scale === 'Time' || _this50.options.data[xAxis].scale === 'Linear' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
8848
+
8849
+ if (_this50.options.orientation === 'horizontal') {
8850
+ return "translate(".concat(_this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(_this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment, ")");
8851
+ } else {
8852
+ return "translate(".concat(_this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment, ", ").concat(_this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
8853
+ }
8732
8854
  }); // Enter
8733
8855
 
8734
8856
  symbols.enter().append('path').attr('d', function (d) {
@@ -8737,8 +8859,13 @@ var WebsyChart = /*#__PURE__*/function () {
8737
8859
  .attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
8738
8860
  return "symbol symbol_".concat(series.key);
8739
8861
  }).attr('transform', function (d) {
8740
- var adjustment = _this50.options.data[xAxis].scale === 'Time' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
8741
- return "translate(".concat(_this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment, ", ").concat(_this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
8862
+ var adjustment = _this50.options.data[xAxis].scale === 'Time' || _this50.options.data[xAxis].scale === 'Linear' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
8863
+
8864
+ if (_this50.options.orientation === 'horizontal') {
8865
+ return "translate(".concat(_this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(_this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment, ")");
8866
+ } else {
8867
+ return "translate(".concat(_this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment, ", ").concat(_this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
8868
+ }
8742
8869
  });
8743
8870
  }
8744
8871
  }, {
@@ -8833,11 +8960,12 @@ var WebsyChart = /*#__PURE__*/function () {
8833
8960
 
8834
8961
  if (el) {
8835
8962
  el.classList.remove('has-error');
8836
- } // const chartEl = document.getElementById(`${this.elementId}_chartContainer`)
8837
- // chartEl.classList.remove('hidden')
8963
+ }
8838
8964
 
8965
+ if (this.svg) {
8966
+ this.svg.classed('hidden', false);
8967
+ }
8839
8968
 
8840
- this.svg.classed('hidden', false);
8841
8969
  var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
8842
8970
 
8843
8971
  if (containerEl) {
@@ -8857,10 +8985,13 @@ var WebsyChart = /*#__PURE__*/function () {
8857
8985
  if (el) {
8858
8986
  el.classList.add('has-error');
8859
8987
  } // const chartEl = document.getElementById(`${this.elementId}_chartContainer`)
8860
- // chartEl.classList.add('hidden')
8988
+ // chartEl.classList.add('hidden')
8861
8989
 
8862
8990
 
8863
- this.svg.classed('hidden', true);
8991
+ if (this.svg) {
8992
+ this.svg.classed('hidden', true);
8993
+ }
8994
+
8864
8995
  var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
8865
8996
 
8866
8997
  if (containerEl) {