@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.
@@ -4159,15 +4159,18 @@ class WebsyRouter {
4159
4159
  let inputPath = this.currentView
4160
4160
  if (this.options.urlPrefix) {
4161
4161
  inputPath = `/${this.options.urlPrefix}/${inputPath}`
4162
+ }
4163
+ this.currentParams = {
4164
+ path: '',
4165
+ items: {}
4162
4166
  }
4163
4167
  if (reloadView === true) {
4164
4168
  this.navigate(`${inputPath}`, 'main', null, noHistory)
4165
4169
  }
4166
4170
  else {
4167
- this.currentParams = {
4168
- path: '',
4169
- items: {}
4170
- }
4171
+ history.replaceState({
4172
+ inputPath
4173
+ }, 'unused', inputPath)
4171
4174
  }
4172
4175
  }
4173
4176
  buildUrlPath (params) {
@@ -7890,9 +7893,9 @@ else {
7890
7893
  this.brushLayer
7891
7894
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
7892
7895
  this.clip
7893
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7896
+ .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, 0)`)
7894
7897
  .attr('width', this.plotWidth)
7895
- .attr('height', this.plotHeight)
7898
+ .attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop)
7896
7899
  this.xAxisClip
7897
7900
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7898
7901
  .attr('width', this.plotWidth + this.options.margin.axisLeft)
@@ -8192,7 +8195,11 @@ else {
8192
8195
  }
8193
8196
  return d
8194
8197
  })
8195
- )
8198
+ )
8199
+ if (this.customLeftRange.length > 0) {
8200
+ this.leftAxisLayer.selectAll('g')
8201
+ .attr('transform', (d, i) => `translate(0, ${this.customLeftRange[i] + ((this.customLeftRange[i + 1] - this.customLeftRange[i]) / 2)})`)
8202
+ }
8196
8203
  }
8197
8204
  if (this.options.data.left && this.options.data.left.showTitle === true) {
8198
8205
  this.leftAxisLabel.selectAll('.title').remove()
@@ -8288,7 +8295,11 @@ else {
8288
8295
  for (const key in this.renderedKeys) {
8289
8296
  if (newKeys.indexOf(key) === -1) {
8290
8297
  // remove the components
8291
- this[`remove${this.renderedKeys[key]}`](key)
8298
+ // this[`remove${this.renderedKeys[key]}`](key)
8299
+ this.removeline(key)
8300
+ this.removebar(key)
8301
+ this.removesymbol(key)
8302
+ this.removelabel(key)
8292
8303
  }
8293
8304
  }
8294
8305
  this.renderComponents()
@@ -8386,10 +8397,10 @@ if (this.options.orientation === 'horizontal') {
8386
8397
  xAxis = 'left'
8387
8398
  yAxis = 'bottom'
8388
8399
  }
8389
- function getBarHeight (d, i, heightBounds, yAxis, xAxis) {
8400
+ function getBarHeight (d, i, yAxis, xAxis) {
8390
8401
  let output
8391
8402
  if (this.options.orientation === 'horizontal') {
8392
- output = this.options.data[xAxis].bandWidth
8403
+ output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2))
8393
8404
  }
8394
8405
  else {
8395
8406
  let x = getBarX.call(this, d, i, xAxis)
@@ -8406,9 +8417,7 @@ function getBarHeight (d, i, heightBounds, yAxis, xAxis) {
8406
8417
  function getBarWidth (d, i, xAxis) {
8407
8418
  let output
8408
8419
  if (this.options.orientation === 'horizontal') {
8409
- let width = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
8410
- acummulativeY[d.y.index] += width
8411
- output = width
8420
+ output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8412
8421
  }
8413
8422
  else {
8414
8423
  let x = getBarX.call(this, d, i, xAxis)
@@ -8426,12 +8435,15 @@ function getBarX (d, i, xAxis) {
8426
8435
  let output
8427
8436
  if (this.options.orientation === 'horizontal') {
8428
8437
  if (this.options.grouping === 'stacked') {
8429
- let h = getBarWidth.call(this, d, i, xAxis)
8430
- let adjustment = 0
8431
- if (d.y.accumulative && d.y.accumulative !== 0) {
8432
- adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
8433
- }
8434
- output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
8438
+ // let h = getBarWidth.call(this, d, i, xAxis)
8439
+ // let adjustment = 0
8440
+ // if (d.y.accumulative && d.y.accumulative !== 0) {
8441
+ // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
8442
+ // }
8443
+ // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
8444
+ let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
8445
+ // let h = getBarWidth.call(this, d, i, xAxis)
8446
+ output = (accH * (d.y.accumulative < 0 ? 0 : 1))
8435
8447
  }
8436
8448
  else {
8437
8449
  let h = getBarWidth.call(this, d, i, xAxis)
@@ -8470,8 +8482,9 @@ function getBarX (d, i, xAxis) {
8470
8482
  }
8471
8483
  // console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output)
8472
8484
  }
8473
- else {
8474
- output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)]
8485
+ else {
8486
+ let barAdjustment = ((xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2) + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding)
8487
+ output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment
8475
8488
  }
8476
8489
  }
8477
8490
  if (isNaN(output)) {
@@ -8479,11 +8492,12 @@ function getBarX (d, i, xAxis) {
8479
8492
  }
8480
8493
  return output
8481
8494
  }
8482
- function getBarY (d, i, heightBounds, yAxis, xAxis) {
8495
+ function getBarY (d, i, yAxis, xAxis) {
8483
8496
  let output
8484
8497
  if (this.options.orientation === 'horizontal') {
8485
8498
  if (this.options.grouping !== 'grouped') {
8486
- output = this[`${xAxis}Axis`](this.parseX(d.x.value))
8499
+ let barAdjustment = ((xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2) + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding)
8500
+ output = this[`custom${xAxis.toInitialCaps()}Range`][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment
8487
8501
  }
8488
8502
  else {
8489
8503
  output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + ((d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth)
@@ -8491,13 +8505,12 @@ function getBarY (d, i, heightBounds, yAxis, xAxis) {
8491
8505
  }
8492
8506
  else {
8493
8507
  if (this.options.grouping === 'stacked') {
8494
- let accH = getBarHeight.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, heightBounds, yAxis, xAxis)
8495
- let h = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis)
8496
- // output = heightBounds - this[`${yAxis}Axis`](d.y.accumulative)
8508
+ let accH = getBarHeight.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, yAxis, xAxis)
8509
+ let h = getBarHeight.call(this, d, i, yAxis, xAxis)
8497
8510
  output = (this[`${yAxis}Axis`](0)) - ((accH + h) * (d.y.accumulative < 0 ? 0 : 1))
8498
8511
  }
8499
8512
  else {
8500
- let h = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis)
8513
+ let h = getBarHeight.call(this, d, i, yAxis, xAxis)
8501
8514
  output = (this[`${yAxis}Axis`](0)) - (h * (d.y.value < 0 ? 0 : 1))
8502
8515
  }
8503
8516
  }
@@ -8514,9 +8527,9 @@ bars
8514
8527
 
8515
8528
  bars
8516
8529
  .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, xAxis)))
8517
- .attr('height', (d, i) => getBarHeight.call(this, d, i, this.plotHeight, yAxis, xAxis))
8530
+ .attr('height', (d, i) => getBarHeight.call(this, d, i, yAxis, xAxis))
8518
8531
  .attr('x', (d, i) => getBarX.call(this, d, i, xAxis))
8519
- .attr('y', (d, i) => getBarY.call(this, d, i, this.plotHeight, yAxis, xAxis))
8532
+ .attr('y', (d, i) => getBarY.call(this, d, i, yAxis, xAxis))
8520
8533
  // .transition(this.transition)
8521
8534
  .attr('fill', d => d.y.color || d.color || series.color)
8522
8535
 
@@ -8524,9 +8537,9 @@ bars
8524
8537
  .enter()
8525
8538
  .append('rect')
8526
8539
  .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, xAxis)))
8527
- .attr('height', (d, i) => getBarHeight.call(this, d, i, this.plotHeight, yAxis, xAxis))
8540
+ .attr('height', (d, i) => getBarHeight.call(this, d, i, yAxis, xAxis))
8528
8541
  .attr('x', (d, i) => getBarX.call(this, d, i, xAxis))
8529
- .attr('y', (d, i) => getBarY.call(this, d, i, this.plotHeight, yAxis, xAxis))
8542
+ .attr('y', (d, i) => getBarY.call(this, d, i, yAxis, xAxis))
8530
8543
  // .transition(this.transition)
8531
8544
  .attr('fill', d => d.y.color || d.color || series.color)
8532
8545
  .attr('class', d => {
@@ -8543,9 +8556,9 @@ if (!this.brushBarsInitialized[series.key]) {
8543
8556
 
8544
8557
  brushBars
8545
8558
  .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${xAxis}Brush`)))
