@websy/websy-designs 1.7.7 → 1.7.9
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.
- package/dist/websy-designs-es6.debug.js +110 -57
- package/dist/websy-designs-es6.js +97 -52
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +110 -57
- package/dist/websy-designs.js +97 -52
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -7402,7 +7402,8 @@ class WebsyChart {
|
|
|
7402
7402
|
brushHeight: 50,
|
|
7403
7403
|
minBandWidth: 30,
|
|
7404
7404
|
maxBandWidth: 100,
|
|
7405
|
-
allowUnevenBands: true
|
|
7405
|
+
allowUnevenBands: true,
|
|
7406
|
+
balancedMinMax: false
|
|
7406
7407
|
}
|
|
7407
7408
|
this.elementId = elementId
|
|
7408
7409
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
@@ -7463,32 +7464,43 @@ class WebsyChart {
|
|
|
7463
7464
|
}
|
|
7464
7465
|
let that = this
|
|
7465
7466
|
this.brushed = function (event) {
|
|
7466
|
-
console.log('brushing', event)
|
|
7467
7467
|
let newX = (that.options.margin.left + that.options.margin.axisLeft) + (1 - (event.selection[0] / ((that.plotWidth) / (that.widthForCalc + that.totalBandPadding))))
|
|
7468
|
+
let newY = that.options.margin.top + that.options.margin.axisTop
|
|
7469
|
+
if (that.options.orientation === 'horizontal') {
|
|
7470
|
+
newX = that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft
|
|
7471
|
+
newY = (that.options.margin.top + that.options.margin.axisTop) + (1 - (event.selection[0] / ((that.plotHeight) / (that.widthForCalc + that.totalBandPadding))))
|
|
7472
|
+
}
|
|
7468
7473
|
if (that.plotArea) {
|
|
7469
|
-
that.plotArea.attr('transform', `translate(${newX}, ${
|
|
7474
|
+
that.plotArea.attr('transform', `translate(${newX}, ${newY})`)
|
|
7470
7475
|
}
|
|
7471
7476
|
if (that.areaLayer) {
|
|
7472
|
-
that.areaLayer.attr('transform', `translate(${newX}, ${
|
|
7477
|
+
that.areaLayer.attr('transform', `translate(${newX}, ${newY})`)
|
|
7473
7478
|
}
|
|
7474
7479
|
if (that.lineLayer) {
|
|
7475
|
-
that.lineLayer.attr('transform', `translate(${newX}, ${
|
|
7480
|
+
that.lineLayer.attr('transform', `translate(${newX}, ${newY})`)
|
|
7476
7481
|
}
|
|
7477
7482
|
if (that.barLayer) {
|
|
7478
|
-
that.barLayer.attr('transform', `translate(${newX}, ${
|
|
7483
|
+
that.barLayer.attr('transform', `translate(${newX}, ${newY})`)
|
|
7479
7484
|
}
|
|
7480
7485
|
if (that.labelLayer) {
|
|
7481
|
-
that.labelLayer.attr('transform', `translate(${newX}, ${
|
|
7486
|
+
that.labelLayer.attr('transform', `translate(${newX}, ${newY})`)
|
|
7482
7487
|
}
|
|
7483
7488
|
if (that.symbolLayer) {
|
|
7484
|
-
that.symbolLayer.attr('transform', `translate(${newX}, ${
|
|
7489
|
+
that.symbolLayer.attr('transform', `translate(${newX}, ${newY})`)
|
|
7485
7490
|
}
|
|
7486
7491
|
if (that.refLineLayer) {
|
|
7487
|
-
that.refLineLayer.attr('transform', `translate(${newX}, ${
|
|
7488
|
-
}
|
|
7489
|
-
if (that.
|
|
7490
|
-
|
|
7492
|
+
that.refLineLayer.attr('transform', `translate(${newX}, ${newY})`)
|
|
7493
|
+
}
|
|
7494
|
+
if (that.options.orientation === 'horizontal') {
|
|
7495
|
+
if (that.leftAxisLayer) {
|
|
7496
|
+
that.leftAxisLayer.attr('transform', `translate(${that.options.brushHeight + that.options.margin.left + that.options.margin.axisLeft}, ${newY})`)
|
|
7497
|
+
}
|
|
7491
7498
|
}
|
|
7499
|
+
else {
|
|
7500
|
+
if (that.bottomAxisLayer) {
|
|
7501
|
+
that.bottomAxisLayer.attr('transform', `translate(${newX}, ${newY + that.plotHeight})`)
|
|
7502
|
+
}
|
|
7503
|
+
}
|
|
7492
7504
|
// that.brushedDomain = []
|
|
7493
7505
|
// let xAxis = 'bottom'
|
|
7494
7506
|
// let xAxisCaps = 'Bottom'
|
|
@@ -7856,7 +7868,7 @@ this.clip = this.defs.append('clipPath').attr('id', `${this.elementId}_clip`).ap
|
|
|
7856
7868
|
this.xAxisClip = this.defs.append('clipPath').attr('id', `${this.elementId}_xAxisClip`).append('rect')
|
|
7857
7869
|
this.yAxisClip = this.defs.append('clipPath').attr('id', `${this.elementId}_yAxisClip`).append('rect')
|
|
7858
7870
|
this.brushClip = this.defs.append('clipPath').attr('id', `${this.elementId}_brushclip`).append('rect')
|
|
7859
|
-
this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer')
|
|
7871
|
+
this.leftAxisLayer = this.svg.append('g').attr('class', 'left-axis-layer').attr('clip-path', `url(#${this.elementId}_yAxisClip)`).append('g')
|
|
7860
7872
|
this.rightAxisLayer = this.svg.append('g').attr('class', 'right-axis-layer')
|
|
7861
7873
|
this.bottomAxisLayer = this.svg.append('g').attr('class', 'bottom-axis-layer').attr('clip-path', `url(#${this.elementId}_xAxisClip)`).append('g')
|
|
7862
7874
|
this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer')
|
|
@@ -8054,6 +8066,22 @@ else {
|
|
|
8054
8066
|
if (this.options.data.right.formatter) {
|
|
8055
8067
|
this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString()
|
|
8056
8068
|
}
|
|
8069
|
+
}
|
|
8070
|
+
// Check to see if we need to balance the min and max values
|
|
8071
|
+
if (this.options.balancedMinMax) {
|
|
8072
|
+
if (this.options.orientation === 'horizontal') {
|
|
8073
|
+
let biggestBottom = Math.max(Math.abs(this.options.data.bottom.min, this.options.data.bottom.max))
|
|
8074
|
+
this.options.data.bottom.min = 1 - biggestBottom
|
|
8075
|
+
this.options.data.bottom.max = biggestBottom
|
|
8076
|
+
}
|
|
8077
|
+
else {
|
|
8078
|
+
let biggestLeft = Math.max(Math.abs(this.options.data.left.min, this.options.data.left.max))
|
|
8079
|
+
this.options.data.left.min = 1 - biggestLeft
|
|
8080
|
+
this.options.data.left.max = biggestLeft
|
|
8081
|
+
let biggestRight = Math.max(Math.abs(this.options.data.right.min, this.options.data.right.max))
|
|
8082
|
+
this.options.data.right.min = 1 - biggestRight
|
|
8083
|
+
this.options.data.right.max = biggestRight
|
|
8084
|
+
}
|
|
8057
8085
|
}
|
|
8058
8086
|
// establish the space needed for the various axes
|
|
8059
8087
|
// this.options.margin.axisLeft = this.longestLeft * ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize) * 0.7
|
|
@@ -8235,48 +8263,53 @@ else {
|
|
|
8235
8263
|
// }
|
|
8236
8264
|
// }
|
|
8237
8265
|
// Translate the layers
|
|
8266
|
+
const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0
|
|
8238
8267
|
this.leftAxisLayer
|
|
8239
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8268
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8240
8269
|
.style('font-size', (this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize)
|
|
8241
8270
|
this.rightAxisLayer
|
|
8242
|
-
.attr('transform', `translate(${this.options.margin.left + this.plotWidth + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8271
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.plotWidth + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8243
8272
|
.style('font-size', (this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize)
|
|
8244
8273
|
this.bottomAxisLayer
|
|
8245
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
|
|
8274
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
|
|
8246
8275
|
.style('font-size', (this.options.data.bottom && this.options.data.bottom.fontSize) || this.options.fontSize)
|
|
8247
8276
|
this.leftAxisLabel
|
|
8248
|
-
.attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8277
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8249
8278
|
this.rightAxisLabel
|
|
8250
|
-
.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})`)
|
|
8279
|
+
.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})`)
|
|
8251
8280
|
this.bottomAxisLabel
|
|
8252
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
|
|
8281
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
|
|
8253
8282
|
this.plotArea
|
|
8254
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8283
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8255
8284
|
this.areaLayer
|
|
8256
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8285
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8257
8286
|
this.lineLayer
|
|
8258
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8287
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8259
8288
|
this.barLayer
|
|
8260
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8289
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8261
8290
|
this.labelLayer
|
|
8262
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8291
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8263
8292
|
this.symbolLayer
|
|
8264
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8293
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8265
8294
|
this.refLineLayer
|
|
8266
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8295
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8267
8296
|
this.trackingLineLayer
|
|
8268
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8297
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8269
8298
|
this.clip
|
|
8270
|
-
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, 0)`)
|
|
8299
|
+
.attr('transform', `translate(${(leftBrushAdjustment) + this.options.margin.left + this.options.margin.axisLeft}, 0)`)
|
|
8271
8300
|
.attr('width', this.plotWidth)
|
|
8272
8301
|
.attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop)
|
|
8273
8302
|
if (this.options.orientation === 'horizontal') {
|
|
8274
8303
|
this.brushLayer
|
|
8275
8304
|
.attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8276
8305
|
this.yAxisClip
|
|
8277
|
-
.attr('transform', `translate(${
|
|
8278
|
-
.attr('width', this.options.margin.axisLeft
|
|
8279
|
-
.attr('height', this.plotHeight)
|
|
8306
|
+
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8307
|
+
.attr('width', this.options.margin.axisLeft + 10)
|
|
8308
|
+
.attr('height', this.plotHeight)
|
|
8309
|
+
this.xAxisClip
|
|
8310
|
+
.attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
|
|
8311
|
+
.attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
|
|
8312
|
+
.attr('height', longestBottomBounds.height + 10)
|
|
8280
8313
|
this.brushClip
|
|
8281
8314
|
.attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8282
8315
|
.attr('height', this.plotHeight)
|
|
@@ -8285,6 +8318,10 @@ else {
|
|
|
8285
8318
|
else {
|
|
8286
8319
|
this.brushLayer
|
|
8287
8320
|
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
|
|
8321
|
+
this.yAxisClip
|
|
8322
|
+
.attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop - 10})`)
|
|
8323
|
+
.attr('width', this.options.margin.axisLeft + 10)
|
|
8324
|
+
.attr('height', this.plotHeight + 20)
|
|
8288
8325
|
this.xAxisClip
|
|
8289
8326
|
.attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
|
|
8290
8327
|
.attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
|
|
@@ -8801,7 +8838,7 @@ function getBarHeight (d, i, yAxis, xAxis) {
|
|
|
8801
8838
|
output = Math.max(1, this.options.data[xAxis].bandWidth - (xAxis.indexOf('Brush') !== -1 ? 2 : this.options.groupPadding * 2))
|
|
8802
8839
|
}
|
|
8803
8840
|
else {
|
|
8804
|
-
let x = getBarX.call(this, d, i, xAxis)
|
|
8841
|
+
let x = getBarX.call(this, d, i, yAxis, xAxis)
|
|
8805
8842
|
if (typeof x === 'undefined' || x === null) {
|
|
8806
8843
|
return null
|
|
8807
8844
|
}
|
|
@@ -8812,15 +8849,16 @@ function getBarHeight (d, i, yAxis, xAxis) {
|
|
|
8812
8849
|
}
|
|
8813
8850
|
return output
|
|
8814
8851
|
}
|
|
8815
|
-
function getBarWidth (d, i, xAxis) {
|
|
8852
|
+
function getBarWidth (d, i, yAxis, xAxis) {
|
|
8816
8853
|
let output
|
|
8817
8854
|
if (this.options.orientation === 'horizontal') {
|
|
8818
8855
|
// output = this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8856
|
+
// output = this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8857
|
+
// output = (this[`${yAxis}Axis`](0)) + this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8819
8858
|
output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8820
|
-
// output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8821
8859
|
}
|
|
8822
8860
|
else {
|
|
8823
|
-
let x = getBarX.call(this, d, i, xAxis)
|
|
8861
|
+
let x = getBarX.call(this, d, i, yAxis, xAxis)
|
|
8824
8862
|
if (typeof x === 'undefined' || x === null) {
|
|
8825
8863
|
return null
|
|
8826
8864
|
}
|
|
@@ -8831,7 +8869,7 @@ function getBarWidth (d, i, xAxis) {
|
|
|
8831
8869
|
}
|
|
8832
8870
|
return output
|
|
8833
8871
|
}
|
|
8834
|
-
function getBarX (d, i, xAxis) {
|
|
8872
|
+
function getBarX (d, i, yAxis, xAxis) {
|
|
8835
8873
|
let output
|
|
8836
8874
|
if (this.options.orientation === 'horizontal') {
|
|
8837
8875
|
// if (this.options.grouping === 'stacked') {
|
|
@@ -8850,13 +8888,24 @@ function getBarX (d, i, xAxis) {
|
|
|
8850
8888
|
// output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
8851
8889
|
// }
|
|
8852
8890
|
if (this.options.grouping === 'stacked') { // no support for stacks yet
|
|
8853
|
-
let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
|
|
8854
|
-
let h = getBarWidth.call(this, d, i, xAxis)
|
|
8855
|
-
output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
|
|
8891
|
+
let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, yAxis, xAxis)
|
|
8892
|
+
let h = getBarWidth.call(this, d, i, yAxis, xAxis)
|
|
8893
|
+
// output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
|
|
8894
|
+
if (d.y.value >= 0) {
|
|
8895
|
+
output = (this[`${yAxis}Axis`](0)) + ((Math.abs(accH)) * (d.y.accumulative > 0 ? 1 : 0))
|
|
8896
|
+
}
|
|
8897
|
+
else {
|
|
8898
|
+
output = (this[`${yAxis}Axis`](0)) - ((Math.abs(accH) + Math.abs(h)) * (d.y.accumulative > 0 ? 1 : 0))
|
|
8899
|
+
}
|
|
8856
8900
|
}
|
|
8857
8901
|
else {
|
|
8858
|
-
let h = getBarWidth.call(this, d, i, xAxis)
|
|
8859
|
-
|
|
8902
|
+
let h = getBarWidth.call(this, d, i, yAxis, xAxis)
|
|
8903
|
+
if (d.y.value >= 0) {
|
|
8904
|
+
output = (this[`${yAxis}Axis`](0))
|
|
8905
|
+
}
|
|
8906
|
+
else {
|
|
8907
|
+
output = (this[`${yAxis}Axis`](0)) + h
|
|
8908
|
+
}
|
|
8860
8909
|
}
|
|
8861
8910
|
}
|
|
8862
8911
|
else {
|
|
@@ -8945,9 +8994,9 @@ bars
|
|
|
8945
8994
|
.remove()
|
|
8946
8995
|
|
|
8947
8996
|
bars
|
|
8948
|
-
.attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, xAxis)))
|
|
8997
|
+
.attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, yAxis, xAxis)))
|
|
8949
8998
|
.attr('height', (d, i) => getBarHeight.call(this, d, i, yAxis, xAxis))
|
|
8950
|
-
.attr('x', (d, i) => getBarX.call(this, d, i, xAxis))
|
|
8999
|
+
.attr('x', (d, i) => getBarX.call(this, d, i, yAxis, xAxis))
|
|
8951
9000
|
.attr('y', (d, i) => getBarY.call(this, d, i, yAxis, xAxis))
|
|
8952
9001
|
// .transition(this.transition)
|
|
8953
9002
|
.attr('fill', d => d.y.color || d.color || series.color)
|
|
@@ -8955,9 +9004,9 @@ bars
|
|
|
8955
9004
|
bars
|
|
8956
9005
|
.enter()
|
|
8957
9006
|
.append('rect')
|
|
8958
|
-
.attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, xAxis)))
|
|
9007
|
+
.attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, yAxis, xAxis)))
|
|
8959
9008
|
.attr('height', (d, i) => getBarHeight.call(this, d, i, yAxis, xAxis))
|
|
8960
|
-
.attr('x', (d, i) => getBarX.call(this, d, i, xAxis))
|
|
9009
|
+
.attr('x', (d, i) => getBarX.call(this, d, i, yAxis, xAxis))
|
|
8961
9010
|
.attr('y', (d, i) => getBarY.call(this, d, i, yAxis, xAxis))
|
|
8962
9011
|
// .transition(this.transition)
|
|
8963
9012
|
.attr('fill', d => d.y.color || d.color || series.color)
|
|
@@ -8974,9 +9023,9 @@ if (!this.brushBarsInitialized[series.key]) {
|
|
|
8974
9023
|
.remove()
|
|
8975
9024
|
|
|
8976
9025
|
brushBars
|
|
8977
|
-
.attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${xAxis}Brush`)))
|
|
9026
|
+
.attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`)))
|
|
8978
9027
|
.attr('height', (d, i) => getBarHeight.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
|
|
8979
|
-
.attr('x', (d, i) => getBarX.call(this, d, i, `${xAxis}Brush`))
|
|
9028
|
+
.attr('x', (d, i) => getBarX.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
|
|
8980
9029
|
.attr('y', (d, i) => getBarY.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
|
|
8981
9030
|
// .transition(this.transition)
|
|
8982
9031
|
.attr('fill', d => d.y.color || d.color || series.color)
|
|
@@ -8984,9 +9033,9 @@ if (!this.brushBarsInitialized[series.key]) {
|
|
|
8984
9033
|
brushBars
|
|
8985
9034
|
.enter()
|
|
8986
9035
|
.append('rect')
|
|
8987
|
-
.attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${xAxis}Brush`)))
|
|
9036
|
+
.attr('width', (d, i) => Math.abs(getBarWidth.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`)))
|
|
8988
9037
|
.attr('height', (d, i) => getBarHeight.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
|
|
8989
|
-
.attr('x', (d, i) => getBarX.call(this, d, i, `${xAxis}Brush`))
|
|
9038
|
+
.attr('x', (d, i) => getBarX.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
|
|
8990
9039
|
.attr('y', (d, i) => getBarY.call(this, d, i, `${yAxis}Brush`, `${xAxis}Brush`))
|
|
8991
9040
|
// .transition(this.transition)
|
|
8992
9041
|
.attr('fill', d => d.y.color || d.color || series.color)
|
|
@@ -9042,26 +9091,30 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
9042
9091
|
this.setAttribute('text-anchor', 'middle')
|
|
9043
9092
|
}
|
|
9044
9093
|
else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
9094
|
+
console.log('anhor end for', d.y.value)
|
|
9045
9095
|
this.setAttribute('text-anchor', 'end')
|
|
9046
9096
|
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
9047
9097
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
9048
9098
|
}
|
|
9049
|
-
else if (d.y.value < 0 &&
|
|
9050
|
-
this.setAttribute('text-anchor', 'end')
|
|
9051
|
-
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
9052
|
-
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
9053
|
-
}
|
|
9054
|
-
else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
|
|
9099
|
+
else if (d.y.value < 0 && this.getAttribute('x') < 0) {
|
|
9055
9100
|
this.setAttribute('text-anchor', 'start')
|
|
9056
|
-
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
9101
|
+
this.setAttribute('x', Math.max(+(this.getAttribute('x')) + 8, 8))
|
|
9057
9102
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
9058
9103
|
}
|
|
9104
|
+
else if (d.y.value < 0 && this.getAttribute('x') > 0) {
|
|
9105
|
+
console.log('anhor end for', d.y.value)
|
|
9106
|
+
this.setAttribute('text-anchor', 'end')
|
|
9107
|
+
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
9108
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
9109
|
+
}
|
|
9059
9110
|
else if (series.labelPosition === 'outside') {
|
|
9060
9111
|
this.setAttribute('text-anchor', 'start')
|
|
9061
9112
|
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
9062
9113
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
9063
9114
|
}
|
|
9064
|
-
else {
|
|
9115
|
+
else {
|
|
9116
|
+
console.log('anhor end for', d.y.value)
|
|
9117
|
+
this.setAttribute('text-anchor', 'start')
|
|
9065
9118
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
9066
9119
|
}
|
|
9067
9120
|
}
|