@websy/websy-designs 1.4.2 → 1.4.4
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 +57 -19
- package/dist/websy-designs-es6.js +110 -75
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +66 -21
- package/dist/websy-designs.js +120 -78
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -232,7 +232,9 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
232
232
|
var DEFAULTS = {
|
|
233
233
|
style: 'button',
|
|
234
234
|
subscribers: {},
|
|
235
|
-
activeItem:
|
|
235
|
+
activeItem: -1,
|
|
236
|
+
tag: 'div',
|
|
237
|
+
allowNone: false
|
|
236
238
|
};
|
|
237
239
|
this.options = _extends({}, DEFAULTS, options);
|
|
238
240
|
var el = document.getElementById(this.elementId);
|
|
@@ -250,7 +252,7 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
250
252
|
var index = +event.target.getAttribute('data-index');
|
|
251
253
|
|
|
252
254
|
if (this.options.activeItem !== index) {
|
|
253
|
-
if (this.options.onDeactivate) {
|
|
255
|
+
if (this.options.onDeactivate && this.options.activeItem !== -1) {
|
|
254
256
|
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem);
|
|
255
257
|
}
|
|
256
258
|
|
|
@@ -269,6 +271,13 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
269
271
|
});
|
|
270
272
|
event.target.classList.remove('inactive');
|
|
271
273
|
event.target.classList.add('active');
|
|
274
|
+
} else if (this.options.activeItem === index && this.options.allowNone === true) {
|
|
275
|
+
if (this.options.onDeactivate) {
|
|
276
|
+
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
this.options.activeItem = -1;
|
|
280
|
+
event.target.classList.remove('active');
|
|
272
281
|
}
|
|
273
282
|
}
|
|
274
283
|
}
|
|
@@ -303,7 +312,7 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
303
312
|
activeClass = i === _this.options.activeItem ? 'active' : 'inactive';
|
|
304
313
|
}
|
|
305
314
|
|
|
306
|
-
return "\n <
|
|
315
|
+
return "\n <".concat(_this.options.tag, " ").concat((t.attributes || []).join(' '), " data-id=\"").concat(t.id || t.label, "\" data-index=\"").concat(i, "\" class=\"websy-button-group-item ").concat((t.classes || []).join(' '), " ").concat(_this.options.style, "-style ").concat(activeClass, "\">").concat(t.label, "</").concat(_this.options.tag, ">\n ");
|
|
307
316
|
}).join('');
|
|
308
317
|
}
|
|
309
318
|
}
|
|
@@ -1653,7 +1662,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1653
1662
|
el.style.zIndex = '';
|
|
1654
1663
|
}
|
|
1655
1664
|
|
|
1656
|
-
scrollEl
|
|
1665
|
+
if (scrollEl) {
|
|
1666
|
+
scrollEl.scrollTo(0, 0);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1657
1669
|
maskEl.classList.remove('active');
|
|
1658
1670
|
contentEl.classList.remove('active');
|
|
1659
1671
|
contentEl.classList.remove('on-top');
|
|
@@ -4942,8 +4954,13 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4942
4954
|
value: function handleClick(event) {
|
|
4943
4955
|
if (event.target.classList.contains('clear')) {
|
|
4944
4956
|
var inputEl = document.getElementById("".concat(this.elementId, "_search"));
|
|
4945
|
-
inputEl.value = '';
|
|
4946
|
-
this.options.onSearch('')
|
|
4957
|
+
inputEl.value = ''; // if (this.options.onSearch) {
|
|
4958
|
+
// this.options.onSearch('')
|
|
4959
|
+
// }
|
|
4960
|
+
|
|
4961
|
+
if (this.options.onClear) {
|
|
4962
|
+
this.options.onClear();
|
|
4963
|
+
}
|
|
4947
4964
|
}
|
|
4948
4965
|
}
|
|
4949
4966
|
}, {
|
|
@@ -4982,7 +4999,9 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4982
4999
|
}, this.options.searchTimeout);
|
|
4983
5000
|
} else {
|
|
4984
5001
|
if (this.options.onSearch && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
4985
|
-
this.options.
|
|
5002
|
+
if (this.options.onClear) {
|
|
5003
|
+
this.options.onClear();
|
|
5004
|
+
}
|
|
4986
5005
|
}
|
|
4987
5006
|
}
|
|
4988
5007
|
}
|
|
@@ -6626,14 +6645,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6626
6645
|
return; // need to revisit this logic
|
|
6627
6646
|
}
|
|
6628
6647
|
|
|
6629
|
-
var style =
|
|
6630
|
-
var divStyle =
|
|
6648
|
+
var style = '';
|
|
6649
|
+
var divStyle = '';
|
|
6650
|
+
|
|
6651
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
6652
|
+
style = "width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important; ");
|
|
6653
|
+
divStyle = style;
|
|
6654
|
+
}
|
|
6631
6655
|
|
|
6632
6656
|
if (cell.style) {
|
|
6633
6657
|
style += cell.style;
|
|
6634
6658
|
}
|
|
6635
6659
|
|
|
6636
|
-
if (useWidths === true) {
|
|
6660
|
+
if (useWidths === true && (+cell.colspan === 1 || !cell.colspan)) {
|
|
6637
6661
|
style += "max-width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important;");
|
|
6638
6662
|
divStyle += "max-width: ".concat(sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth, "px!important;");
|
|
6639
6663
|
}
|
|
@@ -6668,6 +6692,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6668
6692
|
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(WebsyDesigns.Icons.MinusFilled, "</i>");
|
|
6669
6693
|
}
|
|
6670
6694
|
|
|
6695
|
+
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6696
|
+
cell.value = "\n <a href='".concat(cell.value, "' target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
|
|
6697
|
+
}
|
|
6698
|
+
|
|
6699
|
+
if (sizingColumns[sizeIndex].showAsRouterLink === true && cell.value.trim() !== '') {
|
|
6700
|
+
cell.value = "\n <a data-view='".concat((cell.link || cell.value).replace(/'/g, '\''), "' class='websy-trigger'>").concat(cell.value, "</a>\n ");
|
|
6701
|
+
}
|
|
6702
|
+
|
|
6703
|
+
if (sizingColumns[sizeIndex].showAsImage === true) {
|
|
6704
|
+
cell.value = "\n <img \n style=\"width: ".concat(sizingColumns[sizeIndex].imgWidth ? sizingColumns[sizeIndex].imgWidth : 'auto', "; height: ").concat(sizingColumns[sizeIndex].imgHeight ? sizingColumns[sizeIndex].imgHeight : 'auto', ";\" \n src='").concat(cell.value, "'\n ").concat(sizingColumns[sizeIndex].errorImage ? 'onerror="this.src=\'' + sizingColumns[sizeIndex].errorImage + '\'"' : '', "\n />\n ");
|
|
6705
|
+
}
|
|
6706
|
+
|
|
6671
6707
|
bodyHtml += "\n ".concat(cell.value, "\n </div></td>");
|
|
6672
6708
|
});
|
|
6673
6709
|
bodyHtml += "</tr>";
|
|
@@ -6919,6 +6955,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6919
6955
|
}, {
|
|
6920
6956
|
key: "createSample",
|
|
6921
6957
|
value: function createSample(data) {
|
|
6958
|
+
var _this42 = this;
|
|
6959
|
+
|
|
6922
6960
|
var output = [];
|
|
6923
6961
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6924
6962
|
if (col.maxLength) {
|
|
@@ -6929,8 +6967,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6929
6967
|
var longest = '';
|
|
6930
6968
|
|
|
6931
6969
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6932
|
-
if (
|
|
6933
|
-
longest
|
|
6970
|
+
if (data[i].length === _this42.options.columns[_this42.options.columns.length - 1].length) {
|
|
6971
|
+
if (longest.length < data[i][colIndex].value.length) {
|
|
6972
|
+
longest = data[i][colIndex].value;
|
|
6973
|
+
}
|
|
6934
6974
|
}
|
|
6935
6975
|
}
|
|
6936
6976
|
|
|
@@ -7021,12 +7061,14 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7021
7061
|
}, {
|
|
7022
7062
|
key: "handleScrollWheel",
|
|
7023
7063
|
value: function handleScrollWheel(event) {
|
|
7024
|
-
|
|
7064
|
+
if (this.options.virtualScroll === true) {
|
|
7065
|
+
event.preventDefault(); // console.log('scrollwheel', event)
|
|
7025
7066
|
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7067
|
+
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
7068
|
+
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
|
|
7069
|
+
} else {
|
|
7070
|
+
this.scrollY(Math.max(-5, Math.min(5, event.deltaY)));
|
|
7071
|
+
}
|
|
7030
7072
|
}
|
|
7031
7073
|
}
|
|
7032
7074
|
}, {
|
|
@@ -7320,7 +7362,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7320
7362
|
|
|
7321
7363
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7322
7364
|
function WebsyChart(elementId, options) {
|
|
7323
|
-
var
|
|
7365
|
+
var _this43 = this;
|
|
7324
7366
|
|
|
7325
7367
|
_classCallCheck(this, WebsyChart);
|
|
7326
7368
|
|
|
@@ -7371,22 +7413,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7371
7413
|
this.invertOverride = function (input, input2) {
|
|
7372
7414
|
var xAxis = 'bottomAxis';
|
|
7373
7415
|
|
|
7374
|
-
if (
|
|
7416
|
+
if (_this43.options.orientation === 'horizontal') {
|
|
7375
7417
|
xAxis = 'leftAxis';
|
|
7376
7418
|
}
|
|
7377
7419
|
|
|
7378
|
-
var width =
|
|
7420
|
+
var width = _this43[xAxis].step();
|
|
7379
7421
|
|
|
7380
7422
|
var output;
|
|
7381
7423
|
|
|
7382
|
-
var domain = _toConsumableArray(
|
|
7424
|
+
var domain = _toConsumableArray(_this43[xAxis].domain());
|
|
7383
7425
|
|
|
7384
|
-
if (
|
|
7426
|
+
if (_this43.options.orientation === 'horizontal') {
|
|
7385
7427
|
domain = domain.reverse();
|
|
7386
7428
|
}
|
|
7387
7429
|
|
|
7388
7430
|
for (var j = 0; j < domain.length; j++) {
|
|
7389
|
-
var breakA =
|
|
7431
|
+
var breakA = _this43[xAxis](domain[j]) - width / 2;
|
|
7390
7432
|
var breakB = breakA + width;
|
|
7391
7433
|
|
|
7392
7434
|
if (input > breakA && input <= breakB) {
|
|
@@ -7486,10 +7528,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7486
7528
|
}, {
|
|
7487
7529
|
key: "handleEventMouseMove",
|
|
7488
7530
|
value: function handleEventMouseMove(event, d) {
|
|
7489
|
-
var
|
|
7531
|
+
var _this44 = this;
|
|
7490
7532
|
|
|
7491
7533
|
var bisectDate = d3.bisector(function (d) {
|
|
7492
|
-
return
|
|
7534
|
+
return _this44.parseX(d.x.value);
|
|
7493
7535
|
}).left;
|
|
7494
7536
|
|
|
7495
7537
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7528,8 +7570,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7528
7570
|
}
|
|
7529
7571
|
|
|
7530
7572
|
this.options.data.series.forEach(function (s) {
|
|
7531
|
-
if (
|
|
7532
|
-
xPoint =
|
|
7573
|
+
if (_this44.options.data[xData].scale !== 'Time') {
|
|
7574
|
+
xPoint = _this44[xAxis](_this44.parseX(xLabel));
|
|
7533
7575
|
s.data.forEach(function (d) {
|
|
7534
7576
|
if (d.x.value === xLabel) {
|
|
7535
7577
|
if (!tooltipTitle) {
|
|
@@ -7548,13 +7590,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7548
7590
|
var pointA = s.data[index - 1];
|
|
7549
7591
|
var pointB = s.data[index];
|
|
7550
7592
|
|
|
7551
|
-
if (
|
|
7593
|
+
if (_this44.options.orientation === 'horizontal') {
|
|
7552
7594
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7553
7595
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7554
7596
|
}
|
|
7555
7597
|
|
|
7556
7598
|
if (pointA && !pointB) {
|
|
7557
|
-
xPoint =
|
|
7599
|
+
xPoint = _this44[xAxis](_this44.parseX(pointA.x.value));
|
|
7558
7600
|
tooltipTitle = pointA.x.value;
|
|
7559
7601
|
|
|
7560
7602
|
if (!pointA.y.color) {
|
|
@@ -7564,12 +7606,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7564
7606
|
tooltipData.push(pointA.y);
|
|
7565
7607
|
|
|
7566
7608
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7567
|
-
tooltipTitle = d3.timeFormat(
|
|
7609
|
+
tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7568
7610
|
}
|
|
7569
7611
|
}
|
|
7570
7612
|
|
|
7571
7613
|
if (pointB && !pointA) {
|
|
7572
|
-
xPoint =
|
|
7614
|
+
xPoint = _this44[xAxis](_this44.parseX(pointB.x.value));
|
|
7573
7615
|
tooltipTitle = pointB.x.value;
|
|
7574
7616
|
|
|
7575
7617
|
if (!pointB.y.color) {
|
|
@@ -7579,14 +7621,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7579
7621
|
tooltipData.push(pointB.y);
|
|
7580
7622
|
|
|
7581
7623
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7582
|
-
tooltipTitle = d3.timeFormat(
|
|
7624
|
+
tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7583
7625
|
}
|
|
7584
7626
|
}
|
|
7585
7627
|
|
|
7586
7628
|
if (pointA && pointB) {
|
|
7587
|
-
var d0 =
|
|
7629
|
+
var d0 = _this44[xAxis](_this44.parseX(pointA.x.value));
|
|
7588
7630
|
|
|
7589
|
-
var d1 =
|
|
7631
|
+
var d1 = _this44[xAxis](_this44.parseX(pointB.x.value));
|
|
7590
7632
|
|
|
7591
7633
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7592
7634
|
|
|
@@ -7595,7 +7637,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7595
7637
|
tooltipTitle = pointB.x.value;
|
|
7596
7638
|
|
|
7597
7639
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7598
|
-
tooltipTitle = d3.timeFormat(
|
|
7640
|
+
tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7599
7641
|
}
|
|
7600
7642
|
|
|
7601
7643
|
if (!pointB.y.color) {
|
|
@@ -7608,7 +7650,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7608
7650
|
tooltipTitle = pointA.x.value;
|
|
7609
7651
|
|
|
7610
7652
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7611
|
-
tooltipTitle = d3.timeFormat(
|
|
7653
|
+
tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7612
7654
|
}
|
|
7613
7655
|
|
|
7614
7656
|
if (!pointA.y.color) {
|
|
@@ -7722,7 +7764,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7722
7764
|
}, {
|
|
7723
7765
|
key: "render",
|
|
7724
7766
|
value: function render(options) {
|
|
7725
|
-
var
|
|
7767
|
+
var _this45 = this;
|
|
7726
7768
|
|
|
7727
7769
|
/* global d3 options WebsyUtils */
|
|
7728
7770
|
if (typeof options !== 'undefined') {
|
|
@@ -7791,7 +7833,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7791
7833
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7792
7834
|
return {
|
|
7793
7835
|
value: s.label || s.key,
|
|
7794
|
-
color: s.color ||
|
|
7836
|
+
color: s.color || _this45.options.colors[i % _this45.options.colors.length]
|
|
7795
7837
|
};
|
|
7796
7838
|
});
|
|
7797
7839
|
|
|
@@ -8073,7 +8115,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8073
8115
|
|
|
8074
8116
|
if (this.options.data.bottom.formatter) {
|
|
8075
8117
|
bAxisFunc.tickFormat(function (d) {
|
|
8076
|
-
return
|
|
8118
|
+
return _this45.options.data.bottom.formatter(d);
|
|
8077
8119
|
});
|
|
8078
8120
|
}
|
|
8079
8121
|
|
|
@@ -8099,8 +8141,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8099
8141
|
|
|
8100
8142
|
if (this.options.margin.axisLeft > 0) {
|
|
8101
8143
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8102
|
-
if (
|
|
8103
|
-
d =
|
|
8144
|
+
if (_this45.options.data.left.formatter) {
|
|
8145
|
+
d = _this45.options.data.left.formatter(d);
|
|
8104
8146
|
}
|
|
8105
8147
|
|
|
8106
8148
|
return d;
|
|
@@ -8137,8 +8179,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8137
8179
|
|
|
8138
8180
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8139
8181
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8140
|
-
if (
|
|
8141
|
-
d =
|
|
8182
|
+
if (_this45.options.data.right.formatter) {
|
|
8183
|
+
d = _this45.options.data.right.formatter(d);
|
|
8142
8184
|
}
|
|
8143
8185
|
|
|
8144
8186
|
return d;
|
|
@@ -8177,18 +8219,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8177
8219
|
this.renderedKeys = {};
|
|
8178
8220
|
this.options.data.series.forEach(function (series, index) {
|
|
8179
8221
|
if (!series.key) {
|
|
8180
|
-
series.key =
|
|
8222
|
+
series.key = _this45.createIdentity();
|
|
8181
8223
|
}
|
|
8182
8224
|
|
|
8183
8225
|
if (!series.color) {
|
|
8184
|
-
series.color =
|
|
8226
|
+
series.color = _this45.options.colors[index % _this45.options.colors.length];
|
|
8185
8227
|
}
|
|
8186
8228
|
|
|
8187
|
-
|
|
8229
|
+
_this45["render".concat(series.type || 'bar')](series, index);
|
|
8188
8230
|
|
|
8189
|
-
|
|
8231
|
+
_this45.renderLabels(series, index);
|
|
8190
8232
|
|
|
8191
|
-
|
|
8233
|
+
_this45.renderedKeys[series.key] = series.type;
|
|
8192
8234
|
});
|
|
8193
8235
|
}
|
|
8194
8236
|
}
|
|
@@ -8196,17 +8238,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8196
8238
|
}, {
|
|
8197
8239
|
key: "renderarea",
|
|
8198
8240
|
value: function renderarea(series, index) {
|
|
8199
|
-
var
|
|
8241
|
+
var _this46 = this;
|
|
8200
8242
|
|
|
8201
8243
|
/* global d3 series index */
|
|
8202
8244
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8203
8245
|
return d3.area().x(function (d) {
|
|
8204
|
-
return
|
|
8246
|
+
return _this46[xAxis](_this46.parseX(d.x.value));
|
|
8205
8247
|
}).y0(function (d) {
|
|
8206
|
-
return
|
|
8248
|
+
return _this46[yAxis](0);
|
|
8207
8249
|
}).y1(function (d) {
|
|
8208
|
-
return
|
|
8209
|
-
}).curve(d3[curveStyle ||
|
|
8250
|
+
return _this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8251
|
+
}).curve(d3[curveStyle || _this46.options.curveStyle]);
|
|
8210
8252
|
};
|
|
8211
8253
|
|
|
8212
8254
|
var xAxis = 'bottomAxis';
|
|
@@ -8329,7 +8371,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8329
8371
|
}, {
|
|
8330
8372
|
key: "renderLabels",
|
|
8331
8373
|
value: function renderLabels(series, index) {
|
|
8332
|
-
var
|
|
8374
|
+
var _this47 = this;
|
|
8333
8375
|
|
|
8334
8376
|
/* global series index d3 WebsyDesigns */
|
|
8335
8377
|
var xAxis = 'bottomAxis';
|
|
@@ -8348,11 +8390,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8348
8390
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8349
8391
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8350
8392
|
labels.attr('x', function (d) {
|
|
8351
|
-
return getLabelX.call(
|
|
8393
|
+
return getLabelX.call(_this47, d, series.labelPosition);
|
|
8352
8394
|
}).attr('y', function (d) {
|
|
8353
|
-
return getLabelY.call(
|
|
8395
|
+
return getLabelY.call(_this47, d, series.labelPosition);
|
|
8354
8396
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8355
|
-
return
|
|
8397
|
+
return _this47.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8356
8398
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8357
8399
|
return d.y.label || d.y.value;
|
|
8358
8400
|
}).each(function (d, i) {
|
|
@@ -8377,11 +8419,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8377
8419
|
}
|
|
8378
8420
|
});
|
|
8379
8421
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8380
|
-
return getLabelX.call(
|
|
8422
|
+
return getLabelX.call(_this47, d, series.labelPosition);
|
|
8381
8423
|
}).attr('y', function (d) {
|
|
8382
|
-
return getLabelY.call(
|
|
8424
|
+
return getLabelY.call(_this47, d, series.labelPosition);
|
|
8383
8425
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8384
|
-
return
|
|
8426
|
+
return _this47.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8385
8427
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8386
8428
|
return d.y.label || d.y.value;
|
|
8387
8429
|
}).each(function (d, i) {
|
|
@@ -8438,16 +8480,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8438
8480
|
}, {
|
|
8439
8481
|
key: "renderline",
|
|
8440
8482
|
value: function renderline(series, index) {
|
|
8441
|
-
var
|
|
8483
|
+
var _this48 = this;
|
|
8442
8484
|
|
|
8443
8485
|
/* global series index d3 */
|
|
8444
8486
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8445
8487
|
return d3.line().x(function (d) {
|
|
8446
|
-
var adjustment =
|
|
8447
|
-
return
|
|
8488
|
+
var adjustment = _this48.options.data[xAxis].scale === 'Time' ? 0 : _this48["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8489
|
+
return _this48["".concat(xAxis, "Axis")](_this48.parseX(d.x.value)) + adjustment;
|
|
8448
8490
|
}).y(function (d) {
|
|
8449
|
-
return
|
|
8450
|
-
}).curve(d3[curveStyle ||
|
|
8491
|
+
return _this48["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8492
|
+
}).curve(d3[curveStyle || _this48.options.curveStyle]);
|
|
8451
8493
|
};
|
|
8452
8494
|
|
|
8453
8495
|
var xAxis = 'bottom';
|
|
@@ -8491,14 +8533,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8491
8533
|
}, {
|
|
8492
8534
|
key: "rendersymbol",
|
|
8493
8535
|
value: function rendersymbol(series, index) {
|
|
8494
|
-
var
|
|
8536
|
+
var _this49 = this;
|
|
8495
8537
|
|
|
8496
8538
|
/* global d3 series index series.key */
|
|
8497
8539
|
var drawSymbol = function drawSymbol(size) {
|
|
8498
8540
|
return d3.symbol() // .type(d => {
|
|
8499
8541
|
// return d3.symbols[0]
|
|
8500
8542
|
// })
|
|
8501
|
-
.size(size ||
|
|
8543
|
+
.size(size || _this49.options.symbolSize);
|
|
8502
8544
|
};
|
|
8503
8545
|
|
|
8504
8546
|
var xAxis = 'bottomAxis';
|
|
@@ -8516,7 +8558,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8516
8558
|
symbols.attr('d', function (d) {
|
|
8517
8559
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8518
8560
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8519
|
-
return "translate(".concat(
|
|
8561
|
+
return "translate(".concat(_this49[xAxis](_this49.parseX(d.x.value)), ", ").concat(_this49[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8520
8562
|
}); // Enter
|
|
8521
8563
|
|
|
8522
8564
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8525,7 +8567,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8525
8567
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8526
8568
|
return "symbol symbol_".concat(series.key);
|
|
8527
8569
|
}).attr('transform', function (d) {
|
|
8528
|
-
return "translate(".concat(
|
|
8570
|
+
return "translate(".concat(_this49[xAxis](_this49.parseX(d.x.value)), ", ").concat(_this49[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8529
8571
|
});
|
|
8530
8572
|
}
|
|
8531
8573
|
}, {
|
|
@@ -8680,7 +8722,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8680
8722
|
}, {
|
|
8681
8723
|
key: "resize",
|
|
8682
8724
|
value: function resize() {
|
|
8683
|
-
var
|
|
8725
|
+
var _this50 = this;
|
|
8684
8726
|
|
|
8685
8727
|
var el = document.getElementById(this.elementId);
|
|
8686
8728
|
|
|
@@ -8693,7 +8735,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8693
8735
|
// }
|
|
8694
8736
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8695
8737
|
html += this._data.map(function (d, i) {
|
|
8696
|
-
return
|
|
8738
|
+
return _this50.getLegendItemHTML(d);
|
|
8697
8739
|
}).join('');
|
|
8698
8740
|
html += "\n <div>\n ";
|
|
8699
8741
|
el.innerHTML = html;
|
|
@@ -8865,7 +8907,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8865
8907
|
}, {
|
|
8866
8908
|
key: "render",
|
|
8867
8909
|
value: function render() {
|
|
8868
|
-
var
|
|
8910
|
+
var _this51 = this;
|
|
8869
8911
|
|
|
8870
8912
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8871
8913
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8874,7 +8916,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8874
8916
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8875
8917
|
return {
|
|
8876
8918
|
value: s.label || s.key,
|
|
8877
|
-
color: s.color ||
|
|
8919
|
+
color: s.color || _this51.options.colors[i % _this51.options.colors.length]
|
|
8878
8920
|
};
|
|
8879
8921
|
});
|
|
8880
8922
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8938,7 +8980,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8938
8980
|
|
|
8939
8981
|
if (this.polygons) {
|
|
8940
8982
|
this.polygons.forEach(function (p) {
|
|
8941
|
-
return
|
|
8983
|
+
return _this51.map.removeLayer(p);
|
|
8942
8984
|
});
|
|
8943
8985
|
}
|
|
8944
8986
|
|
|
@@ -8996,18 +9038,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8996
9038
|
}
|
|
8997
9039
|
|
|
8998
9040
|
if (!p.options.color) {
|
|
8999
|
-
p.options.color =
|
|
9041
|
+
p.options.color = _this51.options.colors[i % _this51.options.colors.length];
|
|
9000
9042
|
}
|
|
9001
9043
|
|
|
9002
9044
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9003
9045
|
return c.map(function (d) {
|
|
9004
9046
|
return [d.Latitude, d.Longitude];
|
|
9005
9047
|
});
|
|
9006
|
-
}), p.options).addTo(
|
|
9048
|
+
}), p.options).addTo(_this51.map);
|
|
9007
9049
|
|
|
9008
|
-
|
|
9050
|
+
_this51.polygons.push(pol);
|
|
9009
9051
|
|
|
9010
|
-
|
|
9052
|
+
_this51.map.fitBounds(pol.getBounds());
|
|
9011
9053
|
});
|
|
9012
9054
|
} // if (this.data.markers.length > 0) {
|
|
9013
9055
|
// el.classList.remove('hidden')
|