8546
- .attr('height', (d, i) => getBarHeight.call(this, d, i, this.options.brushHeight, `${yAxis}Brush`, `${xAxis}Brush`))
8559
+ .attr('height', (d, i) => getBarHeight.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8547
8560
  .attr('x', (d, i) => getBarX.call(this, d, i, `${xAxis}Brush`))
8548
- .attr('y', (d, i) => getBarY.call(this, d, i, this.options.brushHeight, `${yAxis}Brush`, `${xAxis}Brush`))
8561
+ .attr('y', (d, i) => getBarY.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8549
8562
  // .transition(this.transition)
8550
8563
  .attr('fill', d => d.y.color || d.color || series.color)
8551
8564
 
@@ -8553,9 +8566,9 @@ if (!this.brushBarsInitialized[series.key]) {
8553
8566
  .enter()
8554
8567
  .append('rect')
8555
8568
  .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${xAxis}Brush`)))
8556
- .attr('height', (d, i) => getBarHeight.call(this, d, i, this.options.brushHeight, `${yAxis}Brush`, `${xAxis}Brush`))
8569
+ .attr('height', (d, i) => getBarHeight.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8557
8570
  .attr('x', (d, i) => getBarX.call(this, d, i, `${xAxis}Brush`))
8558
- .attr('y', (d, i) => getBarY.call(this, d, i, this.options.brushHeight, `${yAxis}Brush`, `${xAxis}Brush`))
8571
+ .attr('y', (d, i) => getBarY.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8559
8572
  // .transition(this.transition)
8560
8573
  .attr('fill', d => d.y.color || d.color || series.color)
8561
8574
  .attr('class', d => {
@@ -8679,10 +8692,10 @@ if (this.options.showLabels === true || series.showLabels === true) {
8679
8692
  function getLabelX (d, labelPosition = 'inside') {
8680
8693
  if (this.options.orientation === 'horizontal') {
8681
8694
  if (this.options.grouping === 'stacked') {
8682
- return this[yAxis](d.y.accumulative) + (this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1))
8695
+ return this[yAxis + 'Axis'](d.y.accumulative) + (this[yAxis + 'Axis'](d.y.value) / (labelPosition === 'inside' ? 2 : 1))
8683
8696
  }
8684
8697
  else {
8685
- return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4
8698
+ return this[yAxis + 'Axis'](isNaN(d.y.value) ? 0 : d.y.value) + 4
8686
8699
  }
8687
8700
  }
8688
8701
  else {
@@ -8697,7 +8710,12 @@ function getLabelX (d, labelPosition = 'inside') {
8697
8710
  }
8698
8711
  function getLabelY (d, labelPosition = 'inside') {
8699
8712
  if (this.options.orientation === 'horizontal') {
8700
- return this[xAxis + 'Axis'](this.parseX(d.x.value)) + (this.options.data[xAxis].bandWidth / 2)
8713
+ let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
8714
+ let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
8715
+ if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
8716
+ xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
8717
+ }
8718
+ return xPos
8701
8719
  }
8702
8720
  else {
8703
8721
  if (this.options.grouping === 'stacked') {
@@ -8872,6 +8890,26 @@ let lines = this.lineLayer.selectAll(`.line_${key}`)
8872
8890
  .transition(this.transition)
8873
8891
  .style('stroke-opacity', 1e-6)
8874
8892
  .remove()
8893
+ let areas = this.areaLayer.selectAll(`.area_${key}`)
8894
+ .transition(this.transition)
8895
+ .style('stroke-opacity', 1e-6)
8896
+ .remove()
8897
+
8898
+ }
8899
+ removelabel (key) {
8900
+ /* global key d3 */
8901
+ let labels = this.labelLayer.selectAll(`.label_${key}`)
8902
+ .transition(this.transition)
8903
+ .style('stroke-opacity', 1e-6)
8904
+ .remove()
8905
+
8906
+ }
8907
+ removesymbol (key) {
8908
+ /* global key d3 */
8909
+ let symbols = this.symbolLayer.selectAll(`.symbol_${key}`)
8910
+ .transition(this.transition)
8911
+ .style('stroke-opacity', 1e-6)
8912
+ .remove()
8875
8913
 
8876
8914
  }
8877
8915
  rendersymbol (series, index) {
@@ -4539,13 +4539,17 @@ var WebsyRouter = /*#__PURE__*/function () {
4539
4539
  inputPath = "/".concat(this.options.urlPrefix, "/").concat(inputPath);
4540
4540
  }
4541
4541
 
4542
+ this.currentParams = {
4543
+ path: '',
4544
+ items: {}
4545
+ };
4546
+
4542
4547
  if (reloadView === true) {
4543
4548
  this.navigate("".concat(inputPath), 'main', null, noHistory);
4544
4549
  } else {
4545
- this.currentParams = {
4546
- path: '',
4547
- items: {}
4548
- };
4550
+ history.replaceState({
4551
+ inputPath: inputPath
4552
+ }, 'unused', inputPath);
4549
4553
  }
4550
4554
  }
4551
4555
  }, {
@@ -8689,7 +8693,7 @@ var WebsyChart = /*#__PURE__*/function () {
8689
8693
  this.refLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8690
8694
  this.trackingLineLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8691
8695
  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, ")"));
8692
- 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);
8696
+ 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);
8693
8697
  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);
8694
8698
  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);
8695
8699
  this.eventLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
@@ -8969,6 +8973,12 @@ var WebsyChart = /*#__PURE__*/function () {
8969
8973
 
8970
8974
  return d;
8971
8975
  }));
8976
+
8977
+ if (this.customLeftRange.length > 0) {
8978
+ this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8979
+ return "translate(0, ".concat(_this48.customLeftRange[i] + (_this48.customLeftRange[i + 1] - _this48.customLeftRange[i]) / 2, ")");
8980
+ });
8981
+ }
8972
8982
  }
8973
8983
 
8974
8984
  if (this.options.data.left && this.options.data.left.showTitle === true) {
@@ -9031,7 +9041,11 @@ var WebsyChart = /*#__PURE__*/function () {
9031
9041
  for (var key in this.renderedKeys) {
9032
9042
  if (newKeys.indexOf(key) === -1) {
9033
9043
  // remove the components
9034
- this["remove".concat(this.renderedKeys[key])](key);
9044
+ // this[`remove${this.renderedKeys[key]}`](key)
9045
+ this.removeline(key);
9046
+ this.removebar(key);
9047
+ this.removesymbol(key);
9048
+ this.removelabel(key);
9035
9049
  }
9036
9050
  }
9037
9051
 
@@ -9144,11 +9158,11 @@ var WebsyChart = /*#__PURE__*/function () {
9144
9158
  yAxis = 'bottom';
9145
9159
  }
9146
9160
 
9147
- function getBarHeight(d, i, heightBounds, yAxis, xAxis) {
9161
+ function getBarHeight(d, i, yAxis, xAxis) {
9148
9162
  var output;
9149
9163
 
9150
9164
  if (this.options.orientation === 'horizontal') {
9151
- output = this.options.data[xAxis].bandWidth;
9165
+ output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2));
9152
9166
  } else {
9153
9167
  var x = getBarX.call(this, d, i, xAxis);
9154
9168
 
@@ -9170,9 +9184,7 @@ var WebsyChart = /*#__PURE__*/function () {
9170
9184
  var output;
9171
9185
 
9172
9186
  if (this.options.orientation === 'horizontal') {
9173
- var width = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
9174
- acummulativeY[d.y.index] += width;
9175
- output = width;
9187
+ output = this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
9176
9188
  } else {
9177
9189
  var x = getBarX.call(this, d, i, xAxis);
9178
9190
 
@@ -9195,18 +9207,23 @@ var WebsyChart = /*#__PURE__*/function () {
9195
9207
 
9196
9208
  if (this.options.orientation === 'horizontal') {
9197
9209
  if (this.options.grouping === 'stacked') {
9198
- var h = getBarWidth.call(this, d, i, xAxis);
9199
- var adjustment = 0;
9200
-
9201
- if (d.y.accumulative && d.y.accumulative !== 0) {
9202
- adjustment = this["".concat(yAxis, "Axis")](d.y.accumulative || 0);
9203
- }
9210
+ // let h = getBarWidth.call(this, d, i, xAxis)
9211
+ // let adjustment = 0
9212
+ // if (d.y.accumulative && d.y.accumulative !== 0) {
9213
+ // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
9214
+ // }
9215
+ // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
9216
+ var accH = getBarWidth.call(this, {
9217
+ x: d.x,
9218
+ y: {
9219
+ value: d.y.accumulative
9220
+ }
9221
+ }, i, xAxis); // let h = getBarWidth.call(this, d, i, xAxis)
9204
9222
 
9205
- output = this["".concat(yAxis, "Axis")](0) + adjustment * (d.y.value < 0 ? 1 : 0) + h * (d.y.value < 0 ? 1 : 0);
9223
+ output = accH * (d.y.accumulative < 0 ? 0 : 1);
9206
9224
  } else {
9207
- var _h = getBarWidth.call(this, d, i, xAxis);
9208
-
9209
- output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value < 0 ? 1 : 0);
9225
+ var h = getBarWidth.call(this, d, i, xAxis);
9226
+ output = this["".concat(yAxis, "Axis")](0) + h * (d.y.value < 0 ? 1 : 0);
9210
9227
  }
9211
9228
  } else {
9212
9229
  // let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
@@ -9243,7 +9260,9 @@ var WebsyChart = /*#__PURE__*/function () {
9243
9260
  } // console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output)
9244
9261
 
9245
9262
  } else {
9246
- output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)];
9263
+ var _barAdjustment = (xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2 + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding);
9264
+
9265
+ output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + _barAdjustment;
9247
9266
  }
9248
9267
  }
9249
9268
 
@@ -9254,12 +9273,13 @@ var WebsyChart = /*#__PURE__*/function () {
9254
9273
  return output;
9255
9274
  }
9256
9275
 
9257
- function getBarY(d, i, heightBounds, yAxis, xAxis) {
9276
+ function getBarY(d, i, yAxis, xAxis) {
9258
9277
  var output;
9259
9278
 
9260
9279
  if (this.options.orientation === 'horizontal') {
9261
9280
  if (this.options.grouping !== 'grouped') {
9262
- output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
9281
+ var barAdjustment = (xAxis.indexOf('Brush') !== -1 ? this.brushBandPadding : this.bandPadding) / 2 + (xAxis.indexOf('Brush') !== -1 ? 1 : this.options.groupPadding);
9282
+ output = this["custom".concat(xAxis.toInitialCaps(), "Range")][this[xAxis + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment;
9263
9283
  } else {
9264
9284
  output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth;
9265
9285
  }
@@ -9270,14 +9290,13 @@ var WebsyChart = /*#__PURE__*/function () {
9270
9290
  y: {
9271
9291
  value: d.y.accumulative
9272
9292
  }
9273
- }, i, heightBounds, yAxis, xAxis);
9274
- var h = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis); // output = heightBounds - this[`${yAxis}Axis`](d.y.accumulative)
9275
-
9293
+ }, i, yAxis, xAxis);
9294
+ var h = getBarHeight.call(this, d, i, yAxis, xAxis);
9276
9295
  output = this["".concat(yAxis, "Axis")](0) - (accH + h) * (d.y.accumulative < 0 ? 0 : 1);
9277
9296
  } else {
9278
- var _h2 = getBarHeight.call(this, d, i, heightBounds, yAxis, xAxis);
9297
+ var _h = getBarHeight.call(this, d, i, yAxis, xAxis);
9279
9298
 
9280
- output = this["".concat(yAxis, "Axis")](0) - _h2 * (d.y.value < 0 ? 0 : 1);
9299
+ output = this["".concat(yAxis, "Axis")](0) - _h * (d.y.value < 0 ? 0 : 1);
9281
9300
  }
9282
9301
  }
9283
9302
 
@@ -9292,11 +9311,11 @@ var WebsyChart = /*#__PURE__*/function () {
9292
9311
  bars.attr('width', function (d, i) {
9293
9312
  return Math.abs(getBarWidth.call(_this51, d, i, xAxis));
9294
9313
  }).attr('height', function (d, i) {
9295
- return getBarHeight.call(_this51, d, i, _this51.plotHeight, yAxis, xAxis);
9314
+ return getBarHeight.call(_this51, d, i, yAxis, xAxis);
9296
9315
  }).attr('x', function (d, i) {
9297
9316
  return getBarX.call(_this51, d, i, xAxis);
9298
9317
  }).attr('y', function (d, i) {
9299
- return getBarY.call(_this51, d, i, _this51.plotHeight, yAxis, xAxis);
9318
+ return getBarY.call(_this51, d, i, yAxis, xAxis);
9300
9319
  }) // .transition(this.transition)
9301
9320
  .attr('fill', function (d) {
9302
9321
  return d.y.color || d.color || series.color;
@@ -9304,11 +9323,11 @@ var WebsyChart = /*#__PURE__*/function () {
9304
9323
  bars.enter().append('rect').attr('width', function (d, i) {
9305
9324
  return Math.abs(getBarWidth.call(_this51, d, i, xAxis));
9306
9325
  }).attr('height', function (d, i) {
9307
- return getBarHeight.call(_this51, d, i, _this51.plotHeight, yAxis, xAxis);
9326
+ return getBarHeight.call(_this51, d, i, yAxis, xAxis);
9308
9327
  }).attr('x', function (d, i) {
9309
9328
  return getBarX.call(_this51, d, i, xAxis);
9310
9329
  }).attr('y', function (d, i) {
9311
- return getBarY.call(_this51, d, i, _this51.plotHeight, yAxis, xAxis);
9330
+ return getBarY.call(_this51, d, i, yAxis, xAxis);
9312
9331
  }) // .transition(this.transition)
9313
9332
  .attr('fill', function (d) {
9314
9333
  return d.y.color || d.color || series.color;
@@ -9322,11 +9341,11 @@ var WebsyChart = /*#__PURE__*/function () {
9322
9341
  brushBars.attr('width', function (d, i) {
9323
9342
  return Math.abs(getBarWidth.call(_this51, d, i, "".concat(xAxis, "Brush")));
9324
9343
  }).attr('height', function (d, i) {
9325
- return getBarHeight.call(_this51, d, i, _this51.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9344
+ return getBarHeight.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9326
9345
  }).attr('x', function (d, i) {
9327
9346
  return getBarX.call(_this51, d, i, "".concat(xAxis, "Brush"));
9328
9347
  }).attr('y', function (d, i) {
9329
- return getBarY.call(_this51, d, i, _this51.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9348
+ return getBarY.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9330
9349
  }) // .transition(this.transition)
9331
9350
  .attr('fill', function (d) {
9332
9351
  return d.y.color || d.color || series.color;
@@ -9334,11 +9353,11 @@ var WebsyChart = /*#__PURE__*/function () {
9334
9353
  brushBars.enter().append('rect').attr('width', function (d, i) {
9335
9354
  return Math.abs(getBarWidth.call(_this51, d, i, "".concat(xAxis, "Brush")));
9336
9355
  }).attr('height', function (d, i) {
9337
- return getBarHeight.call(_this51, d, i, _this51.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9356
+ return getBarHeight.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9338
9357
  }).attr('x', function (d, i) {
9339
9358
  return getBarX.call(_this51, d, i, "".concat(xAxis, "Brush"));
9340
9359
  }).attr('y', function (d, i) {
9341
- return getBarY.call(_this51, d, i, _this51.options.brushHeight, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9360
+ return getBarY.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9342
9361
  }) // .transition(this.transition)
9343
9362
  .attr('fill', function (d) {
9344
9363
  return d.y.color || d.color || series.color;
@@ -9451,9 +9470,9 @@ var WebsyChart = /*#__PURE__*/function () {
9451
9470
 
9452
9471
  if (this.options.orientation === 'horizontal') {
9453
9472
  if (this.options.grouping === 'stacked') {
9454
- return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
9473
+ return this[yAxis + 'Axis'](d.y.accumulative) + this[yAxis + 'Axis'](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
9455
9474
  } else {
9456
- return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
9475
+ return this[yAxis + 'Axis'](isNaN(d.y.value) ? 0 : d.y.value) + 4;
9457
9476
  }
9458
9477
  } else {
9459
9478
  // return this[xAxis](this.parseX(d.x.value)) + (this.options.data[xAxis.replace('Axis', '')].bandWidth / 2)
@@ -9472,7 +9491,14 @@ var WebsyChart = /*#__PURE__*/function () {
9472
9491
  var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
9473
9492
 
9474
9493
  if (this.options.orientation === 'horizontal') {
9475
- return this[xAxis + 'Axis'](this.parseX(d.x.value)) + this.options.data[xAxis].bandWidth / 2;
9494
+ var xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value);
9495
+ var xPos = this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9496
+
9497
+ if (this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9498
+ xPos = xPos + (this["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9499
+ }
9500
+
9501
+ return xPos;
9476
9502
  } else {
9477
9503
  if (this.options.grouping === 'stacked') {
9478
9504
  var accH = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.accumulative));
@@ -9611,6 +9637,19 @@ var WebsyChart = /*#__PURE__*/function () {
9611
9637
  value: function removeline(key) {
9612
9638
  /* global key d3 */
9613
9639
  var lines = this.lineLayer.selectAll(".line_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
9640
+ var areas = this.areaLayer.selectAll(".area_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
9641
+ }
9642
+ }, {
9643
+ key: "removelabel",
9644
+ value: function removelabel(key) {
9645
+ /* global key d3 */
9646
+ var labels = this.labelLayer.selectAll(".label_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
9647
+ }
9648
+ }, {
9649
+ key: "removesymbol",
9650
+ value: function removesymbol(key) {
9651
+ /* global key d3 */
9652
+ var symbols = this.symbolLayer.selectAll(".symbol_".concat(key)).transition(this.transition).style('stroke-opacity', 1e-6).remove();
9614
9653
  }
9615
9654
  }, {
9616
9655
  key: "rendersymbol",