@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.
@@ -6526,7 +6526,12 @@ class WebsyTable3 {
6526
6526
  this.currentData = data
6527
6527
  }
6528
6528
  else {
6529
- bodyEl.innerHTML += this.buildBodyHtml(data, true)
6529
+ if (bodyEl.querySelector('tbody')) {
6530
+ bodyEl.querySelector('tbody').innerHTML += this.buildBodyHtml(data, true, true)
6531
+ }
6532
+ else {
6533
+ bodyEl.innerHTML += this.buildBodyHtml(data, true)
6534
+ }
6530
6535
  this.currentData = this.currentData.concat(data)
6531
6536
  }
6532
6537
  }
@@ -7458,32 +7463,43 @@ class WebsyChart {
7458
7463
  }
7459
7464
  let that = this
7460
7465
  this.brushed = function (event) {
7461
- console.log('brushing', event)
7462
7466
  let newX = (that.options.margin.left + that.options.margin.axisLeft) + (1 - (event.selection[0] / ((that.plotWidth) / (that.widthForCalc + that.totalBandPadding))))
7467
+ let newY = that.options.margin.top + that.options.margin.axisTop
7468
+ if (that.options.orientation === 'horizontal') {
7469
+ newX = that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft
7470
+ newY = (that.options.margin.top + that.options.margin.axisTop) + (1 - (event.selection[0] / ((that.plotHeight) / (that.widthForCalc + that.totalBandPadding))))
7471
+ }
7463
7472
  if (that.plotArea) {
7464
- that.plotArea.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7473
+ that.plotArea.attr('transform', `translate(${newX}, ${newY})`)
7465
7474
  }
7466
7475
  if (that.areaLayer) {
7467
- that.areaLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7476
+ that.areaLayer.attr('transform', `translate(${newX}, ${newY})`)
7468
7477
  }
7469
7478
  if (that.lineLayer) {
7470
- that.lineLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7479
+ that.lineLayer.attr('transform', `translate(${newX}, ${newY})`)
7471
7480
  }
7472
7481
  if (that.barLayer) {
7473
- that.barLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7482
+ that.barLayer.attr('transform', `translate(${newX}, ${newY})`)
7474
7483
  }
7475
7484
  if (that.labelLayer) {
7476
- that.labelLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7485
+ that.labelLayer.attr('transform', `translate(${newX}, ${newY})`)
7477
7486
  }
7478
7487
  if (that.symbolLayer) {
7479
- that.symbolLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7488
+ that.symbolLayer.attr('transform', `translate(${newX}, ${newY})`)
7480
7489
  }
7481
7490
  if (that.refLineLayer) {
7482
- that.refLineLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop})`)
7483
- }
7484
- if (that.bottomAxisLayer) {
7485
- that.bottomAxisLayer.attr('transform', `translate(${newX}, ${that.options.margin.top + that.options.margin.axisTop + that.plotHeight})`)
7491
+ that.refLineLayer.attr('transform', `translate(${newX}, ${newY})`)
7492
+ }
7493
+ if (that.options.orientation === 'horizontal') {
7494
+ if (that.leftAxisLayer) {
7495
+ that.leftAxisLayer.attr('transform', `translate(${that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft}, ${newY})`)
7496
+ }
7486
7497
  }
7498
+ else {
7499
+ if (that.bottomAxisLayer) {
7500
+ that.bottomAxisLayer.attr('transform', `translate(${newX}, ${newY + that.plotHeight})`)
7501
+ }
7502
+ }
7487
7503
  // that.brushedDomain = []
7488
7504
  // let xAxis = 'bottom'
7489
7505
  // let xAxisCaps = 'Bottom'
@@ -7588,18 +7604,18 @@ class WebsyChart {
7588
7604
  this.render()
7589
7605
  }
7590
7606
  close () {
7591
- this.leftAxisLayer.selectAll('*').remove()
7592
- this.rightAxisLayer.selectAll('*').remove()
7593
- this.bottomAxisLayer.selectAll('*').remove()
7594
- this.leftAxisLabel.selectAll('*').remove()
7595
- this.rightAxisLabel.selectAll('*').remove()
7596
- this.bottomAxisLabel.selectAll('*').remove()
7597
- this.plotArea.selectAll('*').remove()
7598
- this.areaLayer.selectAll('*').remove()
7599
- this.lineLayer.selectAll('*').remove()
7600
- this.barLayer.selectAll('*').remove()
7601
- this.labelLayer.selectAll('*').remove()
7602
- this.symbolLayer.selectAll('*').remove()
7607
+ this.leftAxisLayer && this.leftAxisLayer.selectAll('*').remove()
7608
+ this.rightAxisLayer && this.rightAxisLayer.selectAll('*').remove()
7609
+ this.bottomAxisLayer && this.bottomAxisLayer.selectAll('*').remove()
7610
+ this.leftAxisLabel && this.leftAxisLabel.selectAll('*').remove()
7611
+ this.rightAxisLabel && this.rightAxisLabel.selectAll('*').remove()
7612
+ this.bottomAxisLabel && this.bottomAxisLabel.selectAll('*').remove()
7613
+ this.plotArea && this.plotArea.selectAll('*').remove()
7614
+ this.areaLayer && this.areaLayer.selectAll('*').remove()
7615
+ this.lineLayer && this.lineLayer.selectAll('*').remove()
7616
+ this.barLayer && this.barLayer.selectAll('*').remove()
7617
+ this.labelLayer && this.labelLayer.selectAll('*').remove()
7618
+ this.symbolLayer && this.symbolLayer.selectAll('*').remove()
7603
7619
  }
7604
7620
  createDomain (side, forBrush = false) {
7605
7621
  let domain = []
@@ -7851,7 +7867,7 @@ this.clip = this.defs.append('clipPath').attr('id', `${this.elementId}_clip`).ap
7851
7867
  this.xAxisClip = this.defs.append('clipPath').attr('id', `${this.elementId}_xAxisClip`).append('rect')
7852
7868
  this.yAxisClip = this.defs.append('clipPath').attr('id', `${this.elementId}_yAxisClip`).append('rect')
7853
7869
  this.brushClip = this.defs.append('clipPath').attr('id', `${this.elementId}_brushclip`).append('rect')
7854
- this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer') // .attr('clip-path', `url(#${this.elementId}_yAxisClip)`).append('g')
7870
+ this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer').attr('clip-path', `url(#${this.elementId}_yAxisClip)`).append('g')
7855
7871
  this.rightAxisLayer = this.svg.append('g').attr('class', 'right-axis-layer')
7856
7872
  this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer').attr('clip-path', `url(#${this.elementId}_xAxisClip)`).append('g')
7857
7873
  this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer')
@@ -8230,48 +8246,53 @@ else {
8230
8246
  // }
8231
8247
  // }
8232
8248
  // Translate the layers
8249
+ const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight + 5 : 0
8233
8250
  this.leftAxisLayer
8234
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8251
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8235
8252
  .style('font-size', (this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize)
8236
8253
  this.rightAxisLayer
8237
- .attr('transform', `translate(${this.options.margin.left + this.plotWidth + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8254
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.plotWidth + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8238
8255
  .style('font-size', (this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize)
8239
8256
  this.bottomAxisLayer
8240
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8257
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8241
8258
  .style('font-size', (this.options.data.bottom && this.options.data.bottom.fontSize) || this.options.fontSize)
8242
8259
  this.leftAxisLabel
8243
- .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8260
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8244
8261
  this.rightAxisLabel
8245
- .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})`)
8262
+ .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})`)
8246
8263
  this.bottomAxisLabel
8247
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8264
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8248
8265
  this.plotArea
8249
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8266
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8250
8267
  this.areaLayer
8251
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8268
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8252
8269
  this.lineLayer
8253
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8270
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8254
8271
  this.barLayer
8255
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8272
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8256
8273
  this.labelLayer
8257
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8274
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8258
8275
  this.symbolLayer
8259
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8276
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8260
8277
  this.refLineLayer
8261
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8278
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8262
8279
  this.trackingLineLayer
8263
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8280
+ .attr('transform', `translate(${leftBrushAdjustment - 5 + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8264
8281
  this.clip
8265
- .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, 0)`)
8282
+ .attr('transform', `translate(${(leftBrushAdjustment - 5) + this.options.margin.left + this.options.margin.axisLeft}, 0)`)
8266
8283
  .attr('width', this.plotWidth)
8267
8284
  .attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop)
8268
8285
  if (this.options.orientation === 'horizontal') {
8269
8286
  this.brushLayer
8270
8287
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8271
8288
  this.yAxisClip
8272
- .attr('transform', `translate(${this.options.brushHeight + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8273
- .attr('width', this.options.margin.axisLeft - this.options.brushHeight)
8274
- .attr('height', this.plotHeight)
8289
+ .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8290
+ .attr('width', this.options.margin.axisLeft + 10)
8291
+ .attr('height', this.plotHeight)
8292
+ this.xAxisClip
8293
+ .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8294
+ .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
8295
+ .attr('height', longestBottomBounds.height + 10)
8275
8296
  this.brushClip
8276
8297
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8277
8298
  .attr('height', this.plotHeight)
@@ -8280,6 +8301,10 @@ else {
8280
8301
  else {
8281
8302
  this.brushLayer
8282
8303
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
8304
+ this.yAxisClip
8305
+ .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop - 10})`)
8306
+ .attr('width', this.options.margin.axisLeft + 10)
8307
+ .attr('height', this.plotHeight + 20)
8283
8308
  this.xAxisClip
8284
8309
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8285
8310
  .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
@@ -8796,7 +8821,7 @@ function getBarHeight (d, i, yAxis, xAxis) {
8796
8821
  output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2))
8797
8822
  }
8798
8823
  else {
8799
- let x = getBarX.call(this, d, i, xAxis)
8824
+ let x = getBarX.call(this, d, i, yAxis, xAxis)
8800
8825
  if (typeof x === 'undefined' || x === null) {
8801
8826
  return null
8802
8827
  }
@@ -8807,14 +8832,16 @@ function getBarHeight (d, i, yAxis, xAxis) {
8807
8832
  }
8808
8833
  return output
8809
8834
  }
8810
- function getBarWidth (d, i, xAxis) {
8835
+ function getBarWidth (d, i, yAxis, xAxis) {
8811
8836
  let output
8812
8837
  if (this.options.orientation === 'horizontal') {
8838
+ // output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8813
8839
  output = this[`${yAxis}Axis`](Math.abs(d.y.value))
8840
+ // output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
8814
8841
  // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
8815
8842
  }
8816
8843
  else {
8817
- let x = getBarX.call(this, d, i, xAxis)
8844
+ let x = getBarX.call(this, d, i, yAxis, xAxis)
8818
8845
  if (typeof x === 'undefined' || x === null) {
8819
8846
  return null
8820
8847
  }
@@ -8825,23 +8852,33 @@ function getBarWidth (d, i, xAxis) {
8825
8852
  }
8826
8853
  return output
8827
8854
  }
8828
- function getBarX (d, i, xAxis) {
8855
+ function getBarX (d, i, yAxis, xAxis) {
8829
8856
  let output
8830
8857
  if (this.options.orientation === 'horizontal') {
8831
- if (this.options.grouping === 'stacked') {
8832
- // let h = getBarWidth.call(this, d, i, xAxis)
8833
- // let adjustment = 0
8834
- // if (d.y.accumulative && d.y.accumulative !== 0) {
8835
- // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
8836
- // }
8837
- // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
8838
- let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
8839
- // let h = getBarWidth.call(this, d, i, xAxis)
8840
- output = (accH * (d.y.accumulative < 0 ? 0 : 1))
8858
+ // if (this.options.grouping === 'stacked') {
8859
+ // // let h = getBarWidth.call(this, d, i, xAxis)
8860
+ // // let adjustment = 0
8861
+ // // if (d.y.accumulative && d.y.accumulative !== 0) {
8862
+ // // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
8863
+ // // }
8864
+ // // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
8865
+ // let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
8866
+ // // let h = getBarWidth.call(this, d, i, xAxis)
8867
+ // output = (accH * (d.y.accumulative < 0 ? 0 : 1))
8868
+ // }
8869
+ // else {
8870
+ // let h = getBarWidth.call(this, d, i, xAxis)
8871
+ // output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value < 0 ? 1 : 0))
8872
+ // }
8873
+ if (this.options.grouping === 'stacked') { // no support for stacks yet
8874
+ let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, yAxis, xAxis)
8875
+ let h = getBarWidth.call(this, d, i, yAxis, xAxis)
8876
+ // output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
8877
+ output = (this[`${yAxis}Axis`](0)) + ((accH) * (d.y.accumulative > 0 ? 1 : 0))
8841
8878
  }
8842
8879
  else {
8843
- let h = getBarWidth.call(this, d, i, xAxis)
8844
- output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value < 0 ? 1 : 0))
8880
+ let h = getBarWidth.call(this, d, i, yAxis, xAxis)
8881
+ output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value > 0 ? 0 : 1))
8845
8882
  }
8846
8883
  }
8847
8884
  else {
@@ -8930,9 +8967,9 @@ bars
8930
8967
  .remove()
8931
8968
 
8932
8969
  bars
8933
- .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, xAxis)))
8970
+ .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, yAxis, xAxis)))
8934
8971
  .attr('height', (d, i) => getBarHeight.call(this, d, i, yAxis, xAxis))
8935
- .attr('x', (d, i) => getBarX.call(this, d, i, xAxis))
8972
+ .attr('x', (d, i) => getBarX.call(this, d, i, yAxis, xAxis))
8936
8973
  .attr('y', (d, i) => getBarY.call(this, d, i, yAxis, xAxis))
8937
8974
  // .transition(this.transition)
8938
8975
  .attr('fill', d => d.y.color || d.color || series.color)
@@ -8940,9 +8977,9 @@ bars
8940
8977
  bars
8941
8978
  .enter()
8942
8979
  .append('rect')
8943
- .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, xAxis)))
8980
+ .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, yAxis, xAxis)))
8944
8981
  .attr('height', (d, i) => getBarHeight.call(this, d, i, yAxis, xAxis))
8945
- .attr('x', (d, i) => getBarX.call(this, d, i, xAxis))
8982
+ .attr('x', (d, i) => getBarX.call(this, d, i, yAxis, xAxis))
8946
8983
  .attr('y', (d, i) => getBarY.call(this, d, i, yAxis, xAxis))
8947
8984
  // .transition(this.transition)
8948
8985
  .attr('fill', d => d.y.color || d.color || series.color)
@@ -8959,9 +8996,9 @@ if (!this.brushBarsInitialized[series.key]) {
8959
8996
  .remove()
8960
8997
 
8961
8998
  brushBars
8962
- .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${xAxis}Brush`)))
8999
+ .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`)))
8963
9000
  .attr('height', (d, i) => getBarHeight.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8964
- .attr('x', (d, i) => getBarX.call(this, d, i, `${xAxis}Brush`))
9001
+ .attr('x', (d, i) => getBarX.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8965
9002
  .attr('y', (d, i) => getBarY.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8966
9003
  // .transition(this.transition)
8967
9004
  .attr('fill', d => d.y.color || d.color || series.color)
@@ -8969,9 +9006,9 @@ if (!this.brushBarsInitialized[series.key]) {
8969
9006
  brushBars
8970
9007
  .enter()
8971
9008
  .append('rect')
8972
- .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${xAxis}Brush`)))
9009
+ .attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`)))
8973
9010
  .attr('height', (d, i) => getBarHeight.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8974
- .attr('x', (d, i) => getBarX.call(this, d, i, `${xAxis}Brush`))
9011
+ .attr('x', (d, i) => getBarX.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8975
9012
  .attr('y', (d, i) => getBarY.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
8976
9013
  // .transition(this.transition)
8977
9014
  .attr('fill', d => d.y.color || d.color || series.color)
@@ -9030,7 +9067,17 @@ if (this.options.showLabels === true || series.showLabels === true) {
9030
9067
  this.setAttribute('text-anchor', 'end')
9031
9068
  this.setAttribute('x', +(this.getAttribute('x')) - 8)
9032
9069
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
9033
- }
9070
+ }
9071
+ else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
9072
+ this.setAttribute('text-anchor', 'end')
9073
+ this.setAttribute('x', +(this.getAttribute('x')) - 8)
9074
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
9075
+ }
9076
+ else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
9077
+ this.setAttribute('text-anchor', 'start')
9078
+ this.setAttribute('x', +(this.getAttribute('x')) + 8)
9079
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
9080
+ }
9034
9081
  else if (series.labelPosition === 'outside') {
9035
9082
  this.setAttribute('text-anchor', 'start')
9036
9083
  this.setAttribute('x', +(this.getAttribute('x')) + 8)
@@ -9072,7 +9119,17 @@ if (this.options.showLabels === true || series.showLabels === true) {
9072
9119
  this.setAttribute('text-anchor', 'end')
9073
9120
  this.setAttribute('x', +(this.getAttribute('x')) - 8)
9074
9121
  this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
9075
- }
9122
+ }
9123
+ else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
9124
+ this.setAttribute('text-anchor', 'end')
9125
+ this.setAttribute('x', +(this.getAttribute('x')) - 8)
9126
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
9127
+ }
9128
+ else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
9129
+ this.setAttribute('text-anchor', 'start')
9130
+ this.setAttribute('x', +(this.getAttribute('x')) + 8)
9131
+ this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
9132
+ }
9076
9133
  else if (series.labelPosition === 'outside') {
9077
9134
  this.setAttribute('text-anchor', 'start')
9078
9135
  this.setAttribute('x', +(this.getAttribute('x')) + 8)