@websy/websy-designs 1.4.8 → 1.4.9
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.
|
@@ -6020,7 +6020,9 @@ class WebsyTable3 {
|
|
|
6020
6020
|
minHandleSize: 20,
|
|
6021
6021
|
maxColWidth: '50%',
|
|
6022
6022
|
allowPivoting: false,
|
|
6023
|
-
searchIcon: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 512 512"><title>ionicons-v5-f</title><path d="M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z" style="fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px"/><line x1="338.29" y1="338.29" x2="448" y2="448" style="fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px"/></svg
|
|
6023
|
+
searchIcon: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 512 512"><title>ionicons-v5-f</title><path d="M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z" style="fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px"/><line x1="338.29" y1="338.29" x2="448" y2="448" style="fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px"/></svg>`,
|
|
6024
|
+
plusIcon: WebsyDesigns.Icons.PlusFilled,
|
|
6025
|
+
minusIcon: WebsyDesigns.Icons.MinusFilled
|
|
6024
6026
|
}
|
|
6025
6027
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
6026
6028
|
this.sizes = {}
|
|
@@ -6180,14 +6182,14 @@ class WebsyTable3 {
|
|
|
6180
6182
|
data-row-index='${rowIndex}'
|
|
6181
6183
|
data-col-index='${cell.level || cellIndex}'
|
|
6182
6184
|
class='websy-table-cell-expand'
|
|
6183
|
-
>${
|
|
6185
|
+
>${this.options.plusIcon}</i>`
|
|
6184
6186
|
}
|
|
6185
6187
|
if (cell.collapsable === true) {
|
|
6186
6188
|
bodyHtml += `<i
|
|
6187
6189
|
data-row-index='${rowIndex}'
|
|
6188
6190
|
data-col-index='${cell.level || cellIndex}'
|
|
6189
6191
|
class='websy-table-cell-collapse'
|
|
6190
|
-
>${
|
|
6192
|
+
>${this.options.minusIcon}</i>`
|
|
6191
6193
|
}
|
|
6192
6194
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6193
6195
|
cell.value = `
|
package/dist/websy-designs.js
CHANGED
|
@@ -6604,7 +6604,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6604
6604
|
minHandleSize: 20,
|
|
6605
6605
|
maxColWidth: '50%',
|
|
6606
6606
|
allowPivoting: false,
|
|
6607
|
-
searchIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>"
|
|
6607
|
+
searchIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>",
|
|
6608
|
+
plusIcon: WebsyDesigns.Icons.PlusFilled,
|
|
6609
|
+
minusIcon: WebsyDesigns.Icons.MinusFilled
|
|
6608
6610
|
};
|
|
6609
6611
|
this.options = _extends({}, DEFAULTS, options);
|
|
6610
6612
|
this.sizes = {};
|
|
@@ -6671,6 +6673,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6671
6673
|
}, {
|
|
6672
6674
|
key: "buildBodyHtml",
|
|
6673
6675
|
value: function buildBodyHtml() {
|
|
6676
|
+
var _this40 = this;
|
|
6677
|
+
|
|
6674
6678
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6675
6679
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6676
6680
|
|
|
@@ -6738,11 +6742,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6738
6742
|
bodyHtml += "\n ><div style='".concat(divStyle, "'>");
|
|
6739
6743
|
|
|
6740
6744
|
if (cell.expandable === true) {
|
|
6741
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6745
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this40.options.plusIcon, "</i>");
|
|
6742
6746
|
}
|
|
6743
6747
|
|
|
6744
6748
|
if (cell.collapsable === true) {
|
|
6745
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6749
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this40.options.minusIcon, "</i>");
|
|
6746
6750
|
}
|
|
6747
6751
|
|
|
6748
6752
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
@@ -6767,7 +6771,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6767
6771
|
}, {
|
|
6768
6772
|
key: "buildHeaderHtml",
|
|
6769
6773
|
value: function buildHeaderHtml() {
|
|
6770
|
-
var
|
|
6774
|
+
var _this41 = this;
|
|
6771
6775
|
|
|
6772
6776
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6773
6777
|
var headerHtml = '';
|
|
@@ -6782,7 +6786,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6782
6786
|
}
|
|
6783
6787
|
|
|
6784
6788
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6785
|
-
if (useWidths === false && rowIndex !==
|
|
6789
|
+
if (useWidths === false && rowIndex !== _this41.options.columns.length - 1) {
|
|
6786
6790
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6787
6791
|
return;
|
|
6788
6792
|
}
|
|
@@ -6808,18 +6812,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6808
6812
|
// `
|
|
6809
6813
|
// }
|
|
6810
6814
|
|
|
6811
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6815
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this41.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6812
6816
|
});
|
|
6813
6817
|
headerHtml += "</tr>";
|
|
6814
6818
|
});
|
|
6815
6819
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6816
6820
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6817
6821
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6818
|
-
var testEl = document.getElementById("".concat(
|
|
6822
|
+
var testEl = document.getElementById("".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6819
6823
|
|
|
6820
6824
|
if (!testEl) {
|
|
6821
6825
|
var newE = document.createElement('div');
|
|
6822
|
-
newE.id = "".concat(
|
|
6826
|
+
newE.id = "".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6823
6827
|
newE.className = 'websy-modal-dropdown';
|
|
6824
6828
|
dropdownEl.appendChild(newE);
|
|
6825
6829
|
}
|
|
@@ -6835,7 +6839,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6835
6839
|
}, {
|
|
6836
6840
|
key: "buildTotalHtml",
|
|
6837
6841
|
value: function buildTotalHtml() {
|
|
6838
|
-
var
|
|
6842
|
+
var _this42 = this;
|
|
6839
6843
|
|
|
6840
6844
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6841
6845
|
|
|
@@ -6848,7 +6852,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6848
6852
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6849
6853
|
|
|
6850
6854
|
if (useWidths === true) {
|
|
6851
|
-
totalHtml += "\n style='width: ".concat(
|
|
6855
|
+
totalHtml += "\n style='width: ".concat(_this42.options.columns[_this42.options.columns.length - 1][colIndex].width || _this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6852
6856
|
}
|
|
6853
6857
|
|
|
6854
6858
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6859,7 +6863,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6859
6863
|
}, {
|
|
6860
6864
|
key: "calculateSizes",
|
|
6861
6865
|
value: function calculateSizes() {
|
|
6862
|
-
var
|
|
6866
|
+
var _this43 = this;
|
|
6863
6867
|
|
|
6864
6868
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6865
6869
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6902,32 +6906,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6902
6906
|
rows.forEach(function (row, rowIndex) {
|
|
6903
6907
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6904
6908
|
var colSize = col.getBoundingClientRect();
|
|
6905
|
-
|
|
6909
|
+
_this43.sizes.cellHeight = colSize.height;
|
|
6906
6910
|
|
|
6907
|
-
if (
|
|
6908
|
-
if (!
|
|
6909
|
-
|
|
6911
|
+
if (_this43.options.columns[_this43.options.columns.length - 1][colIndex]) {
|
|
6912
|
+
if (!_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth) {
|
|
6913
|
+
_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6910
6914
|
}
|
|
6911
6915
|
|
|
6912
|
-
|
|
6913
|
-
|
|
6916
|
+
_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6917
|
+
_this43.options.columns[_this43.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6914
6918
|
|
|
6915
|
-
if (colIndex >=
|
|
6916
|
-
firstNonPinnedColumnWidth =
|
|
6919
|
+
if (colIndex >= _this43.pinnedColumns) {
|
|
6920
|
+
firstNonPinnedColumnWidth = _this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth;
|
|
6917
6921
|
}
|
|
6918
6922
|
}
|
|
6919
6923
|
});
|
|
6920
6924
|
});
|
|
6921
6925
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6922
|
-
if (colIndex <
|
|
6923
|
-
|
|
6926
|
+
if (colIndex < _this43.pinnedColumns) {
|
|
6927
|
+
_this43.sizes.scrollableWidth -= col.actualWidth;
|
|
6924
6928
|
}
|
|
6925
6929
|
});
|
|
6926
6930
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6927
6931
|
return a + (b.width || b.actualWidth);
|
|
6928
6932
|
}, 0);
|
|
6929
6933
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6930
|
-
return i >=
|
|
6934
|
+
return i >= _this43.pinnedColumns;
|
|
6931
6935
|
}).reduce(function (a, b) {
|
|
6932
6936
|
return a + (b.width || b.actualWidth);
|
|
6933
6937
|
}, 0);
|
|
@@ -6948,10 +6952,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6948
6952
|
c.actualWidth += equalWidth; // }
|
|
6949
6953
|
// }
|
|
6950
6954
|
|
|
6951
|
-
|
|
6955
|
+
_this43.sizes.totalWidth += c.width || c.actualWidth;
|
|
6952
6956
|
|
|
6953
|
-
if (i <
|
|
6954
|
-
|
|
6957
|
+
if (i < _this43.pinnedColumns) {
|
|
6958
|
+
_this43.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6955
6959
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6956
6960
|
|
|
6957
6961
|
});
|
|
@@ -7008,7 +7012,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7008
7012
|
}, {
|
|
7009
7013
|
key: "createSample",
|
|
7010
7014
|
value: function createSample(data) {
|
|
7011
|
-
var
|
|
7015
|
+
var _this44 = this;
|
|
7012
7016
|
|
|
7013
7017
|
var output = [];
|
|
7014
7018
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -7020,7 +7024,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7020
7024
|
var longest = '';
|
|
7021
7025
|
|
|
7022
7026
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7023
|
-
if (data[i].length ===
|
|
7027
|
+
if (data[i].length === _this44.options.columns[_this44.options.columns.length - 1].length) {
|
|
7024
7028
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7025
7029
|
longest = data[i][colIndex].value;
|
|
7026
7030
|
}
|
|
@@ -7415,7 +7419,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7415
7419
|
|
|
7416
7420
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7417
7421
|
function WebsyChart(elementId, options) {
|
|
7418
|
-
var
|
|
7422
|
+
var _this45 = this;
|
|
7419
7423
|
|
|
7420
7424
|
_classCallCheck(this, WebsyChart);
|
|
7421
7425
|
|
|
@@ -7466,22 +7470,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7466
7470
|
this.invertOverride = function (input, input2) {
|
|
7467
7471
|
var xAxis = 'bottomAxis';
|
|
7468
7472
|
|
|
7469
|
-
if (
|
|
7473
|
+
if (_this45.options.orientation === 'horizontal') {
|
|
7470
7474
|
xAxis = 'leftAxis';
|
|
7471
7475
|
}
|
|
7472
7476
|
|
|
7473
|
-
var width =
|
|
7477
|
+
var width = _this45[xAxis].step();
|
|
7474
7478
|
|
|
7475
7479
|
var output;
|
|
7476
7480
|
|
|
7477
|
-
var domain = _toConsumableArray(
|
|
7481
|
+
var domain = _toConsumableArray(_this45[xAxis].domain());
|
|
7478
7482
|
|
|
7479
|
-
if (
|
|
7483
|
+
if (_this45.options.orientation === 'horizontal') {
|
|
7480
7484
|
domain = domain.reverse();
|
|
7481
7485
|
}
|
|
7482
7486
|
|
|
7483
7487
|
for (var j = 0; j < domain.length; j++) {
|
|
7484
|
-
var breakA =
|
|
7488
|
+
var breakA = _this45[xAxis](domain[j]) - width / 2;
|
|
7485
7489
|
var breakB = breakA + width;
|
|
7486
7490
|
|
|
7487
7491
|
if (input > breakA && input <= breakB) {
|
|
@@ -7581,10 +7585,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7581
7585
|
}, {
|
|
7582
7586
|
key: "handleEventMouseMove",
|
|
7583
7587
|
value: function handleEventMouseMove(event, d) {
|
|
7584
|
-
var
|
|
7588
|
+
var _this46 = this;
|
|
7585
7589
|
|
|
7586
7590
|
var bisectDate = d3.bisector(function (d) {
|
|
7587
|
-
return
|
|
7591
|
+
return _this46.parseX(d.x.value);
|
|
7588
7592
|
}).left;
|
|
7589
7593
|
|
|
7590
7594
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7623,8 +7627,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7623
7627
|
}
|
|
7624
7628
|
|
|
7625
7629
|
this.options.data.series.forEach(function (s) {
|
|
7626
|
-
if (
|
|
7627
|
-
xPoint =
|
|
7630
|
+
if (_this46.options.data[xData].scale !== 'Time') {
|
|
7631
|
+
xPoint = _this46[xAxis](_this46.parseX(xLabel));
|
|
7628
7632
|
s.data.forEach(function (d) {
|
|
7629
7633
|
if (d.x.value === xLabel) {
|
|
7630
7634
|
if (!tooltipTitle) {
|
|
@@ -7643,13 +7647,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7643
7647
|
var pointA = s.data[index - 1];
|
|
7644
7648
|
var pointB = s.data[index];
|
|
7645
7649
|
|
|
7646
|
-
if (
|
|
7650
|
+
if (_this46.options.orientation === 'horizontal') {
|
|
7647
7651
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7648
7652
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7649
7653
|
}
|
|
7650
7654
|
|
|
7651
7655
|
if (pointA && !pointB) {
|
|
7652
|
-
xPoint =
|
|
7656
|
+
xPoint = _this46[xAxis](_this46.parseX(pointA.x.value));
|
|
7653
7657
|
tooltipTitle = pointA.x.value;
|
|
7654
7658
|
|
|
7655
7659
|
if (!pointA.y.color) {
|
|
@@ -7659,12 +7663,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7659
7663
|
tooltipData.push(pointA.y);
|
|
7660
7664
|
|
|
7661
7665
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7662
|
-
tooltipTitle = d3.timeFormat(
|
|
7666
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7663
7667
|
}
|
|
7664
7668
|
}
|
|
7665
7669
|
|
|
7666
7670
|
if (pointB && !pointA) {
|
|
7667
|
-
xPoint =
|
|
7671
|
+
xPoint = _this46[xAxis](_this46.parseX(pointB.x.value));
|
|
7668
7672
|
tooltipTitle = pointB.x.value;
|
|
7669
7673
|
|
|
7670
7674
|
if (!pointB.y.color) {
|
|
@@ -7674,14 +7678,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7674
7678
|
tooltipData.push(pointB.y);
|
|
7675
7679
|
|
|
7676
7680
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7677
|
-
tooltipTitle = d3.timeFormat(
|
|
7681
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7678
7682
|
}
|
|
7679
7683
|
}
|
|
7680
7684
|
|
|
7681
7685
|
if (pointA && pointB) {
|
|
7682
|
-
var d0 =
|
|
7686
|
+
var d0 = _this46[xAxis](_this46.parseX(pointA.x.value));
|
|
7683
7687
|
|
|
7684
|
-
var d1 =
|
|
7688
|
+
var d1 = _this46[xAxis](_this46.parseX(pointB.x.value));
|
|
7685
7689
|
|
|
7686
7690
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7687
7691
|
|
|
@@ -7690,7 +7694,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7690
7694
|
tooltipTitle = pointB.x.value;
|
|
7691
7695
|
|
|
7692
7696
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7693
|
-
tooltipTitle = d3.timeFormat(
|
|
7697
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7694
7698
|
}
|
|
7695
7699
|
|
|
7696
7700
|
if (!pointB.y.color) {
|
|
@@ -7703,7 +7707,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7703
7707
|
tooltipTitle = pointA.x.value;
|
|
7704
7708
|
|
|
7705
7709
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7706
|
-
tooltipTitle = d3.timeFormat(
|
|
7710
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7707
7711
|
}
|
|
7708
7712
|
|
|
7709
7713
|
if (!pointA.y.color) {
|
|
@@ -7817,7 +7821,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7817
7821
|
}, {
|
|
7818
7822
|
key: "render",
|
|
7819
7823
|
value: function render(options) {
|
|
7820
|
-
var
|
|
7824
|
+
var _this47 = this;
|
|
7821
7825
|
|
|
7822
7826
|
/* global d3 options WebsyUtils */
|
|
7823
7827
|
if (typeof options !== 'undefined') {
|
|
@@ -7886,7 +7890,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7886
7890
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7887
7891
|
return {
|
|
7888
7892
|
value: s.label || s.key,
|
|
7889
|
-
color: s.color ||
|
|
7893
|
+
color: s.color || _this47.options.colors[i % _this47.options.colors.length]
|
|
7890
7894
|
};
|
|
7891
7895
|
});
|
|
7892
7896
|
|
|
@@ -8168,7 +8172,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8168
8172
|
|
|
8169
8173
|
if (this.options.data.bottom.formatter) {
|
|
8170
8174
|
bAxisFunc.tickFormat(function (d) {
|
|
8171
|
-
return
|
|
8175
|
+
return _this47.options.data.bottom.formatter(d);
|
|
8172
8176
|
});
|
|
8173
8177
|
}
|
|
8174
8178
|
|
|
@@ -8194,8 +8198,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8194
8198
|
|
|
8195
8199
|
if (this.options.margin.axisLeft > 0) {
|
|
8196
8200
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8197
|
-
if (
|
|
8198
|
-
d =
|
|
8201
|
+
if (_this47.options.data.left.formatter) {
|
|
8202
|
+
d = _this47.options.data.left.formatter(d);
|
|
8199
8203
|
}
|
|
8200
8204
|
|
|
8201
8205
|
return d;
|
|
@@ -8232,8 +8236,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8232
8236
|
|
|
8233
8237
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8234
8238
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8235
|
-
if (
|
|
8236
|
-
d =
|
|
8239
|
+
if (_this47.options.data.right.formatter) {
|
|
8240
|
+
d = _this47.options.data.right.formatter(d);
|
|
8237
8241
|
}
|
|
8238
8242
|
|
|
8239
8243
|
return d;
|
|
@@ -8272,18 +8276,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8272
8276
|
this.renderedKeys = {};
|
|
8273
8277
|
this.options.data.series.forEach(function (series, index) {
|
|
8274
8278
|
if (!series.key) {
|
|
8275
|
-
series.key =
|
|
8279
|
+
series.key = _this47.createIdentity();
|
|
8276
8280
|
}
|
|
8277
8281
|
|
|
8278
8282
|
if (!series.color) {
|
|
8279
|
-
series.color =
|
|
8283
|
+
series.color = _this47.options.colors[index % _this47.options.colors.length];
|
|
8280
8284
|
}
|
|
8281
8285
|
|
|
8282
|
-
|
|
8286
|
+
_this47["render".concat(series.type || 'bar')](series, index);
|
|
8283
8287
|
|
|
8284
|
-
|
|
8288
|
+
_this47.renderLabels(series, index);
|
|
8285
8289
|
|
|
8286
|
-
|
|
8290
|
+
_this47.renderedKeys[series.key] = series.type;
|
|
8287
8291
|
});
|
|
8288
8292
|
}
|
|
8289
8293
|
}
|
|
@@ -8291,17 +8295,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8291
8295
|
}, {
|
|
8292
8296
|
key: "renderarea",
|
|
8293
8297
|
value: function renderarea(series, index) {
|
|
8294
|
-
var
|
|
8298
|
+
var _this48 = this;
|
|
8295
8299
|
|
|
8296
8300
|
/* global d3 series index */
|
|
8297
8301
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8298
8302
|
return d3.area().x(function (d) {
|
|
8299
|
-
return
|
|
8303
|
+
return _this48[xAxis](_this48.parseX(d.x.value));
|
|
8300
8304
|
}).y0(function (d) {
|
|
8301
|
-
return
|
|
8305
|
+
return _this48[yAxis](0);
|
|
8302
8306
|
}).y1(function (d) {
|
|
8303
|
-
return
|
|
8304
|
-
}).curve(d3[curveStyle ||
|
|
8307
|
+
return _this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8308
|
+
}).curve(d3[curveStyle || _this48.options.curveStyle]);
|
|
8305
8309
|
};
|
|
8306
8310
|
|
|
8307
8311
|
var xAxis = 'bottomAxis';
|
|
@@ -8424,7 +8428,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8424
8428
|
}, {
|
|
8425
8429
|
key: "renderLabels",
|
|
8426
8430
|
value: function renderLabels(series, index) {
|
|
8427
|
-
var
|
|
8431
|
+
var _this49 = this;
|
|
8428
8432
|
|
|
8429
8433
|
/* global series index d3 WebsyDesigns */
|
|
8430
8434
|
var xAxis = 'bottomAxis';
|
|
@@ -8443,11 +8447,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8443
8447
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8444
8448
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8445
8449
|
labels.attr('x', function (d) {
|
|
8446
|
-
return getLabelX.call(
|
|
8450
|
+
return getLabelX.call(_this49, d, series.labelPosition);
|
|
8447
8451
|
}).attr('y', function (d) {
|
|
8448
|
-
return getLabelY.call(
|
|
8452
|
+
return getLabelY.call(_this49, d, series.labelPosition);
|
|
8449
8453
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8450
|
-
return
|
|
8454
|
+
return _this49.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8451
8455
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8452
8456
|
return d.y.label || d.y.value;
|
|
8453
8457
|
}).each(function (d, i) {
|
|
@@ -8472,11 +8476,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8472
8476
|
}
|
|
8473
8477
|
});
|
|
8474
8478
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8475
|
-
return getLabelX.call(
|
|
8479
|
+
return getLabelX.call(_this49, d, series.labelPosition);
|
|
8476
8480
|
}).attr('y', function (d) {
|
|
8477
|
-
return getLabelY.call(
|
|
8481
|
+
return getLabelY.call(_this49, d, series.labelPosition);
|
|
8478
8482
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8479
|
-
return
|
|
8483
|
+
return _this49.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8480
8484
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8481
8485
|
return d.y.label || d.y.value;
|
|
8482
8486
|
}).each(function (d, i) {
|
|
@@ -8533,16 +8537,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8533
8537
|
}, {
|
|
8534
8538
|
key: "renderline",
|
|
8535
8539
|
value: function renderline(series, index) {
|
|
8536
|
-
var
|
|
8540
|
+
var _this50 = this;
|
|
8537
8541
|
|
|
8538
8542
|
/* global series index d3 */
|
|
8539
8543
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8540
8544
|
return d3.line().x(function (d) {
|
|
8541
|
-
var adjustment =
|
|
8542
|
-
return
|
|
8545
|
+
var adjustment = _this50.options.data[xAxis].scale === 'Time' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8546
|
+
return _this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment;
|
|
8543
8547
|
}).y(function (d) {
|
|
8544
|
-
return
|
|
8545
|
-
}).curve(d3[curveStyle ||
|
|
8548
|
+
return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8549
|
+
}).curve(d3[curveStyle || _this50.options.curveStyle]);
|
|
8546
8550
|
};
|
|
8547
8551
|
|
|
8548
8552
|
var xAxis = 'bottom';
|
|
@@ -8586,14 +8590,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8586
8590
|
}, {
|
|
8587
8591
|
key: "rendersymbol",
|
|
8588
8592
|
value: function rendersymbol(series, index) {
|
|
8589
|
-
var
|
|
8593
|
+
var _this51 = this;
|
|
8590
8594
|
|
|
8591
8595
|
/* global d3 series index series.key */
|
|
8592
8596
|
var drawSymbol = function drawSymbol(size) {
|
|
8593
8597
|
return d3.symbol() // .type(d => {
|
|
8594
8598
|
// return d3.symbols[0]
|
|
8595
8599
|
// })
|
|
8596
|
-
.size(size ||
|
|
8600
|
+
.size(size || _this51.options.symbolSize);
|
|
8597
8601
|
};
|
|
8598
8602
|
|
|
8599
8603
|
var xAxis = 'bottomAxis';
|
|
@@ -8611,7 +8615,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8611
8615
|
symbols.attr('d', function (d) {
|
|
8612
8616
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8613
8617
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8614
|
-
return "translate(".concat(
|
|
8618
|
+
return "translate(".concat(_this51[xAxis](_this51.parseX(d.x.value)), ", ").concat(_this51[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8615
8619
|
}); // Enter
|
|
8616
8620
|
|
|
8617
8621
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8620,7 +8624,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8620
8624
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8621
8625
|
return "symbol symbol_".concat(series.key);
|
|
8622
8626
|
}).attr('transform', function (d) {
|
|
8623
|
-
return "translate(".concat(
|
|
8627
|
+
return "translate(".concat(_this51[xAxis](_this51.parseX(d.x.value)), ", ").concat(_this51[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8624
8628
|
});
|
|
8625
8629
|
}
|
|
8626
8630
|
}, {
|
|
@@ -8775,7 +8779,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8775
8779
|
}, {
|
|
8776
8780
|
key: "resize",
|
|
8777
8781
|
value: function resize() {
|
|
8778
|
-
var
|
|
8782
|
+
var _this52 = this;
|
|
8779
8783
|
|
|
8780
8784
|
var el = document.getElementById(this.elementId);
|
|
8781
8785
|
|
|
@@ -8788,7 +8792,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8788
8792
|
// }
|
|
8789
8793
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8790
8794
|
html += this._data.map(function (d, i) {
|
|
8791
|
-
return
|
|
8795
|
+
return _this52.getLegendItemHTML(d);
|
|
8792
8796
|
}).join('');
|
|
8793
8797
|
html += "\n <div>\n ";
|
|
8794
8798
|
el.innerHTML = html;
|
|
@@ -8960,7 +8964,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8960
8964
|
}, {
|
|
8961
8965
|
key: "render",
|
|
8962
8966
|
value: function render() {
|
|
8963
|
-
var
|
|
8967
|
+
var _this53 = this;
|
|
8964
8968
|
|
|
8965
8969
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8966
8970
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8969,7 +8973,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8969
8973
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8970
8974
|
return {
|
|
8971
8975
|
value: s.label || s.key,
|
|
8972
|
-
color: s.color ||
|
|
8976
|
+
color: s.color || _this53.options.colors[i % _this53.options.colors.length]
|
|
8973
8977
|
};
|
|
8974
8978
|
});
|
|
8975
8979
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9033,7 +9037,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9033
9037
|
|
|
9034
9038
|
if (this.polygons) {
|
|
9035
9039
|
this.polygons.forEach(function (p) {
|
|
9036
|
-
return
|
|
9040
|
+
return _this53.map.removeLayer(p);
|
|
9037
9041
|
});
|
|
9038
9042
|
}
|
|
9039
9043
|
|
|
@@ -9091,18 +9095,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9091
9095
|
}
|
|
9092
9096
|
|
|
9093
9097
|
if (!p.options.color) {
|
|
9094
|
-
p.options.color =
|
|
9098
|
+
p.options.color = _this53.options.colors[i % _this53.options.colors.length];
|
|
9095
9099
|
}
|
|
9096
9100
|
|
|
9097
9101
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9098
9102
|
return c.map(function (d) {
|
|
9099
9103
|
return [d.Latitude, d.Longitude];
|
|
9100
9104
|
});
|
|
9101
|
-
}), p.options).addTo(
|
|
9105
|
+
}), p.options).addTo(_this53.map);
|
|
9102
9106
|
|
|
9103
|
-
|
|
9107
|
+
_this53.polygons.push(pol);
|
|
9104
9108
|
|
|
9105
|
-
|
|
9109
|
+
_this53.map.fitBounds(pol.getBounds());
|
|
9106
9110
|
});
|
|
9107
9111
|
} // if (this.data.markers.length > 0) {
|
|
9108
9112
|
// el.classList.remove('hidden')
|