@websy/websy-designs 1.4.2 → 1.4.3
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.
|
@@ -4479,7 +4479,12 @@ class WebsySearch {
|
|
|
4479
4479
|
if (event.target.classList.contains('clear')) {
|
|
4480
4480
|
const inputEl = document.getElementById(`${this.elementId}_search`)
|
|
4481
4481
|
inputEl.value = ''
|
|
4482
|
-
this.options.onSearch
|
|
4482
|
+
// if (this.options.onSearch) {
|
|
4483
|
+
// this.options.onSearch('')
|
|
4484
|
+
// }
|
|
4485
|
+
if (this.options.onClear) {
|
|
4486
|
+
this.options.onClear()
|
|
4487
|
+
}
|
|
4483
4488
|
}
|
|
4484
4489
|
}
|
|
4485
4490
|
handleKeyDown (event) {
|
|
@@ -4511,7 +4516,9 @@ class WebsySearch {
|
|
|
4511
4516
|
}
|
|
4512
4517
|
else {
|
|
4513
4518
|
if (this.options.onSearch && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
4514
|
-
this.options.
|
|
4519
|
+
if (this.options.onClear) {
|
|
4520
|
+
this.options.onClear()
|
|
4521
|
+
}
|
|
4515
4522
|
}
|
|
4516
4523
|
}
|
|
4517
4524
|
}
|
|
@@ -6344,9 +6351,11 @@ class WebsyTable3 {
|
|
|
6344
6351
|
}
|
|
6345
6352
|
else if (data) {
|
|
6346
6353
|
let longest = ''
|
|
6347
|
-
for (let i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6348
|
-
if (
|
|
6349
|
-
longest
|
|
6354
|
+
for (let i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6355
|
+
if (data[i].length === this.options.columns[this.options.columns.length - 1].length) {
|
|
6356
|
+
if (longest.length < data[i][colIndex].value.length) {
|
|
6357
|
+
longest = data[i][colIndex].value
|
|
6358
|
+
}
|
|
6350
6359
|
}
|
|
6351
6360
|
}
|
|
6352
6361
|
output.push({value: longest})
|
package/dist/websy-designs.js
CHANGED
|
@@ -4942,8 +4942,13 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4942
4942
|
value: function handleClick(event) {
|
|
4943
4943
|
if (event.target.classList.contains('clear')) {
|
|
4944
4944
|
var inputEl = document.getElementById("".concat(this.elementId, "_search"));
|
|
4945
|
-
inputEl.value = '';
|
|
4946
|
-
this.options.onSearch('')
|
|
4945
|
+
inputEl.value = ''; // if (this.options.onSearch) {
|
|
4946
|
+
// this.options.onSearch('')
|
|
4947
|
+
// }
|
|
4948
|
+
|
|
4949
|
+
if (this.options.onClear) {
|
|
4950
|
+
this.options.onClear();
|
|
4951
|
+
}
|
|
4947
4952
|
}
|
|
4948
4953
|
}
|
|
4949
4954
|
}, {
|
|
@@ -4982,7 +4987,9 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4982
4987
|
}, this.options.searchTimeout);
|
|
4983
4988
|
} else {
|
|
4984
4989
|
if (this.options.onSearch && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
4985
|
-
this.options.
|
|
4990
|
+
if (this.options.onClear) {
|
|
4991
|
+
this.options.onClear();
|
|
4992
|
+
}
|
|
4986
4993
|
}
|
|
4987
4994
|
}
|
|
4988
4995
|
}
|
|
@@ -6919,6 +6926,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6919
6926
|
}, {
|
|
6920
6927
|
key: "createSample",
|
|
6921
6928
|
value: function createSample(data) {
|
|
6929
|
+
var _this42 = this;
|
|
6930
|
+
|
|
6922
6931
|
var output = [];
|
|
6923
6932
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6924
6933
|
if (col.maxLength) {
|
|
@@ -6929,8 +6938,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6929
6938
|
var longest = '';
|
|
6930
6939
|
|
|
6931
6940
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6932
|
-
if (
|
|
6933
|
-
longest
|
|
6941
|
+
if (data[i].length === _this42.options.columns[_this42.options.columns.length - 1].length) {
|
|
6942
|
+
if (longest.length < data[i][colIndex].value.length) {
|
|
6943
|
+
longest = data[i][colIndex].value;
|
|
6944
|
+
}
|
|
6934
6945
|
}
|
|
6935
6946
|
}
|
|
6936
6947
|
|
|
@@ -7320,7 +7331,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7320
7331
|
|
|
7321
7332
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7322
7333
|
function WebsyChart(elementId, options) {
|
|
7323
|
-
var
|
|
7334
|
+
var _this43 = this;
|
|
7324
7335
|
|
|
7325
7336
|
_classCallCheck(this, WebsyChart);
|
|
7326
7337
|
|
|
@@ -7371,22 +7382,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7371
7382
|
this.invertOverride = function (input, input2) {
|
|
7372
7383
|
var xAxis = 'bottomAxis';
|
|
7373
7384
|
|
|
7374
|
-
if (
|
|
7385
|
+
if (_this43.options.orientation === 'horizontal') {
|
|
7375
7386
|
xAxis = 'leftAxis';
|
|
7376
7387
|
}
|
|
7377
7388
|
|
|
7378
|
-
var width =
|
|
7389
|
+
var width = _this43[xAxis].step();
|
|
7379
7390
|
|
|
7380
7391
|
var output;
|
|
7381
7392
|
|
|
7382
|
-
var domain = _toConsumableArray(
|
|
7393
|
+
var domain = _toConsumableArray(_this43[xAxis].domain());
|
|
7383
7394
|
|
|
7384
|
-
if (
|
|
7395
|
+
if (_this43.options.orientation === 'horizontal') {
|
|
7385
7396
|
domain = domain.reverse();
|
|
7386
7397
|
}
|
|
7387
7398
|
|
|
7388
7399
|
for (var j = 0; j < domain.length; j++) {
|
|
7389
|
-
var breakA =
|
|
7400
|
+
var breakA = _this43[xAxis](domain[j]) - width / 2;
|
|
7390
7401
|
var breakB = breakA + width;
|
|
7391
7402
|
|
|
7392
7403
|
if (input > breakA && input <= breakB) {
|
|
@@ -7486,10 +7497,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7486
7497
|
}, {
|
|
7487
7498
|
key: "handleEventMouseMove",
|
|
7488
7499
|
value: function handleEventMouseMove(event, d) {
|
|
7489
|
-
var
|
|
7500
|
+
var _this44 = this;
|
|
7490
7501
|
|
|
7491
7502
|
var bisectDate = d3.bisector(function (d) {
|
|
7492
|
-
return
|
|
7503
|
+
return _this44.parseX(d.x.value);
|
|
7493
7504
|
}).left;
|
|
7494
7505
|
|
|
7495
7506
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7528,8 +7539,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7528
7539
|
}
|
|
7529
7540
|
|
|
7530
7541
|
this.options.data.series.forEach(function (s) {
|
|
7531
|
-
if (
|
|
7532
|
-
xPoint =
|
|
7542
|
+
if (_this44.options.data[xData].scale !== 'Time') {
|
|
7543
|
+
xPoint = _this44[xAxis](_this44.parseX(xLabel));
|
|
7533
7544
|
s.data.forEach(function (d) {
|
|
7534
7545
|
if (d.x.value === xLabel) {
|
|
7535
7546
|
if (!tooltipTitle) {
|
|
@@ -7548,13 +7559,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7548
7559
|
var pointA = s.data[index - 1];
|
|
7549
7560
|
var pointB = s.data[index];
|
|
7550
7561
|
|
|
7551
|
-
if (
|
|
7562
|
+
if (_this44.options.orientation === 'horizontal') {
|
|
7552
7563
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7553
7564
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7554
7565
|
}
|
|
7555
7566
|
|
|
7556
7567
|
if (pointA && !pointB) {
|
|
7557
|
-
xPoint =
|
|
7568
|
+
xPoint = _this44[xAxis](_this44.parseX(pointA.x.value));
|
|
7558
7569
|
tooltipTitle = pointA.x.value;
|
|
7559
7570
|
|
|
7560
7571
|
if (!pointA.y.color) {
|
|
@@ -7564,12 +7575,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7564
7575
|
tooltipData.push(pointA.y);
|
|
7565
7576
|
|
|
7566
7577
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7567
|
-
tooltipTitle = d3.timeFormat(
|
|
7578
|
+
tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7568
7579
|
}
|
|
7569
7580
|
}
|
|
7570
7581
|
|
|
7571
7582
|
if (pointB && !pointA) {
|
|
7572
|
-
xPoint =
|
|
7583
|
+
xPoint = _this44[xAxis](_this44.parseX(pointB.x.value));
|
|
7573
7584
|
tooltipTitle = pointB.x.value;
|
|
7574
7585
|
|
|
7575
7586
|
if (!pointB.y.color) {
|
|
@@ -7579,14 +7590,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7579
7590
|
tooltipData.push(pointB.y);
|
|
7580
7591
|
|
|
7581
7592
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7582
|
-
tooltipTitle = d3.timeFormat(
|
|
7593
|
+
tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7583
7594
|
}
|
|
7584
7595
|
}
|
|
7585
7596
|
|
|
7586
7597
|
if (pointA && pointB) {
|
|
7587
|
-
var d0 =
|
|
7598
|
+
var d0 = _this44[xAxis](_this44.parseX(pointA.x.value));
|
|
7588
7599
|
|
|
7589
|
-
var d1 =
|
|
7600
|
+
var d1 = _this44[xAxis](_this44.parseX(pointB.x.value));
|
|
7590
7601
|
|
|
7591
7602
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7592
7603
|
|
|
@@ -7595,7 +7606,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7595
7606
|
tooltipTitle = pointB.x.value;
|
|
7596
7607
|
|
|
7597
7608
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7598
|
-
tooltipTitle = d3.timeFormat(
|
|
7609
|
+
tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7599
7610
|
}
|
|
7600
7611
|
|
|
7601
7612
|
if (!pointB.y.color) {
|
|
@@ -7608,7 +7619,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7608
7619
|
tooltipTitle = pointA.x.value;
|
|
7609
7620
|
|
|
7610
7621
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7611
|
-
tooltipTitle = d3.timeFormat(
|
|
7622
|
+
tooltipTitle = d3.timeFormat(_this44.options.dateFormat || _this44.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7612
7623
|
}
|
|
7613
7624
|
|
|
7614
7625
|
if (!pointA.y.color) {
|
|
@@ -7722,7 +7733,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7722
7733
|
}, {
|
|
7723
7734
|
key: "render",
|
|
7724
7735
|
value: function render(options) {
|
|
7725
|
-
var
|
|
7736
|
+
var _this45 = this;
|
|
7726
7737
|
|
|
7727
7738
|
/* global d3 options WebsyUtils */
|
|
7728
7739
|
if (typeof options !== 'undefined') {
|
|
@@ -7791,7 +7802,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7791
7802
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7792
7803
|
return {
|
|
7793
7804
|
value: s.label || s.key,
|
|
7794
|
-
color: s.color ||
|
|
7805
|
+
color: s.color || _this45.options.colors[i % _this45.options.colors.length]
|
|
7795
7806
|
};
|
|
7796
7807
|
});
|
|
7797
7808
|
|
|
@@ -8073,7 +8084,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8073
8084
|
|
|
8074
8085
|
if (this.options.data.bottom.formatter) {
|
|
8075
8086
|
bAxisFunc.tickFormat(function (d) {
|
|
8076
|
-
return
|
|
8087
|
+
return _this45.options.data.bottom.formatter(d);
|
|
8077
8088
|
});
|
|
8078
8089
|
}
|
|
8079
8090
|
|
|
@@ -8099,8 +8110,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8099
8110
|
|
|
8100
8111
|
if (this.options.margin.axisLeft > 0) {
|
|
8101
8112
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8102
|
-
if (
|
|
8103
|
-
d =
|
|
8113
|
+
if (_this45.options.data.left.formatter) {
|
|
8114
|
+
d = _this45.options.data.left.formatter(d);
|
|
8104
8115
|
}
|
|
8105
8116
|
|
|
8106
8117
|
return d;
|
|
@@ -8137,8 +8148,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8137
8148
|
|
|
8138
8149
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8139
8150
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8140
|
-
if (
|
|
8141
|
-
d =
|
|
8151
|
+
if (_this45.options.data.right.formatter) {
|
|
8152
|
+
d = _this45.options.data.right.formatter(d);
|
|
8142
8153
|
}
|
|
8143
8154
|
|
|
8144
8155
|
return d;
|
|
@@ -8177,18 +8188,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8177
8188
|
this.renderedKeys = {};
|
|
8178
8189
|
this.options.data.series.forEach(function (series, index) {
|
|
8179
8190
|
if (!series.key) {
|
|
8180
|
-
series.key =
|
|
8191
|
+
series.key = _this45.createIdentity();
|
|
8181
8192
|
}
|
|
8182
8193
|
|
|
8183
8194
|
if (!series.color) {
|
|
8184
|
-
series.color =
|
|
8195
|
+
series.color = _this45.options.colors[index % _this45.options.colors.length];
|
|
8185
8196
|
}
|
|
8186
8197
|
|
|
8187
|
-
|
|
8198
|
+
_this45["render".concat(series.type || 'bar')](series, index);
|
|
8188
8199
|
|
|
8189
|
-
|
|
8200
|
+
_this45.renderLabels(series, index);
|
|
8190
8201
|
|
|
8191
|
-
|
|
8202
|
+
_this45.renderedKeys[series.key] = series.type;
|
|
8192
8203
|
});
|
|
8193
8204
|
}
|
|
8194
8205
|
}
|
|
@@ -8196,17 +8207,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8196
8207
|
}, {
|
|
8197
8208
|
key: "renderarea",
|
|
8198
8209
|
value: function renderarea(series, index) {
|
|
8199
|
-
var
|
|
8210
|
+
var _this46 = this;
|
|
8200
8211
|
|
|
8201
8212
|
/* global d3 series index */
|
|
8202
8213
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8203
8214
|
return d3.area().x(function (d) {
|
|
8204
|
-
return
|
|
8215
|
+
return _this46[xAxis](_this46.parseX(d.x.value));
|
|
8205
8216
|
}).y0(function (d) {
|
|
8206
|
-
return
|
|
8217
|
+
return _this46[yAxis](0);
|
|
8207
8218
|
}).y1(function (d) {
|
|
8208
|
-
return
|
|
8209
|
-
}).curve(d3[curveStyle ||
|
|
8219
|
+
return _this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8220
|
+
}).curve(d3[curveStyle || _this46.options.curveStyle]);
|
|
8210
8221
|
};
|
|
8211
8222
|
|
|
8212
8223
|
var xAxis = 'bottomAxis';
|
|
@@ -8329,7 +8340,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8329
8340
|
}, {
|
|
8330
8341
|
key: "renderLabels",
|
|
8331
8342
|
value: function renderLabels(series, index) {
|
|
8332
|
-
var
|
|
8343
|
+
var _this47 = this;
|
|
8333
8344
|
|
|
8334
8345
|
/* global series index d3 WebsyDesigns */
|
|
8335
8346
|
var xAxis = 'bottomAxis';
|
|
@@ -8348,11 +8359,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8348
8359
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8349
8360
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8350
8361
|
labels.attr('x', function (d) {
|
|
8351
|
-
return getLabelX.call(
|
|
8362
|
+
return getLabelX.call(_this47, d, series.labelPosition);
|
|
8352
8363
|
}).attr('y', function (d) {
|
|
8353
|
-
return getLabelY.call(
|
|
8364
|
+
return getLabelY.call(_this47, d, series.labelPosition);
|
|
8354
8365
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8355
|
-
return
|
|
8366
|
+
return _this47.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8356
8367
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8357
8368
|
return d.y.label || d.y.value;
|
|
8358
8369
|
}).each(function (d, i) {
|
|
@@ -8377,11 +8388,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8377
8388
|
}
|
|
8378
8389
|
});
|
|
8379
8390
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8380
|
-
return getLabelX.call(
|
|
8391
|
+
return getLabelX.call(_this47, d, series.labelPosition);
|
|
8381
8392
|
}).attr('y', function (d) {
|
|
8382
|
-
return getLabelY.call(
|
|
8393
|
+
return getLabelY.call(_this47, d, series.labelPosition);
|
|
8383
8394
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8384
|
-
return
|
|
8395
|
+
return _this47.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8385
8396
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8386
8397
|
return d.y.label || d.y.value;
|
|
8387
8398
|
}).each(function (d, i) {
|
|
@@ -8438,16 +8449,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8438
8449
|
}, {
|
|
8439
8450
|
key: "renderline",
|
|
8440
8451
|
value: function renderline(series, index) {
|
|
8441
|
-
var
|
|
8452
|
+
var _this48 = this;
|
|
8442
8453
|
|
|
8443
8454
|
/* global series index d3 */
|
|
8444
8455
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8445
8456
|
return d3.line().x(function (d) {
|
|
8446
|
-
var adjustment =
|
|
8447
|
-
return
|
|
8457
|
+
var adjustment = _this48.options.data[xAxis].scale === 'Time' ? 0 : _this48["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8458
|
+
return _this48["".concat(xAxis, "Axis")](_this48.parseX(d.x.value)) + adjustment;
|
|
8448
8459
|
}).y(function (d) {
|
|
8449
|
-
return
|
|
8450
|
-
}).curve(d3[curveStyle ||
|
|
8460
|
+
return _this48["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8461
|
+
}).curve(d3[curveStyle || _this48.options.curveStyle]);
|
|
8451
8462
|
};
|
|
8452
8463
|
|
|
8453
8464
|
var xAxis = 'bottom';
|
|
@@ -8491,14 +8502,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8491
8502
|
}, {
|
|
8492
8503
|
key: "rendersymbol",
|
|
8493
8504
|
value: function rendersymbol(series, index) {
|
|
8494
|
-
var
|
|
8505
|
+
var _this49 = this;
|
|
8495
8506
|
|
|
8496
8507
|
/* global d3 series index series.key */
|
|
8497
8508
|
var drawSymbol = function drawSymbol(size) {
|
|
8498
8509
|
return d3.symbol() // .type(d => {
|
|
8499
8510
|
// return d3.symbols[0]
|
|
8500
8511
|
// })
|
|
8501
|
-
.size(size ||
|
|
8512
|
+
.size(size || _this49.options.symbolSize);
|
|
8502
8513
|
};
|
|
8503
8514
|
|
|
8504
8515
|
var xAxis = 'bottomAxis';
|
|
@@ -8516,7 +8527,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8516
8527
|
symbols.attr('d', function (d) {
|
|
8517
8528
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8518
8529
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8519
|
-
return "translate(".concat(
|
|
8530
|
+
return "translate(".concat(_this49[xAxis](_this49.parseX(d.x.value)), ", ").concat(_this49[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8520
8531
|
}); // Enter
|
|
8521
8532
|
|
|
8522
8533
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8525,7 +8536,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8525
8536
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8526
8537
|
return "symbol symbol_".concat(series.key);
|
|
8527
8538
|
}).attr('transform', function (d) {
|
|
8528
|
-
return "translate(".concat(
|
|
8539
|
+
return "translate(".concat(_this49[xAxis](_this49.parseX(d.x.value)), ", ").concat(_this49[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8529
8540
|
});
|
|
8530
8541
|
}
|
|
8531
8542
|
}, {
|
|
@@ -8680,7 +8691,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8680
8691
|
}, {
|
|
8681
8692
|
key: "resize",
|
|
8682
8693
|
value: function resize() {
|
|
8683
|
-
var
|
|
8694
|
+
var _this50 = this;
|
|
8684
8695
|
|
|
8685
8696
|
var el = document.getElementById(this.elementId);
|
|
8686
8697
|
|
|
@@ -8693,7 +8704,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8693
8704
|
// }
|
|
8694
8705
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8695
8706
|
html += this._data.map(function (d, i) {
|
|
8696
|
-
return
|
|
8707
|
+
return _this50.getLegendItemHTML(d);
|
|
8697
8708
|
}).join('');
|
|
8698
8709
|
html += "\n <div>\n ";
|
|
8699
8710
|
el.innerHTML = html;
|
|
@@ -8865,7 +8876,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8865
8876
|
}, {
|
|
8866
8877
|
key: "render",
|
|
8867
8878
|
value: function render() {
|
|
8868
|
-
var
|
|
8879
|
+
var _this51 = this;
|
|
8869
8880
|
|
|
8870
8881
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8871
8882
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8874,7 +8885,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8874
8885
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8875
8886
|
return {
|
|
8876
8887
|
value: s.label || s.key,
|
|
8877
|
-
color: s.color ||
|
|
8888
|
+
color: s.color || _this51.options.colors[i % _this51.options.colors.length]
|
|
8878
8889
|
};
|
|
8879
8890
|
});
|
|
8880
8891
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8938,7 +8949,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8938
8949
|
|
|
8939
8950
|
if (this.polygons) {
|
|
8940
8951
|
this.polygons.forEach(function (p) {
|
|
8941
|
-
return
|
|
8952
|
+
return _this51.map.removeLayer(p);
|
|
8942
8953
|
});
|
|
8943
8954
|
}
|
|
8944
8955
|
|
|
@@ -8996,18 +9007,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8996
9007
|
}
|
|
8997
9008
|
|
|
8998
9009
|
if (!p.options.color) {
|
|
8999
|
-
p.options.color =
|
|
9010
|
+
p.options.color = _this51.options.colors[i % _this51.options.colors.length];
|
|
9000
9011
|
}
|
|
9001
9012
|
|
|
9002
9013
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9003
9014
|
return c.map(function (d) {
|
|
9004
9015
|
return [d.Latitude, d.Longitude];
|
|
9005
9016
|
});
|
|
9006
|
-
}), p.options).addTo(
|
|
9017
|
+
}), p.options).addTo(_this51.map);
|
|
9007
9018
|
|
|
9008
|
-
|
|
9019
|
+
_this51.polygons.push(pol);
|
|
9009
9020
|
|
|
9010
|
-
|
|
9021
|
+
_this51.map.fitBounds(pol.getBounds());
|
|
9011
9022
|
});
|
|
9012
9023
|
} // if (this.data.markers.length > 0) {
|
|
9013
9024
|
// el.classList.remove('hidden')
|