@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.
|
@@ -5619,7 +5619,9 @@ class WebsyTable3 {
|
|
|
5619
5619
|
minHandleSize: 20,
|
|
5620
5620
|
maxColWidth: '50%',
|
|
5621
5621
|
allowPivoting: false,
|
|
5622
|
-
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
|
|
5622
|
+
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>`,
|
|
5623
|
+
plusIcon: WebsyDesigns.Icons.PlusFilled,
|
|
5624
|
+
minusIcon: WebsyDesigns.Icons.MinusFilled
|
|
5623
5625
|
}
|
|
5624
5626
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
5625
5627
|
this.sizes = {}
|
|
@@ -5779,14 +5781,14 @@ class WebsyTable3 {
|
|
|
5779
5781
|
data-row-index='${rowIndex}'
|
|
5780
5782
|
data-col-index='${cell.level || cellIndex}'
|
|
5781
5783
|
class='websy-table-cell-expand'
|
|
5782
|
-
>${
|
|
5784
|
+
>${this.options.plusIcon}</i>`
|
|
5783
5785
|
}
|
|
5784
5786
|
if (cell.collapsable === true) {
|
|
5785
5787
|
bodyHtml += `<i
|
|
5786
5788
|
data-row-index='${rowIndex}'
|
|
5787
5789
|
data-col-index='${cell.level || cellIndex}'
|
|
5788
5790
|
class='websy-table-cell-collapse'
|
|
5789
|
-
>${
|
|
5791
|
+
>${this.options.minusIcon}</i>`
|
|
5790
5792
|
}
|
|
5791
5793
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
5792
5794
|
cell.value = `
|
|
@@ -6142,7 +6142,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6142
6142
|
minHandleSize: 20,
|
|
6143
6143
|
maxColWidth: '50%',
|
|
6144
6144
|
allowPivoting: false,
|
|
6145
|
-
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>"
|
|
6145
|
+
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>",
|
|
6146
|
+
plusIcon: WebsyDesigns.Icons.PlusFilled,
|
|
6147
|
+
minusIcon: WebsyDesigns.Icons.MinusFilled
|
|
6146
6148
|
};
|
|
6147
6149
|
this.options = _extends({}, DEFAULTS, options);
|
|
6148
6150
|
this.sizes = {};
|
|
@@ -6209,6 +6211,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6209
6211
|
}, {
|
|
6210
6212
|
key: "buildBodyHtml",
|
|
6211
6213
|
value: function buildBodyHtml() {
|
|
6214
|
+
var _this37 = this;
|
|
6215
|
+
|
|
6212
6216
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6213
6217
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6214
6218
|
|
|
@@ -6276,11 +6280,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6276
6280
|
bodyHtml += "\n ><div style='".concat(divStyle, "'>");
|
|
6277
6281
|
|
|
6278
6282
|
if (cell.expandable === true) {
|
|
6279
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6283
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this37.options.plusIcon, "</i>");
|
|
6280
6284
|
}
|
|
6281
6285
|
|
|
6282
6286
|
if (cell.collapsable === true) {
|
|
6283
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6287
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this37.options.minusIcon, "</i>");
|
|
6284
6288
|
}
|
|
6285
6289
|
|
|
6286
6290
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
@@ -6305,7 +6309,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6305
6309
|
}, {
|
|
6306
6310
|
key: "buildHeaderHtml",
|
|
6307
6311
|
value: function buildHeaderHtml() {
|
|
6308
|
-
var
|
|
6312
|
+
var _this38 = this;
|
|
6309
6313
|
|
|
6310
6314
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6311
6315
|
var headerHtml = '';
|
|
@@ -6320,7 +6324,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6320
6324
|
}
|
|
6321
6325
|
|
|
6322
6326
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6323
|
-
if (useWidths === false && rowIndex !==
|
|
6327
|
+
if (useWidths === false && rowIndex !== _this38.options.columns.length - 1) {
|
|
6324
6328
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6325
6329
|
return;
|
|
6326
6330
|
}
|
|
@@ -6346,18 +6350,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6346
6350
|
// `
|
|
6347
6351
|
// }
|
|
6348
6352
|
|
|
6349
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6353
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this38.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6350
6354
|
});
|
|
6351
6355
|
headerHtml += "</tr>";
|
|
6352
6356
|
});
|
|
6353
6357
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6354
6358
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6355
6359
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6356
|
-
var testEl = document.getElementById("".concat(
|
|
6360
|
+
var testEl = document.getElementById("".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6357
6361
|
|
|
6358
6362
|
if (!testEl) {
|
|
6359
6363
|
var newE = document.createElement('div');
|
|
6360
|
-
newE.id = "".concat(
|
|
6364
|
+
newE.id = "".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6361
6365
|
newE.className = 'websy-modal-dropdown';
|
|
6362
6366
|
dropdownEl.appendChild(newE);
|
|
6363
6367
|
}
|
|
@@ -6373,7 +6377,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6373
6377
|
}, {
|
|
6374
6378
|
key: "buildTotalHtml",
|
|
6375
6379
|
value: function buildTotalHtml() {
|
|
6376
|
-
var
|
|
6380
|
+
var _this39 = this;
|
|
6377
6381
|
|
|
6378
6382
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6379
6383
|
|
|
@@ -6386,7 +6390,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6386
6390
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6387
6391
|
|
|
6388
6392
|
if (useWidths === true) {
|
|
6389
|
-
totalHtml += "\n style='width: ".concat(
|
|
6393
|
+
totalHtml += "\n style='width: ".concat(_this39.options.columns[_this39.options.columns.length - 1][colIndex].width || _this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6390
6394
|
}
|
|
6391
6395
|
|
|
6392
6396
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6397,7 +6401,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6397
6401
|
}, {
|
|
6398
6402
|
key: "calculateSizes",
|
|
6399
6403
|
value: function calculateSizes() {
|
|
6400
|
-
var
|
|
6404
|
+
var _this40 = this;
|
|
6401
6405
|
|
|
6402
6406
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6403
6407
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6440,32 +6444,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6440
6444
|
rows.forEach(function (row, rowIndex) {
|
|
6441
6445
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6442
6446
|
var colSize = col.getBoundingClientRect();
|
|
6443
|
-
|
|
6447
|
+
_this40.sizes.cellHeight = colSize.height;
|
|
6444
6448
|
|
|
6445
|
-
if (
|
|
6446
|
-
if (!
|
|
6447
|
-
|
|
6449
|
+
if (_this40.options.columns[_this40.options.columns.length - 1][colIndex]) {
|
|
6450
|
+
if (!_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth) {
|
|
6451
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6448
6452
|
}
|
|
6449
6453
|
|
|
6450
|
-
|
|
6451
|
-
|
|
6454
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6455
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6452
6456
|
|
|
6453
|
-
if (colIndex >=
|
|
6454
|
-
firstNonPinnedColumnWidth =
|
|
6457
|
+
if (colIndex >= _this40.pinnedColumns) {
|
|
6458
|
+
firstNonPinnedColumnWidth = _this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth;
|
|
6455
6459
|
}
|
|
6456
6460
|
}
|
|
6457
6461
|
});
|
|
6458
6462
|
});
|
|
6459
6463
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6460
|
-
if (colIndex <
|
|
6461
|
-
|
|
6464
|
+
if (colIndex < _this40.pinnedColumns) {
|
|
6465
|
+
_this40.sizes.scrollableWidth -= col.actualWidth;
|
|
6462
6466
|
}
|
|
6463
6467
|
});
|
|
6464
6468
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6465
6469
|
return a + (b.width || b.actualWidth);
|
|
6466
6470
|
}, 0);
|
|
6467
6471
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6468
|
-
return i >=
|
|
6472
|
+
return i >= _this40.pinnedColumns;
|
|
6469
6473
|
}).reduce(function (a, b) {
|
|
6470
6474
|
return a + (b.width || b.actualWidth);
|
|
6471
6475
|
}, 0);
|
|
@@ -6486,10 +6490,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6486
6490
|
c.actualWidth += equalWidth; // }
|
|
6487
6491
|
// }
|
|
6488
6492
|
|
|
6489
|
-
|
|
6493
|
+
_this40.sizes.totalWidth += c.width || c.actualWidth;
|
|
6490
6494
|
|
|
6491
|
-
if (i <
|
|
6492
|
-
|
|
6495
|
+
if (i < _this40.pinnedColumns) {
|
|
6496
|
+
_this40.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6493
6497
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6494
6498
|
|
|
6495
6499
|
});
|
|
@@ -6546,7 +6550,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6546
6550
|
}, {
|
|
6547
6551
|
key: "createSample",
|
|
6548
6552
|
value: function createSample(data) {
|
|
6549
|
-
var
|
|
6553
|
+
var _this41 = this;
|
|
6550
6554
|
|
|
6551
6555
|
var output = [];
|
|
6552
6556
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -6558,7 +6562,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6558
6562
|
var longest = '';
|
|
6559
6563
|
|
|
6560
6564
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6561
|
-
if (data[i].length ===
|
|
6565
|
+
if (data[i].length === _this41.options.columns[_this41.options.columns.length - 1].length) {
|
|
6562
6566
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6563
6567
|
longest = data[i][colIndex].value;
|
|
6564
6568
|
}
|
|
@@ -6953,7 +6957,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6953
6957
|
|
|
6954
6958
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6955
6959
|
function WebsyChart(elementId, options) {
|
|
6956
|
-
var
|
|
6960
|
+
var _this42 = this;
|
|
6957
6961
|
|
|
6958
6962
|
_classCallCheck(this, WebsyChart);
|
|
6959
6963
|
|
|
@@ -7004,22 +7008,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7004
7008
|
this.invertOverride = function (input, input2) {
|
|
7005
7009
|
var xAxis = 'bottomAxis';
|
|
7006
7010
|
|
|
7007
|
-
if (
|
|
7011
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7008
7012
|
xAxis = 'leftAxis';
|
|
7009
7013
|
}
|
|
7010
7014
|
|
|
7011
|
-
var width =
|
|
7015
|
+
var width = _this42[xAxis].step();
|
|
7012
7016
|
|
|
7013
7017
|
var output;
|
|
7014
7018
|
|
|
7015
|
-
var domain = _toConsumableArray(
|
|
7019
|
+
var domain = _toConsumableArray(_this42[xAxis].domain());
|
|
7016
7020
|
|
|
7017
|
-
if (
|
|
7021
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7018
7022
|
domain = domain.reverse();
|
|
7019
7023
|
}
|
|
7020
7024
|
|
|
7021
7025
|
for (var j = 0; j < domain.length; j++) {
|
|
7022
|
-
var breakA =
|
|
7026
|
+
var breakA = _this42[xAxis](domain[j]) - width / 2;
|
|
7023
7027
|
var breakB = breakA + width;
|
|
7024
7028
|
|
|
7025
7029
|
if (input > breakA && input <= breakB) {
|
|
@@ -7119,10 +7123,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7119
7123
|
}, {
|
|
7120
7124
|
key: "handleEventMouseMove",
|
|
7121
7125
|
value: function handleEventMouseMove(event, d) {
|
|
7122
|
-
var
|
|
7126
|
+
var _this43 = this;
|
|
7123
7127
|
|
|
7124
7128
|
var bisectDate = d3.bisector(function (d) {
|
|
7125
|
-
return
|
|
7129
|
+
return _this43.parseX(d.x.value);
|
|
7126
7130
|
}).left;
|
|
7127
7131
|
|
|
7128
7132
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7161,8 +7165,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7161
7165
|
}
|
|
7162
7166
|
|
|
7163
7167
|
this.options.data.series.forEach(function (s) {
|
|
7164
|
-
if (
|
|
7165
|
-
xPoint =
|
|
7168
|
+
if (_this43.options.data[xData].scale !== 'Time') {
|
|
7169
|
+
xPoint = _this43[xAxis](_this43.parseX(xLabel));
|
|
7166
7170
|
s.data.forEach(function (d) {
|
|
7167
7171
|
if (d.x.value === xLabel) {
|
|
7168
7172
|
if (!tooltipTitle) {
|
|
@@ -7181,13 +7185,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7181
7185
|
var pointA = s.data[index - 1];
|
|
7182
7186
|
var pointB = s.data[index];
|
|
7183
7187
|
|
|
7184
|
-
if (
|
|
7188
|
+
if (_this43.options.orientation === 'horizontal') {
|
|
7185
7189
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7186
7190
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7187
7191
|
}
|
|
7188
7192
|
|
|
7189
7193
|
if (pointA && !pointB) {
|
|
7190
|
-
xPoint =
|
|
7194
|
+
xPoint = _this43[xAxis](_this43.parseX(pointA.x.value));
|
|
7191
7195
|
tooltipTitle = pointA.x.value;
|
|
7192
7196
|
|
|
7193
7197
|
if (!pointA.y.color) {
|
|
@@ -7197,12 +7201,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7197
7201
|
tooltipData.push(pointA.y);
|
|
7198
7202
|
|
|
7199
7203
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7200
|
-
tooltipTitle = d3.timeFormat(
|
|
7204
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7201
7205
|
}
|
|
7202
7206
|
}
|
|
7203
7207
|
|
|
7204
7208
|
if (pointB && !pointA) {
|
|
7205
|
-
xPoint =
|
|
7209
|
+
xPoint = _this43[xAxis](_this43.parseX(pointB.x.value));
|
|
7206
7210
|
tooltipTitle = pointB.x.value;
|
|
7207
7211
|
|
|
7208
7212
|
if (!pointB.y.color) {
|
|
@@ -7212,14 +7216,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7212
7216
|
tooltipData.push(pointB.y);
|
|
7213
7217
|
|
|
7214
7218
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7215
|
-
tooltipTitle = d3.timeFormat(
|
|
7219
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7216
7220
|
}
|
|
7217
7221
|
}
|
|
7218
7222
|
|
|
7219
7223
|
if (pointA && pointB) {
|
|
7220
|
-
var d0 =
|
|
7224
|
+
var d0 = _this43[xAxis](_this43.parseX(pointA.x.value));
|
|
7221
7225
|
|
|
7222
|
-
var d1 =
|
|
7226
|
+
var d1 = _this43[xAxis](_this43.parseX(pointB.x.value));
|
|
7223
7227
|
|
|
7224
7228
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7225
7229
|
|
|
@@ -7228,7 +7232,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7228
7232
|
tooltipTitle = pointB.x.value;
|
|
7229
7233
|
|
|
7230
7234
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7231
|
-
tooltipTitle = d3.timeFormat(
|
|
7235
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7232
7236
|
}
|
|
7233
7237
|
|
|
7234
7238
|
if (!pointB.y.color) {
|
|
@@ -7241,7 +7245,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7241
7245
|
tooltipTitle = pointA.x.value;
|
|
7242
7246
|
|
|
7243
7247
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7244
|
-
tooltipTitle = d3.timeFormat(
|
|
7248
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7245
7249
|
}
|
|
7246
7250
|
|
|
7247
7251
|
if (!pointA.y.color) {
|
|
@@ -7355,7 +7359,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7355
7359
|
}, {
|
|
7356
7360
|
key: "render",
|
|
7357
7361
|
value: function render(options) {
|
|
7358
|
-
var
|
|
7362
|
+
var _this44 = this;
|
|
7359
7363
|
|
|
7360
7364
|
/* global d3 options WebsyUtils */
|
|
7361
7365
|
if (typeof options !== 'undefined') {
|
|
@@ -7424,7 +7428,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7424
7428
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7425
7429
|
return {
|
|
7426
7430
|
value: s.label || s.key,
|
|
7427
|
-
color: s.color ||
|
|
7431
|
+
color: s.color || _this44.options.colors[i % _this44.options.colors.length]
|
|
7428
7432
|
};
|
|
7429
7433
|
});
|
|
7430
7434
|
|
|
@@ -7706,7 +7710,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7706
7710
|
|
|
7707
7711
|
if (this.options.data.bottom.formatter) {
|
|
7708
7712
|
bAxisFunc.tickFormat(function (d) {
|
|
7709
|
-
return
|
|
7713
|
+
return _this44.options.data.bottom.formatter(d);
|
|
7710
7714
|
});
|
|
7711
7715
|
}
|
|
7712
7716
|
|
|
@@ -7732,8 +7736,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7732
7736
|
|
|
7733
7737
|
if (this.options.margin.axisLeft > 0) {
|
|
7734
7738
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7735
|
-
if (
|
|
7736
|
-
d =
|
|
7739
|
+
if (_this44.options.data.left.formatter) {
|
|
7740
|
+
d = _this44.options.data.left.formatter(d);
|
|
7737
7741
|
}
|
|
7738
7742
|
|
|
7739
7743
|
return d;
|
|
@@ -7770,8 +7774,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7770
7774
|
|
|
7771
7775
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7772
7776
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7773
|
-
if (
|
|
7774
|
-
d =
|
|
7777
|
+
if (_this44.options.data.right.formatter) {
|
|
7778
|
+
d = _this44.options.data.right.formatter(d);
|
|
7775
7779
|
}
|
|
7776
7780
|
|
|
7777
7781
|
return d;
|
|
@@ -7810,18 +7814,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7810
7814
|
this.renderedKeys = {};
|
|
7811
7815
|
this.options.data.series.forEach(function (series, index) {
|
|
7812
7816
|
if (!series.key) {
|
|
7813
|
-
series.key =
|
|
7817
|
+
series.key = _this44.createIdentity();
|
|
7814
7818
|
}
|
|
7815
7819
|
|
|
7816
7820
|
if (!series.color) {
|
|
7817
|
-
series.color =
|
|
7821
|
+
series.color = _this44.options.colors[index % _this44.options.colors.length];
|
|
7818
7822
|
}
|
|
7819
7823
|
|
|
7820
|
-
|
|
7824
|
+
_this44["render".concat(series.type || 'bar')](series, index);
|
|
7821
7825
|
|
|
7822
|
-
|
|
7826
|
+
_this44.renderLabels(series, index);
|
|
7823
7827
|
|
|
7824
|
-
|
|
7828
|
+
_this44.renderedKeys[series.key] = series.type;
|
|
7825
7829
|
});
|
|
7826
7830
|
}
|
|
7827
7831
|
}
|
|
@@ -7829,17 +7833,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7829
7833
|
}, {
|
|
7830
7834
|
key: "renderarea",
|
|
7831
7835
|
value: function renderarea(series, index) {
|
|
7832
|
-
var
|
|
7836
|
+
var _this45 = this;
|
|
7833
7837
|
|
|
7834
7838
|
/* global d3 series index */
|
|
7835
7839
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7836
7840
|
return d3.area().x(function (d) {
|
|
7837
|
-
return
|
|
7841
|
+
return _this45[xAxis](_this45.parseX(d.x.value));
|
|
7838
7842
|
}).y0(function (d) {
|
|
7839
|
-
return
|
|
7843
|
+
return _this45[yAxis](0);
|
|
7840
7844
|
}).y1(function (d) {
|
|
7841
|
-
return
|
|
7842
|
-
}).curve(d3[curveStyle ||
|
|
7845
|
+
return _this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7846
|
+
}).curve(d3[curveStyle || _this45.options.curveStyle]);
|
|
7843
7847
|
};
|
|
7844
7848
|
|
|
7845
7849
|
var xAxis = 'bottomAxis';
|
|
@@ -7962,7 +7966,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7962
7966
|
}, {
|
|
7963
7967
|
key: "renderLabels",
|
|
7964
7968
|
value: function renderLabels(series, index) {
|
|
7965
|
-
var
|
|
7969
|
+
var _this46 = this;
|
|
7966
7970
|
|
|
7967
7971
|
/* global series index d3 WebsyDesigns */
|
|
7968
7972
|
var xAxis = 'bottomAxis';
|
|
@@ -7981,11 +7985,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7981
7985
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7982
7986
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7983
7987
|
labels.attr('x', function (d) {
|
|
7984
|
-
return getLabelX.call(
|
|
7988
|
+
return getLabelX.call(_this46, d, series.labelPosition);
|
|
7985
7989
|
}).attr('y', function (d) {
|
|
7986
|
-
return getLabelY.call(
|
|
7990
|
+
return getLabelY.call(_this46, d, series.labelPosition);
|
|
7987
7991
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7988
|
-
return
|
|
7992
|
+
return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7989
7993
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7990
7994
|
return d.y.label || d.y.value;
|
|
7991
7995
|
}).each(function (d, i) {
|
|
@@ -8010,11 +8014,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8010
8014
|
}
|
|
8011
8015
|
});
|
|
8012
8016
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8013
|
-
return getLabelX.call(
|
|
8017
|
+
return getLabelX.call(_this46, d, series.labelPosition);
|
|
8014
8018
|
}).attr('y', function (d) {
|
|
8015
|
-
return getLabelY.call(
|
|
8019
|
+
return getLabelY.call(_this46, d, series.labelPosition);
|
|
8016
8020
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8017
|
-
return
|
|
8021
|
+
return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8018
8022
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8019
8023
|
return d.y.label || d.y.value;
|
|
8020
8024
|
}).each(function (d, i) {
|
|
@@ -8071,16 +8075,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8071
8075
|
}, {
|
|
8072
8076
|
key: "renderline",
|
|
8073
8077
|
value: function renderline(series, index) {
|
|
8074
|
-
var
|
|
8078
|
+
var _this47 = this;
|
|
8075
8079
|
|
|
8076
8080
|
/* global series index d3 */
|
|
8077
8081
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8078
8082
|
return d3.line().x(function (d) {
|
|
8079
|
-
var adjustment =
|
|
8080
|
-
return
|
|
8083
|
+
var adjustment = _this47.options.data[xAxis].scale === 'Time' ? 0 : _this47["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8084
|
+
return _this47["".concat(xAxis, "Axis")](_this47.parseX(d.x.value)) + adjustment;
|
|
8081
8085
|
}).y(function (d) {
|
|
8082
|
-
return
|
|
8083
|
-
}).curve(d3[curveStyle ||
|
|
8086
|
+
return _this47["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8087
|
+
}).curve(d3[curveStyle || _this47.options.curveStyle]);
|
|
8084
8088
|
};
|
|
8085
8089
|
|
|
8086
8090
|
var xAxis = 'bottom';
|
|
@@ -8124,14 +8128,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8124
8128
|
}, {
|
|
8125
8129
|
key: "rendersymbol",
|
|
8126
8130
|
value: function rendersymbol(series, index) {
|
|
8127
|
-
var
|
|
8131
|
+
var _this48 = this;
|
|
8128
8132
|
|
|
8129
8133
|
/* global d3 series index series.key */
|
|
8130
8134
|
var drawSymbol = function drawSymbol(size) {
|
|
8131
8135
|
return d3.symbol() // .type(d => {
|
|
8132
8136
|
// return d3.symbols[0]
|
|
8133
8137
|
// })
|
|
8134
|
-
.size(size ||
|
|
8138
|
+
.size(size || _this48.options.symbolSize);
|
|
8135
8139
|
};
|
|
8136
8140
|
|
|
8137
8141
|
var xAxis = 'bottomAxis';
|
|
@@ -8149,7 +8153,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8149
8153
|
symbols.attr('d', function (d) {
|
|
8150
8154
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8151
8155
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8152
|
-
return "translate(".concat(
|
|
8156
|
+
return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8153
8157
|
}); // Enter
|
|
8154
8158
|
|
|
8155
8159
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8158,7 +8162,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8158
8162
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8159
8163
|
return "symbol symbol_".concat(series.key);
|
|
8160
8164
|
}).attr('transform', function (d) {
|
|
8161
|
-
return "translate(".concat(
|
|
8165
|
+
return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8162
8166
|
});
|
|
8163
8167
|
}
|
|
8164
8168
|
}, {
|
|
@@ -8313,7 +8317,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8313
8317
|
}, {
|
|
8314
8318
|
key: "resize",
|
|
8315
8319
|
value: function resize() {
|
|
8316
|
-
var
|
|
8320
|
+
var _this49 = this;
|
|
8317
8321
|
|
|
8318
8322
|
var el = document.getElementById(this.elementId);
|
|
8319
8323
|
|
|
@@ -8326,7 +8330,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8326
8330
|
// }
|
|
8327
8331
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8328
8332
|
html += this._data.map(function (d, i) {
|
|
8329
|
-
return
|
|
8333
|
+
return _this49.getLegendItemHTML(d);
|
|
8330
8334
|
}).join('');
|
|
8331
8335
|
html += "\n <div>\n ";
|
|
8332
8336
|
el.innerHTML = html;
|
|
@@ -8498,7 +8502,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8498
8502
|
}, {
|
|
8499
8503
|
key: "render",
|
|
8500
8504
|
value: function render() {
|
|
8501
|
-
var
|
|
8505
|
+
var _this50 = this;
|
|
8502
8506
|
|
|
8503
8507
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8504
8508
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8507,7 +8511,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8507
8511
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8508
8512
|
return {
|
|
8509
8513
|
value: s.label || s.key,
|
|
8510
|
-
color: s.color ||
|
|
8514
|
+
color: s.color || _this50.options.colors[i % _this50.options.colors.length]
|
|
8511
8515
|
};
|
|
8512
8516
|
});
|
|
8513
8517
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8571,7 +8575,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8571
8575
|
|
|
8572
8576
|
if (this.polygons) {
|
|
8573
8577
|
this.polygons.forEach(function (p) {
|
|
8574
|
-
return
|
|
8578
|
+
return _this50.map.removeLayer(p);
|
|
8575
8579
|
});
|
|
8576
8580
|
}
|
|
8577
8581
|
|
|
@@ -8629,18 +8633,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8629
8633
|
}
|
|
8630
8634
|
|
|
8631
8635
|
if (!p.options.color) {
|
|
8632
|
-
p.options.color =
|
|
8636
|
+
p.options.color = _this50.options.colors[i % _this50.options.colors.length];
|
|
8633
8637
|
}
|
|
8634
8638
|
|
|
8635
8639
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8636
8640
|
return c.map(function (d) {
|
|
8637
8641
|
return [d.Latitude, d.Longitude];
|
|
8638
8642
|
});
|
|
8639
|
-
}), p.options).addTo(
|
|
8643
|
+
}), p.options).addTo(_this50.map);
|
|
8640
8644
|
|
|
8641
|
-
|
|
8645
|
+
_this50.polygons.push(pol);
|
|
8642
8646
|
|
|
8643
|
-
|
|
8647
|
+
_this50.map.fitBounds(pol.getBounds());
|
|
8644
8648
|
});
|
|
8645
8649
|
} // if (this.data.markers.length > 0) {
|
|
8646
8650
|
// el.classList.remove('hidden')
|