@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.
@@ -181,7 +181,9 @@ class ButtonGroup {
181
181
  subscribers: {},
182
182
  activeItem: -1,
183
183
  tag: 'div',
184
- allowNone: false
184
+ allowNone: false,
185
+ onActivate: () => {},
186
+ onDeactivate: () => {}
185
187
  }
186
188
  this.options = Object.assign({}, DEFAULTS, options)
187
189
  const el = document.getElementById(this.elementId)
@@ -193,7 +195,19 @@ class ButtonGroup {
193
195
  handleClick (event) {
194
196
  if (event.target.classList.contains('websy-button-group-item')) {
195
197
  const index = +event.target.getAttribute('data-index')
196
- if (this.options.activeItem !== index) {
198
+ if (this.options.multiSelect === true) {
199
+ if (event.target.classList.contains('active')) {
200
+ this.options.onDeactivate(this.options.items[index], index, event)
201
+ event.target.classList.remove('active')
202
+ event.target.classList.add('inactive')
203
+ }
204
+ else {
205
+ this.options.onActivate(this.options.items[index], index, event)
206
+ event.target.classList.add('active')
207
+ event.target.classList.remove('inactive')
208
+ }
209
+ }
210
+ else if (this.options.activeItem !== index) {
197
211
  const el = document.getElementById(this.elementId)
198
212
  let buttons = Array.from(el.querySelectorAll('.websy-button-group-item'))
199
213
  buttons.forEach(el => {
@@ -2520,7 +2534,7 @@ class WebsyForm {
2520
2534
  let componentsToProcess = []
2521
2535
  if (el) {
2522
2536
  let html = `
2523
- <form id="${this.elementId}Form" class="websy-form ${this.options.classes || ''}">
2537
+ <form id="${this.elementId}Form" class="websy-form ${(this.options.classes || []).join(' ')}">
2524
2538
  `
2525
2539
  this.options.fields.forEach((f, i) => {
2526
2540
  this.fieldMap[f.field] = f
@@ -3039,6 +3053,7 @@ class WebsyNavigationMenu {
3039
3053
  activeSymbol: 'none',
3040
3054
  enableSearch: false,
3041
3055
  searchProp: 'text',
3056
+ indent: 'padding',
3042
3057
  menuIcon: `<svg viewbox="0 0 40 40" width="30" height="40">
3043
3058
  <rect x="0" y="0" width="30" height="4" rx="2"></rect>
3044
3059
  <rect x="0" y="12" width="30" height="4" rx="2"></rect>
@@ -3283,7 +3298,7 @@ class WebsyNavigationMenu {
3283
3298
  data-menu-id='${this.elementId}_${currentBlock}_list'
3284
3299
  data-popout-id='${level > 1 ? block : currentBlock}'
3285
3300
  data-text='${items[i].isLink !== true ? items[i].text : ''}'
3286
- style='padding-left: ${level * this.options.childIndentation}px'
3301
+ style='${this.options.indent}-left: ${level * this.options.childIndentation}px'
3287
3302
  ${(items[i].attributes && items[i].attributes.join(' ')) || ''}
3288
3303
  >
3289
3304
  `
@@ -5446,7 +5461,7 @@ const WebsyUtils = {
5446
5461
  if (numOut % 1 > 0) {
5447
5462
  decimals = 1
5448
5463
  }
5449
- if (numOut < 1) {
5464
+ if (numOut < 1 && decimals === 0) {
5450
5465
  decimals = getZeroDecimals(numOut)
5451
5466
  }
5452
5467
  numOut = (+numOut).toFixed(decimals)
@@ -7837,6 +7852,9 @@ else {
7837
7852
  .select('.tracking-line')
7838
7853
  .attr('stroke-opacity', 0)
7839
7854
  this.tooltip.hide()
7855
+ if (this.options.onMouseOut) {
7856
+ this.options.onMouseOut()
7857
+ }
7840
7858
  }
7841
7859
  handleEventMouseMove (event, d) {
7842
7860
  let bisectDate = d3.bisector(d => {
@@ -7863,6 +7881,9 @@ else {
7863
7881
  let xDiff
7864
7882
  if (typeof x0 === 'undefined') {
7865
7883
  this.tooltip.hide()
7884
+ if (this.options.onMouseOut) {
7885
+ this.options.onMouseOut()
7886
+ }
7866
7887
  return
7867
7888
  }
7868
7889
  let xLabel = this[xAxis].domain()[x0]
@@ -7885,7 +7906,7 @@ else {
7885
7906
  if (!d.y.color) {
7886
7907
  d.y.color = s.color
7887
7908
  }
7888
- tooltipData.push(d.y)
7909
+ tooltipData.push(d)
7889
7910
  }
7890
7911
  })
7891
7912
  }
@@ -7903,7 +7924,7 @@ else {
7903
7924
  if (!pointA.y.color) {
7904
7925
  pointA.y.color = s.color
7905
7926
  }
7906
- tooltipData.push(pointA.y)
7927
+ tooltipData.push(pointA)
7907
7928
  if (typeof pointA.x.value.getTime !== 'undefined') {
7908
7929
  tooltipTitle = d3.timeFormat(this.options.dateFormat || this.options.calculatedTimeFormatPattern)(pointA.x.value)
7909
7930
  }
@@ -7914,7 +7935,7 @@ else {
7914
7935
  if (!pointB.y.color) {
7915
7936
  pointB.y.color = s.color
7916
7937
  }
7917
- tooltipData.push(pointB.y)
7938
+ tooltipData.push(pointB)
7918
7939
  if (typeof pointB.x.value.getTime !== 'undefined') {
7919
7940
  tooltipTitle = d3.timeFormat(this.options.dateFormat || this.options.calculatedTimeFormatPattern)(pointB.x.value)
7920
7941
  }
@@ -7932,7 +7953,7 @@ else {
7932
7953
  if (!pointB.y.color) {
7933
7954
  pointB.y.color = s.color
7934
7955
  }
7935
- tooltipData.push(pointB.y)
7956
+ tooltipData.push(pointB)
7936
7957
  }
7937
7958
  else {
7938
7959
  xPoint = d0
@@ -7943,7 +7964,7 @@ else {
7943
7964
  if (!pointA.y.color) {
7944
7965
  pointA.y.color = s.color
7945
7966
  }
7946
- tooltipData.push(pointA.y)
7967
+ tooltipData.push(pointA)
7947
7968
  }
7948
7969
  }
7949
7970
  }
@@ -7953,10 +7974,13 @@ else {
7953
7974
  `
7954
7975
  tooltipHTML += tooltipData.map(d => `
7955
7976
  <li>
7956
- <i style='background-color: ${d.color};'></i>
7957
- ${d.tooltipLabel || ''}<span>: ${d.tooltipValue || d.value}</span>
7977
+ <i style='background-color: ${d.y.color};'></i>
7978
+ ${d.y.tooltipLabel || ''}<span>: ${d.y.tooltipValue || d.value}</span>
7958
7979
  </li>
7959
7980
  `).join('')
7981
+ if (this.options.onMouseOver) {
7982
+ this.options.onMouseOver(tooltipData)
7983
+ }
7960
7984
  tooltipHTML += `</ul>`
7961
7985
  let posOptions = {
7962
7986
  width: this.options.tooltipWidth,
@@ -8000,6 +8024,9 @@ else {
8000
8024
  this.tooltip.setHeight(this.plotHeight)
8001
8025
  if (isNaN(posOptions.left)) {
8002
8026
  this.tooltip.hide()
8027
+ if (this.options.onMouseOut) {
8028
+ this.options.onMouseOut()
8029
+ }
8003
8030
  return
8004
8031
  }
8005
8032
  this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions)
@@ -8046,9 +8073,9 @@ this.leftAxisLabel = this.svg.append('g').attr('class', 'left-axis-label-layer')
8046
8073
  this.rightAxisLabel = this.svg.append('g').attr('class', 'right-axis-label-layer')
8047
8074
  this.bottomAxisLabel = this.svg.append('g').attr('class', 'bottom-axis-label-layer')
8048
8075
  this.plotArea = this.svg.append('g').attr('class', 'plot-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8076
+ this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8049
8077
  this.areaLayer = this.svg.append('g').attr('class', 'area-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8050
8078
  this.lineLayer = this.svg.append('g').attr('class', 'line-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8051
- this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8052
8079
  // this.barLayer.attr('clip-path', `url(#${this.elementId}_clip)`)
8053
8080
  this.labelLayer = this.svg.append('g').attr('class', 'label-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
8054
8081
  this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer').attr('clip-path', `url(#${this.elementId}_clip)`).append('g')
@@ -8233,9 +8260,9 @@ else {
8233
8260
  this.options.data.right.max = d3.max(this.options.data.right.data)
8234
8261
  }
8235
8262
  if (this.options.data.right && typeof this.options.data.right.max !== 'undefined') {
8236
- this.longestRight = this.options.data.right.max.toString()
8263
+ 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()
8237
8264
  if (this.options.data.right.formatter) {
8238
- this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString()
8265
+ this.longestRight = this.options.data.right.formatter(this.longestRight).toString()
8239
8266
  }
8240
8267
  }
8241
8268
  // Check to see if we need to balance the min and max values
@@ -8247,10 +8274,10 @@ else {
8247
8274
  }
8248
8275
  else {
8249
8276
  let biggestLeft = Math.max(Math.abs(this.options.data.left.min), this.options.data.left.max)
8250
- this.options.data.left.min = 1 - biggestLeft
8277
+ this.options.data.left.min = biggestLeft * -1
8251
8278
  this.options.data.left.max = biggestLeft
8252
8279
  let biggestRight = Math.max(Math.abs(this.options.data.right.min), this.options.data.right.max)
8253
- this.options.data.right.min = 1 - biggestRight
8280
+ this.options.data.right.min = biggestRight * -1
8254
8281
  this.options.data.right.max = biggestRight
8255
8282
  }
8256
8283
  }
@@ -8275,7 +8302,7 @@ else {
8275
8302
  }
8276
8303
  }
8277
8304
  this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth) + 5 // + 5 to accommodate for space between text and axis line
8278
- this.options.margin.axisRight = longestRightBounds.width
8305
+ this.options.margin.axisRight = longestRightBounds.width + 10
8279
8306
  this.options.margin.axisBottom = longestBottomBounds.height + 10
8280
8307
  this.options.margin.axisTop = 0
8281
8308
  // adjust axis margins based on title options
@@ -8340,7 +8367,8 @@ else {
8340
8367
  this.totalBrushBandPadding = 0
8341
8368
  let noOfPoints = 0
8342
8369
  let noOfGroups = 0
8343
- let plotable = 0
8370
+ let plotable = 0
8371
+
8344
8372
  if (this.options.maxBandWidth) {
8345
8373
  if (this.options.orientation === 'horizontal') {
8346
8374
  this.options.data.left.totalValueCount = this.options.data.left.data.reduce((a, b) => {
@@ -8434,7 +8462,8 @@ else {
8434
8462
  // }
8435
8463
  // }
8436
8464
  // Translate the layers
8437
- const leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0
8465
+ const leftBrushAdjustment = this.options.orientation === 'horizontal' && this.brushNeeded === true ? this.options.brushHeight : 0
8466
+ // const bottomBrushAdjustment = this.options.orientation === 'vertical' && this.brushNeeded === true ? this.options.brushHeight : 0
8438
8467
  this.leftAxisLayer
8439
8468
  .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop})`)
8440
8469
  .style('font-size', (this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize)
@@ -8474,12 +8503,12 @@ else {
8474
8503
  this.brushLayer
8475
8504
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8476
8505
  this.yAxisClip
8477
- .attr('transform', `translate(${leftBrushAdjustment + this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
8506
+ .attr('transform', `translate(${leftBrushAdjustment}, ${this.options.margin.top + this.options.margin.axisTop})`)
8478
8507
  .attr('width', this.options.margin.axisLeft + 10)
8479
8508
  .attr('height', this.plotHeight)
8480
8509
  this.xAxisClip
8481
8510
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8482
- .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
8511
+ .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right)
8483
8512
  .attr('height', longestBottomBounds.height + 10)
8484
8513
  this.brushClip
8485
8514
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop})`)
@@ -8490,12 +8519,12 @@ else {
8490
8519
  this.brushLayer
8491
8520
  .attr('transform', `translate(${this.options.margin.left + this.options.margin.axisLeft}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight + longestBottomBounds.height})`)
8492
8521
  this.yAxisClip
8493
- .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop - 10})`)
8522
+ .attr('transform', `translate(0, ${this.options.margin.top + this.options.margin.axisTop - 10})`)
8494
8523
  .attr('width', this.options.margin.axisLeft + 10)
8495
8524
  .attr('height', this.plotHeight + 20)
8496
8525
  this.xAxisClip
8497
8526
  .attr('transform', `translate(${this.options.margin.left}, ${this.options.margin.top + this.options.margin.axisTop + this.plotHeight})`)
8498
- .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight)
8527
+ .attr('width', this.plotWidth + this.options.margin.axisLeft + this.options.margin.axisRight + this.options.margin.right)
8499
8528
  .attr('height', longestBottomBounds.height + 10)
8500
8529
  this.brushClip
8501
8530
  .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.activeItem !== index) {
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) {
@@ -2528,7 +2540,7 @@ var WebsyForm = /*#__PURE__*/function () {
2528
2540
  var el = document.getElementById(this.elementId);
2529
2541
  var componentsToProcess = [];
2530
2542
  if (el) {
2531
- var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat(this.options.classes || '', "\">\n ");
2543
+ var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat((this.options.classes || []).join(' '), "\">\n ");
2532
2544
  this.options.fields.forEach(function (f, i) {
2533
2545
  _this19.fieldMap[f.field] = f;
2534
2546
  if (f.component) {
@@ -2850,6 +2862,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2850
2862
  activeSymbol: 'none',
2851
2863
  enableSearch: false,
2852
2864
  searchProp: 'text',
2865
+ indent: 'padding',
2853
2866
  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>",
2854
2867
  searchOptions: {}
2855
2868
  }, options);
@@ -3089,7 +3102,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
3089
3102
  if (Array.isArray(items[i].classes)) {
3090
3103
  items[i].classes = items[i].classes.join(' ');
3091
3104
  }
3092
- 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='padding-left: ").concat(level * this.options.childIndentation, "px'\n ").concat(items[i].attributes && items[i].attributes.join(' ') || '', "\n >\n ");
3105
+ 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 ");
3093
3106
  if (this.options.orientation === 'horizontal') {
3094
3107
  html += items[i].text;
3095
3108
  }
@@ -5281,7 +5294,7 @@ var WebsyUtils = {
5281
5294
  if (numOut % 1 > 0) {
5282
5295
  decimals = 1;
5283
5296
  }
5284
- if (numOut < 1) {
5297
+ if (numOut < 1 && decimals === 0) {
5285
5298
  decimals = getZeroDecimals(numOut);
5286
5299
  }
5287
5300
  numOut = (+numOut).toFixed(decimals);
@@ -7524,6 +7537,9 @@ var WebsyChart = /*#__PURE__*/function () {
7524
7537
  value: function handleEventMouseOut(event, d) {
7525
7538
  this.trackingLineLayer.select('.tracking-line').attr('stroke-opacity', 0);
7526
7539
  this.tooltip.hide();
7540
+ if (this.options.onMouseOut) {
7541
+ this.options.onMouseOut();
7542
+ }
7527
7543
  }
7528
7544
  }, {
7529
7545
  key: "handleEventMouseMove",
@@ -7553,6 +7569,9 @@ var WebsyChart = /*#__PURE__*/function () {
7553
7569
  var xDiff;
7554
7570
  if (typeof x0 === 'undefined') {
7555
7571
  this.tooltip.hide();
7572
+ if (this.options.onMouseOut) {
7573
+ this.options.onMouseOut();
7574
+ }
7556
7575
  return;
7557
7576
  }
7558
7577
  var xLabel = this[xAxis].domain()[x0];
@@ -7575,7 +7594,7 @@ var WebsyChart = /*#__PURE__*/function () {
7575
7594
  if (!d.y.color) {
7576
7595
  d.y.color = s.color;
7577
7596
  }
7578
- tooltipData.push(d.y);
7597
+ tooltipData.push(d);
7579
7598
  }
7580
7599
  });
7581
7600
  } else {
@@ -7592,7 +7611,7 @@ var WebsyChart = /*#__PURE__*/function () {
7592
7611
  if (!pointA.y.color) {
7593
7612
  pointA.y.color = s.color;
7594
7613
  }
7595
- tooltipData.push(pointA.y);
7614
+ tooltipData.push(pointA);
7596
7615
  if (typeof pointA.x.value.getTime !== 'undefined') {
7597
7616
  tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointA.x.value);
7598
7617
  }
@@ -7603,7 +7622,7 @@ var WebsyChart = /*#__PURE__*/function () {
7603
7622
  if (!pointB.y.color) {
7604
7623
  pointB.y.color = s.color;
7605
7624
  }
7606
- tooltipData.push(pointB.y);
7625
+ tooltipData.push(pointB);
7607
7626
  if (typeof pointB.x.value.getTime !== 'undefined') {
7608
7627
  tooltipTitle = d3.timeFormat(_this49.options.dateFormat || _this49.options.calculatedTimeFormatPattern)(pointB.x.value);
7609
7628
  }
@@ -7621,7 +7640,7 @@ var WebsyChart = /*#__PURE__*/function () {
7621
7640
  if (!pointB.y.color) {
7622
7641
  pointB.y.color = s.color;
7623
7642
  }
7624
- tooltipData.push(pointB.y);
7643
+ tooltipData.push(pointB);
7625
7644
  } else {
7626
7645
  xPoint = d0;
7627
7646
  tooltipTitle = pointA.x.value;
@@ -7631,15 +7650,18 @@ var WebsyChart = /*#__PURE__*/function () {
7631
7650
  if (!pointA.y.color) {
7632
7651
  pointA.y.color = s.color;
7633
7652
  }
7634
- tooltipData.push(pointA.y);
7653
+ tooltipData.push(pointA);
7635
7654
  }
7636
7655
  }
7637
7656
  }
7638
7657
  });
7639
7658
  tooltipHTML = " \n <ul>\n ";
7640
7659
  tooltipHTML += tooltipData.map(function (d) {
7641
- 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 ");
7660
+ 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 ");
7642
7661
  }).join('');
7662
+ if (this.options.onMouseOver) {
7663
+ this.options.onMouseOver(tooltipData);
7664
+ }
7643
7665
  tooltipHTML += "</ul>";
7644
7666
  var posOptions = {
7645
7667
  width: this.options.tooltipWidth,
@@ -7682,6 +7704,9 @@ var WebsyChart = /*#__PURE__*/function () {
7682
7704
  this.tooltip.setHeight(this.plotHeight);
7683
7705
  if (isNaN(posOptions.left)) {
7684
7706
  this.tooltip.hide();
7707
+ if (this.options.onMouseOut) {
7708
+ this.options.onMouseOut();
7709
+ }
7685
7710
  return;
7686
7711
  }
7687
7712
  this.options.showTooltip && this.tooltip.show(tooltipTitle, tooltipHTML, posOptions);
@@ -7722,9 +7747,9 @@ var WebsyChart = /*#__PURE__*/function () {
7722
7747
  this.rightAxisLabel = this.svg.append('g').attr('class', 'right-axis-label-layer');
7723
7748
  this.bottomAxisLabel = this.svg.append('g').attr('class', 'bottom-axis-label-layer');
7724
7749
  this.plotArea = this.svg.append('g').attr('class', 'plot-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7750
+ this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7725
7751
  this.areaLayer = this.svg.append('g').attr('class', 'area-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7726
7752
  this.lineLayer = this.svg.append('g').attr('class', 'line-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7727
- this.barLayer = this.svg.append('g').attr('class', 'bar-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7728
7753
  // this.barLayer.attr('clip-path', `url(#${this.elementId}_clip)`)
7729
7754
  this.labelLayer = this.svg.append('g').attr('class', 'label-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
7730
7755
  this.symbolLayer = this.svg.append('g').attr('class', 'symbol-layer').attr('clip-path', "url(#".concat(this.elementId, "_clip)")).append('g');
@@ -7917,9 +7942,9 @@ var WebsyChart = /*#__PURE__*/function () {
7917
7942
  this.options.data.right.max = d3.max(this.options.data.right.data);
7918
7943
  }
7919
7944
  if (this.options.data.right && typeof this.options.data.right.max !== 'undefined') {
7920
- this.longestRight = this.options.data.right.max.toString();
7945
+ 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();
7921
7946
  if (this.options.data.right.formatter) {
7922
- this.longestRight = this.options.data.right.formatter(this.options.data.right.max).toString();
7947
+ this.longestRight = this.options.data.right.formatter(this.longestRight).toString();
7923
7948
  }
7924
7949
  }
7925
7950
  // Check to see if we need to balance the min and max values
@@ -7930,10 +7955,10 @@ var WebsyChart = /*#__PURE__*/function () {
7930
7955
  this.options.data.bottom.max = biggestBottom;
7931
7956
  } else {
7932
7957
  var biggestLeft = Math.max(Math.abs(this.options.data.left.min), this.options.data.left.max);
7933
- this.options.data.left.min = 1 - biggestLeft;
7958
+ this.options.data.left.min = biggestLeft * -1;
7934
7959
  this.options.data.left.max = biggestLeft;
7935
7960
  var biggestRight = Math.max(Math.abs(this.options.data.right.min), this.options.data.right.max);
7936
- this.options.data.right.min = 1 - biggestRight;
7961
+ this.options.data.right.min = biggestRight * -1;
7937
7962
  this.options.data.right.max = biggestRight;
7938
7963
  }
7939
7964
  }
@@ -7957,7 +7982,7 @@ var WebsyChart = /*#__PURE__*/function () {
7957
7982
  }
7958
7983
  }
7959
7984
  this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth) + 5; // + 5 to accommodate for space between text and axis line
7960
- this.options.margin.axisRight = longestRightBounds.width;
7985
+ this.options.margin.axisRight = longestRightBounds.width + 10;
7961
7986
  this.options.margin.axisBottom = longestBottomBounds.height + 10;
7962
7987
  this.options.margin.axisTop = 0;
7963
7988
  // adjust axis margins based on title options
@@ -8109,7 +8134,8 @@ var WebsyChart = /*#__PURE__*/function () {
8109
8134
  // }
8110
8135
  // }
8111
8136
  // Translate the layers
8112
- var leftBrushAdjustment = this.brushNeeded === true ? this.options.brushHeight : 0;
8137
+ var leftBrushAdjustment = this.options.orientation === 'horizontal' && this.brushNeeded === true ? this.options.brushHeight : 0;
8138
+ // const bottomBrushAdjustment = this.options.orientation === 'vertical' && this.brushNeeded === true ? this.options.brushHeight : 0
8113
8139
  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);
8114
8140
  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);
8115
8141
  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);
@@ -8127,13 +8153,13 @@ var WebsyChart = /*#__PURE__*/function () {
8127
8153
  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);
8128
8154
  if (this.options.orientation === 'horizontal') {
8129
8155
  this.brushLayer.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));
8130
- this.yAxisClip.attr('transform', "translate(".concat(leftBrushAdjustment + this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")")).attr('width', this.options.margin.axisLeft + 10).attr('height', this.plotHeight);
8131
- 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);
8156
+ 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);
8157
+ 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);
8132
8158
  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);
8133
8159
  } else {
8134
8160
  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, ")"));
8135
- this.yAxisClip.attr('transform', "translate(".concat(this.options.margin.left, ", ").concat(this.options.margin.top + this.options.margin.axisTop - 10, ")")).attr('width', this.options.margin.axisLeft + 10).attr('height', this.plotHeight + 20);
8136
- 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);
8161
+ 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);
8162
+ 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);
8137
8163
  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);
8138
8164
  }
8139
8165
  this.eventLayer.attr('transform', "translate(".concat(this.options.margin.left + this.options.margin.axisLeft, ", ").concat(this.options.margin.top + this.options.margin.axisTop, ")"));