@websy/websy-designs 1.7.6 → 1.7.8

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.
@@ -6111,7 +6111,12 @@ class WebsyTable3 {
6111
6111
  this.currentData = data
6112
6112
  }
6113
6113
  else {
6114
- bodyEl.innerHTML += this.buildBodyHtml(data, true)
6114
+ if (bodyEl.querySelector('tbody')) {
6115
+ bodyEl.querySelector('tbody').innerHTML += this.buildBodyHtml(data, true, true)
6116
+ }
6117
+ else {
6118
+ bodyEl.innerHTML += this.buildBodyHtml(data, true)
6119
+ }
6115
6120
  this.currentData = this.currentData.concat(data)
6116
6121
  }
6117
6122
  }
@@ -7043,32 +7048,43 @@ class WebsyChart {
7043
7048
  }
7044
7049
  let that = this
7045
7050
  this.brushed = function (event) {
7046
- console.log('brushing', event)
7047
7051
  let newX = (that.options.margin.left + that.options.margin.axisLeft) + (1 - (event.selection[0] / ((that.plotWidth) / (that.widthForCalc + that.totalBandPadding))))
7052
+ let newY = that.options.margin.top + that.options.margin.axisTop
7053
+ if (that.options.orientation === 'horizontal') {
7054
+ newX = that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft
7055
+ newY = (that.options.margin.top + that.options.margin.axisTop) + (1 - (event.selection[0] / ((that.plotHeight) / (that.widthForCalc + that.totalBandPadding))))
7056
+ }
7048
7057
  if (that.plotArea) {
7049
- that.plotArea.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7058
+ that.plotArea.attr('transform', `translate(${newX}, ${newY})`)
7050
7059
  }
7051
7060
  if (that.areaLayer) {
7052
- that.areaLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7061
+ that.areaLayer.attr('transform', `translate(${newX}, ${newY})`)
7053
7062
  }
7054
7063
  if (that.lineLayer) {
7055
- that.lineLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7064
+ that.lineLayer.attr('transform', `translate(${newX}, ${newY})`)
7056
7065
  }
7057
7066
  if (that.barLayer) {
7058
- that.barLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7067
+ that.barLayer.attr('transform', `translate(${newX}, ${newY})`)
7059
7068
  }
7060
7069
  if (that.labelLayer) {
7061
- that.labelLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7070
+ that.labelLayer.attr('transform', `translate(${newX}, ${newY})`)
7062
7071
  }
7063
7072
  if (that.symbolLayer) {
7064
- that.symbolLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7073
+ that.symbolLayer.attr('transform', `translate(${newX}, ${newY})`)
7065
7074
  }
7066
7075
  if (that.refLineLayer) {
7067
- that.refLineLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7068
- }
7069
- if (that.bottomAxisLayer) {
7070
- that.bottomAxisLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop + that.plotHeight})`)
7076
+ that.refLineLayer.attr('transform', `translate(${newX}, ${newY})`)
7077
+ }
7078
+ if (that.options.orientation === 'horizontal') {
7079
+ if (that.leftAxisLayer) {
7080
+ that.leftAxisLayer.attr('transform', `translate(${that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft}, ${newY})`)
7081
+ }
7071
7082
  }
7083
+ else {
7084
+ if (that.bottomAxisLayer) {
7085
+ that.bottomAxisLayer.attr('transform', `translate(${newX}, ${newY + that.plotHeight})`)
7086
+ }
7087
+ }
7072
7088
  // that.brushedDomain = []
7073
7089
  // let xAxis = 'bottom'
7074
7090
  // let xAxisCaps = 'Bottom'
@@ -7173,18 +7189,18 @@ class WebsyChart {
7173
7189
  this.render()
7174
7190
  }
7175
7191
  close () {
7176
- this.leftAxisLayer.selectAll('*').remove()
7177
- this.rightAxisLayer.selectAll('*').remove()
7178
- this.bottomAxisLayer.selectAll('*').remove()
7179
- this.leftAxisLabel.selectAll('*').remove()
7180
- this.rightAxisLabel.selectAll('*').remove()
7181
- this.bottomAxisLabel.selectAll('*').remove()
7182
- this.plotArea.selectAll('*').remove()
7183
- this.areaLayer.selectAll('*').remove()
7184
- this.lineLayer.selectAll('*').remove()
7185
- this.barLayer.selectAll('*').remove()
7186
- this.labelLayer.selectAll('*').remove()
7187
- this.symbolLayer.selectAll('*').remove()
7192
+ this.leftAxisLayer && this.leftAxisLayer.selectAll('*').remove()
7193
+ this.rightAxisLayer && this.rightAxisLayer.selectAll('*').remove()
7194
+ this.bottomAxisLayer && this.bottomAxisLayer.selectAll('*').remove()
7195
+ this.leftAxisLabel && this.leftAxisLabel.selectAll('*').remove()
7196
+ this.rightAxisLabel && this.rightAxisLabel.selectAll('*').remove()
7197
+ this.bottomAxisLabel && this.bottomAxisLabel.selectAll('*').remove()
7198
+ this.plotArea && this.plotArea.selectAll('*').remove()
7199
+ this.areaLayer && this.areaLayer.selectAll('*').remove()
7200
+ this.lineLayer && this.lineLayer.selectAll('*').remove()
7201
+ this.barLayer && this.barLayer.selectAll('*').remove()
7202
+ this.labelLayer && this.labelLayer.selectAll('*').remove()
7203
+ this.symbolLayer && this.symbolLayer.selectAll('*').remove()
7188
7204
  }
7189
7205
  createDomain (side, forBrush = false) {
7190
7206
  let domain = []
@@ -7436,7 +7452,7 @@ this.clip = this.defs.append('clipPath').attr('id', `${this.elementId}_clip`).ap
7436
7452
  this.xAxisClip = this.defs.append('clipPath').attr('id', `${this.elementId}_xAxisClip`).append('rect')
7437
7453
  this.yAxisClip = this.defs.append('clipPath').attr('id', `${this.elementId}_yAxisClip`).append('rect')
7438
7454
  this.brushClip = this.defs.append('clipPath').attr('id', `${this.elementId}_brushclip`).append('rect')
7439
- this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer') // .attr('clip-path', `url(#${this.elementId}_yAxisClip)`).append('g')
7455
+ this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer').attr('clip-path', `url(#${this.elementId}_yAxisClip)`).append('g')
7440
7456
  this.rightAxisLayer = this.svg.append('g').attr('class', 'right-axis-layer')
7441
7457
  this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer').attr('clip-path', `url(#${this.elementId}_xAxisClip)`).append('g')
7442
7458
  this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer')
@@ -7815,48 +7831,53 @@ else {
7815
7831
  // }
7816
7832
  // }
7817
7833
  // Translate the layers
7834
+ const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight + 5 : 0
7818
7835
  this.leftAxisLayer
7819
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7836
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7820
7837
  .style('font-size', (this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize)
7821
7838
  this.rightAxisLayer
7822
- .attr('transform', `translate(${this.options.margin.left + this.plotWidth + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7839
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.plotWidth + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7823
7840
  .style('font-size', (this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize)
7824
7841
  this.bottomAxisLayer
7825
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7842
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7826
7843
  .style('font-size', (this.options.data.bottom && this.options.data.bottom.fontSize) || this.options.fontSize)
7827
7844
  this.leftAxisLabel
7828
- .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
7845
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
7829
7846
  this.rightAxisLabel
7830
- .attr('transform', `translate(${this.options.margin.left + this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight}, ${this.options.margin.top + this.options.margin.axisTop})`)
7847
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight}, ${this.options.margin.top + this.options.margin.axisTop})`)
7831
7848
  this.bottomAxisLabel
7832
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7849
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7833
7850
  this.plotArea
7834
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7851
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7835
7852
  this.areaLayer
7836
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7853
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7837
7854
  this.lineLayer
7838
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7855
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7839
7856
  this.barLayer
7840
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7857
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7841
7858
  this.labelLayer
7842
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7859
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7843
7860
  this.symbolLayer
7844
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7861
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7845
7862
  this.refLineLayer
7846
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7863
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7847
7864
  this.trackingLineLayer
7848
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7865
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
7849
7866
  this.clip
7850
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, 0)`)
7867
+ .attr('transform', `translate(${(leftBrushAdjustment - 5) + this.options.margin.left + this.options.margin.axisLeft}, 0)`)
7851
7868
  .attr('width', this.plotWidth)
7852
7869
  .attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop)
7853
7870
  if (this.options.orientation === 'horizontal') {
7854
7871
  this.brushLayer
7855
7872
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
7856
7873
  this.yAxisClip
7857
- .attr('transform', `translate(${this.options.brushHeight + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
7858
- .attr('width', this.options.margin.axisLeft - this.options.brushHeight)
7859
- .attr('height', this.plotHeight)
7874
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
7875
+ .attr('width', this.options.margin.axisLeft + 10)
7876
+ .attr('height', this.plotHeight)
7877
+ this.xAxisClip
7878
+ .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7879
+ .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
7880
+ .attr('height', longestBottomBounds.height + 10)
7860
7881
  this.brushClip
7861
7882
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
7862
7883
  .attr('height', this.plotHeight)
@@ -7865,6 +7886,10 @@ else {
7865
7886
  else {
7866
7887
  this.brushLayer
7867
7888
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
7889
+ this.yAxisClip
7890
+ .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop - 10})`)
7891
+ .attr('width', this.options.margin.axisLeft + 10)
7892
+ .attr('height', this.plotHeight + 20)
7868
7893
  this.xAxisClip
7869
7894
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
7870
7895
  .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
@@ -8381,7 +8406,7 @@ function getBarHeight (d, i, yAxis, xAxis) {
8381
8406
  output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2))
8382
8407
  }
8383
8408
  else {
8384
- let x = getBarX.call(this, d, i, xAxis)
8409
+ let x = getBarX.call(this, d, i, yAxis, xAxis)
8385
8410
  if (typeof x === 'undefined' || x === null) {
8386
8411
  return null
8387
8412
  }
@@ -8392,14 +8417,16 @@ function getBarHeight (d, i, yAxis, xAxis) {
8392
8417
  }
8393
8418
  return output
8394
8419
  }
8395
- function getBarWidth (d, i, xAxis) {
8420
+ function getBarWidth (d, i, yAxis, xAxis) {
8396
8421
  let output
8397
8422
  if (this.options.orientation === 'horizontal') {
8423
+ // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8398
8424
  output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8425
+ // output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
8399
8426
  // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
8400
8427
  }
8401
8428
  else {
8402
- let x = getBarX.call(this, d, i, xAxis)
8429
+ let x = getBarX.call(this, d, i, yAxis, xAxis)
8403
8430
  if (typeof x === 'undefined' || x === null) {
8404
8431
  return null
8405
8432
  }
@@ -8410,23 +8437,33 @@ function getBarWidth (d, i, xAxis) {
8410
8437
  }
8411
8438
  return output
8412
8439
  }
8413
- function getBarX (d, i, xAxis) {
8440
+ function getBarX (d, i, yAxis, xAxis) {
8414
8441
  let output
8415
8442
  if (this.options.orientation === 'horizontal') {
8416
- if (this.options.grouping === 'stacked') {
8417
- // let h = getBarWidth.call(this, d, i, xAxis)
8418
- // let adjustment = 0
8419
- // if (d.y.accumulative && d.y.accumulative !== 0) {
8420
- // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
8421
- // }
8422
- // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
8423
- let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
8424
- // let h = getBarWidth.call(this, d, i, xAxis)
8425
- output = (accH * (d.y.accumulative < 0 ? 0 : 1))
8443
+ // if (this.options.grouping === 'stacked') {
8444
+ // // let h = getBarWidth.call(this, d, i, xAxis)
8445
+ // // let adjustment = 0
8446
+ // // if (d.y.accumulative && d.y.accumulative !== 0) {
8447
+ // // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
8448
+ // // }
8449
+ // // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
8450
+ // let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
8451
+ // // let h = getBarWidth.call(this, d, i, xAxis)
8452
+ // output = (accH * (d.y.accumulative < 0 ? 0 : 1))
8453
+ // }
8454
+ // else {
8455
+ // let h = getBarWidth.call(this, d, i, xAxis)
8456
+ // output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value < 0 ? 1 : 0))
8457
+ // }
8458
+ if (this.options.grouping === 'stacked') { // no support for stacks yet
8459
+ let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, yAxis, xAxis)
8460
+ let h = getBarWidth.call(this, d, i, yAxis, xAxis)
8461
+ // output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
8462
+ output = (this[`${yAxis}Axis`](0)) + ((accH) * (d.y.accumulative > 0 ? 1 : 0))
8426
8463
  }
8427
8464
  else {
8428
- let h = getBarWidth.call(this, d, i, xAxis)
8429
- output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value < 0 ? 1 : 0))
8465
+ let h = getBarWidth.call(this, d, i, yAxis, xAxis)
8466
+ output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value > 0 ? 0 : 1))
8430
8467
  }
8431
8468
  }
8432
8469
  else {
@@ -8515,9 +8552,9 @@ bars
8515
8552
  .remove()
8516
8553
 
8517
8554
  bars
8518
- .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, xAxis)))
8555
+ .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, yAxis, xAxis)))
8519
8556
  .attr('height', (d, i) => getBarHeight.call(this, d, i, yAxis, xAxis))
8520
- .attr('x', (d, i) => getBarX.call(this, d, i, xAxis))
8557
+ .attr('x', (d, i) => getBarX.call(this, d, i, yAxis, xAxis))
8521
8558
  .attr('y', (d, i) => getBarY.call(this, d, i, yAxis, xAxis))
8522
8559
  // .transition(this.transition)
8523
8560
  .attr('fill', d => d.y.color || d.color || series.color)
@@ -8525,9 +8562,9 @@ bars
8525
8562
  bars
8526
8563
  .enter()
8527
8564
  .append('rect')
8528
- .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, xAxis)))
8565
+ .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, yAxis, xAxis)))
8529
8566
  .attr('height', (d, i) => getBarHeight.call(this, d, i, yAxis, xAxis))
8530
- .attr('x', (d, i) => getBarX.call(this, d, i, xAxis))
8567
+ .attr('x', (d, i) => getBarX.call(this, d, i, yAxis, xAxis))
8531
8568
  .attr('y', (d, i) => getBarY.call(this, d, i, yAxis, xAxis))
8532
8569
  // .transition(this.transition)
8533
8570
  .attr('fill', d => d.y.color || d.color || series.color)
@@ -8544,9 +8581,9 @@ if (!this.brushBarsInitialized[series.key]) {
8544
8581
  .remove()
8545
8582
 
8546
8583
  brushBars
8547
- .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${xAxis}Brush`)))
8584
+ .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`)))
8548
8585
  .attr('height', (d, i) => getBarHeight.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8549
- .attr('x', (d, i) => getBarX.call(this, d, i, `${xAxis}Brush`))
8586
+ .attr('x', (d, i) => getBarX.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8550
8587
  .attr('y', (d, i) => getBarY.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8551
8588
  // .transition(this.transition)
8552
8589
  .attr('fill', d => d.y.color || d.color || series.color)
@@ -8554,9 +8591,9 @@ if (!this.brushBarsInitialized[series.key]) {
8554
8591
  brushBars
8555
8592
  .enter()
8556
8593
  .append('rect')
8557
- .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${xAxis}Brush`)))
8594
+ .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`)))
8558
8595
  .attr('height', (d, i) => getBarHeight.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8559
- .attr('x', (d, i) => getBarX.call(this, d, i, `${xAxis}Brush`))
8596
+ .attr('x', (d, i) => getBarX.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8560
8597
  .attr('y', (d, i) => getBarY.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8561
8598
  // .transition(this.transition)
8562
8599
  .attr('fill', d => d.y.color || d.color || series.color)
@@ -8615,7 +8652,17 @@ if (this.options.showLabels === true || series.showLabels === true) {
8615
8652
  this.setAttribute('text-anchor', 'end')
8616
8653
  this.setAttribute('x', +(this.getAttribute('x')) - 8)
8617
8654
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
8618
- }
8655
+ }
8656
+ else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
8657
+ this.setAttribute('text-anchor', 'end')
8658
+ this.setAttribute('x', +(this.getAttribute('x')) - 8)
8659
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
8660
+ }
8661
+ else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
8662
+ this.setAttribute('text-anchor', 'start')
8663
+ this.setAttribute('x', +(this.getAttribute('x')) + 8)
8664
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
8665
+ }
8619
8666
  else if (series.labelPosition === 'outside') {
8620
8667
  this.setAttribute('text-anchor', 'start')
8621
8668
  this.setAttribute('x', +(this.getAttribute('x')) + 8)
@@ -8657,7 +8704,17 @@ if (this.options.showLabels === true || series.showLabels === true) {
8657
8704
  this.setAttribute('text-anchor', 'end')
8658
8705
  this.setAttribute('x', +(this.getAttribute('x')) - 8)
8659
8706
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
8660
- }
8707
+ }
8708
+ else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
8709
+ this.setAttribute('text-anchor', 'end')
8710
+ this.setAttribute('x', +(this.getAttribute('x')) - 8)
8711
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
8712
+ }
8713
+ else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
8714
+ this.setAttribute('text-anchor', 'start')
8715
+ this.setAttribute('x', +(this.getAttribute('x')) + 8)
8716
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
8717
+ }
8661
8718
  else if (series.labelPosition === 'outside') {
8662
8719
  this.setAttribute('text-anchor', 'start')
8663
8720
  this.setAttribute('x', +(this.getAttribute('x')) + 8)