@websy/websy-designs 1.4.25 → 1.4.27
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.
|
@@ -2839,7 +2839,8 @@ class WebsyNavigationMenu {
|
|
|
2839
2839
|
}
|
|
2840
2840
|
handleSearch (searchText) {
|
|
2841
2841
|
const el = document.getElementById(this.elementId)
|
|
2842
|
-
let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
2842
|
+
// let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
2843
|
+
let lowestItems = this.flatItems.filter(d => !d.hasChildren)
|
|
2843
2844
|
let visibleItems = lowestItems
|
|
2844
2845
|
let defaultMethod = 'remove'
|
|
2845
2846
|
if (searchText && searchText.length > 1) {
|
|
@@ -7379,7 +7380,7 @@ else {
|
|
|
7379
7380
|
firstBottom = Math.max(0, firstBottomWidth)
|
|
7380
7381
|
}
|
|
7381
7382
|
}
|
|
7382
|
-
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth)
|
|
7383
|
+
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth) + 5 // + 5 to accommodate for space between text and axis line
|
|
7383
7384
|
this.options.margin.axisRight = longestRightBounds.width
|
|
7384
7385
|
this.options.margin.axisBottom = longestBottomBounds.height + 10
|
|
7385
7386
|
this.options.margin.axisTop = 0
|
|
@@ -7635,7 +7636,6 @@ else {
|
|
|
7635
7636
|
if (this.rightAxis.nice) {
|
|
7636
7637
|
this.rightAxis.nice()
|
|
7637
7638
|
}
|
|
7638
|
-
console.log('axis right', this.options.margin.axisRight)
|
|
7639
7639
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7640
7640
|
this.rightAxisLayer.call(
|
|
7641
7641
|
d3.axisRight(this.rightAxis)
|
|
@@ -7891,7 +7891,12 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
7891
7891
|
.attr('x', d => getLabelX.call(this, d, series.labelPosition))
|
|
7892
7892
|
.attr('y', d => getLabelY.call(this, d, series.labelPosition))
|
|
7893
7893
|
.attr('class', `label_${series.key}`)
|
|
7894
|
-
.attr('fill', d =>
|
|
7894
|
+
.attr('fill', d => {
|
|
7895
|
+
if (this.options.grouping === 'stacked' && d.y.value === 0) {
|
|
7896
|
+
return 'transparent'
|
|
7897
|
+
}
|
|
7898
|
+
return this.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color)
|
|
7899
|
+
})
|
|
7895
7900
|
.style('font-size', `${this.options.labelSize || this.options.fontSize}px`)
|
|
7896
7901
|
.transition(this.transition)
|
|
7897
7902
|
.text(d => d.y.label || d.y.value)
|
|
@@ -7929,7 +7934,12 @@ if (this.options.showLabels === true || series.showLabels === true) {
|
|
|
7929
7934
|
.attr('y', d => getLabelY.call(this, d, series.labelPosition))
|
|
7930
7935
|
.attr('alignment-baseline', 'central')
|
|
7931
7936
|
.attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle')
|
|
7932
|
-
.attr('fill', d =>
|
|
7937
|
+
.attr('fill', d => {
|
|
7938
|
+
if (this.options.grouping === 'stacked' && d.y.value === 0) {
|
|
7939
|
+
return 'transparent'
|
|
7940
|
+
}
|
|
7941
|
+
return this.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color)
|
|
7942
|
+
})
|
|
7933
7943
|
.style('font-size', `${this.options.labelSize || this.options.fontSize}px`)
|
|
7934
7944
|
.text(d => d.y.label || d.y.value)
|
|
7935
7945
|
.each(function (d, i) {
|
|
@@ -8047,18 +8057,24 @@ if (series.showSymbols === true) {
|
|
|
8047
8057
|
/* global d3 data */
|
|
8048
8058
|
let xAxis = 'bottom'
|
|
8049
8059
|
let yAxis = 'left'
|
|
8060
|
+
let yAttr = 'y'
|
|
8061
|
+
let xAttr = 'x'
|
|
8050
8062
|
let that = this
|
|
8063
|
+
let length = this.plotWidth
|
|
8051
8064
|
if (this.options.orientation === 'horizontal') {
|
|
8052
8065
|
xAxis = 'left'
|
|
8053
8066
|
yAxis = 'bottom'
|
|
8067
|
+
yAttr = 'x'
|
|
8068
|
+
xAttr = 'y'
|
|
8069
|
+
length = this.plotHeight
|
|
8054
8070
|
}
|
|
8055
8071
|
this.refLineLayer.selectAll('.reference-line').remove()
|
|
8056
8072
|
this.refLineLayer.selectAll('.reference-line-label').remove()
|
|
8057
8073
|
this.refLineLayer
|
|
8058
8074
|
.append('line')
|
|
8059
|
-
.attr(
|
|
8060
|
-
.attr(
|
|
8061
|
-
.attr(
|
|
8075
|
+
.attr(`${yAttr}1`, this[`${yAxis}Axis`](data.value))
|
|
8076
|
+
.attr(`${yAttr}2`, this[`${yAxis}Axis`](data.value))
|
|
8077
|
+
.attr(`${xAttr}2`, length)
|
|
8062
8078
|
.attr('class', `reference-line`)
|
|
8063
8079
|
.style('stroke', data.color)
|
|
8064
8080
|
.style('stroke-width', `${data.lineWidth}px`)
|
|
@@ -8068,7 +8084,7 @@ if (data.label && data.label !== '') {
|
|
|
8068
8084
|
this.refLineLayer
|
|
8069
8085
|
.append('text')
|
|
8070
8086
|
.attr('class', `reference-line-label`)
|
|
8071
|
-
.attr('x',
|
|
8087
|
+
.attr('x', length)
|
|
8072
8088
|
.attr('y', this[`${yAxis}Axis`](data.value))
|
|
8073
8089
|
.attr('font-size', this.options.fontSize)
|
|
8074
8090
|
.attr('fill', data.color)
|
|
@@ -8629,8 +8645,7 @@ class WebsyChartTooltip {
|
|
|
8629
8645
|
}
|
|
8630
8646
|
if (position.onTop === true) {
|
|
8631
8647
|
classes.push('top')
|
|
8632
|
-
}
|
|
8633
|
-
console.log(classes.join(' '))
|
|
8648
|
+
}
|
|
8634
8649
|
let fO = this.tooltipLayer
|
|
8635
8650
|
.selectAll('foreignObject')
|
|
8636
8651
|
.attr('width', `${position.width}px`)
|
package/dist/websy-designs.js
CHANGED
|
@@ -3036,9 +3036,10 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3036
3036
|
value: function handleSearch(searchText) {
|
|
3037
3037
|
var _this19 = this;
|
|
3038
3038
|
|
|
3039
|
-
var el = document.getElementById(this.elementId);
|
|
3039
|
+
var el = document.getElementById(this.elementId); // let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
3040
|
+
|
|
3040
3041
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
3041
|
-
return d.
|
|
3042
|
+
return !d.hasChildren;
|
|
3042
3043
|
});
|
|
3043
3044
|
var visibleItems = lowestItems;
|
|
3044
3045
|
var defaultMethod = 'remove';
|
|
@@ -8180,7 +8181,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8180
8181
|
}
|
|
8181
8182
|
}
|
|
8182
8183
|
|
|
8183
|
-
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth);
|
|
8184
|
+
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth) + 5; // + 5 to accommodate for space between text and axis line
|
|
8185
|
+
|
|
8184
8186
|
this.options.margin.axisRight = longestRightBounds.width;
|
|
8185
8187
|
this.options.margin.axisBottom = longestBottomBounds.height + 10;
|
|
8186
8188
|
this.options.margin.axisTop = 0; // adjust axis margins based on title options
|
|
@@ -8385,8 +8387,6 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8385
8387
|
this.rightAxis.nice();
|
|
8386
8388
|
}
|
|
8387
8389
|
|
|
8388
|
-
console.log('axis right', this.options.margin.axisRight);
|
|
8389
|
-
|
|
8390
8390
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8391
8391
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8392
8392
|
if (_this47.options.data.right.formatter) {
|
|
@@ -8616,6 +8616,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8616
8616
|
}).attr('y', function (d) {
|
|
8617
8617
|
return getLabelY.call(_this49, d, series.labelPosition);
|
|
8618
8618
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8619
|
+
if (_this49.options.grouping === 'stacked' && d.y.value === 0) {
|
|
8620
|
+
return 'transparent';
|
|
8621
|
+
}
|
|
8622
|
+
|
|
8619
8623
|
return _this49.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8620
8624
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8621
8625
|
return d.y.label || d.y.value;
|
|
@@ -8645,6 +8649,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8645
8649
|
}).attr('y', function (d) {
|
|
8646
8650
|
return getLabelY.call(_this49, d, series.labelPosition);
|
|
8647
8651
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8652
|
+
if (_this49.options.grouping === 'stacked' && d.y.value === 0) {
|
|
8653
|
+
return 'transparent';
|
|
8654
|
+
}
|
|
8655
|
+
|
|
8648
8656
|
return _this49.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8649
8657
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8650
8658
|
return d.y.label || d.y.value;
|
|
@@ -8752,20 +8760,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8752
8760
|
/* global d3 data */
|
|
8753
8761
|
var xAxis = 'bottom';
|
|
8754
8762
|
var yAxis = 'left';
|
|
8763
|
+
var yAttr = 'y';
|
|
8764
|
+
var xAttr = 'x';
|
|
8755
8765
|
var that = this;
|
|
8766
|
+
var length = this.plotWidth;
|
|
8756
8767
|
|
|
8757
8768
|
if (this.options.orientation === 'horizontal') {
|
|
8758
8769
|
xAxis = 'left';
|
|
8759
8770
|
yAxis = 'bottom';
|
|
8771
|
+
yAttr = 'x';
|
|
8772
|
+
xAttr = 'y';
|
|
8773
|
+
length = this.plotHeight;
|
|
8760
8774
|
}
|
|
8761
8775
|
|
|
8762
8776
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8763
8777
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8764
|
-
this.refLineLayer.append('line').attr(
|
|
8778
|
+
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);
|
|
8765
8779
|
|
|
8766
8780
|
if (data.label && data.label !== '') {
|
|
8767
8781
|
// show the text on the line
|
|
8768
|
-
this.refLineLayer.append('text').attr('class', "reference-line-label").attr('x',
|
|
8782
|
+
this.refLineLayer.append('text').attr('class', "reference-line-label").attr('x', length).attr('y', this["".concat(yAxis, "Axis")](data.value)).attr('font-size', this.options.fontSize).attr('fill', data.color).text(data.label).attr('text-anchor', 'end').attr('alignment-baseline', 'text-after-edge');
|
|
8769
8783
|
}
|
|
8770
8784
|
}
|
|
8771
8785
|
}, {
|
|
@@ -9371,7 +9385,6 @@ var WebsyChartTooltip = /*#__PURE__*/function () {
|
|
|
9371
9385
|
classes.push('top');
|
|
9372
9386
|
}
|
|
9373
9387
|
|
|
9374
|
-
console.log(classes.join(' '));
|
|
9375
9388
|
var fO = this.tooltipLayer.selectAll('foreignObject').attr('width', "".concat(position.width, "px")) // .attr('height', `${position.height}px`)
|
|
9376
9389
|
// .attr('y', `0px`)
|
|
9377
9390
|
.attr('class', "websy-chart-tooltip ".concat(classes.join(' ')));
|