@websy/websy-designs 1.6.0 → 1.6.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.
@@ -3897,15 +3897,18 @@ class WebsyRouter {
3897
3897
  let inputPath = this.currentView
3898
3898
  if (this.options.urlPrefix) {
3899
3899
  inputPath = `/${this.options.urlPrefix}/${inputPath}`
3900
+ }
3901
+ this.currentParams = {
3902
+ path: '',
3903
+ items: {}
3900
3904
  }
3901
3905
  if (reloadView === true) {
3902
3906
  this.navigate(`${inputPath}`, 'main', null, noHistory)
3903
3907
  }
3904
3908
  else {
3905
- this.currentParams = {
3906
- path: '',
3907
- items: {}
3908
- }
3909
+ history.replaceState({
3910
+ inputPath
3911
+ }, 'unused', inputPath)
3909
3912
  }
3910
3913
  }
3911
3914
  buildUrlPath (params) {
@@ -7475,9 +7478,9 @@ else {
7475
7478
  this.brushLayer
7476
7479
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
7477
7480
  this.clip
7478
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7481
+ .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, 0)`)
7479
7482
  .attr('width', this.plotWidth)
7480
- .attr('height', this.plotHeight)
7483
+ .attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop)
7481
7484
  this.xAxisClip
7482
7485
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7483
7486
  .attr('width', this.plotWidth + this.options.margin.axisLeft)
@@ -7777,7 +7780,11 @@ else {
7777
7780
  }
7778
7781
  return d
7779
7782
  })
7780
- )
7783
+ )
7784
+ if (this.customLeftRange.length > 0) {
7785
+ this.leftAxisLayer.selectAll('g')
7786
+ .attr('transform', (d, i) => `translate(0, ${this.customLeftRange[i] + ((this.customLeftRange[i + 1] - this.customLeftRange[i]) / 2)})`)
7787
+ }
7781
7788
  }
7782
7789
  if (this.options.data.left && this.options.data.left.showTitle === true) {
7783
7790
  this.leftAxisLabel.selectAll('.title').remove()
@@ -7873,7 +7880,11 @@ else {
7873
7880
  for (const key in this.renderedKeys) {
7874
7881
  if (newKeys.indexOf(key) === -1) {
7875
7882
  // remove the components
7876
- this[`remove${this.renderedKeys[key]}`](key)
7883
+ // this[`remove${this.renderedKeys[key]}`](key)
7884
+ this.removeline(key)
7885
+ this.removebar(key)
7886
+ this.removesymbol(key)
7887
+ this.removelabel(key)
7877
7888
  }
7878
7889
  }
7879
7890
  this.renderComponents()
@@ -7971,10 +7982,10 @@ if (this.options.orientation === 'horizontal') {
7971
7982
  xAxis = 'left'
7972
7983
  yAxis = 'bottom'
7973
7984
  }
7974
- function getBarHeight (d, i, heightBounds, yAxis, xAxis) {
7985
+ function getBarHeight (d, i, yAxis, xAxis) {
7975
7986
  let output
7976
7987
  if (this.options.orientation === 'horizontal') {
7977
- output = this.options.data[xAxis].bandWidth
7988
+ output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2))
7978
7989
  }
7979
7990
  else {
7980
7991
  let x = getBarX.call(this, d, i, xAxis)
@@ -7991,9 +8002,7 @@ function getBarHeight (d, i, heightBounds, yAxis, xAxis) {
7991
8002
  function getBarWidth (d, i, xAxis) {
7992
8003
  let output
7993
8004
  if (this.options.orientation === 'horizontal') {
7994
- let width = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
7995
- acummulativeY[d.y.index] += width
7996
- output = width
8005
+ output = this[`${yAxis}Axis`](Math.abs(d.y.value))
7997
8006
  }
7998
8007
  else {
7999
8008
  let x = getBarX.call(this, d, i, xAxis)
@@ -8011,12 +8020,15 @@ function getBarX (d, i, xAxis) {
8011
8020
  let output
8012
8021
  if (this.options.orientation === 'horizontal') {
8013
8022
  if (this.options.grouping === 'stacked') {
8014
- let h = getBarWidth.call(this, d, i, xAxis)
8015
- let adjustment = 0
8016
- if (d.y.accumulative && d.y.accumulative !== 0) {
8017
- adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
8018
- }
8019
- output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
8023
+ // let h = getBarWidth.call(this, d, i, xAxis)
8024
+ // let adjustment = 0
8025
+ // if (d.y.accumulative && d.y.accumulative !== 0) {
8026
+ // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
8027
+ // }
8028
+ // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
8029
+ let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
8030
+ // let h = getBarWidth.call(this, d, i, xAxis)
8031
+ output = (accH * (d.y.accumulative < 0 ? 0 : 1))
8020
8032
  }
8021
8033
  else {
8022
8034
  let h = getBarWidth.call(this, d, i, xAxis)
@@ -8055,8 +8067,9 @@ function getBarX (d, i, xAxis) {
8055
8067
  }
8056
8068
  // console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output)
8057
8069
  }
8058
- else {
8059
- output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)]
8070
+ else {
8071
+ let barAdjustment = ((xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2) + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding)
8072
+ output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment
8060
8073
  }
8061
8074
  }
8062
8075
  if (isNaN(output)) {
@@ -8064,11 +8077,12 @@ function getBarX (d, i, xAxis) {
8064
8077
  }
8065
8078
  return output
8066
8079
  }
8067
- function getBarY (d, i, heightBounds, yAxis, xAxis) {
8080
+ function getBarY (d, i, yAxis, xAxis) {
8068
8081
  let output
8069
8082
  if (this.options.orientation === 'horizontal') {
8070
8083
  if (this.options.grouping !== 'grouped') {
8071
- output = this[`${xAxis}Axis`](this.parseX(d.x.value))
8084
+ let barAdjustment = ((xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2) + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding)
8085
+ output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment
8072
8086
  }
8073
8087
  else {
8074
8088
  output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + ((d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth)
@@ -8076,13 +8090,12 @@ function getBarY (d, i, heightBounds, yAxis, xAxis) {
8076
8090
  }
8077
8091
  else {
8078
8092
  if (this.options.grouping === 'stacked') {
8079
- let accH = getBarHeight.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, heightBounds, yAxis, xAxis)
8080
- let h = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis)
8081
- // output = heightBounds - this[`${yAxis}Axis`](d.y.accumulative)
8093
+ let accH = getBarHeight.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, yAxis, xAxis)
8094
+ let h = getBarHeight.call(this, d, i, yAxis, xAxis)
8082
8095
  output = (this[`${yAxis}Axis`](0)) - ((accH + h) * (d.y.accumulative < 0 ? 0 : 1))
8083
8096
  }
8084
8097
  else {
8085
- let h = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis)
8098
+ let h = getBarHeight.call(this, d, i, yAxis, xAxis)
8086
8099
  output = (this[`${yAxis}Axis`](0)) - (h * (d.y.value < 0 ? 0 : 1))
8087
8100
  }
8088
8101
  }
@@ -8099,9 +8112,9 @@ bars
8099
8112
 
8100
8113
  bars
8101
8114
  .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, xAxis)))
8102
- .attr('height', (d, i) => getBarHeight.call(this, d, i, this.plotHeight, yAxis, xAxis))
8115
+ .attr('height', (d, i) => getBarHeight.call(this, d, i, yAxis, xAxis))
8103
8116
  .attr('x', (d, i) => getBarX.call(this, d, i, xAxis))
8104
- .attr('y', (d, i) => getBarY.call(this, d, i, this.plotHeight, yAxis, xAxis))
8117
+ .attr('y', (d, i) => getBarY.call(this, d, i, yAxis, xAxis))
8105
8118
  // .transition(this.transition)
8106
8119
  .attr('fill', d => d.y.color || d.color || series.color)
8107
8120
 
@@ -8109,9 +8122,9 @@ bars
8109
8122
  .enter()
8110
8123
  .append('rect')
8111
8124
  .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, xAxis)))
8112
- .attr('height', (d, i) => getBarHeight.call(this, d, i, this.plotHeight, yAxis, xAxis))
8125
+ .attr('height', (d, i) => getBarHeight.call(this, d, i, yAxis, xAxis))
8113
8126
  .attr('x', (d, i) => getBarX.call(this, d, i, xAxis))
8114
- .attr('y', (d, i) => getBarY.call(this, d, i, this.plotHeight, yAxis, xAxis))
8127
+ .attr('y', (d, i) => getBarY.call(this, d, i, yAxis, xAxis))
8115
8128
  // .transition(this.transition)
8116
8129
  .attr('fill', d => d.y.color || d.color || series.color)
8117
8130
  .attr('class', d => {
@@ -8128,9 +8141,9 @@ if (!this.brushBarsInitialized[series.key]) {
8128
8141
 
8129
8142
  brushBars
8130
8143
  .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${xAxis}Brush`)))
