@websy/websy-designs 1.9.2 → 1.9.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.
- package/dist/websy-designs-es6.debug.js +53 -24
- package/dist/websy-designs-es6.js +48 -22
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +53 -24
- package/dist/websy-designs.js +48 -22
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -176,7 +176,9 @@ class ButtonGroup {
|
|
|
176
176
|
subscribers: {},
|
|
177
177
|
activeItem: -1,
|
|
178
178
|
tag: 'div',
|
|
179
|
-
allowNone: false
|
|
179
|
+
allowNone: false,
|
|
180
|
+
onActivate: () => {},
|
|
181
|
+
onDeactivate: () => {}
|
|
180
182
|
}
|
|
181
183
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
182
184
|
const el = document.getElementById(this.elementId)
|
|
@@ -188,7 +190,19 @@ class ButtonGroup {
|
|
|
188
190
|
handleClick (event) {
|
|
189
191
|
if (event.target.classList.contains('websy-button-group-item')) {
|
|
190
192
|
const index = +event.target.getAttribute('data-index')
|
|
191
|
-
if (this.options.
|
|
193
|
+
if (this.options.multiSelect === true) {
|
|
194
|
+
if (event.target.classList.contains('active')) {
|
|
195
|
+
this.options.onDeactivate(this.options.items[index], index, event)
|
|
196
|
+
event.target.classList.remove('active')
|
|
197
|
+
event.target.classList.add('inactive')
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
this.options.onActivate(this.options.items[index], index, event)
|
|
201
|
+
event.target.classList.add('active')
|
|
202
|
+
event.target.classList.remove('inactive')
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else if (this.options.activeItem !== index) {
|
|
192
206
|
const el = document.getElementById(this.elementId)
|
|
193
207
|
let buttons = Array.from(el.querySelectorAll('.websy-button-group-item'))
|
|
194
208
|
buttons.forEach(el => {
|
|
@@ -2321,7 +2335,7 @@ class WebsyForm {
|
|
|
2321
2335
|
let componentsToProcess = []
|
|
2322
2336
|
if (el) {
|
|
2323
2337
|
let html = `
|
|
2324
|
-
<form id="${this.elementId}Form" class="websy-form ${this.options.classes || ''}">
|
|
2338
|
+
<form id="${this.elementId}Form" class="websy-form ${(this.options.classes || []).join(' ')}">
|
|
2325
2339
|
`
|
|
2326
2340
|
this.options.fields.forEach((f, i) => {
|
|
2327
2341
|
this.fieldMap[f.field] = f
|
|
@@ -2776,6 +2790,7 @@ class WebsyNavigationMenu {
|
|
|
2776
2790
|
activeSymbol: 'none',
|
|
2777
2791
|
enableSearch: false,
|
|
2778
2792
|
searchProp: 'text',
|
|
2793
|
+
indent: 'padding',
|
|
2779
2794
|
menuIcon: `<svg viewbox="0 0 40 40" width="30" height="40">
|
|
2780
2795
|
<rect x="0" y="0" width="30" height="4" rx="2"></rect>
|
|
2781
2796
|
<rect x="0" y="12" width="30" height="4" rx="2"></rect>
|
|
@@ -3020,7 +3035,7 @@ class WebsyNavigationMenu {
|
|
|
3020
3035
|
data-menu-id='${this.elementId}_${currentBlock}_list'
|
|
3021
3036
|
data-popout-id='${level > 1 ? block : currentBlock}'
|
|
3022
3037
|
data-text='${items[i].isLink !== true ? items[i].text : ''}'
|
|
3023
|
-
style='
|
|
3038
|
+
style='${this.options.indent}-left: ${level * this.options.childIndentation}px'
|
|
3024
3039
|
${(items[i].attributes && items[i].attributes.join(' ')) || ''}
|
|
3025
3040
|
>
|
|
3026
3041
|
`
|
|
@@ -5030,7 +5045,7 @@ const WebsyUtils = {
|
|
|
5030
5045
|
if (numOut % 1 > 0) {
|
|
5031
5046
|
decimals = 1
|
|
5032
5047
|
}
|
|
5033
|
-
if (numOut < 1) {
|
|
5048
|
+
if (numOut < 1 && decimals === 0) {
|
|
5034
5049
|
decimals = getZeroDecimals(numOut)
|
|
5035
5050
|
}
|
|
5036
5051
|
numOut = (+numOut).toFixed(decimals)
|
|
@@ -7421,6 +7436,9 @@ else {
|
|
|
7421
7436
|
.select('.tracking-line')
|
|
7422
7437
|
.attr('stroke-opacity', 0)
|
|
7423
7438
|
this.tooltip.hide()
|
|
7439
|
+
if (this.options.onMouseOut) {
|
|
7440
|
+
this.options.onMouseOut()
|
|
7441
|
+
}
|
|
7424
7442
|
}
|
|
7425
7443
|
handleEventMouseMove (event, d) {
|
|
7426
7444
|
let bisectDate = d3.bisector(d => {
|
|
@@ -7447,6 +7465,9 @@ else {
|
|
|
7447
7465
|
let xDiff
|
|
7448
7466
|
if (typeof x0 === 'undefined') {
|
|
7449
7467
|
this.tooltip.hide()
|
|
7468
|
+
if (this.options.onMouseOut) {
|
|
7469
|
+
this.options.onMouseOut()
|
|
7470
|
+
}
|
|
7450
7471
|
return
|
|
7451
7472
|
}
|
|
7452
7473
|
let xLabel = this[xAxis].domain()[x0]
|
|
@@ -7469,7 +7490,7 @@ else {
|
|
|
7469
7490
|
if (!d.y.color) {
|
|
7470
7491
|
d.y.color = s.color
|
|
7471
7492
|
}
|
|
7472
|
-
tooltipData.push(d
|
|
7493
|
+
tooltipData.push(d)
|
|
7473
7494
|
}
|
|
7474
7495
|
})
|
|
7475
7496
|
}
|
|
@@ -7487,7 +7508,7 @@ else {
|
|
|
7487
7508
|
if (!pointA.y.color) {
|
|
7488
7509
|
pointA.y.color = s.color
|
|
7489
7510
|
}
|
|
7490
|
-
tooltipData.push(pointA
|
|
7511
|
+
tooltipData.push(pointA)
|
|
7491
7512
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7492
7513
|
tooltipTitle = d3.timeFormat(this.options.dateFormat || this.options.calculatedTimeFormatPattern)(pointA.x.value)
|
|
7493
7514
|
}
|
|
@@ -7498,7 +7519,7 @@ else {
|
|
|
7498
7519
|
if (!pointB.y.color) {
|
|
7499
7520
|
pointB.y.color = s.color
|
|
7500
7521
|
}
|
|
7501
|
-
tooltipData.push(pointB
|
|
7522
|
+
tooltipData.push(pointB)
|
|
7502
7523
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7503
7524
|
tooltipTitle = d3.timeFormat(this.options.dateFormat || this.options.calculatedTimeFormatPattern)(pointB.x.value)
|
|
7504
7525
|
}
|
|
@@ -7516,7 +7537,7 @@ else {
|
|
|
7516
7537
|
if (!pointB.y.color) {
|
|
7517
7538
|
pointB.y.color = s.color
|
|
7518
7539
|
}
|
|
7519
|
-
tooltipData.push(pointB
|
|
7540
|
+
tooltipData.push(pointB)
|
|
7520
7541
|
}
|
|
7521
7542
|
else {
|
|
7522
7543
|
xPoint = d0
|
|
@@ -7527,7 +7548,7 @@ else {
|
|
|
7527
7548
|
if (!pointA.y.color) {
|
|
7528
7549
|
pointA.y.color = s.color
|
|
7529
7550
|
}
|
|
7530
|
-
tooltipData.push(pointA
|
|
7551
|
+
tooltipData.push(pointA)
|
|
7531
7552
|
}
|
|
7532
7553
|
}
|
|
7533
7554
|
}
|
|
@@ -7537,10 +7558,13 @@ else {
|
|
|
7537
7558
|
`
|
|
7538
7559
|
tooltipHTML += tooltipData.map(d => `
|
|
7539
7560
|
<li>
|
|
7540
|
-
<i style='background-color: ${d.color};'></i>
|
|
7541
|
-
${d.tooltipLabel || ''}<span>: ${d.tooltipValue || d.value}</span>
|
|
7561
|
+
<i style='background-color: ${d.y.color};'></i>
|
|
7562
|
+
${d.y.tooltipLabel || ''}<span>: ${d.y.tooltipValue || d.value}</span>
|
|
7542
7563
|
</li>
|
|
7543
7564
|
`).join('')
|
|
7565
|
+
if (this.options.onMouseOver) {
|
|
7566
|
+
this.options.onMouseOver(tooltipData)
|
|
7567
|
+
}
|
|
7544
7568
|
tooltipHTML += `</ul>`
|
|
7545
7569
|
let posOptions = {
|
|
7546
7570
|
width: this.options.tooltipWidth,
|
|
@@ -7584,6 +7608,9 @@ else {
|
|
|
7584
7608
|
this.tooltip.setHeight(this.plotHeight)
|
|
7585
7609
|
if (isNaN(posOptions.left)) {
|
|
7586
7610
|
this.tooltip.hide()
|
|
7611
|
+
if (this.options.onMouseOut) {
|
|
7612
|
+
this.options.onMouseOut()
|
|
7613
|
+
}
|
|
7587
7614
|
return
|
|
7588
7615
|
}
|
|
7589
7616
|
this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions)
|
|
@@ -7630,9 +7657,9 @@ this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer')
|
|
|
7630
7657
|
this.rightAxisLabel = this.svg.append('g').attr('class', 'right-axis-label-layer')
|
|
7631
7658
|
this.bottomAxisLabel = this.svg.append('g').attr('class', 'bottom-axis-label-layer')
|
|
7632
7659
|
this.plotArea = this.svg.append('g').attr('class', 'plot-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
|
|
7660
|
+
this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
|
|
7633
7661
|
this.areaLayer = this.svg.append('g').attr('class', 'area-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
|
|
7634
7662
|
this.lineLayer = this.svg.append('g').attr('class', 'line-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
|
|
7635
|
-
this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
|
|
7636
7663
|
// this.barLayer.attr('clip-path', `url(#${this.elementId}_clip)`)
|
|
7637
7664
|
this.labelLayer = this.svg.append('g').attr('class', 'label-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
|
|
7638
7665
|
this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
|
|
@@ -7817,9 +7844,9 @@ else {
|
|
|
7817
7844
|
this.options.data.right.max = d3.max(this.options.data.right.data)
|
|
7818
7845
|
}
|
|
7819
7846
|
if (this.options.data.right && typeof this.options.data.right.max !== 'undefined') {
|
|
7820
|
-
this.longestRight = this.options.data.right.max.toString()
|
|
7847
|
+
this.longestRight = this.options.data.right.max.length > this.options.data.right.min.length ? this.options.data.right.max.toString() : this.options.data.right.min.toString()
|
|
7821
7848
|
if (this.options.data.right.formatter) {
|
|
7822
|
-
this.longestRight = this.options.data.right.formatter(this.
|
|
7849
|
+
this.longestRight = this.options.data.right.formatter(this.longestRight).toString()
|
|
7823
7850
|
}
|
|
7824
7851
|
}
|
|
7825
7852
|
// Check to see if we need to balance the min and max values
|
|
@@ -7831,10 +7858,10 @@ else {
|
|
|
7831
7858
|
}
|
|
7832
7859
|
else {
|
|
7833
7860
|
let biggestLeft = Math.max(Math.abs(this.options.data.left.min), this.options.data.left.max)
|
|
7834
|
-
this.options.data.left.min =
|
|
7861
|
+
this.options.data.left.min = biggestLeft * -1
|
|
7835
7862
|
this.options.data.left.max = biggestLeft
|
|
7836
7863
|
let biggestRight = Math.max(Math.abs(this.options.data.right.min), this.options.data.right.max)
|
|
7837
|
-
this.options.data.right.min =
|
|
7864
|
+
this.options.data.right.min = biggestRight * -1
|
|
7838
7865
|
this.options.data.right.max = biggestRight
|
|
7839
7866
|
}
|
|
7840
7867
|
}
|
|
@@ -7859,7 +7886,7 @@ else {
|
|
|
7859
7886
|
}
|
|
7860
7887
|
}
|
|
7861
7888
|
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth) + 5 // + 5 to accommodate for space between text and axis line
|
|
7862
|
-
this.options.margin.axisRight = longestRightBounds.width
|
|
7889
|
+
this.options.margin.axisRight = longestRightBounds.width + 10
|
|
7863
7890
|
this.options.margin.axisBottom = longestBottomBounds.height + 10
|
|
7864
7891
|
this.options.margin.axisTop = 0
|
|
7865
7892
|
// adjust axis margins based on title options
|
|
@@ -7924,7 +7951,8 @@ else {
|
|
|
7924
7951
|
this.totalBrushBandPadding = 0
|
|
7925
7952
|
let noOfPoints = 0
|
|
7926
7953
|
let noOfGroups = 0
|
|
7927
|
-
let plotable = 0
|
|
7954
|
+
let plotable = 0
|
|
7955
|
+
|
|
7928
7956
|
if (this.options.maxBandWidth) {
|
|
7929
7957
|
if (this.options.orientation === 'horizontal') {
|
|
7930
7958
|
this.options.data.left.totalValueCount = this.options.data.left.data.reduce((a, b) => {
|
|
@@ -8018,7 +8046,8 @@ else {
|
|
|
8018
8046
|
// }
|
|
8019
8047
|
// }
|
|
8020
8048
|
// Translate the layers
|
|
8021
|
-
const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0
|
|
8049
|
+
const leftBrushAdjustment = this.options.orientation === 'horizontal' && this.brushNeeded === true ? this.options.brushHeight : 0
|
|
8050
|
+
// const bottomBrushAdjustment = this.options.orientation === 'vertical' && this.brushNeeded === true ? this.options.brushHeight : 0
|
|
8022
8051
|
this.leftAxisLayer
|
|
8023
8052
|
.attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8024
8053
|
.style('font-size', (this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize)
|
|
@@ -8058,12 +8087,12 @@ else {
|
|
|
8058
8087
|
this.brushLayer
|
|
8059
8088
|
.attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8060
8089
|
this.yAxisClip
|
|
8061
|
-
.attr('transform', `translate(${leftBrushAdjustment
|
|
8090
|
+
.attr('transform', `translate(${leftBrushAdjustment}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
8062
8091
|
.attr('width', this.options.margin.axisLeft + 10)
|
|
8063
8092
|
.attr('height', this.plotHeight)
|
|
8064
8093
|
this.xAxisClip
|
|
8065
8094
|
.attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
|
|
8066
|
-
.attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
|
|
8095
|
+
.attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right)
|
|
8067
8096
|
.attr('height', longestBottomBounds.height + 10)
|
|
8068
8097
|
this.brushClip
|
|
8069
8098
|
.attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
|
|
@@ -8074,12 +8103,12 @@ else {
|
|
|
8074
8103
|
this.brushLayer
|
|
8075
8104
|
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
|
|
8076
8105
|
this.yAxisClip
|
|
8077
|
-
.attr('transform', `translate(
|
|
8106
|
+
.attr('transform', `translate(0, ${this.options.margin.top + this.options.margin.axisTop - 10})`)
|
|
8078
8107
|
.attr('width', this.options.margin.axisLeft + 10)
|
|
8079
8108
|
.attr('height', this.plotHeight + 20)
|
|
8080
8109
|
this.xAxisClip
|
|
8081
8110
|
.attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
|
|
8082
|
-
.attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
|
|
8111
|
+
.attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right)
|
|
8083
8112
|
.attr('height', longestBottomBounds.height + 10)
|
|
8084
8113
|
this.brushClip
|
|
8085
8114
|
.attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
|
|
@@ -219,7 +219,9 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
219
219
|
subscribers: {},
|
|
220
220
|
activeItem: -1,
|
|
221
221
|
tag: 'div',
|
|
222
|
-
allowNone: false
|
|
222
|
+
allowNone: false,
|
|
223
|
+
onActivate: function onActivate() {},
|
|
224
|
+
onDeactivate: function onDeactivate() {}
|
|
223
225
|
};
|
|
224
226
|
this.options = _extends({}, DEFAULTS, options);
|
|
225
227
|
var el = document.getElementById(this.elementId);
|
|
@@ -233,7 +235,17 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
233
235
|
value: function handleClick(event) {
|
|
234
236
|
if (event.target.classList.contains('websy-button-group-item')) {
|
|
235
237
|
var index = +event.target.getAttribute('data-index');
|
|
236
|
-
if (this.options.
|
|
238
|
+
if (this.options.multiSelect === true) {
|
|
239
|
+
if (event.target.classList.contains('active')) {
|
|
240
|
+
this.options.onDeactivate(this.options.items[index], index, event);
|
|
241
|
+
event.target.classList.remove('active');
|
|
242
|
+
event.target.classList.add('inactive');
|
|
243
|
+
} else {
|
|
244
|
+
this.options.onActivate(this.options.items[index], index, event);
|
|
245
|
+
event.target.classList.add('active');
|
|
246
|
+
event.target.classList.remove('inactive');
|
|
247
|
+
}
|
|
248
|
+
} else if (this.options.activeItem !== index) {
|
|
237
249
|
var el = document.getElementById(this.elementId);
|
|
238
250
|
var buttons = Array.from(el.querySelectorAll('.websy-button-group-item'));
|
|
239
251
|
buttons.forEach(function (el) {
|
|
@@ -2351,7 +2363,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2351
2363
|
var el = document.getElementById(this.elementId);
|
|
2352
2364
|
var componentsToProcess = [];
|
|
2353
2365
|
if (el) {
|
|
2354
|
-
var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat(this.options.classes || '', "\">\n ");
|
|
2366
|
+
var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat((this.options.classes || []).join(' '), "\">\n ");
|
|
2355
2367
|
this.options.fields.forEach(function (f, i) {
|
|
2356
2368
|
_this17.fieldMap[f.field] = f;
|
|
2357
2369
|
if (f.component) {
|
|
@@ -2610,6 +2622,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2610
2622
|
activeSymbol: 'none',
|
|
2611
2623
|
enableSearch: false,
|
|
2612
2624
|
searchProp: 'text',
|
|
2625
|
+
indent: 'padding',
|
|
2613
2626
|
menuIcon: "<svg viewbox=\"0 0 40 40\" width=\"30\" height=\"40\"> \n <rect x=\"0\" y=\"0\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n <rect x=\"0\" y=\"12\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n <rect x=\"0\" y=\"24\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n </svg>",
|
|
2614
2627
|
searchOptions: {}
|
|
2615
2628
|
}, options);
|
|
@@ -2849,7 +2862,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2849
2862
|
if (Array.isArray(items[i].classes)) {
|
|
2850
2863
|
items[i].classes = items[i].classes.join(' ');
|
|
2851
2864
|
}
|
|
2852
|
-
html += "\n\t\t\t<li class='websy-".concat(this.options.orientation, "-list-item ").concat(items[i].alwaysOpen === true ? 'always-open' : '', "'>\n\t\t\t\t<div class='websy-menu-header websy-menu-level-").concat(level, " ").concat(items[i].classes || '', " ").concat(selected, " ").concat(active, "' \n id='").concat(blockId, "' \n data-id='").concat(currentBlock, "'\n data-path='").concat(items[i].path, "'\n data-menu-id='").concat(this.elementId, "_").concat(currentBlock, "_list'\n data-popout-id='").concat(level > 1 ? block : currentBlock, "'\n data-text='").concat(items[i].isLink !== true ? items[i].text : '', "'\n style='
|
|
2865
|
+
html += "\n\t\t\t<li class='websy-".concat(this.options.orientation, "-list-item ").concat(items[i].alwaysOpen === true ? 'always-open' : '', "'>\n\t\t\t\t<div class='websy-menu-header websy-menu-level-").concat(level, " ").concat(items[i].classes || '', " ").concat(selected, " ").concat(active, "' \n id='").concat(blockId, "' \n data-id='").concat(currentBlock, "'\n data-path='").concat(items[i].path, "'\n data-menu-id='").concat(this.elementId, "_").concat(currentBlock, "_list'\n data-popout-id='").concat(level > 1 ? block : currentBlock, "'\n data-text='").concat(items[i].isLink !== true ? items[i].text : '', "'\n style='").concat(this.options.indent, "-left: ").concat(level * this.options.childIndentation, "px'\n ").concat(items[i].attributes && items[i].attributes.join(' ') || '', "\n >\n ");
|
|
2853
2866
|
if (this.options.orientation === 'horizontal') {
|
|
2854
2867
|
html += items[i].text;
|
|
2855
2868
|
}
|
|
@@ -4888,7 +4901,7 @@ var WebsyUtils = {
|
|
|
4888
4901
|
if (numOut % 1 > 0) {
|
|
4889
4902
|
decimals = 1;
|
|
4890
4903
|
}
|
|
4891
|
-
if (numOut < 1) {
|
|
4904
|
+
if (numOut < 1 && decimals === 0) {
|
|
4892
4905
|
decimals = getZeroDecimals(numOut);
|
|
4893
4906
|
}
|
|
4894
4907
|
numOut = (+numOut).toFixed(decimals);
|
|
@@ -7131,6 +7144,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7131
7144
|
value: function handleEventMouseOut(event, d) {
|
|
7132
7145
|
this.trackingLineLayer.select('.tracking-line').attr('stroke-opacity', 0);
|
|
7133
7146
|
this.tooltip.hide();
|
|
7147
|
+
if (this.options.onMouseOut) {
|
|
7148
|
+
this.options.onMouseOut();
|
|
7149
|
+
}
|
|
7134
7150
|
}
|
|
7135
7151
|
}, {
|
|
7136
7152
|
key: "handleEventMouseMove",
|
|
@@ -7160,6 +7176,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7160
7176
|
var xDiff;
|
|
7161
7177
|
if (typeof x0 === 'undefined') {
|
|
7162
7178
|
this.tooltip.hide();
|
|
7179
|
+
if (this.options.onMouseOut) {
|
|
7180
|
+
this.options.onMouseOut();
|
|
7181
|
+
}
|
|
7163
7182
|
return;
|
|
7164
7183
|
}
|
|
7165
7184
|
var xLabel = this[xAxis].domain()[x0];
|
|
@@ -7182,7 +7201,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7182
7201
|
if (!d.y.color) {
|
|
7183
7202
|
d.y.color = s.color;
|
|
7184
7203
|
}
|
|
7185
|
-
tooltipData.push(d
|
|
7204
|
+
tooltipData.push(d);
|
|
7186
7205
|
}
|
|
7187
7206
|
});
|
|
7188
7207
|
} else {
|
|
@@ -7199,7 +7218,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7199
7218
|
if (!pointA.y.color) {
|
|
7200
7219
|
pointA.y.color = s.color;
|
|
7201
7220
|
}
|
|
7202
|
-
tooltipData.push(pointA
|
|
7221
|
+
tooltipData.push(pointA);
|
|
7203
7222
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7204
7223
|
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7205
7224
|
}
|
|
@@ -7210,7 +7229,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7210
7229
|
if (!pointB.y.color) {
|
|
7211
7230
|
pointB.y.color = s.color;
|
|
7212
7231
|
}
|
|
7213
|
-
tooltipData.push(pointB
|
|
7232
|
+
tooltipData.push(pointB);
|
|
7214
7233
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7215
7234
|
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7216
7235
|
}
|
|
@@ -7228,7 +7247,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7228
7247
|
if (!pointB.y.color) {
|
|
7229
7248
|
pointB.y.color = s.color;
|
|
7230
7249
|
}
|
|
7231
|
-
tooltipData.push(pointB
|
|
7250
|
+
tooltipData.push(pointB);
|
|
7232
7251
|
} else {
|
|
7233
7252
|
xPoint = d0;
|
|
7234
7253
|
tooltipTitle = pointA.x.value;
|
|
@@ -7238,15 +7257,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7238
7257
|
if (!pointA.y.color) {
|
|
7239
7258
|
pointA.y.color = s.color;
|
|
7240
7259
|
}
|
|
7241
|
-
tooltipData.push(pointA
|
|
7260
|
+
tooltipData.push(pointA);
|
|
7242
7261
|
}
|
|
7243
7262
|
}
|
|
7244
7263
|
}
|
|
7245
7264
|
});
|
|
7246
7265
|
tooltipHTML = " \n <ul>\n ";
|
|
7247
7266
|
tooltipHTML += tooltipData.map(function (d) {
|
|
7248
|
-
return "\n <li>\n <i style='background-color: ".concat(d.color, ";'></i>\n ").concat(d.tooltipLabel || '', "<span>: ").concat(d.tooltipValue || d.value, "</span>\n </li>\n ");
|
|
7267
|
+
return "\n <li>\n <i style='background-color: ".concat(d.y.color, ";'></i>\n ").concat(d.y.tooltipLabel || '', "<span>: ").concat(d.y.tooltipValue || d.value, "</span>\n </li>\n ");
|
|
7249
7268
|
}).join('');
|
|
7269
|
+
if (this.options.onMouseOver) {
|
|
7270
|
+
this.options.onMouseOver(tooltipData);
|
|
7271
|
+
}
|
|
7250
7272
|
tooltipHTML += "</ul>";
|
|
7251
7273
|
var posOptions = {
|
|
7252
7274
|
width: this.options.tooltipWidth,
|
|
@@ -7289,6 +7311,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7289
7311
|
this.tooltip.setHeight(this.plotHeight);
|
|
7290
7312
|
if (isNaN(posOptions.left)) {
|
|
7291
7313
|
this.tooltip.hide();
|
|
7314
|
+
if (this.options.onMouseOut) {
|
|
7315
|
+
this.options.onMouseOut();
|
|
7316
|
+
}
|
|
7292
7317
|
return;
|
|
7293
7318
|
}
|
|
7294
7319
|
this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions);
|
|
@@ -7329,9 +7354,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7329
7354
|
this.rightAxisLabel = this.svg.append('g').attr('class', 'right-axis-label-layer');
|
|
7330
7355
|
this.bottomAxisLabel = this.svg.append('g').attr('class', 'bottom-axis-label-layer');
|
|
7331
7356
|
this.plotArea = this.svg.append('g').attr('class', 'plot-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
7357
|
+
this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
7332
7358
|
this.areaLayer = this.svg.append('g').attr('class', 'area-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
7333
7359
|
this.lineLayer = this.svg.append('g').attr('class', 'line-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
7334
|
-
this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
7335
7360
|
// this.barLayer.attr('clip-path', `url(#${this.elementId}_clip)`)
|
|
7336
7361
|
this.labelLayer = this.svg.append('g').attr('class', 'label-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
7337
7362
|
this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
|
|
@@ -7524,9 +7549,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7524
7549
|
this.options.data.right.max = d3.max(this.options.data.right.data);
|
|
7525
7550
|
}
|
|
7526
7551
|
if (this.options.data.right && typeof this.options.data.right.max !== 'undefined') {
|
|
7527
|
-
this.longestRight = this.options.data.right.max.toString();
|
|
7552
|
+
this.longestRight = this.options.data.right.max.length > this.options.data.right.min.length ? this.options.data.right.max.toString() : this.options.data.right.min.toString();
|
|
7528
7553
|
if (this.options.data.right.formatter) {
|
|
7529
|
-
this.longestRight = this.options.data.right.formatter(this.
|
|
7554
|
+
this.longestRight = this.options.data.right.formatter(this.longestRight).toString();
|
|
7530
7555
|
}
|
|
7531
7556
|
}
|
|
7532
7557
|
// Check to see if we need to balance the min and max values
|
|
@@ -7537,10 +7562,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7537
7562
|
this.options.data.bottom.max = biggestBottom;
|
|
7538
7563
|
} else {
|
|
7539
7564
|
var biggestLeft = Math.max(Math.abs(this.options.data.left.min), this.options.data.left.max);
|
|
7540
|
-
this.options.data.left.min =
|
|
7565
|
+
this.options.data.left.min = biggestLeft * -1;
|
|
7541
7566
|
this.options.data.left.max = biggestLeft;
|
|
7542
7567
|
var biggestRight = Math.max(Math.abs(this.options.data.right.min), this.options.data.right.max);
|
|
7543
|
-
this.options.data.right.min =
|
|
7568
|
+
this.options.data.right.min = biggestRight * -1;
|
|
7544
7569
|
this.options.data.right.max = biggestRight;
|
|
7545
7570
|
}
|
|
7546
7571
|
}
|
|
@@ -7564,7 +7589,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7564
7589
|
}
|
|
7565
7590
|
}
|
|
7566
7591
|
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth) + 5; // + 5 to accommodate for space between text and axis line
|
|
7567
|
-
this.options.margin.axisRight = longestRightBounds.width;
|
|
7592
|
+
this.options.margin.axisRight = longestRightBounds.width + 10;
|
|
7568
7593
|
this.options.margin.axisBottom = longestBottomBounds.height + 10;
|
|
7569
7594
|
this.options.margin.axisTop = 0;
|
|
7570
7595
|
// adjust axis margins based on title options
|
|
@@ -7716,7 +7741,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7716
7741
|
// }
|
|
7717
7742
|
// }
|
|
7718
7743
|
// Translate the layers
|
|
7719
|
-
var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0;
|
|
7744
|
+
var leftBrushAdjustment = this.options.orientation === 'horizontal' && this.brushNeeded === true ? this.options.brushHeight : 0;
|
|
7745
|
+
// const bottomBrushAdjustment = this.options.orientation === 'vertical' && this.brushNeeded === true ? this.options.brushHeight : 0
|
|
7720
7746
|
this.leftAxisLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).style('font-size', this.options.data.left && this.options.data.left.fontSize || this.options.fontSize);
|
|
7721
7747
|
this.rightAxisLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.plotWidth + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).style('font-size', this.options.data.right && this.options.data.right.fontSize || this.options.fontSize);
|
|
7722
7748
|
this.bottomAxisLayer.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).style('font-size', this.options.data.bottom && this.options.data.bottom.fontSize || this.options.fontSize);
|
|
@@ -7734,13 +7760,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7734
7760
|
this.clip.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft, ", 0)")).attr('width', this.plotWidth).attr('height', this.plotHeight + this.options.margin.top + this.options.margin.axisTop);
|
|
7735
7761
|
if (this.options.orientation === 'horizontal') {
|
|
7736
7762
|
this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
|
|
7737
|
-
this.yAxisClip.attr('transform', "translate(".concat(leftBrushAdjustment
|
|
7738
|
-
this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight).attr('height', longestBottomBounds.height + 10);
|
|
7763
|
+
this.yAxisClip.attr('transform', "translate(".concat(leftBrushAdjustment, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('width', this.options.margin.axisLeft + 10).attr('height', this.plotHeight);
|
|
7764
|
+
this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right).attr('height', longestBottomBounds.height + 10);
|
|
7739
7765
|
this.brushClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('height', this.plotHeight).attr('width', this.options.brushHeight);
|
|
7740
7766
|
} else {
|
|
7741
7767
|
this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")"));
|
|
7742
|
-
this.yAxisClip.attr('transform', "translate(
|
|
7743
|
-
this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight).attr('height', longestBottomBounds.height + 10);
|
|
7768
|
+
this.yAxisClip.attr('transform', "translate(0, ".concat(this.options.margin.top + this.options.margin.axisTop - 10, ")")).attr('width', this.options.margin.axisLeft + 10).attr('height', this.plotHeight + 20);
|
|
7769
|
+
this.xAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight, ")")).attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right).attr('height', longestBottomBounds.height + 10);
|
|
7744
7770
|
this.brushClip.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height, ")")).attr('width', this.plotWidth).attr('height', this.options.brushHeight);
|
|
7745
7771
|
}
|
|
7746
7772
|
this.eventLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
|