@websy/websy-designs 1.7.4 → 1.7.6
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 +130 -4
- package/dist/websy-designs-es6.js +276 -129
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +130 -4
- package/dist/websy-designs.js +276 -129
- 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\" class=\"table-dropdown-container\"></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) {
|
|
@@ -7726,9 +7872,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7726
7872
|
console.log("No columns provided for table with ID ".concat(this.elementId));
|
|
7727
7873
|
return;
|
|
7728
7874
|
} // this.data = []
|
|
7729
|
-
// Adjust the sizing of the header/body/footer
|
|
7730
7875
|
|
|
7731
7876
|
|
|
7877
|
+
this.currentData = []; // Adjust the sizing of the header/body/footer
|
|
7878
|
+
|
|
7732
7879
|
if (calcSizes === true) {
|
|
7733
7880
|
var sample = this.createSample(data);
|
|
7734
7881
|
this.calculateSizes(sample, data.length, (data[0] || []).length, 0);
|
|
@@ -7997,7 +8144,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7997
8144
|
|
|
7998
8145
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7999
8146
|
function WebsyChart(elementId, options) {
|
|
8000
|
-
var
|
|
8147
|
+
var _this48 = this;
|
|
8001
8148
|
|
|
8002
8149
|
_classCallCheck(this, WebsyChart);
|
|
8003
8150
|
|
|
@@ -8057,7 +8204,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8057
8204
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8058
8205
|
var xAxis = 'bottom';
|
|
8059
8206
|
|
|
8060
|
-
if (
|
|
8207
|
+
if (_this48.options.orientation === 'horizontal') {
|
|
8061
8208
|
xAxis = 'left';
|
|
8062
8209
|
}
|
|
8063
8210
|
|
|
@@ -8068,13 +8215,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8068
8215
|
xAxis += 'Axis';
|
|
8069
8216
|
var output;
|
|
8070
8217
|
|
|
8071
|
-
var width =
|
|
8218
|
+
var width = _this48.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth; // if (this.customBottomRange) {
|
|
8072
8219
|
|
|
8073
8220
|
|
|
8074
|
-
for (var index = 0; index <
|
|
8075
|
-
if (input >
|
|
8076
|
-
if (
|
|
8077
|
-
if (input <
|
|
8221
|
+
for (var index = 0; index < _this48.customBottomRange.length; index++) {
|
|
8222
|
+
if (input > _this48.customBottomRange[index]) {
|
|
8223
|
+
if (_this48.customBottomRange[index + 1]) {
|
|
8224
|
+
if (input < _this48.customBottomRange[index + 1]) {
|
|
8078
8225
|
output = index;
|
|
8079
8226
|
break;
|
|
8080
8227
|
}
|
|
@@ -8312,10 +8459,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8312
8459
|
}, {
|
|
8313
8460
|
key: "handleEventMouseMove",
|
|
8314
8461
|
value: function handleEventMouseMove(event, d) {
|
|
8315
|
-
var
|
|
8462
|
+
var _this49 = this;
|
|
8316
8463
|
|
|
8317
8464
|
var bisectDate = d3.bisector(function (d) {
|
|
8318
|
-
return
|
|
8465
|
+
return _this49.parseX(d.x.value);
|
|
8319
8466
|
}).left;
|
|
8320
8467
|
|
|
8321
8468
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -8354,9 +8501,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8354
8501
|
}
|
|
8355
8502
|
|
|
8356
8503
|
this.options.data.series.forEach(function (s) {
|
|
8357
|
-
if (
|
|
8504
|
+
if (_this49.options.data[xData].scale !== 'Time') {
|
|
8358
8505
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
8359
|
-
xPoint =
|
|
8506
|
+
xPoint = _this49.customBottomRange[x0] + (_this49.customBottomRange[x0 + 1] - _this49.customBottomRange[x0]) / 2; // }
|
|
8360
8507
|
// else {
|
|
8361
8508
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
8362
8509
|
// }
|
|
@@ -8379,13 +8526,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8379
8526
|
var pointA = s.data[index - 1];
|
|
8380
8527
|
var pointB = s.data[index];
|
|
8381
8528
|
|
|
8382
|
-
if (
|
|
8529
|
+
if (_this49.options.orientation === 'horizontal') {
|
|
8383
8530
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
8384
8531
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
8385
8532
|
}
|
|
8386
8533
|
|
|
8387
8534
|
if (pointA && !pointB) {
|
|
8388
|
-
xPoint =
|
|
8535
|
+
xPoint = _this49[xAxis](_this49.parseX(pointA.x.value));
|
|
8389
8536
|
tooltipTitle = pointA.x.value;
|
|
8390
8537
|
|
|
8391
8538
|
if (!pointA.y.color) {
|
|
@@ -8395,12 +8542,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8395
8542
|
tooltipData.push(pointA.y);
|
|
8396
8543
|
|
|
8397
8544
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
8398
|
-
tooltipTitle = d3.timeFormat(
|
|
8545
|
+
tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
8399
8546
|
}
|
|
8400
8547
|
}
|
|
8401
8548
|
|
|
8402
8549
|
if (pointB && !pointA) {
|
|
8403
|
-
xPoint =
|
|
8550
|
+
xPoint = _this49[xAxis](_this49.parseX(pointB.x.value));
|
|
8404
8551
|
tooltipTitle = pointB.x.value;
|
|
8405
8552
|
|
|
8406
8553
|
if (!pointB.y.color) {
|
|
@@ -8410,14 +8557,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8410
8557
|
tooltipData.push(pointB.y);
|
|
8411
8558
|
|
|
8412
8559
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8413
|
-
tooltipTitle = d3.timeFormat(
|
|
8560
|
+
tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8414
8561
|
}
|
|
8415
8562
|
}
|
|
8416
8563
|
|
|
8417
8564
|
if (pointA && pointB) {
|
|
8418
|
-
var d0 =
|
|
8565
|
+
var d0 = _this49[xAxis](_this49.parseX(pointA.x.value));
|
|
8419
8566
|
|
|
8420
|
-
var d1 =
|
|
8567
|
+
var d1 = _this49[xAxis](_this49.parseX(pointB.x.value));
|
|
8421
8568
|
|
|
8422
8569
|
var mid = Math.abs(d0 - d1) / 2;
|
|
8423
8570
|
|
|
@@ -8426,7 +8573,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8426
8573
|
tooltipTitle = pointB.x.value;
|
|
8427
8574
|
|
|
8428
8575
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8429
|
-
tooltipTitle = d3.timeFormat(
|
|
8576
|
+
tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8430
8577
|
}
|
|
8431
8578
|
|
|
8432
8579
|
if (!pointB.y.color) {
|
|
@@ -8439,7 +8586,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8439
8586
|
tooltipTitle = pointA.x.value;
|
|
8440
8587
|
|
|
8441
8588
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8442
|
-
tooltipTitle = d3.timeFormat(
|
|
8589
|
+
tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8443
8590
|
}
|
|
8444
8591
|
|
|
8445
8592
|
if (!pointA.y.color) {
|
|
@@ -8574,7 +8721,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8574
8721
|
}, {
|
|
8575
8722
|
key: "render",
|
|
8576
8723
|
value: function render(options) {
|
|
8577
|
-
var
|
|
8724
|
+
var _this50 = this;
|
|
8578
8725
|
|
|
8579
8726
|
/* global d3 options WebsyUtils */
|
|
8580
8727
|
if (typeof options !== 'undefined') {
|
|
@@ -8653,7 +8800,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8653
8800
|
this.options.data.series.map(function (s, i) {
|
|
8654
8801
|
return {
|
|
8655
8802
|
value: s.label || s.key,
|
|
8656
|
-
color: s.color ||
|
|
8803
|
+
color: s.color || _this50.options.colors[i % _this50.options.colors.length]
|
|
8657
8804
|
};
|
|
8658
8805
|
});
|
|
8659
8806
|
}
|
|
@@ -9046,28 +9193,28 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9046
9193
|
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
9194
|
var acc = 0;
|
|
9048
9195
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
9049
|
-
var adjustment =
|
|
9196
|
+
var adjustment = _this50.bandPadding * index + _this50.bandPadding; // if (this.options.data.bottom.padding) {
|
|
9050
9197
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
9051
9198
|
// }
|
|
9052
9199
|
|
|
9053
|
-
var start =
|
|
9200
|
+
var start = _this50.widthForCalc / noOfPoints * acc;
|
|
9054
9201
|
|
|
9055
9202
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
9056
9203
|
var pos = i * proposedBandWidth;
|
|
9057
9204
|
|
|
9058
|
-
|
|
9205
|
+
_this50["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
9059
9206
|
}
|
|
9060
9207
|
|
|
9061
|
-
acc +=
|
|
9062
|
-
var end =
|
|
9208
|
+
acc += _this50.options.grouping !== 'stacked' && _this50.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9209
|
+
var end = _this50.widthForCalc / noOfPoints * acc; // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
9063
9210
|
|
|
9064
9211
|
return end + adjustment;
|
|
9065
9212
|
})));
|
|
9066
9213
|
acc = 0;
|
|
9067
9214
|
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 (
|
|
9215
|
+
var adjustment = _this50.brushBandPadding * index + _this50.brushBandPadding;
|
|
9216
|
+
acc += _this50.options.grouping !== 'stacked' && _this50.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9217
|
+
return (_this50.options.orientation === 'vertical' ? _this50.plotWidth : _this50.plotHeight) / noOfPoints * acc;
|
|
9071
9218
|
})));
|
|
9072
9219
|
} // }
|
|
9073
9220
|
|
|
@@ -9249,7 +9396,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9249
9396
|
|
|
9250
9397
|
if (this.options.data.bottom.formatter) {
|
|
9251
9398
|
this.bAxisFunc.tickFormat(function (d) {
|
|
9252
|
-
return
|
|
9399
|
+
return _this50.options.data.bottom.formatter(d);
|
|
9253
9400
|
});
|
|
9254
9401
|
}
|
|
9255
9402
|
|
|
@@ -9261,7 +9408,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9261
9408
|
|
|
9262
9409
|
if (this.customBottomRange.length > 0) {
|
|
9263
9410
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9264
|
-
return "translate(".concat(
|
|
9411
|
+
return "translate(".concat(_this50.customBottomRange[i] + (_this50.customBottomRange[i + 1] - _this50.customBottomRange[i]) / 2, ", 0)");
|
|
9265
9412
|
});
|
|
9266
9413
|
}
|
|
9267
9414
|
} // Configure the left axis
|
|
@@ -9283,8 +9430,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9283
9430
|
|
|
9284
9431
|
if (this.options.margin.axisLeft > 0) {
|
|
9285
9432
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
9286
|
-
if (
|
|
9287
|
-
d =
|
|
9433
|
+
if (_this50.options.data.left.formatter) {
|
|
9434
|
+
d = _this50.options.data.left.formatter(d);
|
|
9288
9435
|
}
|
|
9289
9436
|
|
|
9290
9437
|
return d;
|
|
@@ -9292,7 +9439,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9292
9439
|
|
|
9293
9440
|
if (this.customLeftRange.length > 0) {
|
|
9294
9441
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9295
|
-
return "translate(0, ".concat(
|
|
9442
|
+
return "translate(0, ".concat(_this50.customLeftRange[i] + (_this50.customLeftRange[i + 1] - _this50.customLeftRange[i]) / 2, ")");
|
|
9296
9443
|
});
|
|
9297
9444
|
}
|
|
9298
9445
|
}
|
|
@@ -9325,8 +9472,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9325
9472
|
|
|
9326
9473
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
9327
9474
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
9328
|
-
if (
|
|
9329
|
-
d =
|
|
9475
|
+
if (_this50.options.data.right.formatter) {
|
|
9476
|
+
d = _this50.options.data.right.formatter(d);
|
|
9330
9477
|
}
|
|
9331
9478
|
|
|
9332
9479
|
return d;
|
|
@@ -9372,60 +9519,60 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9372
9519
|
}, {
|
|
9373
9520
|
key: "renderComponents",
|
|
9374
9521
|
value: function renderComponents() {
|
|
9375
|
-
var
|
|
9522
|
+
var _this51 = this;
|
|
9376
9523
|
|
|
9377
9524
|
// Draw the series data
|
|
9378
9525
|
this.renderedKeys = {};
|
|
9379
9526
|
this.options.data.series.forEach(function (series, index) {
|
|
9380
9527
|
if (!series.key) {
|
|
9381
|
-
series.key =
|
|
9528
|
+
series.key = _this51.createIdentity();
|
|
9382
9529
|
}
|
|
9383
9530
|
|
|
9384
9531
|
if (!series.color) {
|
|
9385
|
-
series.color =
|
|
9532
|
+
series.color = _this51.options.colors[index % _this51.options.colors.length];
|
|
9386
9533
|
}
|
|
9387
9534
|
|
|
9388
|
-
|
|
9535
|
+
_this51["render".concat(series.type || 'bar')](series, index);
|
|
9389
9536
|
|
|
9390
|
-
|
|
9537
|
+
_this51.renderLabels(series, index);
|
|
9391
9538
|
|
|
9392
|
-
|
|
9539
|
+
_this51.renderedKeys[series.key] = series.type;
|
|
9393
9540
|
});
|
|
9394
9541
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
9395
9542
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
9396
9543
|
|
|
9397
9544
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
9398
9545
|
this.options.refLines.forEach(function (l) {
|
|
9399
|
-
return
|
|
9546
|
+
return _this51.renderRefLine(l);
|
|
9400
9547
|
});
|
|
9401
9548
|
}
|
|
9402
9549
|
}
|
|
9403
9550
|
}, {
|
|
9404
9551
|
key: "renderarea",
|
|
9405
9552
|
value: function renderarea(series, index) {
|
|
9406
|
-
var
|
|
9553
|
+
var _this52 = this;
|
|
9407
9554
|
|
|
9408
9555
|
/* global d3 series index */
|
|
9409
9556
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
9410
9557
|
return d3.area().x(function (d) {
|
|
9411
|
-
if (
|
|
9412
|
-
return
|
|
9558
|
+
if (_this52.options.data[xAxis].scale === 'Time') {
|
|
9559
|
+
return _this52["".concat(xAxis, "Axis")](_this52.parseX(d.x.value));
|
|
9413
9560
|
} else {
|
|
9414
|
-
var xIndex =
|
|
9561
|
+
var xIndex = _this52[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9415
9562
|
|
|
9416
|
-
var xPos =
|
|
9563
|
+
var xPos = _this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9417
9564
|
|
|
9418
|
-
if (
|
|
9419
|
-
xPos = xPos + (
|
|
9565
|
+
if (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9566
|
+
xPos = xPos + (_this52["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9420
9567
|
}
|
|
9421
9568
|
|
|
9422
9569
|
return xPos;
|
|
9423
9570
|
}
|
|
9424
9571
|
}).y0(function (d) {
|
|
9425
|
-
return
|
|
9572
|
+
return _this52["".concat(yAxis, "Axis")](0);
|
|
9426
9573
|
}).y1(function (d) {
|
|
9427
|
-
return
|
|
9428
|
-
}).curve(d3[curveStyle ||
|
|
9574
|
+
return _this52["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9575
|
+
}).curve(d3[curveStyle || _this52.options.curveStyle]);
|
|
9429
9576
|
};
|
|
9430
9577
|
|
|
9431
9578
|
var xAxis = 'bottom';
|
|
@@ -9463,7 +9610,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9463
9610
|
}, {
|
|
9464
9611
|
key: "renderbar",
|
|
9465
9612
|
value: function renderbar(series, index) {
|
|
9466
|
-
var
|
|
9613
|
+
var _this53 = this;
|
|
9467
9614
|
|
|
9468
9615
|
/* global series index d3 */
|
|
9469
9616
|
var xAxis = 'bottom';
|
|
@@ -9641,25 +9788,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9641
9788
|
|
|
9642
9789
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9643
9790
|
bars.attr('width', function (d, i) {
|
|
9644
|
-
return Math.abs(getBarWidth.call(
|
|
9791
|
+
return Math.abs(getBarWidth.call(_this53, d, i, xAxis));
|
|
9645
9792
|
}).attr('height', function (d, i) {
|
|
9646
|
-
return getBarHeight.call(
|
|
9793
|
+
return getBarHeight.call(_this53, d, i, yAxis, xAxis);
|
|
9647
9794
|
}).attr('x', function (d, i) {
|
|
9648
|
-
return getBarX.call(
|
|
9795
|
+
return getBarX.call(_this53, d, i, xAxis);
|
|
9649
9796
|
}).attr('y', function (d, i) {
|
|
9650
|
-
return getBarY.call(
|
|
9797
|
+
return getBarY.call(_this53, d, i, yAxis, xAxis);
|
|
9651
9798
|
}) // .transition(this.transition)
|
|
9652
9799
|
.attr('fill', function (d) {
|
|
9653
9800
|
return d.y.color || d.color || series.color;
|
|
9654
9801
|
});
|
|
9655
9802
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
9656
|
-
return Math.abs(getBarWidth.call(
|
|
9803
|
+
return Math.abs(getBarWidth.call(_this53, d, i, xAxis));
|
|
9657
9804
|
}).attr('height', function (d, i) {
|
|
9658
|
-
return getBarHeight.call(
|
|
9805
|
+
return getBarHeight.call(_this53, d, i, yAxis, xAxis);
|
|
9659
9806
|
}).attr('x', function (d, i) {
|
|
9660
|
-
return getBarX.call(
|
|
9807
|
+
return getBarX.call(_this53, d, i, xAxis);
|
|
9661
9808
|
}).attr('y', function (d, i) {
|
|
9662
|
-
return getBarY.call(
|
|
9809
|
+
return getBarY.call(_this53, d, i, yAxis, xAxis);
|
|
9663
9810
|
}) // .transition(this.transition)
|
|
9664
9811
|
.attr('fill', function (d) {
|
|
9665
9812
|
return d.y.color || d.color || series.color;
|
|
@@ -9671,25 +9818,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9671
9818
|
this.brushBarsInitialized[series.key] = true;
|
|
9672
9819
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9673
9820
|
brushBars.attr('width', function (d, i) {
|
|
9674
|
-
return Math.abs(getBarWidth.call(
|
|
9821
|
+
return Math.abs(getBarWidth.call(_this53, d, i, "".concat(xAxis, "Brush")));
|
|
9675
9822
|
}).attr('height', function (d, i) {
|
|
9676
|
-
return getBarHeight.call(
|
|
9823
|
+
return getBarHeight.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9677
9824
|
}).attr('x', function (d, i) {
|
|
9678
|
-
return getBarX.call(
|
|
9825
|
+
return getBarX.call(_this53, d, i, "".concat(xAxis, "Brush"));
|
|
9679
9826
|
}).attr('y', function (d, i) {
|
|
9680
|
-
return getBarY.call(
|
|
9827
|
+
return getBarY.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9681
9828
|
}) // .transition(this.transition)
|
|
9682
9829
|
.attr('fill', function (d) {
|
|
9683
9830
|
return d.y.color || d.color || series.color;
|
|
9684
9831
|
});
|
|
9685
9832
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
9686
|
-
return Math.abs(getBarWidth.call(
|
|
9833
|
+
return Math.abs(getBarWidth.call(_this53, d, i, "".concat(xAxis, "Brush")));
|
|
9687
9834
|
}).attr('height', function (d, i) {
|
|
9688
|
-
return getBarHeight.call(
|
|
9835
|
+
return getBarHeight.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9689
9836
|
}).attr('x', function (d, i) {
|
|
9690
|
-
return getBarX.call(
|
|
9837
|
+
return getBarX.call(_this53, d, i, "".concat(xAxis, "Brush"));
|
|
9691
9838
|
}).attr('y', function (d, i) {
|
|
9692
|
-
return getBarY.call(
|
|
9839
|
+
return getBarY.call(_this53, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9693
9840
|
}) // .transition(this.transition)
|
|
9694
9841
|
.attr('fill', function (d) {
|
|
9695
9842
|
return d.y.color || d.color || series.color;
|
|
@@ -9707,7 +9854,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9707
9854
|
}, {
|
|
9708
9855
|
key: "renderLabels",
|
|
9709
9856
|
value: function renderLabels(series, index) {
|
|
9710
|
-
var
|
|
9857
|
+
var _this54 = this;
|
|
9711
9858
|
|
|
9712
9859
|
/* global series index d3 WebsyDesigns */
|
|
9713
9860
|
var xAxis = 'bottom';
|
|
@@ -9726,15 +9873,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9726
9873
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9727
9874
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9728
9875
|
labels.attr('x', function (d) {
|
|
9729
|
-
return getLabelX.call(
|
|
9876
|
+
return getLabelX.call(_this54, d, series.labelPosition);
|
|
9730
9877
|
}).attr('y', function (d) {
|
|
9731
|
-
return getLabelY.call(
|
|
9878
|
+
return getLabelY.call(_this54, d, series.labelPosition);
|
|
9732
9879
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9733
|
-
if (
|
|
9880
|
+
if (_this54.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9734
9881
|
return 'transparent';
|
|
9735
9882
|
}
|
|
9736
9883
|
|
|
9737
|
-
return
|
|
9884
|
+
return _this54.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9738
9885
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9739
9886
|
return d.y.label || d.y.value;
|
|
9740
9887
|
}).each(function (d, i) {
|
|
@@ -9759,15 +9906,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9759
9906
|
}
|
|
9760
9907
|
});
|
|
9761
9908
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9762
|
-
return getLabelX.call(
|
|
9909
|
+
return getLabelX.call(_this54, d, series.labelPosition);
|
|
9763
9910
|
}).attr('y', function (d) {
|
|
9764
|
-
return getLabelY.call(
|
|
9911
|
+
return getLabelY.call(_this54, d, series.labelPosition);
|
|
9765
9912
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9766
|
-
if (
|
|
9913
|
+
if (_this54.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9767
9914
|
return 'transparent';
|
|
9768
9915
|
}
|
|
9769
9916
|
|
|
9770
|
-
return
|
|
9917
|
+
return _this54.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9771
9918
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9772
9919
|
return d.y.label || d.y.value;
|
|
9773
9920
|
}).each(function (d, i) {
|
|
@@ -9845,36 +9992,36 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9845
9992
|
}, {
|
|
9846
9993
|
key: "renderline",
|
|
9847
9994
|
value: function renderline(series, index) {
|
|
9848
|
-
var
|
|
9995
|
+
var _this55 = this;
|
|
9849
9996
|
|
|
9850
9997
|
/* global series index d3 */
|
|
9851
9998
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9852
9999
|
return d3.line().x(function (d) {
|
|
9853
|
-
if (
|
|
9854
|
-
return
|
|
10000
|
+
if (_this55.options.orientation === 'horizontal') {
|
|
10001
|
+
return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9855
10002
|
} else {
|
|
9856
|
-
if (
|
|
9857
|
-
return
|
|
10003
|
+
if (_this55.options.data[xAxis].scale === 'Time') {
|
|
10004
|
+
return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value));
|
|
9858
10005
|
} else {
|
|
9859
|
-
var xIndex =
|
|
10006
|
+
var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9860
10007
|
|
|
9861
|
-
var xPos =
|
|
10008
|
+
var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9862
10009
|
|
|
9863
|
-
if (
|
|
9864
|
-
xPos = xPos + (
|
|
10010
|
+
if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10011
|
+
xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9865
10012
|
}
|
|
9866
10013
|
|
|
9867
10014
|
return xPos;
|
|
9868
10015
|
}
|
|
9869
10016
|
}
|
|
9870
10017
|
}).y(function (d) {
|
|
9871
|
-
if (
|
|
9872
|
-
var adjustment =
|
|
9873
|
-
return
|
|
10018
|
+
if (_this55.options.orientation === 'horizontal') {
|
|
10019
|
+
var adjustment = _this55.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this55.options.data[xAxis].bandWidth / 2;
|
|
10020
|
+
return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value)) + adjustment;
|
|
9874
10021
|
} else {
|
|
9875
|
-
return
|
|
10022
|
+
return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9876
10023
|
}
|
|
9877
|
-
}).curve(d3[curveStyle ||
|
|
10024
|
+
}).curve(d3[curveStyle || _this55.options.curveStyle]);
|
|
9878
10025
|
};
|
|
9879
10026
|
|
|
9880
10027
|
var xAxis = 'bottom';
|
|
@@ -9988,14 +10135,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9988
10135
|
}, {
|
|
9989
10136
|
key: "rendersymbol",
|
|
9990
10137
|
value: function rendersymbol(series, index) {
|
|
9991
|
-
var
|
|
10138
|
+
var _this56 = this;
|
|
9992
10139
|
|
|
9993
10140
|
/* global d3 series index series.key */
|
|
9994
10141
|
var drawSymbol = function drawSymbol(size) {
|
|
9995
10142
|
return d3.symbol() // .type(d => {
|
|
9996
10143
|
// return d3.symbols[0]
|
|
9997
10144
|
// })
|
|
9998
|
-
.size(size ||
|
|
10145
|
+
.size(size || _this56.options.symbolSize);
|
|
9999
10146
|
};
|
|
10000
10147
|
|
|
10001
10148
|
var xAxis = 'bottom';
|
|
@@ -10024,25 +10171,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10024
10171
|
// else {
|
|
10025
10172
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10026
10173
|
// }
|
|
10027
|
-
var xIndex =
|
|
10174
|
+
var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10028
10175
|
|
|
10029
|
-
var xPos =
|
|
10176
|
+
var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10030
10177
|
|
|
10031
|
-
if (
|
|
10032
|
-
xPos = xPos + (
|
|
10178
|
+
if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10179
|
+
xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10033
10180
|
}
|
|
10034
10181
|
|
|
10035
|
-
var adjustment =
|
|
10182
|
+
var adjustment = _this56.options.data[xAxis].scale === 'Time' || _this56.options.data[xAxis].scale === 'Linear' ? 0 : _this56.options.data[xAxis].bandWidth / 2;
|
|
10036
10183
|
|
|
10037
|
-
if (
|
|
10038
|
-
return "translate(".concat(
|
|
10184
|
+
if (_this56.options.orientation === 'horizontal') {
|
|
10185
|
+
return "translate(".concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10039
10186
|
} else {
|
|
10040
|
-
if (
|
|
10041
|
-
xPos =
|
|
10187
|
+
if (_this56.options.data[xAxis].scale === 'Time') {
|
|
10188
|
+
xPos = _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
|
|
10042
10189
|
} // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10043
10190
|
|
|
10044
10191
|
|
|
10045
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10192
|
+
return "translate(".concat(xPos, ", ").concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10046
10193
|
}
|
|
10047
10194
|
}); // Enter
|
|
10048
10195
|
|
|
@@ -10056,25 +10203,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10056
10203
|
}).attr('class', function (d) {
|
|
10057
10204
|
return "symbol symbol_".concat(series.key);
|
|
10058
10205
|
}).attr('transform', function (d) {
|
|
10059
|
-
var xIndex =
|
|
10206
|
+
var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10060
10207
|
|
|
10061
|
-
var xPos =
|
|
10208
|
+
var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10062
10209
|
|
|
10063
|
-
if (
|
|
10064
|
-
xPos = xPos + (
|
|
10210
|
+
if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10211
|
+
xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10065
10212
|
}
|
|
10066
10213
|
|
|
10067
|
-
var adjustment =
|
|
10214
|
+
var adjustment = _this56.options.data[xAxis].scale === 'Time' || _this56.options.data[xAxis].scale === 'Linear' ? 0 : _this56.options.data[xAxis].bandWidth / 2;
|
|
10068
10215
|
|
|
10069
|
-
if (
|
|
10070
|
-
return "translate(".concat(
|
|
10216
|
+
if (_this56.options.orientation === 'horizontal') {
|
|
10217
|
+
return "translate(".concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10071
10218
|
} else {
|
|
10072
|
-
if (
|
|
10073
|
-
xPos =
|
|
10219
|
+
if (_this56.options.data[xAxis].scale === 'Time') {
|
|
10220
|
+
xPos = _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
|
|
10074
10221
|
} // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10075
10222
|
|
|
10076
10223
|
|
|
10077
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10224
|
+
return "translate(".concat(xPos, ", ").concat(_this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10078
10225
|
}
|
|
10079
10226
|
});
|
|
10080
10227
|
}
|
|
@@ -10296,7 +10443,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10296
10443
|
}, {
|
|
10297
10444
|
key: "resize",
|
|
10298
10445
|
value: function resize() {
|
|
10299
|
-
var
|
|
10446
|
+
var _this57 = this;
|
|
10300
10447
|
|
|
10301
10448
|
var el = document.getElementById(this.elementId);
|
|
10302
10449
|
|
|
@@ -10309,7 +10456,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10309
10456
|
// }
|
|
10310
10457
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
10311
10458
|
html += this._data.map(function (d, i) {
|
|
10312
|
-
return
|
|
10459
|
+
return _this57.getLegendItemHTML(d);
|
|
10313
10460
|
}).join('');
|
|
10314
10461
|
html += "\n <div>\n ";
|
|
10315
10462
|
el.innerHTML = html;
|
|
@@ -10486,7 +10633,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10486
10633
|
}, {
|
|
10487
10634
|
key: "render",
|
|
10488
10635
|
value: function render() {
|
|
10489
|
-
var
|
|
10636
|
+
var _this58 = this;
|
|
10490
10637
|
|
|
10491
10638
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
10492
10639
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -10495,7 +10642,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10495
10642
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
10496
10643
|
return {
|
|
10497
10644
|
value: s.label || s.key,
|
|
10498
|
-
color: s.color ||
|
|
10645
|
+
color: s.color || _this58.options.colors[i % _this58.options.colors.length]
|
|
10499
10646
|
};
|
|
10500
10647
|
});
|
|
10501
10648
|
var longestValue = legendData.map(function (s) {
|
|
@@ -10559,7 +10706,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10559
10706
|
|
|
10560
10707
|
if (this.polygons) {
|
|
10561
10708
|
this.polygons.forEach(function (p) {
|
|
10562
|
-
return
|
|
10709
|
+
return _this58.map.removeLayer(p);
|
|
10563
10710
|
});
|
|
10564
10711
|
}
|
|
10565
10712
|
|
|
@@ -10617,18 +10764,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10617
10764
|
}
|
|
10618
10765
|
|
|
10619
10766
|
if (!p.options.color) {
|
|
10620
|
-
p.options.color =
|
|
10767
|
+
p.options.color = _this58.options.colors[i % _this58.options.colors.length];
|
|
10621
10768
|
}
|
|
10622
10769
|
|
|
10623
10770
|
var pol = L.polygon(p.data.map(function (c) {
|
|
10624
10771
|
return c.map(function (d) {
|
|
10625
10772
|
return [d.Latitude, d.Longitude];
|
|
10626
10773
|
});
|
|
10627
|
-
}), p.options).addTo(
|
|
10774
|
+
}), p.options).addTo(_this58.map);
|
|
10628
10775
|
|
|
10629
|
-
|
|
10776
|
+
_this58.polygons.push(pol);
|
|
10630
10777
|
|
|
10631
|
-
|
|
10778
|
+
_this58.map.fitBounds(pol.getBounds());
|
|
10632
10779
|
});
|
|
10633
10780
|
} // if (this.data.markers.length > 0) {
|
|
10634
10781
|
// el.classList.remove('hidden')
|