8131
- .attr('height', (d, i) => getBarHeight.call(this, d, i, this.options.brushHeight, `${yAxis}Brush`, `${xAxis}Brush`))
8144
+ .attr('height', (d, i) => getBarHeight.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8132
8145
  .attr('x', (d, i) => getBarX.call(this, d, i, `${xAxis}Brush`))
8133
- .attr('y', (d, i) => getBarY.call(this, d, i, this.options.brushHeight, `${yAxis}Brush`, `${xAxis}Brush`))
8146
+ .attr('y', (d, i) => getBarY.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8134
8147
  // .transition(this.transition)
8135
8148
  .attr('fill', d => d.y.color || d.color || series.color)
8136
8149
 
@@ -8138,9 +8151,9 @@ if (!this.brushBarsInitialized[series.key]) {
8138
8151
  .enter()
8139
8152
  .append('rect')
8140
8153
  .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${xAxis}Brush`)))
8141
- .attr('height', (d, i) => getBarHeight.call(this, d, i, this.options.brushHeight, `${yAxis}Brush`, `${xAxis}Brush`))
8154
+ .attr('height', (d, i) => getBarHeight.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8142
8155
  .attr('x', (d, i) => getBarX.call(this, d, i, `${xAxis}Brush`))
8143
- .attr('y', (d, i) => getBarY.call(this, d, i, this.options.brushHeight, `${yAxis}Brush`, `${xAxis}Brush`))
8156
+ .attr('y', (d, i) => getBarY.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8144
8157
  // .transition(this.transition)
8145
8158
  .attr('fill', d => d.y.color || d.color || series.color)
8146
8159
  .attr('class', d => {
@@ -8264,10 +8277,10 @@ if (this.options.showLabels === true || series.showLabels === true) {
8264
8277
  function getLabelX (d, labelPosition = 'inside') {
8265
8278
  if (this.options.orientation === 'horizontal') {
8266
8279
  if (this.options.grouping === 'stacked') {
8267
- return this[yAxis](d.y.accumulative) + (this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1))
8280
+ return this[yAxis + 'Axis'](d.y.accumulative) + (this[yAxis + 'Axis'](d.y.value) / (labelPosition === 'inside' ? 2 : 1))
8268
8281
  }
8269
8282
  else {
8270
- return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4
8283
+ return this[yAxis + 'Axis'](isNaN(d.y.value) ? 0 : d.y.value) + 4
8271
8284
  }
8272
8285
  }
8273
8286
  else {
@@ -8282,7 +8295,12 @@ function getLabelX (d, labelPosition = 'inside') {
8282
8295
  }
8283
8296
  function getLabelY (d, labelPosition = 'inside') {
8284
8297
  if (this.options.orientation === 'horizontal') {
8285
- return this[xAxis + 'Axis'](this.parseX(d.x.value)) + (this.options.data[xAxis].bandWidth / 2)
8298
+ let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
8299
+ let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
8300
+ if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
8301
+ xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
8302
+ }
8303
+ return xPos
8286
8304
  }
8287
8305
  else {
8288
8306
  if (this.options.grouping === 'stacked') {
@@ -8457,6 +8475,26 @@ let lines = this.lineLayer.selectAll(`.line_${key}`)
8457
8475
  .transition(this.transition)
8458
8476
  .style('stroke-opacity', 1e-6)
8459
8477
  .remove()
8478
+ let areas = this.areaLayer.selectAll(`.area_${key}`)
8479
+ .transition(this.transition)
8480
+ .style('stroke-opacity', 1e-6)
8481
+ .remove()
8482
+
8483
+ }
8484
+ removelabel (key) {
8485
+ /* global key d3 */
8486
+ let labels = this.labelLayer.selectAll(`.label_${key}`)
8487
+ .transition(this.transition)
8488
+ .style('stroke-opacity', 1e-6)
8489
+ .remove()
8490
+
8491
+ }
8492
+ removesymbol (key) {
8493
+ /* global key d3 */
8494
+ let symbols = this.symbolLayer.selectAll(`.symbol_${key}`)
8495
+ .transition(this.transition)
8496
+ .style('stroke-opacity', 1e-6)
8497
+ .remove()
8460
8498
 
8461
8499
  }
8462
8500
  rendersymbol (series, index) {
@@ -4232,13 +4232,17 @@ var WebsyRouter = /*#__PURE__*/function () {
4232
4232
  inputPath = "/".concat(this.options.urlPrefix, "/").concat(inputPath);
4233
4233
  }
4234
4234
 
4235
+ this.currentParams = {
4236
+ path: '',
4237
+ items: {}
4238
+ };
4239
+
4235
4240
  if (reloadView === true) {
4236
4241
  this.navigate("".concat(inputPath), 'main', null, noHistory);
4237
4242
  } else {
4238
- this.currentParams = {
4239
- path: '',
4240
- items: {}
4241
- };
4243
+ history.replaceState({
4244
+ inputPath: inputPath
4245
+ }, 'unused', inputPath);
4242
4246
  }
4243
4247
  }
4244
4248
  }, {
@@ -8208,7 +8212,7 @@ var WebsyChart = /*#__PURE__*/function () {
8208
8212
  this.refLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8209
8213
  this.trackingLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8210
8214
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")"));
8211
- this.clip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('width', this.plotWidth).attr('height', this.plotHeight);
8215
+ this.clip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", 0)")).attr('width', this.plotWidth).attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop);
8212
8216
  this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft).attr('height', longestBottomBounds.height + 10);
8213
8217
  this.brushClip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")")).attr('width', this.plotWidth).attr('height', this.options.brushHeight);
8214
8218
  this.eventLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
@@ -8488,6 +8492,12 @@ var WebsyChart = /*#__PURE__*/function () {
8488
8492
 
8489
8493
  return d;
8490
8494
  }));
8495
+
8496
+ if (this.customLeftRange.length > 0) {
8497
+ this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8498
+ return "translate(0, ".concat(_this45.customLeftRange[i] + (_this45.customLeftRange[i + 1] - _this45.customLeftRange[i]) / 2, ")");
8499
+ });
8500
+ }
8491
8501
  }
8492
8502
 
8493
8503
  if (this.options.data.left && this.options.data.left.showTitle === true) {
@@ -8550,7 +8560,11 @@ var WebsyChart = /*#__PURE__*/function () {
8550
8560
  for (var key in this.renderedKeys) {
8551
8561
  if (newKeys.indexOf(key) === -1) {
8552
8562
  // remove the components
8553
- this["remove".concat(this.renderedKeys[key])](key);
8563
+ // this[`remove${this.renderedKeys[key]}`](key)
8564
+ this.removeline(key);
8565
+ this.removebar(key);
8566
+ this.removesymbol(key);
8567
+ this.removelabel(key);
8554
8568
  }
8555
8569
  }
8556
8570
 
@@ -8663,11 +8677,11 @@ var WebsyChart = /*#__PURE__*/function () {
8663
8677
  yAxis = 'bottom';
8664
8678
  }
8665
8679
 
8666
- function getBarHeight(d, i, heightBounds, yAxis, xAxis) {
8680
+ function getBarHeight(d, i, yAxis, xAxis) {
8667
8681
  var output;
8668
8682
 
8669
8683
  if (this.options.orientation === 'horizontal') {
8670
- output = this.options.data[xAxis].bandWidth;
8684
+ output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2));
8671
8685
  } else {
8672
8686
  var x = getBarX.call(this, d, i, xAxis);
8673
8687
 
@@ -8689,9 +8703,7 @@ var WebsyChart = /*#__PURE__*/function () {
8689
8703
  var output;
8690
8704
 
8691
8705
  if (this.options.orientation === 'horizontal') {
8692
- var width = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
8693
- acummulativeY[d.y.index] += width;
8694
- output = width;
8706
+ output = this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
8695
8707
  } else {
8696
8708
  var x = getBarX.call(this, d, i, xAxis);
8697
8709
 
@@ -8714,18 +8726,23 @@ var WebsyChart = /*#__PURE__*/function () {
8714
8726
 
8715
8727
  if (this.options.orientation === 'horizontal') {
8716
8728
  if (this.options.grouping === 'stacked') {
8717
- var h = getBarWidth.call(this, d, i, xAxis);
8718
- var adjustment = 0;
8719
-
8720
- if (d.y.accumulative && d.y.accumulative !== 0) {
8721
- adjustment = this["".concat(yAxis, "Axis")](d.y.accumulative || 0);
8722
- }
8729
+ // let h = getBarWidth.call(this, d, i, xAxis)
8730
+ // let adjustment = 0
8731
+ // if (d.y.accumulative && d.y.accumulative !== 0) {
8732
+ // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
8733
+ // }
8734
+ // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
8735
+ var accH = getBarWidth.call(this, {
8736
+ x: d.x,
8737
+ y: {
8738
+ value: d.y.accumulative
8739
+ }
8740
+ }, i, xAxis); // let h = getBarWidth.call(this, d, i, xAxis)
8723
8741
 
8724
- output = this["".concat(yAxis, "Axis")](0) + adjustment * (d.y.value < 0 ? 1 : 0) + h * (d.y.value < 0 ? 1 : 0);
8742
+ output = accH * (d.y.accumulative < 0 ? 0 : 1);
8725
8743
  } else {
8726
- var _h = getBarWidth.call(this, d, i, xAxis);
8727
-
8728
- output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value < 0 ? 1 : 0);
8744
+ var h = getBarWidth.call(this, d, i, xAxis);
8745
+ output = this["".concat(yAxis, "Axis")](0) + h * (d.y.value < 0 ? 1 : 0);
8729
8746
  }
8730
8747
  } else {
8731
8748
  // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
@@ -8762,7 +8779,9 @@ var WebsyChart = /*#__PURE__*/function () {
8762
8779
  } // console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output)
8763
8780
 
8764
8781
  } else {
8765
- output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)];
8782
+ var _barAdjustment = (xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2 + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding);
8783
+
8784
+ output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + _barAdjustment;
8766
8785
  }
8767
8786
  }
8768
8787
 
@@ -8773,12 +8792,13 @@ var WebsyChart = /*#__PURE__*/function () {
8773
8792
  return output;
8774
8793
  }
8775
8794
 
8776
- function getBarY(d, i, heightBounds, yAxis, xAxis) {
8795
+ function getBarY(d, i, yAxis, xAxis) {
8777
8796
  var output;
8778
8797
 
8779
8798
  if (this.options.orientation === 'horizontal') {
8780
8799
  if (this.options.grouping !== 'grouped') {
8781
- output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
8800
+ var barAdjustment = (xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2 + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding);
8801
+ output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment;
8782
8802
  } else {
8783
8803
  output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth;
8784
8804
  }
@@ -8789,14 +8809,13 @@ var WebsyChart = /*#__PURE__*/function () {
8789
8809
  y: {
8790
8810
  value: d.y.accumulative
8791
8811
  }
8792
- }, i, heightBounds, yAxis, xAxis);
8793
- var h = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis); // output = heightBounds - this[`${yAxis}Axis`](d.y.accumulative)
8794
-
8812
+ }, i, yAxis, xAxis);
8813
+ var h = getBarHeight.call(this, d, i, yAxis, xAxis);
8795
8814
  output = this["".concat(yAxis, "Axis")](0) - (accH + h) * (d.y.accumulative < 0 ? 0 : 1);
8796
8815
  } else {
8797
- var _h2 = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis);
8816
+ var _h = getBarHeight.call(this, d, i, yAxis, xAxis);
8798
8817
 
8799
- output = this["".concat(yAxis, "Axis")](0) - _h2 * (d.y.value < 0 ? 0 : 1);
8818
+ output = this["".concat(yAxis, "Axis")](0) - _h * (d.y.value < 0 ? 0 : 1);
8800
8819
  }
8801
8820
  }
8802
8821
 
@@ -8811,11 +8830,11 @@ var WebsyChart = /*#__PURE__*/function () {
8811
8830
  bars.attr('width', function (d, i) {
8812
8831
  return Math.abs(getBarWidth.call(_this48, d, i, xAxis));
8813
8832
  }).attr('height', function (d, i) {
8814
- return getBarHeight.call(_this48, d, i, _this48.plotHeight, yAxis, xAxis);
8833
+ return getBarHeight.call(_this48, d, i, yAxis, xAxis);
8815
8834
  }).attr('x', function (d, i) {
8816
8835
  return getBarX.call(_this48, d, i, xAxis);
8817
8836
  }).attr('y', function (d, i) {
8818
- return getBarY.call(_this48, d, i, _this48.plotHeight, yAxis, xAxis);
8837
+ return getBarY.call(_this48, d, i, yAxis, xAxis);
8819
8838
  }) // .transition(this.transition)
8820
8839
  .attr('fill', function (d) {
8821
8840
  return d.y.color || d.color || series.color;
@@ -8823,11 +8842,11 @@ var WebsyChart = /*#__PURE__*/function () {
8823
8842
  bars.enter().append('rect').attr('width', function (d, i) {
8824
8843
  return Math.abs(getBarWidth.call(_this48, d, i, xAxis));
8825
8844
  }).attr('height', function (d, i) {
8826
- return getBarHeight.call(_this48, d, i, _this48.plotHeight, yAxis, xAxis);
8845
+ return getBarHeight.call(_this48, d, i, yAxis, xAxis);
8827
8846
  }).attr('x', function (d, i) {
8828
8847
  return getBarX.call(_this48, d, i, xAxis);
8829
8848
  }).attr('y', function (d, i) {
8830
- return getBarY.call(_this48, d, i, _this48.plotHeight, yAxis, xAxis);
8849
+ return getBarY.call(_this48, d, i, yAxis, xAxis);
8831
8850
  }) // .transition(this.transition)
8832
8851
  .attr('fill', function (d) {
8833
8852
  return d.y.color || d.color || series.color;
@@ -8841,11 +8860,11 @@ var WebsyChart = /*#__PURE__*/function () {
8841
8860
  brushBars.attr('width', function (d, i) {
8842
8861
  return Math.abs(getBarWidth.call(_this48, d, i, "".concat(xAxis, "Brush")));
8843
8862
  }).attr('height', function (d, i) {
8844
- return getBarHeight.call(_this48, d, i, _this48.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8863
+ return getBarHeight.call(_this48, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8845
8864
  }).attr('x', function (d, i) {
8846
8865
  return getBarX.call(_this48, d, i, "".concat(xAxis, "Brush"));
8847
8866
  }).attr('y', function (d, i) {
8848
- return getBarY.call(_this48, d, i, _this48.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8867
+ return getBarY.call(_this48, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8849
8868
  }) // .transition(this.transition)
8850
8869
  .attr('fill', function (d) {
8851
8870
  return d.y.color || d.color || series.color;
@@ -8853,11 +8872,11 @@ var WebsyChart = /*#__PURE__*/function () {
8853
8872
  brushBars.enter().append('rect').attr('width', function (d, i) {
8854
8873
  return Math.abs(getBarWidth.call(_this48, d, i, "".concat(xAxis, "Brush")));
8855
8874
  }).attr('height', function (d, i) {
8856
- return getBarHeight.call(_this48, d, i, _this48.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8875
+ return getBarHeight.call(_this48, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8857
8876
  }).attr('x', function (d, i) {
8858
8877
  return getBarX.call(_this48, d, i, "".concat(xAxis, "Brush"));
8859
8878
  }).attr('y', function (d, i) {
8860
- return getBarY.call(_this48, d, i, _this48.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8879
+ return getBarY.call(_this48, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
8861
8880
  }) // .transition(this.transition)
8862
8881
  .attr('fill', function (d) {
8863
8882
  return d.y.color || d.color || series.color;
@@ -8970,9 +8989,9 @@ var WebsyChart = /*#__PURE__*/function () {
8970
8989
 
8971
8990
  if (this.options.orientation === 'horizontal') {
8972
8991
  if (this.options.grouping === 'stacked') {
8973
- return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
8992
+ return this[yAxis + 'Axis'](d.y.accumulative) + this[yAxis + 'Axis'](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
8974
8993
  } else {
8975
- return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
8994
+ return this[yAxis + 'Axis'](isNaN(d.y.value) ? 0 : d.y.value) + 4;
8976
8995
  }
8977
8996
  } else {
8978
8997
  // return this[xAxis](this.parseX(d.x.value)) + (this.options.data[xAxis.replace('Axis', '')].bandWidth / 2)
@@ -8991,7 +9010,14 @@ var WebsyChart = /*#__PURE__*/function () {
8991
9010
  var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
8992
9011
 
8993
9012
  if (this.options.orientation === 'horizontal') {
8994
- return this[xAxis + 'Axis'](this.parseX(d.x.value)) + this.options.data[xAxis].bandWidth / 2;
9013
+ var xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value);
9014
+ var xPos = this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9015
+
9016
+ if (this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9017
+ xPos = xPos + (this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9018
+ }
9019
+
9020
+ return xPos;
8995
9021
  } else {
8996
9022
  if (this.options.grouping === 'stacked') {
8997
9023
  var accH = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.accumulative));
@@ -9130,6 +9156,19 @@ var WebsyChart = /*#__PURE__*/function () {
9130
9156
  value: function removeline(key) {
9131
9157
  /* global key d3 */
9132
9158
  var lines = this.lineLayer.selectAll(".line_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
9159
+ var areas = this.areaLayer.selectAll(".area_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
9160
+ }
9161
+ }, {
9162
+ key: "removelabel",
9163
+ value: function removelabel(key) {
9164
+ /* global key d3 */
9165
+ var labels = this.labelLayer.selectAll(".label_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
9166
+ }
9167
+ }, {
9168
+ key: "removesymbol",
9169
+ value: function removesymbol(key) {
9170
+ /* global key d3 */
9171
+ var symbols = this.symbolLayer.selectAll(".symbol_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
9133
9172
  }
9134
9173
  }, {
9135
9174
  key: "rendersymbol",