@websy/websy-designs 1.4.38 → 1.5.1
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 +215 -87
- package/dist/websy-designs-es6.js +233 -86
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +215 -87
- package/dist/websy-designs.js +233 -86
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -6427,7 +6427,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6427
6427
|
} // console.log('rowspan', cell.rowspan)
|
|
6428
6428
|
|
|
6429
6429
|
|
|
6430
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this37.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(sizeIndex, "'\n "); // if (useWidths === true) {
|
|
6430
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this37.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(sizeIndex, "'\n "); // if (useWidths === true) {
|
|
6431
6431
|
// bodyHtml += `
|
|
6432
6432
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
6433
6433
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
@@ -6505,7 +6505,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6505
6505
|
style += col.style;
|
|
6506
6506
|
}
|
|
6507
6507
|
|
|
6508
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this38.pinnedColumns ? 'pinned' : 'unpinned', "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6508
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this38.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6509
6509
|
// headerHtml += `
|
|
6510
6510
|
// style='width: ${col.width || col.actualWidth}px'
|
|
6511
6511
|
// width='${col.width || col.actualWidth}'
|
|
@@ -6556,7 +6556,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6556
6556
|
|
|
6557
6557
|
var totalHtml = "<tr class=\"websy-table-row websy-table-total-row\">";
|
|
6558
6558
|
this.options.totals.forEach(function (col, colIndex) {
|
|
6559
|
-
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6559
|
+
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6560
6560
|
|
|
6561
6561
|
if (useWidths === true) {
|
|
6562
6562
|
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 ");
|
|
@@ -6585,6 +6585,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6585
6585
|
var outerEl = document.getElementById(this.elementId);
|
|
6586
6586
|
var tableEl = document.getElementById("".concat(this.elementId, "_tableContainer"));
|
|
6587
6587
|
var headEl = document.getElementById("".concat(this.elementId, "_tableHeader"));
|
|
6588
|
+
|
|
6589
|
+
if (!headEl) {
|
|
6590
|
+
// something isn't right so exit the function
|
|
6591
|
+
return;
|
|
6592
|
+
}
|
|
6593
|
+
|
|
6588
6594
|
headEl.style.width = 'auto';
|
|
6589
6595
|
headEl.innerHTML = this.buildHeaderHtml();
|
|
6590
6596
|
this.sizes.outer = outerEl.getBoundingClientRect();
|
|
@@ -6868,7 +6874,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6868
6874
|
}
|
|
6869
6875
|
|
|
6870
6876
|
var tableEl = document.getElementById("".concat(this.elementId, "_tableInner"));
|
|
6871
|
-
|
|
6877
|
+
|
|
6878
|
+
if (tableEl) {
|
|
6879
|
+
tableEl.classList.remove('hidden');
|
|
6880
|
+
}
|
|
6881
|
+
|
|
6872
6882
|
var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
|
|
6873
6883
|
|
|
6874
6884
|
if (containerEl) {
|
|
@@ -6916,7 +6926,12 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6916
6926
|
this.appendRows(data);
|
|
6917
6927
|
}
|
|
6918
6928
|
|
|
6919
|
-
var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody"));
|
|
6929
|
+
var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody"));
|
|
6930
|
+
|
|
6931
|
+
if (!bodyEl) {
|
|
6932
|
+
// something isn't right so exit the function
|
|
6933
|
+
return;
|
|
6934
|
+
} // bodyEl.innerHTML = this.buildBodyHtml(data, true)
|
|
6920
6935
|
// if (this.options.maxHeight) {
|
|
6921
6936
|
// bodyEl.style.height = `${this.options.maxHeight - this.sizes.header.height - this.sizes.total.height}px`
|
|
6922
6937
|
// }
|
|
@@ -6924,6 +6939,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6924
6939
|
// bodyEl.style.height = `calc(100% - ${this.sizes.header.height}px - ${this.sizes.total.height}px)`
|
|
6925
6940
|
// }
|
|
6926
6941
|
|
|
6942
|
+
|
|
6927
6943
|
bodyEl.style.height = "".concat(this.sizes.bodyHeight, "px");
|
|
6928
6944
|
|
|
6929
6945
|
if (this.options.virtualScroll === true) {
|
|
@@ -7182,6 +7198,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7182
7198
|
lineWidth: 2,
|
|
7183
7199
|
forceZero: true,
|
|
7184
7200
|
grouping: 'grouped',
|
|
7201
|
+
groupPadding: 3,
|
|
7185
7202
|
fontSize: 14,
|
|
7186
7203
|
symbolSize: 20,
|
|
7187
7204
|
showTrackingLine: true,
|
|
@@ -7190,7 +7207,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7190
7207
|
legendPosition: 'bottom',
|
|
7191
7208
|
tooltipWidth: 200,
|
|
7192
7209
|
brushHeight: 50,
|
|
7193
|
-
minBandWidth: 30
|
|
7210
|
+
minBandWidth: 30,
|
|
7211
|
+
allowUnevenBands: true
|
|
7194
7212
|
};
|
|
7195
7213
|
this.elementId = elementId;
|
|
7196
7214
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -7221,24 +7239,39 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7221
7239
|
}
|
|
7222
7240
|
|
|
7223
7241
|
xAxis += 'Axis';
|
|
7224
|
-
|
|
7225
|
-
var width = _this42[xAxis].step();
|
|
7226
|
-
|
|
7227
7242
|
var output;
|
|
7228
7243
|
|
|
7229
|
-
var
|
|
7244
|
+
var width = _this42.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
7230
7245
|
|
|
7231
|
-
if (_this42.
|
|
7232
|
-
|
|
7233
|
-
|
|
7246
|
+
if (_this42.customBottomRange) {
|
|
7247
|
+
for (var index = 0; index < _this42.customBottomRange.length; index++) {
|
|
7248
|
+
if (input > _this42.customBottomRange[index]) {
|
|
7249
|
+
if (_this42.customBottomRange[index + 1]) {
|
|
7250
|
+
if (input < _this42.customBottomRange[index + 1]) {
|
|
7251
|
+
output = index;
|
|
7252
|
+
break;
|
|
7253
|
+
}
|
|
7254
|
+
} else {
|
|
7255
|
+
output = index;
|
|
7256
|
+
break;
|
|
7257
|
+
}
|
|
7258
|
+
}
|
|
7259
|
+
}
|
|
7260
|
+
} else {
|
|
7261
|
+
var domain = _toConsumableArray(_this42[xAxis].domain());
|
|
7262
|
+
|
|
7263
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7264
|
+
domain = domain.reverse();
|
|
7265
|
+
}
|
|
7234
7266
|
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7267
|
+
for (var j = 0; j < domain.length; j++) {
|
|
7268
|
+
var breakA = _this42[xAxis](domain[j]) - width / 2;
|
|
7269
|
+
var breakB = breakA + width;
|
|
7238
7270
|
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7271
|
+
if (input > breakA && input <= breakB) {
|
|
7272
|
+
output = j;
|
|
7273
|
+
break;
|
|
7274
|
+
}
|
|
7242
7275
|
}
|
|
7243
7276
|
}
|
|
7244
7277
|
|
|
@@ -7258,6 +7291,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7258
7291
|
xAxisCaps = 'Left';
|
|
7259
7292
|
}
|
|
7260
7293
|
|
|
7294
|
+
if (!that["".concat(xAxis, "Axis")]) {
|
|
7295
|
+
return;
|
|
7296
|
+
}
|
|
7297
|
+
|
|
7261
7298
|
if (!that["".concat(xAxis, "Axis")].invert) {
|
|
7262
7299
|
that["".concat(xAxis, "Axis")].invert = that.invertOverride;
|
|
7263
7300
|
}
|
|
@@ -7460,7 +7497,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7460
7497
|
|
|
7461
7498
|
this.options.data.series.forEach(function (s) {
|
|
7462
7499
|
if (_this43.options.data[xData].scale !== 'Time') {
|
|
7463
|
-
|
|
7500
|
+
if (_this43.customBottomRange && _this43.customBottomRange.length > 0) {
|
|
7501
|
+
xPoint = _this43.customBottomRange[x0] + (_this43.customBottomRange[x0 + 1] - _this43.customBottomRange[x0]) / 2;
|
|
7502
|
+
} else {
|
|
7503
|
+
xPoint = _this43[xAxis](_this43.parseX(xLabel));
|
|
7504
|
+
}
|
|
7505
|
+
|
|
7464
7506
|
s.data.forEach(function (d) {
|
|
7465
7507
|
if (d.x.value === xLabel) {
|
|
7466
7508
|
if (!tooltipTitle) {
|
|
@@ -7564,7 +7606,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7564
7606
|
};
|
|
7565
7607
|
|
|
7566
7608
|
if (xPoint > this.plotWidth / 2) {
|
|
7567
|
-
posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15
|
|
7609
|
+
posOptions.left = xPoint - this.options.tooltipWidth - 15; // + this.options.margin.left + this.options.margin.axisLeft + 15)
|
|
7568
7610
|
|
|
7569
7611
|
if (this.options.data[xData].scale !== 'Time') {
|
|
7570
7612
|
// posOptions.left -= (this[xAxis].bandwidth())
|
|
@@ -7574,7 +7616,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7574
7616
|
posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15;
|
|
7575
7617
|
|
|
7576
7618
|
if (this.options.data[xData].scale !== 'Time') {
|
|
7577
|
-
posOptions.left += this[xAxis
|
|
7619
|
+
posOptions.left += this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
|
|
7578
7620
|
}
|
|
7579
7621
|
}
|
|
7580
7622
|
|
|
@@ -7585,7 +7627,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7585
7627
|
var adjuster = 0;
|
|
7586
7628
|
|
|
7587
7629
|
if (this.options.data[xData].scale !== 'Time') {
|
|
7588
|
-
adjuster = this[xAxis
|
|
7630
|
+
adjuster = this.options.data[xAxis.replace('Axis', '')].bandWidth / 2; // - this.options.margin.top
|
|
7589
7631
|
}
|
|
7590
7632
|
|
|
7591
7633
|
posOptions = {
|
|
@@ -7608,8 +7650,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7608
7650
|
// xPoint = x0
|
|
7609
7651
|
// }
|
|
7610
7652
|
|
|
7611
|
-
if (this.options.data[xData].scale !== 'Time') {
|
|
7612
|
-
xPoint += this[xAxis
|
|
7653
|
+
if (this.options.data[xData].scale !== 'Time' && this.customBottomRange.length === 0) {
|
|
7654
|
+
xPoint += this.options.data[xAxis.replace('Axis', '')].bandWidth / 2; // - this.options.margin.top
|
|
7613
7655
|
}
|
|
7614
7656
|
|
|
7615
7657
|
var trackingXStart = xPoint;
|
|
@@ -7673,6 +7715,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7673
7715
|
|
|
7674
7716
|
if (!this.options.data) {// tell the user no data has been provided
|
|
7675
7717
|
} else {
|
|
7718
|
+
this.processedX = {};
|
|
7676
7719
|
this.transition = d3.transition().duration(this.options.transitionDuration);
|
|
7677
7720
|
|
|
7678
7721
|
if (this.options.data.bottom.scale && this.options.data.bottom.scale === 'Time') {
|
|
@@ -7730,12 +7773,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7730
7773
|
// the legend gets rendered so that we can get its actual size
|
|
7731
7774
|
|
|
7732
7775
|
if (this.options.showLegend === true) {
|
|
7733
|
-
var legendData =
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7776
|
+
var legendData = [];
|
|
7777
|
+
|
|
7778
|
+
if (this.options.legendData && this.options.legendData.length > 0) {
|
|
7779
|
+
legendData = this.options.legendData;
|
|
7780
|
+
} else {
|
|
7781
|
+
this.options.data.series.map(function (s, i) {
|
|
7782
|
+
return {
|
|
7783
|
+
value: s.label || s.key,
|
|
7784
|
+
color: s.color || _this44.options.colors[i % _this44.options.colors.length]
|
|
7785
|
+
};
|
|
7786
|
+
});
|
|
7787
|
+
}
|
|
7739
7788
|
|
|
7740
7789
|
if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
|
|
7741
7790
|
this.legendArea.style('width', '100%');
|
|
@@ -7939,18 +7988,34 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7939
7988
|
this.brushNeeded = false;
|
|
7940
7989
|
|
|
7941
7990
|
if (this.options.orientation === 'vertical') {
|
|
7991
|
+
this.options.data.bottom.totalValueCount = this.options.data.bottom.data.reduce(function (a, b) {
|
|
7992
|
+
if (typeof b.valueCount === 'undefined') {
|
|
7993
|
+
return a + 1;
|
|
7994
|
+
}
|
|
7995
|
+
|
|
7996
|
+
return a + b.valueCount;
|
|
7997
|
+
}, 0);
|
|
7998
|
+
|
|
7942
7999
|
if (this.options.maxBandWidth) {
|
|
7943
|
-
this.plotWidth = Math.min(this.plotWidth,
|
|
8000
|
+
this.plotWidth = Math.min(this.plotWidth, this.options.data.bottom.totalValueCount * this.options.maxBandWidth);
|
|
7944
8001
|
} // some if to check if brushing is needed
|
|
7945
8002
|
|
|
7946
8003
|
|
|
7947
|
-
if (this.plotWidth / this.options.data.bottom.
|
|
8004
|
+
if (this.plotWidth / this.options.data.bottom.totalValueCount < this.options.minBandWidth) {
|
|
7948
8005
|
this.brushNeeded = true;
|
|
7949
8006
|
this.plotHeight -= this.options.brushHeight;
|
|
7950
8007
|
}
|
|
7951
8008
|
} else {
|
|
7952
8009
|
// some if to check if brushing is needed
|
|
7953
|
-
|
|
8010
|
+
this.options.data.left.totalValueCount = this.options.data.left.data.reduce(function (a, b) {
|
|
8011
|
+
if (typeof b.valueCount === 'undefined') {
|
|
8012
|
+
return a + 1;
|
|
8013
|
+
}
|
|
8014
|
+
|
|
8015
|
+
return a + b.valueCount;
|
|
8016
|
+
}, 0);
|
|
8017
|
+
|
|
8018
|
+
if (this.plotHeight / this.options.data.left.totalValueCount < this.options.minBandWidth) {
|
|
7954
8019
|
this.brushNeeded = true;
|
|
7955
8020
|
this.plotWidth -= this.options.brushHeight;
|
|
7956
8021
|
}
|
|
@@ -7980,10 +8045,42 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7980
8045
|
|
|
7981
8046
|
var bottomDomain = this.createDomain('bottom');
|
|
7982
8047
|
var bottomBrushDomain = this.createDomain('bottom', true);
|
|
7983
|
-
|
|
8048
|
+
var bottomRange = [0, this.plotWidth];
|
|
8049
|
+
this.customBottomRange = [];
|
|
8050
|
+
|
|
8051
|
+
if (this.options.allowUnevenBands === true) {
|
|
8052
|
+
if (this.options.data.bottom.data && this.options.data.bottom.data[0] && this.options.data.bottom.data[0].valueCount && this.options.data.bottom.scale === 'Ordinal') {
|
|
8053
|
+
var acc = 0;
|
|
8054
|
+
this.customBottomRange = [0].concat(_toConsumableArray(this.options.data.bottom.data.map(function (d) {
|
|
8055
|
+
acc += d.valueCount;
|
|
8056
|
+
return _this44.plotWidth / _this44.options.data.bottom.totalValueCount * acc;
|
|
8057
|
+
})));
|
|
8058
|
+
}
|
|
8059
|
+
}
|
|
8060
|
+
|
|
8061
|
+
this.options.data.bottom.step = this.plotWidth / this.options.data.bottom.totalValueCount;
|
|
8062
|
+
this.options.data.bottom.bandWidth = this.options.data.bottom.step;
|
|
8063
|
+
|
|
8064
|
+
if (this.options.data.bottom.padding) {
|
|
8065
|
+
this.totalPadding = this.plotWidth * this.options.data.bottom.padding;
|
|
8066
|
+
var rangeLength = bottomDomain.length;
|
|
8067
|
+
|
|
8068
|
+
if (this.customBottomRange.length > 0) {
|
|
8069
|
+
rangeLength = this.customBottomRange.length;
|
|
8070
|
+
}
|
|
8071
|
+
|
|
8072
|
+
this.bandPadding = this.totalPadding / rangeLength / 2;
|
|
8073
|
+
this.options.data.bottom.bandWidth = (this.plotWidth - this.totalPadding) / this.options.data.bottom.totalValueCount;
|
|
8074
|
+
}
|
|
8075
|
+
|
|
8076
|
+
if (this.options.grouping === 'grouped' && this.options.data.series.length > 1) {
|
|
8077
|
+
this.options.data.bottom.bandWidth = this.options.data.bottom.bandWidth - this.options.groupPadding * 2;
|
|
8078
|
+
}
|
|
8079
|
+
|
|
8080
|
+
this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomDomain).range(bottomRange);
|
|
7984
8081
|
|
|
7985
8082
|
if (!this.brushInitialized) {
|
|
7986
|
-
this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomBrushDomain).range(
|
|
8083
|
+
this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Band')]().domain(bottomBrushDomain).range(bottomRange);
|
|
7987
8084
|
}
|
|
7988
8085
|
|
|
7989
8086
|
if (this.bottomAxis.nice) {// this.bottomAxis.nice()
|
|
@@ -8102,6 +8199,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8102
8199
|
if (this.options.data.bottom.rotate) {
|
|
8103
8200
|
this.bottomAxisLayer.selectAll('text').attr('transform', "rotate(".concat(this.options.data.bottom && this.options.data.bottom.rotate || 0, ")")).style('text-anchor', "".concat((this.options.data.bottom && this.options.data.bottom.rotate || 0) === 0 ? 'middle' : 'end')).style('transform-origin', (this.options.data.bottom && this.options.data.bottom.rotate || 0) === 0 ? '0 0' : "0 ".concat(this.options.data.bottom && this.options.data.bottom.fontSize || this.options.fontSize, "px"));
|
|
8104
8201
|
}
|
|
8202
|
+
|
|
8203
|
+
if (this.customBottomRange.length > 0) {
|
|
8204
|
+
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8205
|
+
return "translate(".concat(_this44.customBottomRange[i] + (_this44.customBottomRange[i + 1] - _this44.customBottomRange[i]) / 2, ", 0)");
|
|
8206
|
+
});
|
|
8207
|
+
}
|
|
8105
8208
|
} // Configure the left axis
|
|
8106
8209
|
|
|
8107
8210
|
|
|
@@ -8219,6 +8322,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8219
8322
|
|
|
8220
8323
|
_this45.renderedKeys[series.key] = series.type;
|
|
8221
8324
|
});
|
|
8325
|
+
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8326
|
+
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8222
8327
|
|
|
8223
8328
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8224
8329
|
this.options.refLines.forEach(function (l) {
|
|
@@ -8234,20 +8339,20 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8234
8339
|
/* global d3 series index */
|
|
8235
8340
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8236
8341
|
return d3.area().x(function (d) {
|
|
8237
|
-
return _this46[xAxis](_this46.parseX(d.x.value));
|
|
8342
|
+
return _this46["".concat(xAxis, "Axis")](_this46.parseX(d.x.value));
|
|
8238
8343
|
}).y0(function (d) {
|
|
8239
|
-
return _this46[yAxis](0);
|
|
8344
|
+
return _this46["".concat(yAxis, "Axis")](0);
|
|
8240
8345
|
}).y1(function (d) {
|
|
8241
|
-
return _this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8346
|
+
return _this46["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8242
8347
|
}).curve(d3[curveStyle || _this46.options.curveStyle]);
|
|
8243
8348
|
};
|
|
8244
8349
|
|
|
8245
|
-
var xAxis = '
|
|
8246
|
-
var yAxis = series.axis === 'secondary' ? '
|
|
8350
|
+
var xAxis = 'bottom';
|
|
8351
|
+
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
8247
8352
|
|
|
8248
|
-
if (this.options.
|
|
8249
|
-
xAxis = series.axis === 'secondary' ? '
|
|
8250
|
-
yAxis = '
|
|
8353
|
+
if (this.options.orientation === 'horizontal') {
|
|
8354
|
+
xAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
8355
|
+
yAxis = 'bottom';
|
|
8251
8356
|
}
|
|
8252
8357
|
|
|
8253
8358
|
var areas = this.areaLayer.selectAll(".area_".concat(series.key)).data([series.data]); // Exit
|
|
@@ -8265,8 +8370,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8265
8370
|
|
|
8266
8371
|
areas.enter().append('path').attr('d', function (d) {
|
|
8267
8372
|
return drawArea(xAxis, yAxis, series.curveStyle)(d);
|
|
8268
|
-
}).attr('class', "area_".concat(series.key)).attr('id', "area_".concat(series.key))
|
|
8269
|
-
// .style('stroke-width', series.lineWidth || this.options.lineWidth)
|
|
8373
|
+
}).attr('class', "area_".concat(series.key)).attr('id', "area_".concat(series.key)).attr('transform', 'translate(' + (this.options.data[xAxis].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2) + ',0)') // .style('stroke-width', series.lineWidth || this.options.lineWidth)
|
|
8270
8374
|
.attr('fill', series.color) // .style('fill-opacity', 0)
|
|
8271
8375
|
.attr('stroke', 'transparent') // .transition(this.transition)
|
|
8272
8376
|
.style('fill-opacity', series.opacity || 0.5);
|
|
@@ -8292,14 +8396,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8292
8396
|
|
|
8293
8397
|
|
|
8294
8398
|
function getBarHeight(d, i, heightBounds, yAxis, xAxis) {
|
|
8295
|
-
var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
|
|
8296
|
-
var groupedBarWidth = (barWidth - 10) / this.options.data.series.length;
|
|
8297
8399
|
var output;
|
|
8298
8400
|
|
|
8299
8401
|
if (this.options.orientation === 'horizontal') {
|
|
8300
|
-
output =
|
|
8402
|
+
output = this.options.data[xAxis.replace('Brush', '')].bandWidth;
|
|
8301
8403
|
} else {
|
|
8302
|
-
|
|
8404
|
+
var x = getBarX.call(this, d, i, xAxis);
|
|
8405
|
+
|
|
8406
|
+
if (typeof x === 'undefined' || x === null) {
|
|
8303
8407
|
return null;
|
|
8304
8408
|
}
|
|
8305
8409
|
|
|
@@ -8314,25 +8418,20 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8314
8418
|
}
|
|
8315
8419
|
|
|
8316
8420
|
function getBarWidth(d, i, xAxis) {
|
|
8317
|
-
var barWidth = this["".concat(xAxis, "Axis")].bandwidth();
|
|
8318
|
-
var groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data.series.length;
|
|
8319
8421
|
var output;
|
|
8320
8422
|
|
|
8321
8423
|
if (this.options.orientation === 'horizontal') {
|
|
8322
|
-
// let width = this[`${yAxis}Axis`](d.y.value)
|
|
8323
8424
|
var width = this["".concat(yAxis, "Axis")](0) - this["".concat(yAxis, "Axis")](Math.abs(d.y.value));
|
|
8324
8425
|
acummulativeY[d.y.index] += width;
|
|
8325
8426
|
output = width;
|
|
8326
8427
|
} else {
|
|
8327
|
-
|
|
8428
|
+
var x = getBarX.call(this, d, i, xAxis);
|
|
8429
|
+
|
|
8430
|
+
if (typeof x === 'undefined' || x === null) {
|
|
8328
8431
|
return null;
|
|
8329
8432
|
}
|
|
8330
8433
|
|
|
8331
|
-
|
|
8332
|
-
output = Math.max(1, groupedBarWidth);
|
|
8333
|
-
} else {
|
|
8334
|
-
output = Math.max(1, barWidth);
|
|
8335
|
-
}
|
|
8434
|
+
output = Math.max(1, this.options.data[xAxis.replace('Brush', '')].bandWidth);
|
|
8336
8435
|
}
|
|
8337
8436
|
|
|
8338
8437
|
if (isNaN(output)) {
|
|
@@ -8343,8 +8442,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8343
8442
|
}
|
|
8344
8443
|
|
|
8345
8444
|
function getBarX(d, i, xAxis) {
|
|
8346
|
-
|
|
8347
|
-
|
|
8445
|
+
// let barWidth = this.plotWidth / this.options.data[xAxis.replace('Brush', '')].totalValueCount
|
|
8446
|
+
// if (this.options.data[xAxis.replace('Brush', '')].padding) {
|
|
8447
|
+
// barWidth = barWidth - (barWidth * this.options.data[xAxis.replace('Brush', '')].padding)
|
|
8448
|
+
// }
|
|
8449
|
+
// let groupedBarWidth = (barWidth - (xAxis.indexOf('Brush') === -1 ? 10 : 2)) / this.options.data[xAxis.replace('Brush', '')].totalValueCount
|
|
8348
8450
|
var output;
|
|
8349
8451
|
|
|
8350
8452
|
if (this.options.orientation === 'horizontal') {
|
|
@@ -8363,12 +8465,36 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8363
8465
|
output = this["".concat(yAxis, "Axis")](0) + _h * (d.y.value < 0 ? 1 : 0);
|
|
8364
8466
|
}
|
|
8365
8467
|
} else {
|
|
8366
|
-
|
|
8468
|
+
// let adjustment = this.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : this.options.data[xAxis.replace('Brush', '')].bandWidth / 2
|
|
8469
|
+
var _adjustment = this.customBottomRange[i] + i * this.options.data[xAxis.replace('Brush', '')].bandWidth;
|
|
8367
8470
|
|
|
8368
8471
|
if (this.options.grouping === 'grouped') {
|
|
8369
|
-
var
|
|
8472
|
+
var xIndex = 0;
|
|
8473
|
+
|
|
8474
|
+
if (this.processedX[d.x.value]) {
|
|
8475
|
+
xIndex = Math.max(0, this.processedX[d.x.value].indexOf(d.y.tooltipLabel));
|
|
8476
|
+
}
|
|
8370
8477
|
|
|
8371
|
-
|
|
8478
|
+
var barAdjustment = this.options.data[xAxis.replace('Brush', '')].bandWidth * xIndex + xIndex * this.options.groupPadding * 2 + this.options.groupPadding + (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1); // let barAdjustment =
|
|
8479
|
+
// (this.options.data[xAxis.replace('Brush', '')].step * xIndex) +
|
|
8480
|
+
// this.options.groupPadding
|
|
8481
|
+
// // (xAxis.indexOf('Brush') === -1 ? this.bandPadding : 1)
|
|
8482
|
+
|
|
8483
|
+
if (this.customBottomRange.length > 0) {
|
|
8484
|
+
output = this.customBottomRange[this[xAxis.replace('Brush', '') + 'Axis'].domain().indexOf(d.x.value)] + barAdjustment;
|
|
8485
|
+
} else {
|
|
8486
|
+
output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + barAdjustment;
|
|
8487
|
+
}
|
|
8488
|
+
|
|
8489
|
+
if (!this.processedX[d.x.value]) {
|
|
8490
|
+
this.processedX[d.x.value] = [];
|
|
8491
|
+
}
|
|
8492
|
+
|
|
8493
|
+
if (this.processedX[d.x.value].indexOf(d.y.tooltipLabel) === -1) {
|
|
8494
|
+
this.processedX[d.x.value].push(d.y.tooltipLabel);
|
|
8495
|
+
}
|
|
8496
|
+
|
|
8497
|
+
console.log(d.x.value, d.y.tooltipLabel, xIndex, i, barAdjustment, output);
|
|
8372
8498
|
} else {
|
|
8373
8499
|
// output = this[`${xAxis}Axis`](this.parseX(d.x.value)) + (i * barWidth) + adjustment
|
|
8374
8500
|
output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)); // + (i * barWidth)
|
|
@@ -8383,15 +8509,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8383
8509
|
}
|
|
8384
8510
|
|
|
8385
8511
|
function getBarY(d, i, heightBounds, yAxis, xAxis) {
|
|
8386
|
-
|
|
8387
|
-
|
|
8512
|
+
// let barWidth = this[`${xAxis}Axis`].bandwidth()
|
|
8513
|
+
// let groupedBarWidth = (barWidth - 10) / this.options.data.series.length
|
|
8388
8514
|
var output;
|
|
8389
8515
|
|
|
8390
8516
|
if (this.options.orientation === 'horizontal') {
|
|
8391
8517
|
if (this.options.grouping !== 'grouped') {
|
|
8392
8518
|
output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value));
|
|
8393
8519
|
} else {
|
|
8394
|
-
output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
|
|
8520
|
+
output = this["".concat(xAxis, "Axis")](this.parseX(d.x.value)) + (d.y.index || i) * this.options.data[xAxis.replace('Brush', '')].barWidth;
|
|
8395
8521
|
}
|
|
8396
8522
|
} else {
|
|
8397
8523
|
if (this.options.grouping === 'stacked') {
|
|
@@ -8573,7 +8699,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8573
8699
|
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) + 4;
|
|
8574
8700
|
}
|
|
8575
8701
|
} else {
|
|
8576
|
-
return this[xAxis](this.parseX(d.x.value)) + this[xAxis
|
|
8702
|
+
return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
|
|
8577
8703
|
}
|
|
8578
8704
|
}
|
|
8579
8705
|
|
|
@@ -8581,7 +8707,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8581
8707
|
var labelPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'inside';
|
|
8582
8708
|
|
|
8583
8709
|
if (this.options.orientation === 'horizontal') {
|
|
8584
|
-
return this[xAxis](this.parseX(d.x.value)) + this[xAxis
|
|
8710
|
+
return this[xAxis](this.parseX(d.x.value)) + this.options.data[xAxis.replace('Axis', '')].bandWidth / 2;
|
|
8585
8711
|
} else {
|
|
8586
8712
|
if (this.options.grouping === 'stacked') {
|
|
8587
8713
|
return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
|
|
@@ -8599,17 +8725,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8599
8725
|
/* global series index d3 */
|
|
8600
8726
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8601
8727
|
return d3.line().x(function (d) {
|
|
8602
|
-
|
|
8603
|
-
|
|
8728
|
+
if (_this49.options.orientation === 'horizontal') {
|
|
8729
|
+
return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8730
|
+
} else {
|
|
8731
|
+
var adjustment = _this49.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this49["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8732
|
+
return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value)) + adjustment;
|
|
8733
|
+
}
|
|
8604
8734
|
}).y(function (d) {
|
|
8605
|
-
|
|
8735
|
+
if (_this49.options.orientation === 'horizontal') {
|
|
8736
|
+
var adjustment = _this49.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this49["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8737
|
+
return _this49["".concat(xAxis, "Axis")](_this49.parseX(d.x.value)) + adjustment;
|
|
8738
|
+
} else {
|
|
8739
|
+
return _this49["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8740
|
+
}
|
|
8606
8741
|
}).curve(d3[curveStyle || _this49.options.curveStyle]);
|
|
8607
8742
|
};
|
|
8608
8743
|
|
|
8609
8744
|
var xAxis = 'bottom';
|
|
8610
8745
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
8611
8746
|
|
|
8612
|
-
if (this.options.
|
|
8747
|
+
if (this.options.orientation === 'horizontal') {
|
|
8613
8748
|
xAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
8614
8749
|
yAxis = 'bottom';
|
|
8615
8750
|
}
|
|
@@ -8617,7 +8752,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8617
8752
|
var xBrushAxis = 'bottomBrush';
|
|
8618
8753
|
var yBrushAxis = 'leftBrush';
|
|
8619
8754
|
|
|
8620
|
-
if (this.options.
|
|
8755
|
+
if (this.options.orientation === 'horizontal') {
|
|
8621
8756
|
xBrushAxis = 'leftBrush';
|
|
8622
8757
|
yBrushAxis = 'bottomBrush';
|
|
8623
8758
|
}
|
|
@@ -8684,8 +8819,6 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8684
8819
|
length = this.plotHeight;
|
|
8685
8820
|
}
|
|
8686
8821
|
|
|
8687
|
-
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8688
|
-
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8689
8822
|
this.refLineLayer.append('line').attr("".concat(yAttr, "1"), this["".concat(yAxis, "Axis")](data.value)).attr("".concat(yAttr, "2"), this["".concat(yAxis, "Axis")](data.value)).attr("".concat(xAttr, "2"), length).attr('class', "reference-line").style('stroke', data.color).style('stroke-width', "".concat(data.lineWidth, "px")).style('stroke-dasharray', data.lineStyle);
|
|
8690
8823
|
|
|
8691
8824
|
if (data.label && data.label !== '') {
|
|
@@ -8715,7 +8848,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8715
8848
|
var xAxis = 'bottom';
|
|
8716
8849
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
8717
8850
|
|
|
8718
|
-
if (this.options.
|
|
8851
|
+
if (this.options.orientation === 'horizontal') {
|
|
8719
8852
|
xAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
8720
8853
|
yAxis = 'bottom';
|
|
8721
8854
|
}
|
|
@@ -8727,8 +8860,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8727
8860
|
symbols.attr('d', function (d) {
|
|
8728
8861
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8729
8862
|
}).transition(this.transition).attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8730
|
-
var adjustment = _this50.options.data[xAxis].scale === 'Time' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8731
|
-
|
|
8863
|
+
var adjustment = _this50.options.data[xAxis].scale === 'Time' || _this50.options.data[xAxis].scale === 'Linear' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8864
|
+
|
|
8865
|
+
if (_this50.options.orientation === 'horizontal') {
|
|
8866
|
+
return "translate(".concat(_this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(_this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment, ")");
|
|
8867
|
+
} else {
|
|
8868
|
+
return "translate(".concat(_this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment, ", ").concat(_this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8869
|
+
}
|
|
8732
8870
|
}); // Enter
|
|
8733
8871
|
|
|
8734
8872
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8737,8 +8875,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8737
8875
|
.attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8738
8876
|
return "symbol symbol_".concat(series.key);
|
|
8739
8877
|
}).attr('transform', function (d) {
|
|
8740
|
-
var adjustment = _this50.options.data[xAxis].scale === 'Time' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8741
|
-
|
|
8878
|
+
var adjustment = _this50.options.data[xAxis].scale === 'Time' || _this50.options.data[xAxis].scale === 'Linear' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8879
|
+
|
|
8880
|
+
if (_this50.options.orientation === 'horizontal') {
|
|
8881
|
+
return "translate(".concat(_this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(_this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment, ")");
|
|
8882
|
+
} else {
|
|
8883
|
+
return "translate(".concat(_this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment, ", ").concat(_this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8884
|
+
}
|
|
8742
8885
|
});
|
|
8743
8886
|
}
|
|
8744
8887
|
}, {
|
|
@@ -8833,11 +8976,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8833
8976
|
|
|
8834
8977
|
if (el) {
|
|
8835
8978
|
el.classList.remove('has-error');
|
|
8836
|
-
}
|
|
8837
|
-
// chartEl.classList.remove('hidden')
|
|
8979
|
+
}
|
|
8838
8980
|
|
|
8981
|
+
if (this.svg) {
|
|
8982
|
+
this.svg.classed('hidden', false);
|
|
8983
|
+
}
|
|
8839
8984
|
|
|
8840
|
-
this.svg.classed('hidden', false);
|
|
8841
8985
|
var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
|
|
8842
8986
|
|
|
8843
8987
|
if (containerEl) {
|
|
@@ -8857,10 +9001,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8857
9001
|
if (el) {
|
|
8858
9002
|
el.classList.add('has-error');
|
|
8859
9003
|
} // const chartEl = document.getElementById(`${this.elementId}_chartContainer`)
|
|
8860
|
-
// chartEl.classList.add('hidden')
|
|
9004
|
+
// chartEl.classList.add('hidden')
|
|
9005
|
+
|
|
8861
9006
|
|
|
9007
|
+
if (this.svg) {
|
|
9008
|
+
this.svg.classed('hidden', true);
|
|
9009
|
+
}
|
|
8862
9010
|
|
|
8863
|
-
this.svg.classed('hidden', true);
|
|
8864
9011
|
var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
|
|
8865
9012
|
|
|
8866
9013
|
if (containerEl) {
|