@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
package/dist/websy-designs.js
CHANGED
|
@@ -7095,6 +7095,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7095
7095
|
minusIcon: WebsyDesigns.Icons.MinusFilled
|
|
7096
7096
|
};
|
|
7097
7097
|
this.options = _extends({}, DEFAULTS, options);
|
|
7098
|
+
this.isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
7098
7099
|
this.sizes = {};
|
|
7099
7100
|
this.currentData = [];
|
|
7100
7101
|
this.scrollDragging = false;
|
|
@@ -7117,7 +7118,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7117
7118
|
var el = document.getElementById(this.elementId);
|
|
7118
7119
|
|
|
7119
7120
|
if (el) {
|
|
7120
|
-
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 ");
|
|
7121
|
+
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 ");
|
|
7121
7122
|
|
|
7122
7123
|
if (this.options.paging === 'pages') {
|
|
7123
7124
|
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 ");
|
|
@@ -7126,6 +7127,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7126
7127
|
el.innerHTML = html;
|
|
7127
7128
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
7128
7129
|
el.addEventListener('mousedown', this.handleMouseDown.bind(this));
|
|
7130
|
+
el.addEventListener('touchstart', this.handleTouchStart.bind(this));
|
|
7131
|
+
window.addEventListener('touchmove', this.handleTouchMove.bind(this));
|
|
7132
|
+
window.addEventListener('touchend', this.handleTouchEnd.bind(this));
|
|
7129
7133
|
window.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
7130
7134
|
window.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
7131
7135
|
var scrollEl = document.getElementById("".concat(this.elementId, "_tableBody"));
|
|
@@ -7192,6 +7196,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7192
7196
|
bodyHtml += "<tr class=\"websy-table-row\">";
|
|
7193
7197
|
row.forEach(function (cell, cellIndex) {
|
|
7194
7198
|
var sizeIndex = cell.level || cellIndex;
|
|
7199
|
+
var colIndex = cell.index || cellIndex;
|
|
7195
7200
|
|
|
7196
7201
|
if (typeof sizingColumns[sizeIndex] === 'undefined' || sizingColumns[sizeIndex].show === false) {
|
|
7197
7202
|
return; // need to revisit this logic
|
|
@@ -7227,14 +7232,14 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7227
7232
|
} // console.log('rowspan', cell.rowspan)
|
|
7228
7233
|
|
|
7229
7234
|
|
|
7230
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this42.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(
|
|
7235
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this42.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) {
|
|
7231
7236
|
// bodyHtml += `
|
|
7232
7237
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
7233
7238
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
7234
7239
|
// `
|
|
7235
7240
|
// }
|
|
7236
7241
|
|
|
7237
|
-
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(
|
|
7242
|
+
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 >");
|
|
7238
7243
|
|
|
7239
7244
|
if (cell.expandable === true) {
|
|
7240
7245
|
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this42.options.plusIcon, "</i>");
|
|
@@ -7630,6 +7635,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7630
7635
|
}, {
|
|
7631
7636
|
key: "handleMouseDown",
|
|
7632
7637
|
value: function handleMouseDown(event) {
|
|
7638
|
+
if (this.isTouchDevice === true) {
|
|
7639
|
+
return;
|
|
7640
|
+
}
|
|
7641
|
+
|
|
7633
7642
|
if (event.target.classList.contains('websy-scroll-handle-y')) {
|
|
7634
7643
|
// set up the scroll start values
|
|
7635
7644
|
this.scrollDragging = true;
|
|
@@ -7682,8 +7691,99 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7682
7691
|
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
7683
7692
|
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
|
|
7684
7693
|
} else {
|
|
7694
|
+
console.log('delta', event.deltaY);
|
|
7685
7695
|
this.scrollY(Math.max(-5, Math.min(5, event.deltaY)));
|
|
7686
7696
|
}
|
|
7697
|
+
} else if (this.options.onNativeScroll) {
|
|
7698
|
+
var el = document.getElementById("".concat(this.elementId, "_tableBody"));
|
|
7699
|
+
this.options.onNativeScroll(el.scrollTop);
|
|
7700
|
+
}
|
|
7701
|
+
}
|
|
7702
|
+
}, {
|
|
7703
|
+
key: "handleTouchEnd",
|
|
7704
|
+
value: function handleTouchEnd(event) {
|
|
7705
|
+
console.log('touch end fired');
|
|
7706
|
+
|
|
7707
|
+
if (typeof event.targetTouches !== 'undefined') {
|
|
7708
|
+
this.isTouchScrolling = false;
|
|
7709
|
+
this.touchEndTime = new Date().getTime();
|
|
7710
|
+
this.isPerpetual = true; // this.perpetualScroll()
|
|
7711
|
+
|
|
7712
|
+
this.touchStartTime = null;
|
|
7713
|
+
var touchScrollEl = document.getElementById("".concat(this.elementId, "_touchScroller"));
|
|
7714
|
+
touchScrollEl.classList.add('hidden');
|
|
7715
|
+
}
|
|
7716
|
+
}
|
|
7717
|
+
}, {
|
|
7718
|
+
key: "handleTouchMove",
|
|
7719
|
+
value: function handleTouchMove(event) {
|
|
7720
|
+
console.log(event.target.classList);
|
|
7721
|
+
|
|
7722
|
+
if (this.isTouchScrolling === true) {
|
|
7723
|
+
event.preventDefault();
|
|
7724
|
+
event.stopPropagation();
|
|
7725
|
+
|
|
7726
|
+
if (typeof event.targetTouches !== 'undefined' && event.targetTouches.length > 0) {
|
|
7727
|
+
var deltaX = this.mouseXStart - event.targetTouches[0].pageX;
|
|
7728
|
+
var deltaY = this.mouseYStart - event.targetTouches[0].pageY; // need to adjust the delta so that it scrolls at a reasonable speed/distance
|
|
7729
|
+
|
|
7730
|
+
var scrollHandleXEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
7731
|
+
var scrollHandleYEl = document.getElementById("".concat(this.elementId, "_vScrollHandle")); // if (Math.abs(deltaY) > this.sizes.cellHeight) {
|
|
7732
|
+
// this.isTouchScrolling = true
|
|
7733
|
+
// }
|
|
7734
|
+
// else {
|
|
7735
|
+
// this.isTouchScrolling = false
|
|
7736
|
+
// }
|
|
7737
|
+
|
|
7738
|
+
console.log('delta init', deltaY); // deltaX = deltaX * (scrollHandleXEl.offsetWidth / this.sizes.scrollableWidth)
|
|
7739
|
+
// deltaY = deltaY * (scrollHandleYEl.offsetHeight / this.sizes.bodyHeight)
|
|
7740
|
+
// console.log('delta', deltaY)
|
|
7741
|
+
// NW
|
|
7742
|
+
// else if (Math.abs(deltaX) > 50) {
|
|
7743
|
+
// this.isTouchScrolling = false
|
|
7744
|
+
// }
|
|
7745
|
+
|
|
7746
|
+
this.currentClientY = event.targetTouches[0].pageY;
|
|
7747
|
+
this.currentTouchtime = new Date().getTime(); // end
|
|
7748
|
+
// delta = Math.min(10, delta)
|
|
7749
|
+
// delta = Math.max(-10, delta)
|
|
7750
|
+
|
|
7751
|
+
if (this.isTouchScrolling === true) {
|
|
7752
|
+
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7753
|
+
if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 10) {
|
|
7754
|
+
this.scrollX(Math.max(-5, Math.min(5, deltaX)));
|
|
7755
|
+
} else {
|
|
7756
|
+
this.scrollY(Math.max(-5, Math.min(5, deltaY)));
|
|
7757
|
+
}
|
|
7758
|
+
}
|
|
7759
|
+
}
|
|
7760
|
+
}
|
|
7761
|
+
}
|
|
7762
|
+
}, {
|
|
7763
|
+
key: "handleTouchStart",
|
|
7764
|
+
value: function handleTouchStart(event) {
|
|
7765
|
+
if (event.target.classList.contains('websy-table-cell-expand')) {
|
|
7766
|
+
return;
|
|
7767
|
+
}
|
|
7768
|
+
|
|
7769
|
+
if (event.target.classList.contains('websy-table-cell-collapse')) {
|
|
7770
|
+
return;
|
|
7771
|
+
}
|
|
7772
|
+
|
|
7773
|
+
console.log(event.target.classList);
|
|
7774
|
+
|
|
7775
|
+
if (this.options.virtualScroll === true) {
|
|
7776
|
+
this.touchStartTime = new Date().getTime();
|
|
7777
|
+
this.isTouchScrolling = true;
|
|
7778
|
+
this.isPerpetual = false;
|
|
7779
|
+
this.mouseYStart = event.targetTouches[0].pageY;
|
|
7780
|
+
this.mouseXStart = event.targetTouches[0].pageX;
|
|
7781
|
+
var touchScrollEl = document.getElementById("".concat(this.elementId, "_touchScroller"));
|
|
7782
|
+
touchScrollEl.classList.remove('hidden');
|
|
7783
|
+
var handleYEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
7784
|
+
this.handleYStart = handleYEl.offsetTop;
|
|
7785
|
+
var handleXEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
|
|
7786
|
+
this.handleXStart = handleXEl.offsetLeft;
|
|
7687
7787
|
}
|
|
7688
7788
|
}
|
|
7689
7789
|
}, {
|
|
@@ -7712,6 +7812,52 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7712
7812
|
value: function hideLoading() {
|
|
7713
7813
|
this.loadingDialog.hide();
|
|
7714
7814
|
}
|
|
7815
|
+
}, {
|
|
7816
|
+
key: "perpetualScroll",
|
|
7817
|
+
value: function perpetualScroll() {
|
|
7818
|
+
var _this47 = this;
|
|
7819
|
+
|
|
7820
|
+
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
7821
|
+
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
7822
|
+
return;
|
|
7823
|
+
} // get the difference in time between when the touch initially started and when it ended
|
|
7824
|
+
// the longer the touch duration, the slower the scroll
|
|
7825
|
+
|
|
7826
|
+
|
|
7827
|
+
var touchDuration = this.touchEndTime - this.touchStartTime; // get the distance moved between when the touch initially started and when it ended
|
|
7828
|
+
|
|
7829
|
+
var touchDistance = this.currentClientY - this.mouseYStart; // the bigger the distance, the more we scroll
|
|
7830
|
+
// use the duration and distance to calculate the duration of the perpetual scroll
|
|
7831
|
+
|
|
7832
|
+
var perpetualDistance = Math.abs(touchDistance * (1 / (touchDuration / 1000)));
|
|
7833
|
+
var perpetualDuration = touchDuration * 1.5 / 1000;
|
|
7834
|
+
var requiredFrames = Math.abs(Math.ceil(perpetualDistance / this.sizes.cellHeight));
|
|
7835
|
+
var fps = requiredFrames / perpetualDuration;
|
|
7836
|
+
var direction = touchDistance > 0 ? -1 : 1;
|
|
7837
|
+
|
|
7838
|
+
var _loop2 = function _loop2(i) {
|
|
7839
|
+
setTimeout(function () {
|
|
7840
|
+
var delta = _this47.mouseYStart - _this47.currentClientY + _this47.sizes.cellHeight * (i + 1) * direction;
|
|
7841
|
+
delta = Math.min(10, delta);
|
|
7842
|
+
delta = Math.max(-10, delta); // only run this if isPerpetual === true
|
|
7843
|
+
// this value is reset to false on touchStart
|
|
7844
|
+
|
|
7845
|
+
if (_this47.isPerpetual === true) {
|
|
7846
|
+
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7847
|
+
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
7848
|
+
_this47.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
7849
|
+
|
|
7850
|
+
if (_this47.scrollTimeout) {
|
|
7851
|
+
clearTimeout(_this47.scrollTimeout);
|
|
7852
|
+
}
|
|
7853
|
+
}
|
|
7854
|
+
}, 1000 / fps * i);
|
|
7855
|
+
};
|
|
7856
|
+
|
|
7857
|
+
for (var i = 0; i < requiredFrames; i++) {
|
|
7858
|
+
_loop2(i);
|
|
7859
|
+
}
|
|
7860
|
+
}
|
|
7715
7861
|
}, {
|
|
7716
7862
|
key: "render",
|
|
7717
7863
|
value: function render(data) {
|
|
@@ -7997,7 +8143,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7997
8143
|
|
|
7998
8144
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7999
8145
|
function WebsyChart(elementId, options) {
|
|
8000
|
-
var
|
|
8146
|
+
var _this48 = this;
|
|
8001
8147
|
|
|
8002
8148
|
_classCallCheck(this, WebsyChart);
|
|
8003
8149
|
|
|
@@ -8057,7 +8203,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8057
8203
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8058
8204
|
var xAxis = 'bottom';
|
|
8059
8205
|
|
|
8060
|
-
if (
|
|
8206
|
+
if (_this48.options.orientation === 'horizontal') {
|
|
8061
8207
|
xAxis = 'left';
|
|
8062
8208
|
}
|
|
8063
8209
|
|
|
@@ -8068,13 +8214,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8068
8214
|
xAxis += 'Axis';
|
|
8069
8215
|
var output;
|
|
8070
8216
|
|
|
8071
|
-
var width =
|
|
8217
|
+
var width = _this48.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
|
|
8072
8218
|
|
|
8073
8219
|
|
|
8074
|
-
for (var index = 0; index <
|
|
8075
|
-
if (input >
|
|
8076
|
-
if (
|
|
8077
|
-
if (input <
|
|
8220
|
+
for (var index = 0; index < _this48.customBottomRange.length; index++) {
|
|
8221
|
+
if (input > _this48.customBottomRange[index]) {
|
|
8222
|
+
if (_this48.customBottomRange[index + 1]) {
|
|
8223
|
+
if (input < _this48.customBottomRange[index + 1]) {
|
|
8078
8224
|
output = index;
|
|
8079
8225
|
break;
|
|
8080
8226
|
}
|
|
@@ -8312,10 +8458,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8312
8458
|
}, {
|
|
8313
8459
|
key: "handleEventMouseMove",
|
|
8314
8460
|
value: function handleEventMouseMove(event, d) {
|
|
8315
|
-
var
|
|
8461
|
+
var _this49 = this;
|
|
8316
8462
|
|
|
8317
8463
|
var bisectDate = d3.bisector(function (d) {
|
|
8318
|
-
return
|
|
8464
|
+
return _this49.parseX(d.x.value);
|
|
8319
8465
|
}).left;
|
|
8320
8466
|
|
|
8321
8467
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -8354,9 +8500,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8354
8500
|
}
|
|
8355
8501
|
|
|
8356
8502
|
this.options.data.series.forEach(function (s) {
|
|
8357
|
-
if (
|
|
8503
|
+
if (_this49.options.data[xData].scale !== 'Time') {
|
|
8358
8504
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
8359
|
-
xPoint =
|
|
8505
|
+
xPoint = _this49.customBottomRange[x0] + (_this49.customBottomRange[x0 + 1] - _this49.customBottomRange[x0]) / 2; // }
|
|
8360
8506
|
// else {
|
|
8361
8507
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
8362
8508
|
// }
|
|
@@ -8379,13 +8525,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8379
8525
|
var pointA = s.data[index - 1];
|
|
8380
8526
|
var pointB = s.data[index];
|
|
8381
8527
|
|
|
8382
|
-
if (
|
|
8528
|
+
if (_this49.options.orientation === 'horizontal') {
|
|
8383
8529
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
8384
8530
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
8385
8531
|
}
|
|
8386
8532
|
|
|
8387
8533
|
if (pointA && !pointB) {
|
|
8388
|
-
xPoint =
|
|
8534
|
+
xPoint = _this49[xAxis](_this49.parseX(pointA.x.value));
|
|
8389
8535
|
tooltipTitle = pointA.x.value;
|
|
8390
8536
|
|
|
8391
8537
|
if (!pointA.y.color) {
|
|
@@ -8395,12 +8541,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8395
8541
|
tooltipData.push(pointA.y);
|
|
8396
8542
|
|
|
8397
8543
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
8398
|
-
tooltipTitle = d3.timeFormat(
|
|
8544
|
+
tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
8399
8545
|
}
|
|
8400
8546
|
}
|
|
8401
8547
|
|
|
8402
8548
|
if (pointB && !pointA) {
|
|
8403
|
-
xPoint =
|
|
8549
|
+
xPoint = _this49[xAxis](_this49.parseX(pointB.x.value));
|
|
8404
8550
|
tooltipTitle = pointB.x.value;
|
|
8405
8551
|
|
|
8406
8552
|
if (!pointB.y.color) {
|
|
@@ -8410,14 +8556,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8410
8556
|
tooltipData.push(pointB.y);
|
|
8411
8557
|
|
|
8412
8558
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8413
|
-
tooltipTitle = d3.timeFormat(
|
|
8559
|
+
tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8414
8560
|
}
|
|
8415
8561
|
}
|
|
8416
8562
|
|
|
8417
8563
|
if (pointA && pointB) {
|
|
8418
|
-
var d0 =
|
|
8564
|
+
var d0 = _this49[xAxis](_this49.parseX(pointA.x.value));
|
|
8419
8565
|
|
|
8420
|
-
var d1 =
|
|
8566
|
+
var d1 = _this49[xAxis](_this49.parseX(pointB.x.value));
|
|
8421
8567
|
|
|
8422
8568
|
var mid = Math.abs(d0 - d1) / 2;
|
|
8423
8569
|
|
|
@@ -8426,7 +8572,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8426
8572
|
tooltipTitle = pointB.x.value;
|
|
8427
8573
|
|
|
8428
8574
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8429
|
-
tooltipTitle = d3.timeFormat(
|
|
8575
|
+
tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8430
8576
|
}
|
|
8431
8577
|
|
|
8432
8578
|
if (!pointB.y.color) {
|
|
@@ -8439,7 +8585,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8439
8585
|
tooltipTitle = pointA.x.value;
|
|
8440
8586
|
|
|
8441
8587
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8442
|
-
tooltipTitle = d3.timeFormat(
|
|
8588
|
+
tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8443
8589
|
}
|
|
8444
8590
|
|
|
8445
8591
|
if (!pointA.y.color) {
|
|
@@ -8574,7 +8720,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8574
8720
|
}, {
|
|
8575
8721
|
key: "render",
|
|
8576
8722
|
value: function render(options) {
|
|
8577
|
-
var
|
|
8723
|
+
var _this50 = this;
|
|
8578
8724
|
|
|
8579
8725
|
/* global d3 options WebsyUtils */
|
|
8580
8726
|
if (typeof options !== 'undefined') {
|
|
@@ -8653,7 +8799,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8653
8799
|
this.options.data.series.map(function (s, i) {
|
|
8654
8800
|
return {
|
|
8655
8801
|
value: s.label || s.key,
|
|
8656
|
-
color: s.color ||
|
|
8802
|
+
color: s.color || _this50.options.colors[i % _this50.options.colors.length]
|
|
8657
8803
|
};
|
|
8658
8804
|
});
|
|
8659
8805
|
}
|
|
@@ -9046,28 +9192,28 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9046
9192
|
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') {
|
|
9047
9193
|
var acc = 0;
|
|
9048
9194
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
9049
|
-
var adjustment =
|
|
9195
|
+
var adjustment = _this50.bandPadding * index + _this50.bandPadding; // if (this.options.data.bottom.padding) {
|
|
9050
9196
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
9051
9197
|
// }
|
|
9052
9198
|
|
|
9053
|
-
var start =
|
|
9199
|
+
var start = _this50.widthForCalc / noOfPoints * acc;
|
|
9054
9200
|
|
|
9055
9201
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
9056
9202
|
var pos = i * proposedBandWidth;
|
|
9057
9203
|
|
|
9058
|
-
|
|
9204
|
+
_this50["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
9059
9205
|
}
|
|
9060
9206
|
|
|
9061
|
-
acc +=
|
|
9062
|
-
var end =
|
|
9207
|
+
acc += _this50.options.grouping !== 'stacked' && _this50.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9208
|
+
var end = _this50.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
9063
9209
|
|
|
9064
9210
|
return end + adjustment;
|
|
9065
9211
|
})));
|
|
9066
9212
|
acc = 0;
|
|
9067
9213
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
9068
|
-
var adjustment =
|
|
9069
|
-
acc +=
|
|
9070
|
-
return (
|
|
9214
|
+
var adjustment = _this50.brushBandPadding * index + _this50.brushBandPadding;
|
|
9215
|
+
acc += _this50.options.grouping !== 'stacked' && _this50.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9216
|
+
return (_this50.options.orientation === 'vertical' ? _this50.plotWidth : _this50.plotHeight) / noOfPoints * acc;
|
|
9071
9217
|
})));
|
|
9072
9218
|
} // }
|
|
9073
9219
|
|
|
@@ -9249,7 +9395,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9249
9395
|
|
|
9250
9396
|
if (this.options.data.bottom.formatter) {
|
|
9251
9397
|
this.bAxisFunc.tickFormat(function (d) {
|
|
9252
|
-
return
|
|
9398
|
+
return _this50.options.data.bottom.formatter(d);
|
|
9253
9399
|
});
|
|
9254
9400
|
}
|
|
9255
9401
|
|
|
@@ -9261,7 +9407,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9261
9407
|
|
|
9262
9408
|
if (this.customBottomRange.length > 0) {
|
|
9263
9409
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9264
|
-
return "translate(".concat(
|
|
9410
|
+
return "translate(".concat(_this50.customBottomRange[i] + (_this50.customBottomRange[i + 1] - _this50.customBottomRange[i]) / 2, ", 0)");
|
|
9265
9411
|
});
|
|
9266
9412
|
}
|
|
9267
9413
|
} // Configure the left axis
|
|
@@ -9283,8 +9429,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9283
9429
|
|
|
9284
9430
|
if (this.options.margin.axisLeft > 0) {
|
|
9285
9431
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
9286
|
-
if (
|
|
9287
|
-
d =
|
|
9432
|
+
if (_this50.options.data.left.formatter) {
|
|
9433
|
+
d = _this50.options.data.left.formatter(d);
|
|
9288
9434
|
}
|
|
9289
9435
|
|
|
9290
9436
|
return d;
|
|
@@ -9292,7 +9438,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9292
9438
|
|
|
9293
9439
|
if (this.customLeftRange.length > 0) {
|
|
9294
9440
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9295
|
-
return "translate(0, ".concat(
|
|
9441
|
+
return "translate(0, ".concat(_this50.customLeftRange[i] + (_this50.customLeftRange[i + 1] - _this50.customLeftRange[i]) / 2, ")");
|
|
9296
9442
|
});
|
|
9297
9443
|
}
|
|
9298
9444
|
}
|
|
@@ -9325,8 +9471,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9325
9471
|
|
|
9326
9472
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
9327
9473
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
9328
|
-
if (
|
|
9329
|
-
d =
|
|
9474
|
+
if (_this50.options.data.right.formatter) {
|
|
9475
|
+
d = _this50.options.data.right.formatter(d);
|
|
9330
9476
|
}
|
|
9331
9477
|
|
|
9332
9478
|
return d;
|
|
@@ -9372,60 +9518,60 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9372
9518
|
}, {
|
|
9373
9519
|
key: "renderComponents",
|
|
9374
9520
|
value: function renderComponents() {
|
|
9375
|
-
var
|
|
9521
|
+
var _this51 = this;
|
|
9376
9522
|
|
|
9377
9523
|
// Draw the series data
|
|
9378
9524
|
this.renderedKeys = {};
|
|
9379
9525
|
this.options.data.series.forEach(function (series, index) {
|
|
9380
9526
|
if (!series.key) {
|
|
9381
|
-
series.key =
|
|
9527
|
+
series.key = _this51.createIdentity();
|
|
9382
9528
|
}
|
|
9383
9529
|
|
|
9384
9530
|
if (!series.color) {
|
|
9385
|
-
series.color =
|
|
9531
|
+
series.color = _this51.options.colors[index % _this51.options.colors.length];
|
|
9386
9532
|
}
|
|
9387
9533
|
|
|
9388
|
-
|
|
9534
|
+
_this51["render".concat(series.type || 'bar')](series, index);
|
|
9389
9535
|
|
|
9390
|
-
|
|
9536
|
+
_this51.renderLabels(series, index);
|
|
9391
9537
|
|
|
9392
|
-
|
|
9538
|
+
_this51.renderedKeys[series.key] = series.type;
|
|
9393
9539
|
});
|
|
9394
9540
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
9395
9541
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
9396
9542
|
|
|
9397
9543
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
9398
9544
|
this.options.refLines.forEach(function (l) {
|
|
9399
|
-
return
|
|
9545
|
+
return _this51.renderRefLine(l);
|
|
9400
9546
|
});
|
|
9401
9547
|
}
|
|
9402
9548
|
}
|
|
9403
9549
|
}, {
|
|
9404
9550
|
key: "renderarea",
|
|
9405
9551
|
value: function renderarea(series, index) {
|
|
9406
|
-
var
|
|
9552
|
+
var _this52 = this;
|
|
9407
9553
|
|
|
9408
9554
|
/* global d3 series index */
|
|
9409
9555
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
9410
9556
|
return d3.area().x(function (d) {
|
|
9411
|
-
if (
|
|
9412
|
-
return
|
|
9557
|
+
if (_this52.options.data[xAxis].scale === 'Time') {
|
|
9558
|
+
return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value));
|
|
9413
9559
|
} else {
|
|
9414
|
-
var xIndex =
|
|
9560
|
+
var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9415
9561
|
|
|
9416
|
-
var xPos =
|
|
9562
|
+
var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9417
9563
|
|
|
9418
|
-
if (
|
|
9419
|
-
xPos = xPos + (
|
|
9564
|
+
if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9565
|
+
xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9420
9566
|
}
|
|
9421
9567
|
|
|
9422
9568
|
return xPos;
|
|
9423
9569
|
}
|
|
9424
9570
|
}).y0(function (d) {
|
|
9425
|
-
return
|
|
9571
|
+
return _this52["".concat(yAxis, "Axis")](0);
|
|
9426
9572
|
}).y1(function (d) {
|
|
9427
|
-
return
|
|
9428
|
-
}).curve(d3[curveStyle ||
|
|
9573
|
+
return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9574
|
+
}).curve(d3[curveStyle || _this52.options.curveStyle]);
|
|
9429
9575
|
};
|
|
9430
9576
|
|
|
9431
9577
|
var xAxis = 'bottom';
|
|
@@ -9463,7 +9609,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9463
9609
|
}, {
|
|
9464
9610
|
key: "renderbar",
|
|
9465
9611
|
value: function renderbar(series, index) {
|
|
9466
|
-
var
|
|
9612
|
+
var _this53 = this;
|
|
9467
9613
|
|
|
9468
9614
|
/* global series index d3 */
|
|
9469
9615
|
var xAxis = 'bottom';
|
|
@@ -9641,25 +9787,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9641
9787
|
|
|
9642
9788
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9643
9789
|
bars.attr('width', function (d, i) {
|
|
9644
|
-
return Math.abs(getBarWidth.call(
|
|
9790
|
+
return Math.abs(getBarWidth.call(_this53, d, i, xAxis));
|
|
9645
9791
|
}).attr('height', function (d, i) {
|
|
9646
|
-
return getBarHeight.call(
|
|
9792
|
+
return getBarHeight.call(_this53, d, i, yAxis, xAxis);
|
|
9647
9793
|
}).attr('x', function (d, i) {
|
|
9648
|
-
return getBarX.call(
|
|
9794
|
+
return getBarX.call(_this53, d, i, xAxis);
|
|
9649
9795
|
}).attr('y', function (d, i) {
|
|
9650
|
-
return getBarY.call(
|
|
9796
|
+
return getBarY.call(_this53, d, i, yAxis, xAxis);
|
|
9651
9797
|
}) // .transition(this.transition)
|
|
9652
9798
|
.attr('fill', function (d) {
|
|
9653
9799
|
return d.y.color || d.color || series.color;
|
|
9654
9800
|
});
|
|
9655
9801
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
9656
|
-
return Math.abs(getBarWidth.call(
|
|
9802
|
+
return Math.abs(getBarWidth.call(_this53, d, i, xAxis));
|
|
9657
9803
|
}).attr('height', function (d, i) {
|
|
9658
|
-
return getBarHeight.call(
|
|
9804
|
+
return getBarHeight.call(_this53, d, i, yAxis, xAxis);
|
|
9659
9805
|
}).attr('x', function (d, i) {
|
|
9660
|
-
return getBarX.call(
|
|
9806
|
+
return getBarX.call(_this53, d, i, xAxis);
|
|
9661
9807
|
}).attr('y', function (d, i) {
|
|
9662
|
-
return getBarY.call(
|
|
9808
|
+
return getBarY.call(_this53, d, i, yAxis, xAxis);
|
|
9663
9809
|
}) // .transition(this.transition)
|
|
9664
9810
|
.attr('fill', function (d) {
|
|
9665
9811
|
return d.y.color || d.color || series.color;
|
|
@@ -9671,25 +9817,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9671
9817
|
this.brushBarsInitialized[series.key] = true;
|
|
9672
9818
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9673
9819
|
brushBars.attr('width', function (d, i) {
|
|
9674
|
-
return Math.abs(getBarWidth.call(
|
|
9820
|
+
return Math.abs(getBarWidth.call(_this53, d, i, "".concat(xAxis, "Brush")));
|
|
9675
9821
|
}).attr('height', function (d, i) {
|
|
9676
|
-
return getBarHeight.call(
|
|
9822
|
+
return getBarHeight.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9677
9823
|
}).attr('x', function (d, i) {
|
|
9678
|
-
return getBarX.call(
|
|
9824
|
+
return getBarX.call(_this53, d, i, "".concat(xAxis, "Brush"));
|
|
9679
9825
|
}).attr('y', function (d, i) {
|
|
9680
|
-
return getBarY.call(
|
|
9826
|
+
return getBarY.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9681
9827
|
}) // .transition(this.transition)
|
|
9682
9828
|
.attr('fill', function (d) {
|
|
9683
9829
|
return d.y.color || d.color || series.color;
|
|
9684
9830
|
});
|
|
9685
9831
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
9686
|
-
return Math.abs(getBarWidth.call(
|
|
9832
|
+
return Math.abs(getBarWidth.call(_this53, d, i, "".concat(xAxis, "Brush")));
|
|
9687
9833
|
}).attr('height', function (d, i) {
|
|
9688
|
-
return getBarHeight.call(
|
|
9834
|
+
return getBarHeight.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9689
9835
|
}).attr('x', function (d, i) {
|
|
9690
|
-
return getBarX.call(
|
|
9836
|
+
return getBarX.call(_this53, d, i, "".concat(xAxis, "Brush"));
|
|
9691
9837
|
}).attr('y', function (d, i) {
|
|
9692
|
-
return getBarY.call(
|
|
9838
|
+
return getBarY.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9693
9839
|
}) // .transition(this.transition)
|
|
9694
9840
|
.attr('fill', function (d) {
|
|
9695
9841
|
return d.y.color || d.color || series.color;
|
|
@@ -9707,7 +9853,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9707
9853
|
}, {
|
|
9708
9854
|
key: "renderLabels",
|
|
9709
9855
|
value: function renderLabels(series, index) {
|
|
9710
|
-
var
|
|
9856
|
+
var _this54 = this;
|
|
9711
9857
|
|
|
9712
9858
|
/* global series index d3 WebsyDesigns */
|
|
9713
9859
|
var xAxis = 'bottom';
|
|
@@ -9726,15 +9872,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9726
9872
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9727
9873
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9728
9874
|
labels.attr('x', function (d) {
|
|
9729
|
-
return getLabelX.call(
|
|
9875
|
+
return getLabelX.call(_this54, d, series.labelPosition);
|
|
9730
9876
|
}).attr('y', function (d) {
|
|
9731
|
-
return getLabelY.call(
|
|
9877
|
+
return getLabelY.call(_this54, d, series.labelPosition);
|
|
9732
9878
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9733
|
-
if (
|
|
9879
|
+
if (_this54.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9734
9880
|
return 'transparent';
|
|
9735
9881
|
}
|
|
9736
9882
|
|
|
9737
|
-
return
|
|
9883
|
+
return _this54.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9738
9884
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9739
9885
|
return d.y.label || d.y.value;
|
|
9740
9886
|
}).each(function (d, i) {
|
|
@@ -9759,15 +9905,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9759
9905
|
}
|
|
9760
9906
|
});
|
|
9761
9907
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9762
|
-
return getLabelX.call(
|
|
9908
|
+
return getLabelX.call(_this54, d, series.labelPosition);
|
|
9763
9909
|
}).attr('y', function (d) {
|
|
9764
|
-
return getLabelY.call(
|
|
9910
|
+
return getLabelY.call(_this54, d, series.labelPosition);
|
|
9765
9911
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9766
|
-
if (
|
|
9912
|
+
if (_this54.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9767
9913
|
return 'transparent';
|
|
9768
9914
|
}
|
|
9769
9915
|
|
|
9770
|
-
return
|
|
9916
|
+
return _this54.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9771
9917
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9772
9918
|
return d.y.label || d.y.value;
|
|
9773
9919
|
}).each(function (d, i) {
|
|
@@ -9845,36 +9991,36 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9845
9991
|
}, {
|
|
9846
9992
|
key: "renderline",
|
|
9847
9993
|
value: function renderline(series, index) {
|
|
9848
|
-
var
|
|
9994
|
+
var _this55 = this;
|
|
9849
9995
|
|
|
9850
9996
|
/* global series index d3 */
|
|
9851
9997
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9852
9998
|
return d3.line().x(function (d) {
|
|
9853
|
-
if (
|
|
9854
|
-
return
|
|
9999
|
+
if (_this55.options.orientation === 'horizontal') {
|
|
10000
|
+
return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9855
10001
|
} else {
|
|
9856
|
-
if (
|
|
9857
|
-
return
|
|
10002
|
+
if (_this55.options.data[xAxis].scale === 'Time') {
|
|
10003
|
+
return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value));
|
|
9858
10004
|
} else {
|
|
9859
|
-
var xIndex =
|
|
10005
|
+
var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9860
10006
|
|
|
9861
|
-
var xPos =
|
|
10007
|
+
var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9862
10008
|
|
|
9863
|
-
if (
|
|
9864
|
-
xPos = xPos + (
|
|
10009
|
+
if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10010
|
+
xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9865
10011
|
}
|
|
9866
10012
|
|
|
9867
10013
|
return xPos;
|
|
9868
10014
|
}
|
|
9869
10015
|
}
|
|
9870
10016
|
}).y(function (d) {
|
|
9871
|
-
if (
|
|
9872
|
-
var adjustment =
|
|
9873
|
-
return
|
|
10017
|
+
if (_this55.options.orientation === 'horizontal') {
|
|
10018
|
+
var adjustment = _this55.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this55.options.data[xAxis].bandWidth / 2;
|
|
10019
|
+
return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value)) + adjustment;
|
|
9874
10020
|
} else {
|
|
9875
|
-
return
|
|
10021
|
+
return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9876
10022
|
}
|
|
9877
|
-
}).curve(d3[curveStyle ||
|
|
10023
|
+
}).curve(d3[curveStyle || _this55.options.curveStyle]);
|
|
9878
10024
|
};
|
|
9879
10025
|
|
|
9880
10026
|
var xAxis = 'bottom';
|
|
@@ -9988,14 +10134,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9988
10134
|
}, {
|
|
9989
10135
|
key: "rendersymbol",
|
|
9990
10136
|
value: function rendersymbol(series, index) {
|
|
9991
|
-
var
|
|
10137
|
+
var _this56 = this;
|
|
9992
10138
|
|
|
9993
10139
|
/* global d3 series index series.key */
|
|
9994
10140
|
var drawSymbol = function drawSymbol(size) {
|
|
9995
10141
|
return d3.symbol() // .type(d => {
|
|
9996
10142
|
// return d3.symbols[0]
|
|
9997
10143
|
// })
|
|
9998
|
-
.size(size ||
|
|
10144
|
+
.size(size || _this56.options.symbolSize);
|
|
9999
10145
|
};
|
|
10000
10146
|
|
|
10001
10147
|
var xAxis = 'bottom';
|
|
@@ -10024,25 +10170,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10024
10170
|
// else {
|
|
10025
10171
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10026
10172
|
// }
|
|
10027
|
-
var xIndex =
|
|
10173
|
+
var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10028
10174
|
|
|
10029
|
-
var xPos =
|
|
10175
|
+
var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10030
10176
|
|
|
10031
|
-
if (
|
|
10032
|
-
xPos = xPos + (
|
|
10177
|
+
if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10178
|
+
xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10033
10179
|
}
|
|
10034
10180
|
|
|
10035
|
-
var adjustment =
|
|
10181
|
+
var adjustment = _this56.options.data[xAxis].scale === 'Time' || _this56.options.data[xAxis].scale === 'Linear' ? 0 : _this56.options.data[xAxis].bandWidth / 2;
|
|
10036
10182
|
|
|
10037
|
-
if (
|
|
10038
|
-
return "translate(".concat(
|
|
10183
|
+
if (_this56.options.orientation === 'horizontal') {
|
|
10184
|
+
return "translate(".concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10039
10185
|
} else {
|
|
10040
|
-
if (
|
|
10041
|
-
xPos =
|
|
10186
|
+
if (_this56.options.data[xAxis].scale === 'Time') {
|
|
10187
|
+
xPos = _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
|
|
10042
10188
|
} // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10043
10189
|
|
|
10044
10190
|
|
|
10045
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10191
|
+
return "translate(".concat(xPos, ", ").concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10046
10192
|
}
|
|
10047
10193
|
}); // Enter
|
|
10048
10194
|
|
|
@@ -10056,25 +10202,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10056
10202
|
}).attr('class', function (d) {
|
|
10057
10203
|
return "symbol symbol_".concat(series.key);
|
|
10058
10204
|
}).attr('transform', function (d) {
|
|
10059
|
-
var xIndex =
|
|
10205
|
+
var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10060
10206
|
|
|
10061
|
-
var xPos =
|
|
10207
|
+
var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10062
10208
|
|
|
10063
|
-
if (
|
|
10064
|
-
xPos = xPos + (
|
|
10209
|
+
if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10210
|
+
xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10065
10211
|
}
|
|
10066
10212
|
|
|
10067
|
-
var adjustment =
|
|
10213
|
+
var adjustment = _this56.options.data[xAxis].scale === 'Time' || _this56.options.data[xAxis].scale === 'Linear' ? 0 : _this56.options.data[xAxis].bandWidth / 2;
|
|
10068
10214
|
|
|
10069
|
-
if (
|
|
10070
|
-
return "translate(".concat(
|
|
10215
|
+
if (_this56.options.orientation === 'horizontal') {
|
|
10216
|
+
return "translate(".concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10071
10217
|
} else {
|
|
10072
|
-
if (
|
|
10073
|
-
xPos =
|
|
10218
|
+
if (_this56.options.data[xAxis].scale === 'Time') {
|
|
10219
|
+
xPos = _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
|
|
10074
10220
|
} // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10075
10221
|
|
|
10076
10222
|
|
|
10077
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10223
|
+
return "translate(".concat(xPos, ", ").concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10078
10224
|
}
|
|
10079
10225
|
});
|
|
10080
10226
|
}
|
|
@@ -10296,7 +10442,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10296
10442
|
}, {
|
|
10297
10443
|
key: "resize",
|
|
10298
10444
|
value: function resize() {
|
|
10299
|
-
var
|
|
10445
|
+
var _this57 = this;
|
|
10300
10446
|
|
|
10301
10447
|
var el = document.getElementById(this.elementId);
|
|
10302
10448
|
|
|
@@ -10309,7 +10455,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10309
10455
|
// }
|
|
10310
10456
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
10311
10457
|
html += this._data.map(function (d, i) {
|
|
10312
|
-
return
|
|
10458
|
+
return _this57.getLegendItemHTML(d);
|
|
10313
10459
|
}).join('');
|
|
10314
10460
|
html += "\n <div>\n ";
|
|
10315
10461
|
el.innerHTML = html;
|
|
@@ -10486,7 +10632,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10486
10632
|
}, {
|
|
10487
10633
|
key: "render",
|
|
10488
10634
|
value: function render() {
|
|
10489
|
-
var
|
|
10635
|
+
var _this58 = this;
|
|
10490
10636
|
|
|
10491
10637
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
10492
10638
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -10495,7 +10641,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10495
10641
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
10496
10642
|
return {
|
|
10497
10643
|
value: s.label || s.key,
|
|
10498
|
-
color: s.color ||
|
|
10644
|
+
color: s.color || _this58.options.colors[i % _this58.options.colors.length]
|
|
10499
10645
|
};
|
|
10500
10646
|
});
|
|
10501
10647
|
var longestValue = legendData.map(function (s) {
|
|
@@ -10559,7 +10705,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10559
10705
|
|
|
10560
10706
|
if (this.polygons) {
|
|
10561
10707
|
this.polygons.forEach(function (p) {
|
|
10562
|
-
return
|
|
10708
|
+
return _this58.map.removeLayer(p);
|
|
10563
10709
|
});
|
|
10564
10710
|
}
|
|
10565
10711
|
|
|
@@ -10617,18 +10763,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10617
10763
|
}
|
|
10618
10764
|
|
|
10619
10765
|
if (!p.options.color) {
|
|
10620
|
-
p.options.color =
|
|
10766
|
+
p.options.color = _this58.options.colors[i % _this58.options.colors.length];
|
|
10621
10767
|
}
|
|
10622
10768
|
|
|
10623
10769
|
var pol = L.polygon(p.data.map(function (c) {
|
|
10624
10770
|
return c.map(function (d) {
|
|
10625
10771
|
return [d.Latitude, d.Longitude];
|
|
10626
10772
|
});
|
|
10627
|
-
}), p.options).addTo(
|
|
10773
|
+
}), p.options).addTo(_this58.map);
|
|
10628
10774
|
|
|
10629
|
-
|
|
10775
|
+
_this58.polygons.push(pol);
|
|
10630
10776
|
|
|
10631
|
-
|
|
10777
|
+
_this58.map.fitBounds(pol.getBounds());
|
|
10632
10778
|
});
|
|
10633
10779
|
} // if (this.data.markers.length > 0) {
|
|
10634
10780
|
// el.classList.remove('hidden')
|