@websy/websy-designs 1.7.6 → 1.7.7
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.
|
|
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
|
}
|
|
@@ -7588,18 +7593,18 @@ class WebsyChart {
|
|
|
7588
7593
|
this.render()
|
|
7589
7594
|
}
|
|
7590
7595
|
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()
|
|
7596
|
+
this.leftAxisLayer && this.leftAxisLayer.selectAll('*').remove()
|
|
7597
|
+
this.rightAxisLayer && this.rightAxisLayer.selectAll('*').remove()
|
|
7598
|
+
this.bottomAxisLayer && this.bottomAxisLayer.selectAll('*').remove()
|
|
7599
|
+
this.leftAxisLabel && this.leftAxisLabel.selectAll('*').remove()
|
|
7600
|
+
this.rightAxisLabel && this.rightAxisLabel.selectAll('*').remove()
|
|
7601
|
+
this.bottomAxisLabel && this.bottomAxisLabel.selectAll('*').remove()
|
|
7602
|
+
this.plotArea && this.plotArea.selectAll('*').remove()
|
|
7603
|
+
this.areaLayer && this.areaLayer.selectAll('*').remove()
|
|
7604
|
+
this.lineLayer && this.lineLayer.selectAll('*').remove()
|
|
7605
|
+
this.barLayer && this.barLayer.selectAll('*').remove()
|
|
7606
|
+
this.labelLayer && this.labelLayer.selectAll('*').remove()
|
|
7607
|
+
this.symbolLayer && this.symbolLayer.selectAll('*').remove()
|
|
7603
7608
|
}
|
|
7604
7609
|
createDomain (side, forBrush = false) {
|
|
7605
7610
|
let domain = []
|
|
@@ -8810,7 +8815,8 @@ function getBarHeight (d, i, yAxis, xAxis) {
|
|
|
8810
8815
|
function getBarWidth (d, i, xAxis) {
|
|
8811
8816
|
let output
|
|
8812
8817
|
if (this.options.orientation === 'horizontal') {
|
|
8813
|
-
output = this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8818
|
+
// output = this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8819
|
+
output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8814
8820
|
// output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8815
8821
|
}
|
|
8816
8822
|
else {
|
|
@@ -8828,20 +8834,29 @@ function getBarWidth (d, i, xAxis) {
|
|
|
8828
8834
|
function getBarX (d, i, xAxis) {
|
|
8829
8835
|
let output
|
|
8830
8836
|
if (this.options.orientation === 'horizontal') {
|
|
8831
|
-
if (this.options.grouping === 'stacked') {
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8837
|
+
// if (this.options.grouping === 'stacked') {
|
|
8838
|
+
// // let h = getBarWidth.call(this, d, i, xAxis)
|
|
8839
|
+
// // let adjustment = 0
|
|
8840
|
+
// // if (d.y.accumulative && d.y.accumulative !== 0) {
|
|
8841
|
+
// // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
|
|
8842
|
+
// // }
|
|
8843
|
+
// // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
8844
|
+
// let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
|
|
8845
|
+
// // let h = getBarWidth.call(this, d, i, xAxis)
|
|
8846
|
+
// output = (accH * (d.y.accumulative < 0 ? 0 : 1))
|
|
8847
|
+
// }
|
|
8848
|
+
// else {
|
|
8849
|
+
// let h = getBarWidth.call(this, d, i, xAxis)
|
|
8850
|
+
// output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
8851
|
+
// }
|
|
8852
|
+
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))
|
|
8841
8856
|
}
|
|
8842
8857
|
else {
|
|
8843
8858
|
let h = getBarWidth.call(this, d, i, xAxis)
|
|
8844
|
-
output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value
|
|
8859
|
+
output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value > 0 ? 0 : 1))
|
|
8845
8860
|
}
|
|
8846
8861
|
}
|
|
8847
8862
|
else {
|
|
@@ -9030,7 +9045,17 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
9030
9045
|
this.setAttribute('text-anchor', 'end')
|
|
9031
9046
|
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
9032
9047
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
9033
|
-
}
|
|
9048
|
+
}
|
|
9049
|
+
else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
|
|
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) {
|
|
9055
|
+
this.setAttribute('text-anchor', 'start')
|
|
9056
|
+
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
9057
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
9058
|
+
}
|
|
9034
9059
|
else if (series.labelPosition === 'outside') {
|
|
9035
9060
|
this.setAttribute('text-anchor', 'start')
|
|
9036
9061
|
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
@@ -9072,7 +9097,17 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
9072
9097
|
this.setAttribute('text-anchor', 'end')
|
|
9073
9098
|
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
9074
9099
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
9075
|
-
}
|
|
9100
|
+
}
|
|
9101
|
+
else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
|
|
9102
|
+
this.setAttribute('text-anchor', 'end')
|
|
9103
|
+
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
9104
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
9105
|
+
}
|
|
9106
|
+
else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
|
|
9107
|
+
this.setAttribute('text-anchor', 'start')
|
|
9108
|
+
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
9109
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
9110
|
+
}
|
|
9076
9111
|
else if (series.labelPosition === 'outside') {
|
|
9077
9112
|
this.setAttribute('text-anchor', 'start')
|
|
9078
9113
|
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
package/dist/websy-designs.js
CHANGED
|
@@ -7156,7 +7156,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7156
7156
|
bodyEl.innerHTML = this.buildBodyHtml(data, true);
|
|
7157
7157
|
this.currentData = data;
|
|
7158
7158
|
} else {
|
|
7159
|
-
bodyEl.
|
|
7159
|
+
if (bodyEl.querySelector('tbody')) {
|
|
7160
|
+
bodyEl.querySelector('tbody').innerHTML += this.buildBodyHtml(data, true, true);
|
|
7161
|
+
} else {
|
|
7162
|
+
bodyEl.innerHTML += this.buildBodyHtml(data, true);
|
|
7163
|
+
}
|
|
7164
|
+
|
|
7160
7165
|
this.currentData = this.currentData.concat(data);
|
|
7161
7166
|
}
|
|
7162
7167
|
} // this.data = this.data.concat(data)
|
|
@@ -8380,18 +8385,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8380
8385
|
_createClass(WebsyChart, [{
|
|
8381
8386
|
key: "close",
|
|
8382
8387
|
value: function close() {
|
|
8383
|
-
this.leftAxisLayer.selectAll('*').remove();
|
|
8384
|
-
this.rightAxisLayer.selectAll('*').remove();
|
|
8385
|
-
this.bottomAxisLayer.selectAll('*').remove();
|
|
8386
|
-
this.leftAxisLabel.selectAll('*').remove();
|
|
8387
|
-
this.rightAxisLabel.selectAll('*').remove();
|
|
8388
|
-
this.bottomAxisLabel.selectAll('*').remove();
|
|
8389
|
-
this.plotArea.selectAll('*').remove();
|
|
8390
|
-
this.areaLayer.selectAll('*').remove();
|
|
8391
|
-
this.lineLayer.selectAll('*').remove();
|
|
8392
|
-
this.barLayer.selectAll('*').remove();
|
|
8393
|
-
this.labelLayer.selectAll('*').remove();
|
|
8394
|
-
this.symbolLayer.selectAll('*').remove();
|
|
8388
|
+
this.leftAxisLayer && this.leftAxisLayer.selectAll('*').remove();
|
|
8389
|
+
this.rightAxisLayer && this.rightAxisLayer.selectAll('*').remove();
|
|
8390
|
+
this.bottomAxisLayer && this.bottomAxisLayer.selectAll('*').remove();
|
|
8391
|
+
this.leftAxisLabel && this.leftAxisLabel.selectAll('*').remove();
|
|
8392
|
+
this.rightAxisLabel && this.rightAxisLabel.selectAll('*').remove();
|
|
8393
|
+
this.bottomAxisLabel && this.bottomAxisLabel.selectAll('*').remove();
|
|
8394
|
+
this.plotArea && this.plotArea.selectAll('*').remove();
|
|
8395
|
+
this.areaLayer && this.areaLayer.selectAll('*').remove();
|
|
8396
|
+
this.lineLayer && this.lineLayer.selectAll('*').remove();
|
|
8397
|
+
this.barLayer && this.barLayer.selectAll('*').remove();
|
|
8398
|
+
this.labelLayer && this.labelLayer.selectAll('*').remove();
|
|
8399
|
+
this.symbolLayer && this.symbolLayer.selectAll('*').remove();
|
|
8395
8400
|
}
|
|
8396
8401
|
}, {
|
|
8397
8402
|
key: "createDomain",
|
|
@@ -9650,7 +9655,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9650
9655
|
var output;
|
|
9651
9656
|
|
|
9652
9657
|
if (this.options.orientation === 'horizontal') {
|
|
9653
|
-
|
|
9658
|
+
// output = this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
9659
|
+
output = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value)); // output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
9654
9660
|
} else {
|
|
9655
9661
|
var x = getBarX.call(this, d, i, xAxis);
|
|
9656
9662
|
|
|
@@ -9672,24 +9678,35 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9672
9678
|
var output;
|
|
9673
9679
|
|
|
9674
9680
|
if (this.options.orientation === 'horizontal') {
|
|
9681
|
+
// if (this.options.grouping === 'stacked') {
|
|
9682
|
+
// // let h = getBarWidth.call(this, d, i, xAxis)
|
|
9683
|
+
// // let adjustment = 0
|
|
9684
|
+
// // if (d.y.accumulative && d.y.accumulative !== 0) {
|
|
9685
|
+
// // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
|
|
9686
|
+
// // }
|
|
9687
|
+
// // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
9688
|
+
// let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
|
|
9689
|
+
// // let h = getBarWidth.call(this, d, i, xAxis)
|
|
9690
|
+
// output = (accH * (d.y.accumulative < 0 ? 0 : 1))
|
|
9691
|
+
// }
|
|
9692
|
+
// else {
|
|
9693
|
+
// let h = getBarWidth.call(this, d, i, xAxis)
|
|
9694
|
+
// output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
9695
|
+
// }
|
|
9675
9696
|
if (this.options.grouping === 'stacked') {
|
|
9676
|
-
//
|
|
9677
|
-
// let adjustment = 0
|
|
9678
|
-
// if (d.y.accumulative && d.y.accumulative !== 0) {
|
|
9679
|
-
// adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
|
|
9680
|
-
// }
|
|
9681
|
-
// output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
9697
|
+
// no support for stacks yet
|
|
9682
9698
|
var accH = getBarWidth.call(this, {
|
|
9683
9699
|
x: d.x,
|
|
9684
9700
|
y: {
|
|
9685
9701
|
value: d.y.accumulative
|
|
9686
9702
|
}
|
|
9687
|
-
}, i, xAxis);
|
|
9688
|
-
|
|
9689
|
-
output = accH * (d.y.accumulative < 0 ? 0 : 1);
|
|
9690
|
-
} else {
|
|
9703
|
+
}, i, xAxis);
|
|
9691
9704
|
var h = getBarWidth.call(this, d, i, xAxis);
|
|
9692
|
-
output = this["".concat(yAxis, "Axis")](0) + h * (d.y.
|
|
9705
|
+
output = this["".concat(yAxis, "Axis")](0) + (accH + h) * (d.y.accumulative > 0 ? 0 : 1);
|
|
9706
|
+
} else {
|
|
9707
|
+
var _h = getBarWidth.call(this, d, i, xAxis);
|
|
9708
|
+
|
|
9709
|
+
output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value > 0 ? 0 : 1);
|
|
9693
9710
|
}
|
|
9694
9711
|
} else {
|
|
9695
9712
|
// let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
|
|
@@ -9773,9 +9790,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9773
9790
|
var h = getBarHeight.call(this, d, i, yAxis, xAxis);
|
|
9774
9791
|
output = this["".concat(yAxis, "Axis")](0) - (accH + h) * (d.y.accumulative < 0 ? 0 : 1);
|
|
9775
9792
|
} else {
|
|
9776
|
-
var
|
|
9793
|
+
var _h2 = getBarHeight.call(this, d, i, yAxis, xAxis);
|
|
9777
9794
|
|
|
9778
|
-
output = this["".concat(yAxis, "Axis")](0) -
|
|
9795
|
+
output = this["".concat(yAxis, "Axis")](0) - _h2 * (d.y.value < 0 ? 0 : 1);
|
|
9779
9796
|
}
|
|
9780
9797
|
}
|
|
9781
9798
|
|
|
@@ -9892,6 +9909,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9892
9909
|
this.setAttribute('text-anchor', 'end');
|
|
9893
9910
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
9894
9911
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
9912
|
+
} else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
|
|
9913
|
+
this.setAttribute('text-anchor', 'end');
|
|
9914
|
+
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
9915
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
9916
|
+
} else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
|
|
9917
|
+
this.setAttribute('text-anchor', 'start');
|
|
9918
|
+
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
9919
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
9895
9920
|
} else if (series.labelPosition === 'outside') {
|
|
9896
9921
|
this.setAttribute('text-anchor', 'start');
|
|
9897
9922
|
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
@@ -9925,6 +9950,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9925
9950
|
this.setAttribute('text-anchor', 'end');
|
|
9926
9951
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
9927
9952
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
9953
|
+
} else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
|
|
9954
|
+
this.setAttribute('text-anchor', 'end');
|
|
9955
|
+
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
9956
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
9957
|
+
} else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
|
|
9958
|
+
this.setAttribute('text-anchor', 'start');
|
|
9959
|
+
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
9960
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
9928
9961
|
} else if (series.labelPosition === 'outside') {
|
|
9929
9962
|
this.setAttribute('text-anchor', 'start');
|
|
9930
9963
|
this.setAttribute('x', +this.getAttribute('x') + 8);
|