@websy/websy-designs 1.7.4 → 1.7.5
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 +128 -3
- package/dist/websy-designs-es6.js +274 -128
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +128 -3
- package/dist/websy-designs.js +274 -128
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -6614,6 +6614,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6614
6614
|
minusIcon: WebsyDesigns.Icons.MinusFilled
|
|
6615
6615
|
};
|
|
6616
6616
|
this.options = _extends({}, DEFAULTS, options);
|
|
6617
|
+
this.isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
6617
6618
|
this.sizes = {};
|
|
6618
6619
|
this.currentData = [];
|
|
6619
6620
|
this.scrollDragging = false;
|
|
@@ -6636,7 +6637,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6636
6637
|
var el = document.getElementById(this.elementId);
|
|
6637
6638
|
|
|
6638
6639
|
if (el) {
|
|
6639
|
-
var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table-3 ").concat(this.options.paging === 'pages' ? 'with-paging' : '', " ").concat(this.options.virtualScroll === true ? 'with-virtual-scroll' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <div id=\"").concat(this.elementId, "_tableInner\" class=\"websy-table-inner-container\">\n <table id=\"").concat(this.elementId, "_tableHeader\" class=\"websy-table-header\"></table>\n <table id=\"").concat(this.elementId, "_tableBody\" class=\"websy-table-body\"></table>\n <table id=\"").concat(this.elementId, "_tableFooter\" class=\"websy-table-footer\"></table>\n <div id=\"").concat(this.elementId, "_vScrollContainer\" class=\"websy-v-scroll-container\">\n <div id=\"").concat(this.elementId, "_vScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-y\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_hScrollContainer\" class=\"websy-h-scroll-container\">\n <div id=\"").concat(this.elementId, "_hScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-x\"></div>\n </div>\n </div> \n <div id=\"").concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_dropdownContainer\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
|
|
6640
|
+
var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table-3 ").concat(this.options.paging === 'pages' ? 'with-paging' : '', " ").concat(this.options.virtualScroll === true ? 'with-virtual-scroll' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <div id=\"").concat(this.elementId, "_tableInner\" class=\"websy-table-inner-container\">\n <table id=\"").concat(this.elementId, "_tableHeader\" class=\"websy-table-header\"></table>\n <table id=\"").concat(this.elementId, "_tableBody\" class=\"websy-table-body\"></table>\n <table id=\"").concat(this.elementId, "_tableFooter\" class=\"websy-table-footer\"></table>\n <div id=\"").concat(this.elementId, "_vScrollContainer\" class=\"websy-v-scroll-container\">\n <div id=\"").concat(this.elementId, "_vScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-y\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_hScrollContainer\" class=\"websy-h-scroll-container\">\n <div id=\"").concat(this.elementId, "_hScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-x\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_touchScroller\" class=\"websy-table-touch-scroller hidden\"></div>\n </div> \n <div id=\"").concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_dropdownContainer\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
|
|
6640
6641
|
|
|
6641
6642
|
if (this.options.paging === 'pages') {
|
|
6642
6643
|
html += "\n <div class=\"websy-table-paging-container\">\n Show <div id=\"".concat(this.elementId, "_pageSizeSelector\" class=\"websy-vis-page-selector\"></div> rows\n <ul id=\"").concat(this.elementId, "_pageList\" class=\"websy-vis-page-list\"></ul>\n </div>\n ");
|
|
@@ -6645,6 +6646,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6645
6646
|
el.innerHTML = html;
|
|
6646
6647
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
6647
6648
|
el.addEventListener('mousedown', this.handleMouseDown.bind(this));
|
|
6649
|
+
el.addEventListener('touchstart', this.handleTouchStart.bind(this));
|
|
6650
|
+
window.addEventListener('touchmove', this.handleTouchMove.bind(this));
|
|
6651
|
+
window.addEventListener('touchend', this.handleTouchEnd.bind(this));
|
|
6648
6652
|
window.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
6649
6653
|
window.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
6650
6654
|
var scrollEl = document.getElementById("".concat(this.elementId, "_tableBody"));
|
|
@@ -6711,6 +6715,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6711
6715
|
bodyHtml += "<tr class=\"websy-table-row\">";
|
|
6712
6716
|
row.forEach(function (cell, cellIndex) {
|
|
6713
6717
|
var sizeIndex = cell.level || cellIndex;
|
|
6718
|
+
var colIndex = cell.index || cellIndex;
|
|
6714
6719
|
|
|
6715
6720
|
if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
|
|
6716
6721
|
return; // need to revisit this logic
|
|
@@ -6746,14 +6751,14 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6746
6751
|
} // console.log('rowspan', cell.rowspan)
|
|
6747
6752
|
|
|
6748
6753
|
|
|
6749
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this39.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(
|
|
6754
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this39.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n "); // if (useWidths === true) {
|
|
6750
6755
|
// bodyHtml += `
|
|
6751
6756
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
6752
6757
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
6753
6758
|
// `
|
|
6754
6759
|
// }
|
|
6755
6760
|
|
|
6756
|
-
bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(
|
|
6761
|
+
bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n >");
|
|
6757
6762
|
|
|
6758
6763
|
if (cell.expandable === true) {
|
|
6759
6764
|
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this39.options.plusIcon, "</i>");
|
|
@@ -7149,6 +7154,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7149
7154
|
}, {
|
|
7150
7155
|
key: "handleMouseDown",
|
|
7151
7156
|
value: function handleMouseDown(event) {
|
|
7157
|
+
if (this.isTouchDevice === true) {
|
|
7158
|
+
return;
|
|
7159
|
+
}
|
|
7160
|
+
|
|
7152
7161
|
if (event.target.classList.contains('websy-scroll-handle-y')) {
|
|
7153
7162
|
// set up the scroll start values
|
|
7154
7163
|
this.scrollDragging = true;
|
|
@@ -7201,8 +7210,99 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7201
7210
|
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
7202
7211
|
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
|
|
7203
7212
|
} else {
|
|
7213
|
+
console.log('delta', event.deltaY);
|
|
7204
7214
|
this.scrollY(Math.max(-5, Math.min(5, event.deltaY)));
|
|
7205
7215
|
}
|
|
7216
|
+
} else if (this.options.onNativeScroll) {
|
|
7217
|
+
var el = document.getElementById("".concat(this.elementId, "_tableBody"));
|
|
7218
|
+
this.options.onNativeScroll(el.scrollTop);
|
|
7219
|
+
}
|
|
7220
|
+
}
|
|
7221
|
+
}, {
|
|
7222
|
+
key: "handleTouchEnd",
|
|
7223
|
+
value: function handleTouchEnd(event) {
|
|
7224
|
+
console.log('touch end fired');
|
|
7225
|
+
|
|
7226
|
+
if (typeof event.targetTouches !== 'undefined') {
|
|
7227
|
+
this.isTouchScrolling = false;
|
|
7228
|
+
this.touchEndTime = new Date().getTime();
|
|
7229
|
+
this.isPerpetual = true; // this.perpetualScroll()
|
|
7230
|
+
|
|
7231
|
+
this.touchStartTime = null;
|
|
7232
|
+
var touchScrollEl = document.getElementById("".concat(this.elementId, "_touchScroller"));
|
|
7233
|
+
touchScrollEl.classList.add('hidden');
|
|
7234
|
+
}
|
|
7235
|
+
}
|
|
7236
|
+
}, {
|
|
7237
|
+
key: "handleTouchMove",
|
|
7238
|
+
value: function handleTouchMove(event) {
|
|
7239
|
+
console.log(event.target.classList);
|
|
7240
|
+
|
|
7241
|
+
if (this.isTouchScrolling === true) {
|
|
7242
|
+
event.preventDefault();
|
|
7243
|
+
event.stopPropagation();
|
|
7244
|
+
|
|
7245
|
+
if (typeof event.targetTouches !== 'undefined' && event.targetTouches.length > 0) {
|
|
7246
|
+
var deltaX = this.mouseXStart - event.targetTouches[0].pageX;
|
|
7247
|
+
var deltaY = this.mouseYStart - event.targetTouches[0].pageY; // need to adjust the delta so that it scrolls at a reasonable speed/distance
|
|
7248
|
+
|
|
7249
|
+
var scrollHandleXEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
7250
|
+
var scrollHandleYEl = document.getElementById("".concat(this.elementId, "_vScrollHandle")); // if (Math.abs(deltaY) > this.sizes.cellHeight) {
|
|
7251
|
+
// this.isTouchScrolling = true
|
|
7252
|
+
// }
|
|
7253
|
+
// else {
|
|
7254
|
+
// this.isTouchScrolling = false
|
|
7255
|
+
// }
|
|
7256
|
+
|
|
7257
|
+
console.log('delta init', deltaY); // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
|
|
7258
|
+
// deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
|
|
7259
|
+
// console.log('delta', deltaY)
|
|
7260
|
+
// NW
|
|
7261
|
+
// else if (Math.abs(deltaX) > 50) {
|
|
7262
|
+
// this.isTouchScrolling = false
|
|
7263
|
+
// }
|
|
7264
|
+
|
|
7265
|
+
this.currentClientY = event.targetTouches[0].pageY;
|
|
7266
|
+
this.currentTouchtime = new Date().getTime(); // end
|
|
7267
|
+
// delta = Math.min(10, delta)
|
|
7268
|
+
// delta = Math.max(-10, delta)
|
|
7269
|
+
|
|
7270
|
+
if (this.isTouchScrolling === true) {
|
|
7271
|
+
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7272
|
+
if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 10) {
|
|
7273
|
+
this.scrollX(Math.max(-5, Math.min(5, deltaX)));
|
|
7274
|
+
} else {
|
|
7275
|
+
this.scrollY(Math.max(-5, Math.min(5, deltaY)));
|
|
7276
|
+
}
|
|
7277
|
+
}
|
|
7278
|
+
}
|
|
7279
|
+
}
|
|
7280
|
+
}
|
|
7281
|
+
}, {
|
|
7282
|
+
key: "handleTouchStart",
|
|
7283
|
+
value: function handleTouchStart(event) {
|
|
7284
|
+
if (event.target.classList.contains('websy-table-cell-expand')) {
|
|
7285
|
+
return;
|
|
7286
|
+
}
|
|
7287
|
+
|
|
7288
|
+
if (event.target.classList.contains('websy-table-cell-collapse')) {
|
|
7289
|
+
return;
|
|
7290
|
+
}
|
|
7291
|
+
|
|
7292
|
+
console.log(event.target.classList);
|
|
7293
|
+
|
|
7294
|
+
if (this.options.virtualScroll === true) {
|
|
7295
|
+
this.touchStartTime = new Date().getTime();
|
|
7296
|
+
this.isTouchScrolling = true;
|
|
7297
|
+
this.isPerpetual = false;
|
|
7298
|
+
this.mouseYStart = event.targetTouches[0].pageY;
|
|
7299
|
+
this.mouseXStart = event.targetTouches[0].pageX;
|
|
7300
|
+
var touchScrollEl = document.getElementById("".concat(this.elementId, "_touchScroller"));
|
|
7301
|
+
touchScrollEl.classList.remove('hidden');
|
|
7302
|
+
var handleYEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
7303
|
+
this.handleYStart = handleYEl.offsetTop;
|
|
7304
|
+
var handleXEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
7305
|
+
this.handleXStart = handleXEl.offsetLeft;
|
|
7206
7306
|
}
|
|
7207
7307
|
}
|
|
7208
7308
|
}, {
|
|
@@ -7231,6 +7331,52 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7231
7331
|
value: function hideLoading() {
|
|
7232
7332
|
this.loadingDialog.hide();
|
|
7233
7333
|
}
|
|
7334
|
+
}, {
|
|
7335
|
+
key: "perpetualScroll",
|
|
7336
|
+
value: function perpetualScroll() {
|
|
7337
|
+
var _this44 = this;
|
|
7338
|
+
|
|
7339
|
+
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
7340
|
+
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
7341
|
+
return;
|
|
7342
|
+
} // get the difference in time between when the touch initially started and when it ended
|
|
7343
|
+
// the longer the touch duration, the slower the scroll
|
|
7344
|
+
|
|
7345
|
+
|
|
7346
|
+
var touchDuration = this.touchEndTime - this.touchStartTime; // get the distance moved between when the touch initially started and when it ended
|
|
7347
|
+
|
|
7348
|
+
var touchDistance = this.currentClientY - this.mouseYStart; // the bigger the distance, the more we scroll
|
|
7349
|
+
// use the duration and distance to calculate the duration of the perpetual scroll
|
|
7350
|
+
|
|
7351
|
+
var perpetualDistance = Math.abs(touchDistance * (1 / (touchDuration / 1000)));
|
|
7352
|
+
var perpetualDuration = touchDuration * 1.5 / 1000;
|
|
7353
|
+
var requiredFrames = Math.abs(Math.ceil(perpetualDistance / this.sizes.cellHeight));
|
|
7354
|
+
var fps = requiredFrames / perpetualDuration;
|
|
7355
|
+
var direction = touchDistance > 0 ? -1 : 1;
|
|
7356
|
+
|
|
7357
|
+
var _loop2 = function _loop2(i) {
|
|
7358
|
+
setTimeout(function () {
|
|
7359
|
+
var delta = _this44.mouseYStart - _this44.currentClientY + _this44.sizes.cellHeight * (i + 1) * direction;
|
|
7360
|
+
delta = Math.min(10, delta);
|
|
7361
|
+
delta = Math.max(-10, delta); // only run this if isPerpetual === true
|
|
7362
|
+
// this value is reset to false on touchStart
|
|
7363
|
+
|
|
7364
|
+
if (_this44.isPerpetual === true) {
|
|
7365
|
+
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7366
|
+
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
7367
|
+
_this44.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
7368
|
+
|
|
7369
|
+
if (_this44.scrollTimeout) {
|
|
7370
|
+
clearTimeout(_this44.scrollTimeout);
|
|
7371
|
+
}
|
|
7372
|
+
}
|
|
7373
|
+
}, 1000 / fps * i);
|
|
7374
|
+
};
|
|
7375
|
+
|
|
7376
|
+
for (var i = 0; i < requiredFrames; i++) {
|
|
7377
|
+
_loop2(i);
|
|
7378
|
+
}
|
|
7379
|
+
}
|
|
7234
7380
|
}, {
|
|
7235
7381
|
key: "render",
|
|
7236
7382
|
value: function render(data) {
|
|
@@ -7516,7 +7662,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7516
7662
|
|
|
7517
7663
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7518
7664
|
function WebsyChart(elementId, options) {
|
|
7519
|
-
var
|
|
7665
|
+
var _this45 = this;
|
|
7520
7666
|
|
|
7521
7667
|
_classCallCheck(this, WebsyChart);
|
|
7522
7668
|
|
|
@@ -7576,7 +7722,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7576
7722
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7577
7723
|
var xAxis = 'bottom';
|
|
7578
7724
|
|
|
7579
|
-
if (
|
|
7725
|
+
if (_this45.options.orientation === 'horizontal') {
|
|
7580
7726
|
xAxis = 'left';
|
|
7581
7727
|
}
|
|
7582
7728
|
|
|
@@ -7587,13 +7733,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7587
7733
|
xAxis += 'Axis';
|
|
7588
7734
|
var output;
|
|
7589
7735
|
|
|
7590
|
-
var width =
|
|
7736
|
+
var width = _this45.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
|
|
7591
7737
|
|
|
7592
7738
|
|
|
7593
|
-
for (var index = 0; index <
|
|
7594
|
-
if (input >
|
|
7595
|
-
if (
|
|
7596
|
-
if (input <
|
|
7739
|
+
for (var index = 0; index < _this45.customBottomRange.length; index++) {
|
|
7740
|
+
if (input > _this45.customBottomRange[index]) {
|
|
7741
|
+
if (_this45.customBottomRange[index + 1]) {
|
|
7742
|
+
if (input < _this45.customBottomRange[index + 1]) {
|
|
7597
7743
|
output = index;
|
|
7598
7744
|
break;
|
|
7599
7745
|
}
|
|
@@ -7831,10 +7977,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7831
7977
|
}, {
|
|
7832
7978
|
key: "handleEventMouseMove",
|
|
7833
7979
|
value: function handleEventMouseMove(event, d) {
|
|
7834
|
-
var
|
|
7980
|
+
var _this46 = this;
|
|
7835
7981
|
|
|
7836
7982
|
var bisectDate = d3.bisector(function (d) {
|
|
7837
|
-
return
|
|
7983
|
+
return _this46.parseX(d.x.value);
|
|
7838
7984
|
}).left;
|
|
7839
7985
|
|
|
7840
7986
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7873,9 +8019,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7873
8019
|
}
|
|
7874
8020
|
|
|
7875
8021
|
this.options.data.series.forEach(function (s) {
|
|
7876
|
-
if (
|
|
8022
|
+
if (_this46.options.data[xData].scale !== 'Time') {
|
|
7877
8023
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
7878
|
-
xPoint =
|
|
8024
|
+
xPoint = _this46.customBottomRange[x0] + (_this46.customBottomRange[x0 + 1] - _this46.customBottomRange[x0]) / 2; // }
|
|
7879
8025
|
// else {
|
|
7880
8026
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
7881
8027
|
// }
|
|
@@ -7898,13 +8044,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7898
8044
|
var pointA = s.data[index - 1];
|
|
7899
8045
|
var pointB = s.data[index];
|
|
7900
8046
|
|
|
7901
|
-
if (
|
|
8047
|
+
if (_this46.options.orientation === 'horizontal') {
|
|
7902
8048
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7903
8049
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7904
8050
|
}
|
|
7905
8051
|
|
|
7906
8052
|
if (pointA && !pointB) {
|
|
7907
|
-
xPoint =
|
|
8053
|
+
xPoint = _this46[xAxis](_this46.parseX(pointA.x.value));
|
|
7908
8054
|
tooltipTitle = pointA.x.value;
|
|
7909
8055
|
|
|
7910
8056
|
if (!pointA.y.color) {
|
|
@@ -7914,12 +8060,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7914
8060
|
tooltipData.push(pointA.y);
|
|
7915
8061
|
|
|
7916
8062
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7917
|
-
tooltipTitle = d3.timeFormat(
|
|
8063
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7918
8064
|
}
|
|
7919
8065
|
}
|
|
7920
8066
|
|
|
7921
8067
|
if (pointB && !pointA) {
|
|
7922
|
-
xPoint =
|
|
8068
|
+
xPoint = _this46[xAxis](_this46.parseX(pointB.x.value));
|
|
7923
8069
|
tooltipTitle = pointB.x.value;
|
|
7924
8070
|
|
|
7925
8071
|
if (!pointB.y.color) {
|
|
@@ -7929,14 +8075,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7929
8075
|
tooltipData.push(pointB.y);
|
|
7930
8076
|
|
|
7931
8077
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7932
|
-
tooltipTitle = d3.timeFormat(
|
|
8078
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7933
8079
|
}
|
|
7934
8080
|
}
|
|
7935
8081
|
|
|
7936
8082
|
if (pointA && pointB) {
|
|
7937
|
-
var d0 =
|
|
8083
|
+
var d0 = _this46[xAxis](_this46.parseX(pointA.x.value));
|
|
7938
8084
|
|
|
7939
|
-
var d1 =
|
|
8085
|
+
var d1 = _this46[xAxis](_this46.parseX(pointB.x.value));
|
|
7940
8086
|
|
|
7941
8087
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7942
8088
|
|
|
@@ -7945,7 +8091,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7945
8091
|
tooltipTitle = pointB.x.value;
|
|
7946
8092
|
|
|
7947
8093
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7948
|
-
tooltipTitle = d3.timeFormat(
|
|
8094
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7949
8095
|
}
|
|
7950
8096
|
|
|
7951
8097
|
if (!pointB.y.color) {
|
|
@@ -7958,7 +8104,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7958
8104
|
tooltipTitle = pointA.x.value;
|
|
7959
8105
|
|
|
7960
8106
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7961
|
-
tooltipTitle = d3.timeFormat(
|
|
8107
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7962
8108
|
}
|
|
7963
8109
|
|
|
7964
8110
|
if (!pointA.y.color) {
|
|
@@ -8093,7 +8239,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8093
8239
|
}, {
|
|
8094
8240
|
key: "render",
|
|
8095
8241
|
value: function render(options) {
|
|
8096
|
-
var
|
|
8242
|
+
var _this47 = this;
|
|
8097
8243
|
|
|
8098
8244
|
/* global d3 options WebsyUtils */
|
|
8099
8245
|
if (typeof options !== 'undefined') {
|
|
@@ -8172,7 +8318,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8172
8318
|
this.options.data.series.map(function (s, i) {
|
|
8173
8319
|
return {
|
|
8174
8320
|
value: s.label || s.key,
|
|
8175
|
-
color: s.color ||
|
|
8321
|
+
color: s.color || _this47.options.colors[i % _this47.options.colors.length]
|
|
8176
8322
|
};
|
|
8177
8323
|
});
|
|
8178
8324
|
}
|
|
@@ -8565,28 +8711,28 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8565
8711
|
if (this.options.data[customRangeSideLC].data && this.options.data[customRangeSideLC].data[0] && (this.options.data[customRangeSideLC].data[0].valueCount || 1) && this.options.data[customRangeSideLC].scale === 'Ordinal') {
|
|
8566
8712
|
var acc = 0;
|
|
8567
8713
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8568
|
-
var adjustment =
|
|
8714
|
+
var adjustment = _this47.bandPadding * index + _this47.bandPadding; // if (this.options.data.bottom.padding) {
|
|
8569
8715
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8570
8716
|
// }
|
|
8571
8717
|
|
|
8572
|
-
var start =
|
|
8718
|
+
var start = _this47.widthForCalc / noOfPoints * acc;
|
|
8573
8719
|
|
|
8574
8720
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8575
8721
|
var pos = i * proposedBandWidth;
|
|
8576
8722
|
|
|
8577
|
-
|
|
8723
|
+
_this47["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8578
8724
|
}
|
|
8579
8725
|
|
|
8580
|
-
acc +=
|
|
8581
|
-
var end =
|
|
8726
|
+
acc += _this47.options.grouping !== 'stacked' && _this47.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8727
|
+
var end = _this47.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8582
8728
|
|
|
8583
8729
|
return end + adjustment;
|
|
8584
8730
|
})));
|
|
8585
8731
|
acc = 0;
|
|
8586
8732
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8587
|
-
var adjustment =
|
|
8588
|
-
acc +=
|
|
8589
|
-
return (
|
|
8733
|
+
var adjustment = _this47.brushBandPadding * index + _this47.brushBandPadding;
|
|
8734
|
+
acc += _this47.options.grouping !== 'stacked' && _this47.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8735
|
+
return (_this47.options.orientation === 'vertical' ? _this47.plotWidth : _this47.plotHeight) / noOfPoints * acc;
|
|
8590
8736
|
})));
|
|
8591
8737
|
} // }
|
|
8592
8738
|
|
|
@@ -8768,7 +8914,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8768
8914
|
|
|
8769
8915
|
if (this.options.data.bottom.formatter) {
|
|
8770
8916
|
this.bAxisFunc.tickFormat(function (d) {
|
|
8771
|
-
return
|
|
8917
|
+
return _this47.options.data.bottom.formatter(d);
|
|
8772
8918
|
});
|
|
8773
8919
|
}
|
|
8774
8920
|
|
|
@@ -8780,7 +8926,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8780
8926
|
|
|
8781
8927
|
if (this.customBottomRange.length > 0) {
|
|
8782
8928
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8783
|
-
return "translate(".concat(
|
|
8929
|
+
return "translate(".concat(_this47.customBottomRange[i] + (_this47.customBottomRange[i + 1] - _this47.customBottomRange[i]) / 2, ", 0)");
|
|
8784
8930
|
});
|
|
8785
8931
|
}
|
|
8786
8932
|
} // Configure the left axis
|
|
@@ -8802,8 +8948,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8802
8948
|
|
|
8803
8949
|
if (this.options.margin.axisLeft > 0) {
|
|
8804
8950
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8805
|
-
if (
|
|
8806
|
-
d =
|
|
8951
|
+
if (_this47.options.data.left.formatter) {
|
|
8952
|
+
d = _this47.options.data.left.formatter(d);
|
|
8807
8953
|
}
|
|
8808
8954
|
|
|
8809
8955
|
return d;
|
|
@@ -8811,7 +8957,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8811
8957
|
|
|
8812
8958
|
if (this.customLeftRange.length > 0) {
|
|
8813
8959
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8814
|
-
return "translate(0, ".concat(
|
|
8960
|
+
return "translate(0, ".concat(_this47.customLeftRange[i] + (_this47.customLeftRange[i + 1] - _this47.customLeftRange[i]) / 2, ")");
|
|
8815
8961
|
});
|
|
8816
8962
|
}
|
|
8817
8963
|
}
|
|
@@ -8844,8 +8990,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8844
8990
|
|
|
8845
8991
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8846
8992
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
8847
|
-
if (
|
|
8848
|
-
d =
|
|
8993
|
+
if (_this47.options.data.right.formatter) {
|
|
8994
|
+
d = _this47.options.data.right.formatter(d);
|
|
8849
8995
|
}
|
|
8850
8996
|
|
|
8851
8997
|
return d;
|
|
@@ -8891,60 +9037,60 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8891
9037
|
}, {
|
|
8892
9038
|
key: "renderComponents",
|
|
8893
9039
|
value: function renderComponents() {
|
|
8894
|
-
var
|
|
9040
|
+
var _this48 = this;
|
|
8895
9041
|
|
|
8896
9042
|
// Draw the series data
|
|
8897
9043
|
this.renderedKeys = {};
|
|
8898
9044
|
this.options.data.series.forEach(function (series, index) {
|
|
8899
9045
|
if (!series.key) {
|
|
8900
|
-
series.key =
|
|
9046
|
+
series.key = _this48.createIdentity();
|
|
8901
9047
|
}
|
|
8902
9048
|
|
|
8903
9049
|
if (!series.color) {
|
|
8904
|
-
series.color =
|
|
9050
|
+
series.color = _this48.options.colors[index % _this48.options.colors.length];
|
|
8905
9051
|
}
|
|
8906
9052
|
|
|
8907
|
-
|
|
9053
|
+
_this48["render".concat(series.type || 'bar')](series, index);
|
|
8908
9054
|
|
|
8909
|
-
|
|
9055
|
+
_this48.renderLabels(series, index);
|
|
8910
9056
|
|
|
8911
|
-
|
|
9057
|
+
_this48.renderedKeys[series.key] = series.type;
|
|
8912
9058
|
});
|
|
8913
9059
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8914
9060
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8915
9061
|
|
|
8916
9062
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8917
9063
|
this.options.refLines.forEach(function (l) {
|
|
8918
|
-
return
|
|
9064
|
+
return _this48.renderRefLine(l);
|
|
8919
9065
|
});
|
|
8920
9066
|
}
|
|
8921
9067
|
}
|
|
8922
9068
|
}, {
|
|
8923
9069
|
key: "renderarea",
|
|
8924
9070
|
value: function renderarea(series, index) {
|
|
8925
|
-
var
|
|
9071
|
+
var _this49 = this;
|
|
8926
9072
|
|
|
8927
9073
|
/* global d3 series index */
|
|
8928
9074
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8929
9075
|
return d3.area().x(function (d) {
|
|
8930
|
-
if (
|
|
8931
|
-
return
|
|
9076
|
+
if (_this49.options.data[xAxis].scale === 'Time') {
|
|
9077
|
+
return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value));
|
|
8932
9078
|
} else {
|
|
8933
|
-
var xIndex =
|
|
9079
|
+
var xIndex = _this49[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8934
9080
|
|
|
8935
|
-
var xPos =
|
|
9081
|
+
var xPos = _this49["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8936
9082
|
|
|
8937
|
-
if (
|
|
8938
|
-
xPos = xPos + (
|
|
9083
|
+
if (_this49["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9084
|
+
xPos = xPos + (_this49["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8939
9085
|
}
|
|
8940
9086
|
|
|
8941
9087
|
return xPos;
|
|
8942
9088
|
}
|
|
8943
9089
|
}).y0(function (d) {
|
|
8944
|
-
return
|
|
9090
|
+
return _this49["".concat(yAxis, "Axis")](0);
|
|
8945
9091
|
}).y1(function (d) {
|
|
8946
|
-
return
|
|
8947
|
-
}).curve(d3[curveStyle ||
|
|
9092
|
+
return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9093
|
+
}).curve(d3[curveStyle || _this49.options.curveStyle]);
|
|
8948
9094
|
};
|
|
8949
9095
|
|
|
8950
9096
|
var xAxis = 'bottom';
|
|
@@ -8982,7 +9128,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8982
9128
|
}, {
|
|
8983
9129
|
key: "renderbar",
|
|
8984
9130
|
value: function renderbar(series, index) {
|
|
8985
|
-
var
|
|
9131
|
+
var _this50 = this;
|
|
8986
9132
|
|
|
8987
9133
|
/* global series index d3 */
|
|
8988
9134
|
var xAxis = 'bottom';
|
|
@@ -9160,25 +9306,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9160
9306
|
|
|
9161
9307
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9162
9308
|
bars.attr('width', function (d, i) {
|
|
9163
|
-
return Math.abs(getBarWidth.call(
|
|
9309
|
+
return Math.abs(getBarWidth.call(_this50, d, i, xAxis));
|
|
9164
9310
|
}).attr('height', function (d, i) {
|
|
9165
|
-
return getBarHeight.call(
|
|
9311
|
+
return getBarHeight.call(_this50, d, i, yAxis, xAxis);
|
|
9166
9312
|
}).attr('x', function (d, i) {
|
|
9167
|
-
return getBarX.call(
|
|
9313
|
+
return getBarX.call(_this50, d, i, xAxis);
|
|
9168
9314
|
}).attr('y', function (d, i) {
|
|
9169
|
-
return getBarY.call(
|
|
9315
|
+
return getBarY.call(_this50, d, i, yAxis, xAxis);
|
|
9170
9316
|
}) // .transition(this.transition)
|
|
9171
9317
|
.attr('fill', function (d) {
|
|
9172
9318
|
return d.y.color || d.color || series.color;
|
|
9173
9319
|
});
|
|
9174
9320
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
9175
|
-
return Math.abs(getBarWidth.call(
|
|
9321
|
+
return Math.abs(getBarWidth.call(_this50, d, i, xAxis));
|
|
9176
9322
|
}).attr('height', function (d, i) {
|
|
9177
|
-
return getBarHeight.call(
|
|
9323
|
+
return getBarHeight.call(_this50, d, i, yAxis, xAxis);
|
|
9178
9324
|
}).attr('x', function (d, i) {
|
|
9179
|
-
return getBarX.call(
|
|
9325
|
+
return getBarX.call(_this50, d, i, xAxis);
|
|
9180
9326
|
}).attr('y', function (d, i) {
|
|
9181
|
-
return getBarY.call(
|
|
9327
|
+
return getBarY.call(_this50, d, i, yAxis, xAxis);
|
|
9182
9328
|
}) // .transition(this.transition)
|
|
9183
9329
|
.attr('fill', function (d) {
|
|
9184
9330
|
return d.y.color || d.color || series.color;
|
|
@@ -9190,25 +9336,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9190
9336
|
this.brushBarsInitialized[series.key] = true;
|
|
9191
9337
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9192
9338
|
brushBars.attr('width', function (d, i) {
|
|
9193
|
-
return Math.abs(getBarWidth.call(
|
|
9339
|
+
return Math.abs(getBarWidth.call(_this50, d, i, "".concat(xAxis, "Brush")));
|
|
9194
9340
|
}).attr('height', function (d, i) {
|
|
9195
|
-
return getBarHeight.call(
|
|
9341
|
+
return getBarHeight.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9196
9342
|
}).attr('x', function (d, i) {
|
|
9197
|
-
return getBarX.call(
|
|
9343
|
+
return getBarX.call(_this50, d, i, "".concat(xAxis, "Brush"));
|
|
9198
9344
|
}).attr('y', function (d, i) {
|
|
9199
|
-
return getBarY.call(
|
|
9345
|
+
return getBarY.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9200
9346
|
}) // .transition(this.transition)
|
|
9201
9347
|
.attr('fill', function (d) {
|
|
9202
9348
|
return d.y.color || d.color || series.color;
|
|
9203
9349
|
});
|
|
9204
9350
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
9205
|
-
return Math.abs(getBarWidth.call(
|
|
9351
|
+
return Math.abs(getBarWidth.call(_this50, d, i, "".concat(xAxis, "Brush")));
|
|
9206
9352
|
}).attr('height', function (d, i) {
|
|
9207
|
-
return getBarHeight.call(
|
|
9353
|
+
return getBarHeight.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9208
9354
|
}).attr('x', function (d, i) {
|
|
9209
|
-
return getBarX.call(
|
|
9355
|
+
return getBarX.call(_this50, d, i, "".concat(xAxis, "Brush"));
|
|
9210
9356
|
}).attr('y', function (d, i) {
|
|
9211
|
-
return getBarY.call(
|
|
9357
|
+
return getBarY.call(_this50, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9212
9358
|
}) // .transition(this.transition)
|
|
9213
9359
|
.attr('fill', function (d) {
|
|
9214
9360
|
return d.y.color || d.color || series.color;
|
|
@@ -9226,7 +9372,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9226
9372
|
}, {
|
|
9227
9373
|
key: "renderLabels",
|
|
9228
9374
|
value: function renderLabels(series, index) {
|
|
9229
|
-
var
|
|
9375
|
+
var _this51 = this;
|
|
9230
9376
|
|
|
9231
9377
|
/* global series index d3 WebsyDesigns */
|
|
9232
9378
|
var xAxis = 'bottom';
|
|
@@ -9245,15 +9391,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9245
9391
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9246
9392
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9247
9393
|
labels.attr('x', function (d) {
|
|
9248
|
-
return getLabelX.call(
|
|
9394
|
+
return getLabelX.call(_this51, d, series.labelPosition);
|
|
9249
9395
|
}).attr('y', function (d) {
|
|
9250
|
-
return getLabelY.call(
|
|
9396
|
+
return getLabelY.call(_this51, d, series.labelPosition);
|
|
9251
9397
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9252
|
-
if (
|
|
9398
|
+
if (_this51.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9253
9399
|
return 'transparent';
|
|
9254
9400
|
}
|
|
9255
9401
|
|
|
9256
|
-
return
|
|
9402
|
+
return _this51.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9257
9403
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9258
9404
|
return d.y.label || d.y.value;
|
|
9259
9405
|
}).each(function (d, i) {
|
|
@@ -9278,15 +9424,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9278
9424
|
}
|
|
9279
9425
|
});
|
|
9280
9426
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9281
|
-
return getLabelX.call(
|
|
9427
|
+
return getLabelX.call(_this51, d, series.labelPosition);
|
|
9282
9428
|
}).attr('y', function (d) {
|
|
9283
|
-
return getLabelY.call(
|
|
9429
|
+
return getLabelY.call(_this51, d, series.labelPosition);
|
|
9284
9430
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9285
|
-
if (
|
|
9431
|
+
if (_this51.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9286
9432
|
return 'transparent';
|
|
9287
9433
|
}
|
|
9288
9434
|
|
|
9289
|
-
return
|
|
9435
|
+
return _this51.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9290
9436
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9291
9437
|
return d.y.label || d.y.value;
|
|
9292
9438
|
}).each(function (d, i) {
|
|
@@ -9364,36 +9510,36 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9364
9510
|
}, {
|
|
9365
9511
|
key: "renderline",
|
|
9366
9512
|
value: function renderline(series, index) {
|
|
9367
|
-
var
|
|
9513
|
+
var _this52 = this;
|
|
9368
9514
|
|
|
9369
9515
|
/* global series index d3 */
|
|
9370
9516
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9371
9517
|
return d3.line().x(function (d) {
|
|
9372
|
-
if (
|
|
9373
|
-
return
|
|
9518
|
+
if (_this52.options.orientation === 'horizontal') {
|
|
9519
|
+
return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9374
9520
|
} else {
|
|
9375
|
-
if (
|
|
9376
|
-
return
|
|
9521
|
+
if (_this52.options.data[xAxis].scale === 'Time') {
|
|
9522
|
+
return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value));
|
|
9377
9523
|
} else {
|
|
9378
|
-
var xIndex =
|
|
9524
|
+
var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9379
9525
|
|
|
9380
|
-
var xPos =
|
|
9526
|
+
var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9381
9527
|
|
|
9382
|
-
if (
|
|
9383
|
-
xPos = xPos + (
|
|
9528
|
+
if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9529
|
+
xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9384
9530
|
}
|
|
9385
9531
|
|
|
9386
9532
|
return xPos;
|
|
9387
9533
|
}
|
|
9388
9534
|
}
|
|
9389
9535
|
}).y(function (d) {
|
|
9390
|
-
if (
|
|
9391
|
-
var adjustment =
|
|
9392
|
-
return
|
|
9536
|
+
if (_this52.options.orientation === 'horizontal') {
|
|
9537
|
+
var adjustment = _this52.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this52.options.data[xAxis].bandWidth / 2;
|
|
9538
|
+
return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value)) + adjustment;
|
|
9393
9539
|
} else {
|
|
9394
|
-
return
|
|
9540
|
+
return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9395
9541
|
}
|
|
9396
|
-
}).curve(d3[curveStyle ||
|
|
9542
|
+
}).curve(d3[curveStyle || _this52.options.curveStyle]);
|
|
9397
9543
|
};
|
|
9398
9544
|
|
|
9399
9545
|
var xAxis = 'bottom';
|
|
@@ -9507,14 +9653,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9507
9653
|
}, {
|
|
9508
9654
|
key: "rendersymbol",
|
|
9509
9655
|
value: function rendersymbol(series, index) {
|
|
9510
|
-
var
|
|
9656
|
+
var _this53 = this;
|
|
9511
9657
|
|
|
9512
9658
|
/* global d3 series index series.key */
|
|
9513
9659
|
var drawSymbol = function drawSymbol(size) {
|
|
9514
9660
|
return d3.symbol() // .type(d => {
|
|
9515
9661
|
// return d3.symbols[0]
|
|
9516
9662
|
// })
|
|
9517
|
-
.size(size ||
|
|
9663
|
+
.size(size || _this53.options.symbolSize);
|
|
9518
9664
|
};
|
|
9519
9665
|
|
|
9520
9666
|
var xAxis = 'bottom';
|
|
@@ -9543,25 +9689,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9543
9689
|
// else {
|
|
9544
9690
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9545
9691
|
// }
|
|
9546
|
-
var xIndex =
|
|
9692
|
+
var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9547
9693
|
|
|
9548
|
-
var xPos =
|
|
9694
|
+
var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9549
9695
|
|
|
9550
|
-
if (
|
|
9551
|
-
xPos = xPos + (
|
|
9696
|
+
if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9697
|
+
xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9552
9698
|
}
|
|
9553
9699
|
|
|
9554
|
-
var adjustment =
|
|
9700
|
+
var adjustment = _this53.options.data[xAxis].scale === 'Time' || _this53.options.data[xAxis].scale === 'Linear' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
|
|
9555
9701
|
|
|
9556
|
-
if (
|
|
9557
|
-
return "translate(".concat(
|
|
9702
|
+
if (_this53.options.orientation === 'horizontal') {
|
|
9703
|
+
return "translate(".concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9558
9704
|
} else {
|
|
9559
|
-
if (
|
|
9560
|
-
xPos =
|
|
9705
|
+
if (_this53.options.data[xAxis].scale === 'Time') {
|
|
9706
|
+
xPos = _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value));
|
|
9561
9707
|
} // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9562
9708
|
|
|
9563
9709
|
|
|
9564
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9710
|
+
return "translate(".concat(xPos, ", ").concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9565
9711
|
}
|
|
9566
9712
|
}); // Enter
|
|
9567
9713
|
|
|
@@ -9575,25 +9721,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9575
9721
|
}).attr('class', function (d) {
|
|
9576
9722
|
return "symbol symbol_".concat(series.key);
|
|
9577
9723
|
}).attr('transform', function (d) {
|
|
9578
|
-
var xIndex =
|
|
9724
|
+
var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9579
9725
|
|
|
9580
|
-
var xPos =
|
|
9726
|
+
var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9581
9727
|
|
|
9582
|
-
if (
|
|
9583
|
-
xPos = xPos + (
|
|
9728
|
+
if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9729
|
+
xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9584
9730
|
}
|
|
9585
9731
|
|
|
9586
|
-
var adjustment =
|
|
9732
|
+
var adjustment = _this53.options.data[xAxis].scale === 'Time' || _this53.options.data[xAxis].scale === 'Linear' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
|
|
9587
9733
|
|
|
9588
|
-
if (
|
|
9589
|
-
return "translate(".concat(
|
|
9734
|
+
if (_this53.options.orientation === 'horizontal') {
|
|
9735
|
+
return "translate(".concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9590
9736
|
} else {
|
|
9591
|
-
if (
|
|
9592
|
-
xPos =
|
|
9737
|
+
if (_this53.options.data[xAxis].scale === 'Time') {
|
|
9738
|
+
xPos = _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value));
|
|
9593
9739
|
} // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9594
9740
|
|
|
9595
9741
|
|
|
9596
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9742
|
+
return "translate(".concat(xPos, ", ").concat(_this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9597
9743
|
}
|
|
9598
9744
|
});
|
|
9599
9745
|
}
|
|
@@ -9815,7 +9961,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9815
9961
|
}, {
|
|
9816
9962
|
key: "resize",
|
|
9817
9963
|
value: function resize() {
|
|
9818
|
-
var
|
|
9964
|
+
var _this54 = this;
|
|
9819
9965
|
|
|
9820
9966
|
var el = document.getElementById(this.elementId);
|
|
9821
9967
|
|
|
@@ -9828,7 +9974,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9828
9974
|
// }
|
|
9829
9975
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
9830
9976
|
html += this._data.map(function (d, i) {
|
|
9831
|
-
return
|
|
9977
|
+
return _this54.getLegendItemHTML(d);
|
|
9832
9978
|
}).join('');
|
|
9833
9979
|
html += "\n <div>\n ";
|
|
9834
9980
|
el.innerHTML = html;
|
|
@@ -10005,7 +10151,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10005
10151
|
}, {
|
|
10006
10152
|
key: "render",
|
|
10007
10153
|
value: function render() {
|
|
10008
|
-
var
|
|
10154
|
+
var _this55 = this;
|
|
10009
10155
|
|
|
10010
10156
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
10011
10157
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -10014,7 +10160,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10014
10160
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
10015
10161
|
return {
|
|
10016
10162
|
value: s.label || s.key,
|
|
10017
|
-
color: s.color ||
|
|
10163
|
+
color: s.color || _this55.options.colors[i % _this55.options.colors.length]
|
|
10018
10164
|
};
|
|
10019
10165
|
});
|
|
10020
10166
|
var longestValue = legendData.map(function (s) {
|
|
@@ -10078,7 +10224,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10078
10224
|
|
|
10079
10225
|
if (this.polygons) {
|
|
10080
10226
|
this.polygons.forEach(function (p) {
|
|
10081
|
-
return
|
|
10227
|
+
return _this55.map.removeLayer(p);
|
|
10082
10228
|
});
|
|
10083
10229
|
}
|
|
10084
10230
|
|
|
@@ -10136,18 +10282,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10136
10282
|
}
|
|
10137
10283
|
|
|
10138
10284
|
if (!p.options.color) {
|
|
10139
|
-
p.options.color =
|
|
10285
|
+
p.options.color = _this55.options.colors[i % _this55.options.colors.length];
|
|
10140
10286
|
}
|
|
10141
10287
|
|
|
10142
10288
|
var pol = L.polygon(p.data.map(function (c) {
|
|
10143
10289
|
return c.map(function (d) {
|
|
10144
10290
|
return [d.Latitude, d.Longitude];
|
|
10145
10291
|
});
|
|
10146
|
-
}), p.options).addTo(
|
|
10292
|
+
}), p.options).addTo(_this55.map);
|
|
10147
10293
|
|
|
10148
|
-
|
|
10294
|
+
_this55.polygons.push(pol);
|
|
10149
10295
|
|
|
10150
|
-
|
|
10296
|
+
_this55.map.fitBounds(pol.getBounds());
|
|
10151
10297
|
});
|
|
10152
10298
|
} // if (this.data.markers.length > 0) {
|
|
10153
10299
|
// el.classList.remove('hidden')
|