@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.
|
@@ -6111,7 +6111,12 @@ class WebsyTable3 {
|
|
|
6111
6111
|
this.currentData = data
|
|
6112
6112
|
}
|
|
6113
6113
|
else {
|
|
6114
|
-
bodyEl.
|
|
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
|
}
|
|
@@ -7173,18 +7178,18 @@ class WebsyChart {
|
|
|
7173
7178
|
this.render()
|
|
7174
7179
|
}
|
|
7175
7180
|
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()
|
|
7181
|
+
this.leftAxisLayer && this.leftAxisLayer.selectAll('*').remove()
|
|
7182
|
+
this.rightAxisLayer && this.rightAxisLayer.selectAll('*').remove()
|
|
7183
|
+
this.bottomAxisLayer && this.bottomAxisLayer.selectAll('*').remove()
|
|
7184
|
+
this.leftAxisLabel && this.leftAxisLabel.selectAll('*').remove()
|
|
7185
|
+
this.rightAxisLabel && this.rightAxisLabel.selectAll('*').remove()
|
|
7186
|
+
this.bottomAxisLabel && this.bottomAxisLabel.selectAll('*').remove()
|
|
7187
|
+
this.plotArea && this.plotArea.selectAll('*').remove()
|
|
7188
|
+
this.areaLayer && this.areaLayer.selectAll('*').remove()
|
|
7189
|
+
this.lineLayer && this.lineLayer.selectAll('*').remove()
|
|
7190
|
+
this.barLayer && this.barLayer.selectAll('*').remove()
|
|
7191
|
+
this.labelLayer && this.labelLayer.selectAll('*').remove()
|
|
7192
|
+
this.symbolLayer && this.symbolLayer.selectAll('*').remove()
|
|
7188
7193
|
}
|
|
7189
7194
|
createDomain (side, forBrush = false) {
|
|
7190
7195
|
let domain = []
|
|
@@ -8395,7 +8400,8 @@ function getBarHeight (d, i, yAxis, xAxis) {
|
|
|
8395
8400
|
function getBarWidth (d, i, xAxis) {
|
|
8396
8401
|
let output
|
|
8397
8402
|
if (this.options.orientation === 'horizontal') {
|
|
8398
|
-
output = this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8403
|
+
// output = this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8404
|
+
output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8399
8405
|
// output = (this[`${yAxis}Axis`](0)) - this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
8400
8406
|
}
|
|
8401
8407
|
else {
|
|
@@ -8413,20 +8419,29 @@ function getBarWidth (d, i, xAxis) {
|
|
|
8413
8419
|
function getBarX (d, i, xAxis) {
|
|
8414
8420
|
let output
|
|
8415
8421
|
if (this.options.orientation === 'horizontal') {
|
|
8416
|
-
if (this.options.grouping === 'stacked') {
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8422
|
+
// if (this.options.grouping === 'stacked') {
|
|
8423
|
+
// // let h = getBarWidth.call(this, d, i, xAxis)
|
|
8424
|
+
// // let adjustment = 0
|
|
8425
|
+
// // if (d.y.accumulative && d.y.accumulative !== 0) {
|
|
8426
|
+
// // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
|
|
8427
|
+
// // }
|
|
8428
|
+
// // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
8429
|
+
// let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
|
|
8430
|
+
// // let h = getBarWidth.call(this, d, i, xAxis)
|
|
8431
|
+
// output = (accH * (d.y.accumulative < 0 ? 0 : 1))
|
|
8432
|
+
// }
|
|
8433
|
+
// else {
|
|
8434
|
+
// let h = getBarWidth.call(this, d, i, xAxis)
|
|
8435
|
+
// output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
8436
|
+
// }
|
|
8437
|
+
if (this.options.grouping === 'stacked') { // no support for stacks yet
|
|
8438
|
+
let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
|
|
8439
|
+
let h = getBarWidth.call(this, d, i, xAxis)
|
|
8440
|
+
output = (this[`${yAxis}Axis`](0)) + ((accH + h) * (d.y.accumulative > 0 ? 0 : 1))
|
|
8426
8441
|
}
|
|
8427
8442
|
else {
|
|
8428
8443
|
let h = getBarWidth.call(this, d, i, xAxis)
|
|
8429
|
-
output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value
|
|
8444
|
+
output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value > 0 ? 0 : 1))
|
|
8430
8445
|
}
|
|
8431
8446
|
}
|
|
8432
8447
|
else {
|
|
@@ -8615,7 +8630,17 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
8615
8630
|
this.setAttribute('text-anchor', 'end')
|
|
8616
8631
|
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
8617
8632
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
8618
|
-
}
|
|
8633
|
+
}
|
|
8634
|
+
else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
|
|
8635
|
+
this.setAttribute('text-anchor', 'end')
|
|
8636
|
+
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
8637
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
8638
|
+
}
|
|
8639
|
+
else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
|
|
8640
|
+
this.setAttribute('text-anchor', 'start')
|
|
8641
|
+
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
8642
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
8643
|
+
}
|
|
8619
8644
|
else if (series.labelPosition === 'outside') {
|
|
8620
8645
|
this.setAttribute('text-anchor', 'start')
|
|
8621
8646
|
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
@@ -8657,7 +8682,17 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
8657
8682
|
this.setAttribute('text-anchor', 'end')
|
|
8658
8683
|
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
8659
8684
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
8660
|
-
}
|
|
8685
|
+
}
|
|
8686
|
+
else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
|
|
8687
|
+
this.setAttribute('text-anchor', 'end')
|
|
8688
|
+
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
8689
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'))
|
|
8690
|
+
}
|
|
8691
|
+
else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
|
|
8692
|
+
this.setAttribute('text-anchor', 'start')
|
|
8693
|
+
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
8694
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color))
|
|
8695
|
+
}
|
|
8661
8696
|
else if (series.labelPosition === 'outside') {
|
|
8662
8697
|
this.setAttribute('text-anchor', 'start')
|
|
8663
8698
|
this.setAttribute('x', +(this.getAttribute('x')) + 8)
|
|
@@ -6675,7 +6675,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6675
6675
|
bodyEl.innerHTML = this.buildBodyHtml(data, true);
|
|
6676
6676
|
this.currentData = data;
|
|
6677
6677
|
} else {
|
|
6678
|
-
bodyEl.
|
|
6678
|
+
if (bodyEl.querySelector('tbody')) {
|
|
6679
|
+
bodyEl.querySelector('tbody').innerHTML += this.buildBodyHtml(data, true, true);
|
|
6680
|
+
} else {
|
|
6681
|
+
bodyEl.innerHTML += this.buildBodyHtml(data, true);
|
|
6682
|
+
}
|
|
6683
|
+
|
|
6679
6684
|
this.currentData = this.currentData.concat(data);
|
|
6680
6685
|
}
|
|
6681
6686
|
} // this.data = this.data.concat(data)
|
|
@@ -7899,18 +7904,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7899
7904
|
_createClass(WebsyChart, [{
|
|
7900
7905
|
key: "close",
|
|
7901
7906
|
value: function close() {
|
|
7902
|
-
this.leftAxisLayer.selectAll('*').remove();
|
|
7903
|
-
this.rightAxisLayer.selectAll('*').remove();
|
|
7904
|
-
this.bottomAxisLayer.selectAll('*').remove();
|
|
7905
|
-
this.leftAxisLabel.selectAll('*').remove();
|
|
7906
|
-
this.rightAxisLabel.selectAll('*').remove();
|
|
7907
|
-
this.bottomAxisLabel.selectAll('*').remove();
|
|
7908
|
-
this.plotArea.selectAll('*').remove();
|
|
7909
|
-
this.areaLayer.selectAll('*').remove();
|
|
7910
|
-
this.lineLayer.selectAll('*').remove();
|
|
7911
|
-
this.barLayer.selectAll('*').remove();
|
|
7912
|
-
this.labelLayer.selectAll('*').remove();
|
|
7913
|
-
this.symbolLayer.selectAll('*').remove();
|
|
7907
|
+
this.leftAxisLayer && this.leftAxisLayer.selectAll('*').remove();
|
|
7908
|
+
this.rightAxisLayer && this.rightAxisLayer.selectAll('*').remove();
|
|
7909
|
+
this.bottomAxisLayer && this.bottomAxisLayer.selectAll('*').remove();
|
|
7910
|
+
this.leftAxisLabel && this.leftAxisLabel.selectAll('*').remove();
|
|
7911
|
+
this.rightAxisLabel && this.rightAxisLabel.selectAll('*').remove();
|
|
7912
|
+
this.bottomAxisLabel && this.bottomAxisLabel.selectAll('*').remove();
|
|
7913
|
+
this.plotArea && this.plotArea.selectAll('*').remove();
|
|
7914
|
+
this.areaLayer && this.areaLayer.selectAll('*').remove();
|
|
7915
|
+
this.lineLayer && this.lineLayer.selectAll('*').remove();
|
|
7916
|
+
this.barLayer && this.barLayer.selectAll('*').remove();
|
|
7917
|
+
this.labelLayer && this.labelLayer.selectAll('*').remove();
|
|
7918
|
+
this.symbolLayer && this.symbolLayer.selectAll('*').remove();
|
|
7914
7919
|
}
|
|
7915
7920
|
}, {
|
|
7916
7921
|
key: "createDomain",
|
|
@@ -9169,7 +9174,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9169
9174
|
var output;
|
|
9170
9175
|
|
|
9171
9176
|
if (this.options.orientation === 'horizontal') {
|
|
9172
|
-
|
|
9177
|
+
// output = this[`${yAxis}Axis`](Math.abs(d.y.value))
|
|
9178
|
+
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))
|
|
9173
9179
|
} else {
|
|
9174
9180
|
var x = getBarX.call(this, d, i, xAxis);
|
|
9175
9181
|
|
|
@@ -9191,24 +9197,35 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9191
9197
|
var output;
|
|
9192
9198
|
|
|
9193
9199
|
if (this.options.orientation === 'horizontal') {
|
|
9200
|
+
// if (this.options.grouping === 'stacked') {
|
|
9201
|
+
// // let h = getBarWidth.call(this, d, i, xAxis)
|
|
9202
|
+
// // let adjustment = 0
|
|
9203
|
+
// // if (d.y.accumulative && d.y.accumulative !== 0) {
|
|
9204
|
+
// // adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
|
|
9205
|
+
// // }
|
|
9206
|
+
// // output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
9207
|
+
// let accH = getBarWidth.call(this, {x: d.x, y: { value: d.y.accumulative }}, i, xAxis)
|
|
9208
|
+
// // let h = getBarWidth.call(this, d, i, xAxis)
|
|
9209
|
+
// output = (accH * (d.y.accumulative < 0 ? 0 : 1))
|
|
9210
|
+
// }
|
|
9211
|
+
// else {
|
|
9212
|
+
// let h = getBarWidth.call(this, d, i, xAxis)
|
|
9213
|
+
// output = (this[`${yAxis}Axis`](0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
9214
|
+
// }
|
|
9194
9215
|
if (this.options.grouping === 'stacked') {
|
|
9195
|
-
//
|
|
9196
|
-
// let adjustment = 0
|
|
9197
|
-
// if (d.y.accumulative && d.y.accumulative !== 0) {
|
|
9198
|
-
// adjustment = this[`${yAxis}Axis`](d.y.accumulative || 0)
|
|
9199
|
-
// }
|
|
9200
|
-
// output = this[`${yAxis}Axis`](0) + (adjustment * (d.y.value < 0 ? 1 : 0)) + (h * (d.y.value < 0 ? 1 : 0))
|
|
9216
|
+
// no support for stacks yet
|
|
9201
9217
|
var accH = getBarWidth.call(this, {
|
|
9202
9218
|
x: d.x,
|
|
9203
9219
|
y: {
|
|
9204
9220
|
value: d.y.accumulative
|
|
9205
9221
|
}
|
|
9206
|
-
}, i, xAxis);
|
|
9207
|
-
|
|
9208
|
-
output = accH * (d.y.accumulative < 0 ? 0 : 1);
|
|
9209
|
-
} else {
|
|
9222
|
+
}, i, xAxis);
|
|
9210
9223
|
var h = getBarWidth.call(this, d, i, xAxis);
|
|
9211
|
-
output = this["".concat(yAxis, "Axis")](0) + h * (d.y.
|
|
9224
|
+
output = this["".concat(yAxis, "Axis")](0) + (accH + h) * (d.y.accumulative > 0 ? 0 : 1);
|
|
9225
|
+
} else {
|
|
9226
|
+
var _h = getBarWidth.call(this, d, i, xAxis);
|
|
9227
|
+
|
|
9228
|
+
output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value > 0 ? 0 : 1);
|
|
9212
9229
|
}
|
|
9213
9230
|
} else {
|
|
9214
9231
|
// let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
|
|
@@ -9292,9 +9309,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9292
9309
|
var h = getBarHeight.call(this, d, i, yAxis, xAxis);
|
|
9293
9310
|
output = this["".concat(yAxis, "Axis")](0) - (accH + h) * (d.y.accumulative < 0 ? 0 : 1);
|
|
9294
9311
|
} else {
|
|
9295
|
-
var
|
|
9312
|
+
var _h2 = getBarHeight.call(this, d, i, yAxis, xAxis);
|
|
9296
9313
|
|
|
9297
|
-
output = this["".concat(yAxis, "Axis")](0) -
|
|
9314
|
+
output = this["".concat(yAxis, "Axis")](0) - _h2 * (d.y.value < 0 ? 0 : 1);
|
|
9298
9315
|
}
|
|
9299
9316
|
}
|
|
9300
9317
|
|
|
@@ -9411,6 +9428,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9411
9428
|
this.setAttribute('text-anchor', 'end');
|
|
9412
9429
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
9413
9430
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
9431
|
+
} else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
|
|
9432
|
+
this.setAttribute('text-anchor', 'end');
|
|
9433
|
+
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
9434
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
9435
|
+
} else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
|
|
9436
|
+
this.setAttribute('text-anchor', 'start');
|
|
9437
|
+
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
9438
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
9414
9439
|
} else if (series.labelPosition === 'outside') {
|
|
9415
9440
|
this.setAttribute('text-anchor', 'start');
|
|
9416
9441
|
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
@@ -9444,6 +9469,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9444
9469
|
this.setAttribute('text-anchor', 'end');
|
|
9445
9470
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
9446
9471
|
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
9472
|
+
} else if (d.y.value < 0 && d.y.value !== that.options.data[yAxis].min) {
|
|
9473
|
+
this.setAttribute('text-anchor', 'end');
|
|
9474
|
+
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
9475
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark('#ffffff'));
|
|
9476
|
+
} else if (d.y.value < 0 && d.y.value === that.options.data[yAxis].min) {
|
|
9477
|
+
this.setAttribute('text-anchor', 'start');
|
|
9478
|
+
this.setAttribute('x', +this.getAttribute('x') + 8);
|
|
9479
|
+
this.setAttribute('fill', that.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color));
|
|
9447
9480
|
} else if (series.labelPosition === 'outside') {
|
|
9448
9481
|
this.setAttribute('text-anchor', 'start');
|
|
9449
9482
|
this.setAttribute('x', +this.getAttribute('x') + 8);
|