@websy/websy-designs 1.4.34 → 1.4.36
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.
|
@@ -1351,10 +1351,14 @@ class WebsyDatePicker {
|
|
|
1351
1351
|
let start = list[0]
|
|
1352
1352
|
let end = ''
|
|
1353
1353
|
if (this.customRangeSelected === true && this.isContinuousRange === true) {
|
|
1354
|
-
|
|
1354
|
+
if (list.length > 0) {
|
|
1355
|
+
end = ` - ${list[list.length - 1]}`
|
|
1356
|
+
}
|
|
1355
1357
|
if (this.options.mode === 'hour') {
|
|
1356
1358
|
start = this.options.hours[start].text
|
|
1357
|
-
|
|
1359
|
+
if (list.length > 0) {
|
|
1360
|
+
end = `${this.customRangeSelected === true ? ' - ' : ''}${this.options.hours[list[list.length - 1]].text}`
|
|
1361
|
+
}
|
|
1358
1362
|
}
|
|
1359
1363
|
}
|
|
1360
1364
|
else {
|
|
@@ -6977,6 +6981,7 @@ class WebsyChart {
|
|
|
6977
6981
|
this.renderedKeys = {}
|
|
6978
6982
|
this.brushedDomain = []
|
|
6979
6983
|
this.brushBarsInitialized = {}
|
|
6984
|
+
this.brushLinesInitialized = {}
|
|
6980
6985
|
if (!elementId) {
|
|
6981
6986
|
console.log('No element Id provided for Websy Chart')
|
|
6982
6987
|
return
|
|
@@ -7111,7 +7116,7 @@ class WebsyChart {
|
|
|
7111
7116
|
this.labelLayer.selectAll('*').remove()
|
|
7112
7117
|
this.symbolLayer.selectAll('*').remove()
|
|
7113
7118
|
}
|
|
7114
|
-
createDomain (side) {
|
|
7119
|
+
createDomain (side, forBrush = false) {
|
|
7115
7120
|
let domain = []
|
|
7116
7121
|
/* global d3 side domain:writable forBrush */
|
|
7117
7122
|
// if we have a brushed domain we use that
|
|
@@ -7271,7 +7276,7 @@ else {
|
|
|
7271
7276
|
tooltipHTML += tooltipData.map(d => `
|
|
7272
7277
|
<li>
|
|
7273
7278
|
<i style='background-color: ${d.color};'></i>
|
|
7274
|
-
${d.tooltipLabel || ''}<span
|
|
7279
|
+
${d.tooltipLabel || ''}<span>: ${d.tooltipValue || d.value}</span>
|
|
7275
7280
|
</li>
|
|
7276
7281
|
`).join('')
|
|
7277
7282
|
tooltipHTML += `</ul>`
|
|
@@ -7487,7 +7492,9 @@ else {
|
|
|
7487
7492
|
this.longestBottom = this.options.data.bottom.max.toString()
|
|
7488
7493
|
if (this.options.data.bottom.formatter) {
|
|
7489
7494
|
this.longestBottom = this.options.data.bottom.formatter(this.options.data.bottom.max).toString()
|
|
7490
|
-
|
|
7495
|
+
if (this.options.data.bottom.data && this.options.data.bottom.data[0] && this.options.data.bottom.data[0].value) {
|
|
7496
|
+
firstBottom = this.options.data.bottom.formatter(this.options.data.bottom.data[0].value).toString()
|
|
7497
|
+
}
|
|
7491
7498
|
}
|
|
7492
7499
|
else {
|
|
7493
7500
|
if (this.options.data.bottom.scale === 'Time') {
|
|
@@ -7497,7 +7504,9 @@ else {
|
|
|
7497
7504
|
else {
|
|
7498
7505
|
this.longestBottom = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
|
|
7499
7506
|
// firstBottom = (this.options.data.bottom.data[0] || [{value: ''}]).value
|
|
7500
|
-
|
|
7507
|
+
if (this.options.data.bottom.data && this.options.data.bottom.data[0] && this.options.data.bottom.data[0].value) {
|
|
7508
|
+
firstBottom = this.options.data.bottom.data[0].value
|
|
7509
|
+
}
|
|
7501
7510
|
}
|
|
7502
7511
|
}
|
|
7503
7512
|
}
|
|
@@ -7602,6 +7611,7 @@ else {
|
|
|
7602
7611
|
// Define the plot size
|
|
7603
7612
|
this.plotWidth = this.width - this.options.margin.legendLeft - this.options.margin.legendRight - this.options.margin.left - this.options.margin.right - this.options.margin.axisLeft - this.options.margin.axisRight
|
|
7604
7613
|
this.plotHeight = this.height - this.options.margin.legendTop - this.options.margin.legendBottom - this.options.margin.top - this.options.margin.bottom - this.options.margin.axisBottom - this.options.margin.axisTop
|
|
7614
|
+
this.brushNeeded = false
|
|
7605
7615
|
if (this.options.orientation === 'vertical') {
|
|
7606
7616
|
if (this.options.maxBandWidth) {
|
|
7607
7617
|
this.plotWidth = Math.min(this.plotWidth, (this.options.data.bottom.data || []).length * this.options.maxBandWidth)
|
|
@@ -7762,6 +7772,7 @@ else {
|
|
|
7762
7772
|
// this.brushArea.selectAll('*').remove()
|
|
7763
7773
|
if (this.brushNeeded) {
|
|
7764
7774
|
if (!this.brushInitialized) {
|
|
7775
|
+
this.brushLayer.style('visibility', 'visible')
|
|
7765
7776
|
this.brushInitialized = true
|
|
7766
7777
|
this.brushLayer
|
|
7767
7778
|
.select('.brush')
|
|
@@ -7770,7 +7781,9 @@ else {
|
|
|
7770
7781
|
}
|
|
7771
7782
|
}
|
|
7772
7783
|
else {
|
|
7773
|
-
this.brushLayer.
|
|
7784
|
+
this.brushLayer.style('visibility', 'hidden')
|
|
7785
|
+
// this.brushLayer.selectAll().remove()
|
|
7786
|
+
this.brushArea.selectAll('*').remove()
|
|
7774
7787
|
}
|
|
7775
7788
|
if (this.options.margin.axisBottom > 0) {
|
|
7776
7789
|
let timeFormatPattern = ''
|
|
@@ -8359,7 +8372,7 @@ const drawLine = (xAxis, yAxis, curveStyle) => {
|
|
|
8359
8372
|
return d3
|
|
8360
8373
|
.line()
|
|
8361
8374
|
.x(d => {
|
|
8362
|
-
let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
|
|
8375
|
+
let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
|
|
8363
8376
|
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
|
|
8364
8377
|
})
|
|
8365
8378
|
.y(d => {
|
|
@@ -8373,8 +8386,16 @@ if (this.options.orienation === 'horizontal') {
|
|
|
8373
8386
|
xAxis = series.axis === 'secondary' ? 'right' : 'left'
|
|
8374
8387
|
yAxis = 'bottom'
|
|
8375
8388
|
}
|
|
8389
|
+
let xBrushAxis = 'bottomBrush'
|
|
8390
|
+
let yBrushAxis = 'leftBrush'
|
|
8391
|
+
if (this.options.orienation === 'horizontal') {
|
|
8392
|
+
xBrushAxis = 'leftBrush'
|
|
8393
|
+
yBrushAxis = 'bottomBrush'
|
|
8394
|
+
}
|
|
8376
8395
|
let lines = this.lineLayer.selectAll(`.line_${series.key}`)
|
|
8377
8396
|
.data([series.data])
|
|
8397
|
+
let brushLines = this.brushArea.selectAll(`.line_${series.key}`)
|
|
8398
|
+
.data([series.data])
|
|
8378
8399
|
// Exit
|
|
8379
8400
|
lines.exit()
|
|
8380
8401
|
.transition(this.transition)
|
|
@@ -8401,6 +8422,35 @@ lines.enter().append('path')
|
|
|
8401
8422
|
// .transition(this.transition)
|
|
8402
8423
|
.style('stroke-opacity', 1)
|
|
8403
8424
|
|
|
8425
|
+
if (!this.brushLinesInitialized[series.key]) {
|
|
8426
|
+
this.brushLinesInitialized[series.key] = true
|
|
8427
|
+
// Exit
|
|
8428
|
+
brushLines.exit()
|
|
8429
|
+
.transition(this.transition)
|
|
8430
|
+
.style('stroke-opacity', 1e-6)
|
|
8431
|
+
.remove()
|
|
8432
|
+
// Update
|
|
8433
|
+
brushLines
|
|
8434
|
+
.style('stroke-width', 1)
|
|
8435
|
+
// .attr('id', `line_${series.key}`)
|
|
8436
|
+
// .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
|
|
8437
|
+
.attr('stroke', series.color)
|
|
8438
|
+
.attr('fill', 'transparent')
|
|
8439
|
+
.transition(this.transition)
|
|
8440
|
+
.attr('d', d => drawLine(xBrushAxis, yBrushAxis, series.curveStyle)(d))
|
|
8441
|
+
// Enter
|
|
8442
|
+
brushLines.enter().append('path')
|
|
8443
|
+
.attr('d', d => drawLine(xBrushAxis, yBrushAxis, series.curveStyle)(d))
|
|
8444
|
+
.attr('class', `line_${series.key}`)
|
|
8445
|
+
.attr('id', `line_${series.key}`)
|
|
8446
|
+
// .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
|
|
8447
|
+
.style('stroke-width', 1)
|
|
8448
|
+
.attr('stroke', series.color)
|
|
8449
|
+
.attr('fill', 'transparent')
|
|
8450
|
+
// .transition(this.transition)
|
|
8451
|
+
.style('stroke-opacity', 1)
|
|
8452
|
+
}
|
|
8453
|
+
|
|
8404
8454
|
if (series.showArea === true) {
|
|
8405
8455
|
this.renderarea(series, index)
|
|
8406
8456
|
}
|
package/dist/websy-designs.js
CHANGED
|
@@ -1508,11 +1508,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1508
1508
|
var end = '';
|
|
1509
1509
|
|
|
1510
1510
|
if (this.customRangeSelected === true && this.isContinuousRange === true) {
|
|
1511
|
-
|
|
1511
|
+
if (list.length > 0) {
|
|
1512
|
+
end = " - ".concat(list[list.length - 1]);
|
|
1513
|
+
}
|
|
1512
1514
|
|
|
1513
1515
|
if (this.options.mode === 'hour') {
|
|
1514
1516
|
start = this.options.hours[start].text;
|
|
1515
|
-
|
|
1517
|
+
|
|
1518
|
+
if (list.length > 0) {
|
|
1519
|
+
end = "".concat(this.customRangeSelected === true ? ' - ' : '').concat(this.options.hours[list[list.length - 1]].text);
|
|
1520
|
+
}
|
|
1516
1521
|
}
|
|
1517
1522
|
} else {
|
|
1518
1523
|
if (list.length > 1) {
|
|
@@ -7672,6 +7677,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7672
7677
|
this.renderedKeys = {};
|
|
7673
7678
|
this.brushedDomain = [];
|
|
7674
7679
|
this.brushBarsInitialized = {};
|
|
7680
|
+
this.brushLinesInitialized = {};
|
|
7675
7681
|
|
|
7676
7682
|
if (!elementId) {
|
|
7677
7683
|
console.log('No element Id provided for Websy Chart');
|
|
@@ -7821,6 +7827,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7821
7827
|
}, {
|
|
7822
7828
|
key: "createDomain",
|
|
7823
7829
|
value: function createDomain(side) {
|
|
7830
|
+
var forBrush = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7824
7831
|
var domain = [];
|
|
7825
7832
|
/* global d3 side domain:writable forBrush */
|
|
7826
7833
|
// if we have a brushed domain we use that
|
|
@@ -8019,7 +8026,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8019
8026
|
});
|
|
8020
8027
|
tooltipHTML = " \n <ul>\n ";
|
|
8021
8028
|
tooltipHTML += tooltipData.map(function (d) {
|
|
8022
|
-
return "\n <li>\n <i style='background-color: ".concat(d.color, ";'></i>\n ").concat(d.tooltipLabel || '', "<span
|
|
8029
|
+
return "\n <li>\n <i style='background-color: ".concat(d.color, ";'></i>\n ").concat(d.tooltipLabel || '', "<span>: ").concat(d.tooltipValue || d.value, "</span>\n </li>\n ");
|
|
8023
8030
|
}).join('');
|
|
8024
8031
|
tooltipHTML += "</ul>";
|
|
8025
8032
|
var posOptions = {
|
|
@@ -8262,7 +8269,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8262
8269
|
|
|
8263
8270
|
if (this.options.data.bottom.formatter) {
|
|
8264
8271
|
this.longestBottom = this.options.data.bottom.formatter(this.options.data.bottom.max).toString();
|
|
8265
|
-
|
|
8272
|
+
|
|
8273
|
+
if (this.options.data.bottom.data && this.options.data.bottom.data[0] && this.options.data.bottom.data[0].value) {
|
|
8274
|
+
firstBottom = this.options.data.bottom.formatter(this.options.data.bottom.data[0].value).toString();
|
|
8275
|
+
}
|
|
8266
8276
|
} else {
|
|
8267
8277
|
if (this.options.data.bottom.scale === 'Time') {
|
|
8268
8278
|
this.longestBottom = '01/01/2000';
|
|
@@ -8272,7 +8282,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8272
8282
|
return a.length > b.value.length ? a : b.value;
|
|
8273
8283
|
}, ''); // firstBottom = (this.options.data.bottom.data[0] || [{value: ''}]).value
|
|
8274
8284
|
|
|
8275
|
-
|
|
8285
|
+
if (this.options.data.bottom.data && this.options.data.bottom.data[0] && this.options.data.bottom.data[0].value) {
|
|
8286
|
+
firstBottom = this.options.data.bottom.data[0].value;
|
|
8287
|
+
}
|
|
8276
8288
|
}
|
|
8277
8289
|
}
|
|
8278
8290
|
}
|
|
@@ -8397,6 +8409,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8397
8409
|
|
|
8398
8410
|
this.plotWidth = this.width - this.options.margin.legendLeft - this.options.margin.legendRight - this.options.margin.left - this.options.margin.right - this.options.margin.axisLeft - this.options.margin.axisRight;
|
|
8399
8411
|
this.plotHeight = this.height - this.options.margin.legendTop - this.options.margin.legendBottom - this.options.margin.top - this.options.margin.bottom - this.options.margin.axisBottom - this.options.margin.axisTop;
|
|
8412
|
+
this.brushNeeded = false;
|
|
8400
8413
|
|
|
8401
8414
|
if (this.options.orientation === 'vertical') {
|
|
8402
8415
|
if (this.options.maxBandWidth) {
|
|
@@ -8488,11 +8501,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8488
8501
|
|
|
8489
8502
|
if (this.brushNeeded) {
|
|
8490
8503
|
if (!this.brushInitialized) {
|
|
8504
|
+
this.brushLayer.style('visibility', 'visible');
|
|
8491
8505
|
this.brushInitialized = true;
|
|
8492
8506
|
this.brushLayer.select('.brush').call(this.brush).call(this.brush.move, [0, brushEnd]);
|
|
8493
8507
|
}
|
|
8494
8508
|
} else {
|
|
8495
|
-
this.brushLayer.selectAll().remove()
|
|
8509
|
+
this.brushLayer.style('visibility', 'hidden'); // this.brushLayer.selectAll().remove()
|
|
8510
|
+
|
|
8511
|
+
this.brushArea.selectAll('*').remove();
|
|
8496
8512
|
}
|
|
8497
8513
|
|
|
8498
8514
|
if (this.options.margin.axisBottom > 0) {
|
|
@@ -9046,7 +9062,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9046
9062
|
/* global series index d3 */
|
|
9047
9063
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9048
9064
|
return d3.line().x(function (d) {
|
|
9049
|
-
var adjustment = _this52.options.data[xAxis].scale === 'Time' ? 0 : _this52["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
9065
|
+
var adjustment = _this52.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this52["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
9050
9066
|
return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value)) + adjustment;
|
|
9051
9067
|
}).y(function (d) {
|
|
9052
9068
|
return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
@@ -9061,7 +9077,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9061
9077
|
yAxis = 'bottom';
|
|
9062
9078
|
}
|
|
9063
9079
|
|
|
9064
|
-
var
|
|
9080
|
+
var xBrushAxis = 'bottomBrush';
|
|
9081
|
+
var yBrushAxis = 'leftBrush';
|
|
9082
|
+
|
|
9083
|
+
if (this.options.orienation === 'horizontal') {
|
|
9084
|
+
xBrushAxis = 'leftBrush';
|
|
9085
|
+
yBrushAxis = 'bottomBrush';
|
|
9086
|
+
}
|
|
9087
|
+
|
|
9088
|
+
var lines = this.lineLayer.selectAll(".line_".concat(series.key)).data([series.data]);
|
|
9089
|
+
var brushLines = this.brushArea.selectAll(".line_".concat(series.key)).data([series.data]); // Exit
|
|
9065
9090
|
|
|
9066
9091
|
lines.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove(); // Update
|
|
9067
9092
|
|
|
@@ -9077,6 +9102,24 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9077
9102
|
.style('stroke-width', series.lineWidth || this.options.lineWidth).attr('stroke', series.color).attr('fill', 'transparent') // .transition(this.transition)
|
|
9078
9103
|
.style('stroke-opacity', 1);
|
|
9079
9104
|
|
|
9105
|
+
if (!this.brushLinesInitialized[series.key]) {
|
|
9106
|
+
this.brushLinesInitialized[series.key] = true; // Exit
|
|
9107
|
+
|
|
9108
|
+
brushLines.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove(); // Update
|
|
9109
|
+
|
|
9110
|
+
brushLines.style('stroke-width', 1) // .attr('id', `line_${series.key}`)
|
|
9111
|
+
// .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
|
|
9112
|
+
.attr('stroke', series.color).attr('fill', 'transparent').transition(this.transition).attr('d', function (d) {
|
|
9113
|
+
return drawLine(xBrushAxis, yBrushAxis, series.curveStyle)(d);
|
|
9114
|
+
}); // Enter
|
|
9115
|
+
|
|
9116
|
+
brushLines.enter().append('path').attr('d', function (d) {
|
|
9117
|
+
return drawLine(xBrushAxis, yBrushAxis, series.curveStyle)(d);
|
|
9118
|
+
}).attr('class', "line_".concat(series.key)).attr('id', "line_".concat(series.key)) // .attr('transform', 'translate('+ (that.bandWidth/2) +',0)')
|
|
9119
|
+
.style('stroke-width', 1).attr('stroke', series.color).attr('fill', 'transparent') // .transition(this.transition)
|
|
9120
|
+
.style('stroke-opacity', 1);
|
|
9121
|
+
}
|
|
9122
|
+
|
|
9080
9123
|
if (series.showArea === true) {
|
|
9081
9124
|
this.renderarea(series, index);
|
|
9082
9125
|
}
|