@websy/websy-designs 1.1.9 → 1.1.10

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.
@@ -204,6 +204,7 @@ class WebsyDatePicker {
204
204
  this.validDates = []
205
205
  this.validYears = []
206
206
  this.customRangeSelected = true
207
+ this.shiftPressed = false
207
208
  const DEFAULTS = {
208
209
  defaultRange: 0,
209
210
  minAllowedDate: this.floorDate(new Date(new Date((new Date().setFullYear(new Date().getFullYear() - 1))).setDate(1))),
@@ -295,6 +296,8 @@ class WebsyDatePicker {
295
296
  el.addEventListener('mousedown', this.handleMouseDown.bind(this))
296
297
  el.addEventListener('mouseover', this.handleMouseOver.bind(this))
297
298
  el.addEventListener('mouseup', this.handleMouseUp.bind(this))
299
+ document.addEventListener('keydown', this.handleKeyDown.bind(this))
300
+ document.addEventListener('keyup', this.handleKeyUp.bind(this))
298
301
  let html = `
299
302
  <div class='websy-date-picker-container'>
300
303
  <span class='websy-dropdown-header-label'>${this.options.label || 'Date'}</span>
@@ -311,6 +314,7 @@ class WebsyDatePicker {
311
314
  </div><!--
312
315
  --><div id='${this.elementId}_datelist' class='websy-date-picker-custom'>${this.renderDates()}</div>
313
316
  <div class='websy-dp-button-container'>
317
+ <span class="dp-footnote">Click and drag or hold Shift and click to select a range of values</span>
314
318
  <button class='${this.options.cancelBtnClasses || ''} websy-btn websy-dp-cancel'>
315
319
  <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 512 512"><line x1="368" y1="368" x2="144" y2="144" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><line x1="368" y1="144" x2="144" y2="368" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/></svg>
316
320
  </button>
@@ -387,20 +391,37 @@ class WebsyDatePicker {
387
391
  this.close()
388
392
  }
389
393
  }
390
- handleMouseDown (event) {
391
- this.mouseDown = true
392
- this.dragging = false
393
- if (event.target.classList.contains('websy-dp-date')) {
394
- if (event.target.classList.contains('websy-disabled-date')) {
395
- return
396
- }
397
- if (this.customRangeSelected === true) {
398
- this.currentselection = []
399
- this.customRangeSelected = false
400
- }
401
- this.mouseDownId = +event.target.id.split('_')[0]
402
- this.selectDate(this.mouseDownId)
394
+ handleKeyDown (event) {
395
+ console.log('key down', event)
396
+ if (event.key === 'Shift') {
397
+ this.dragging = true
398
+ this.shiftPressed = true
399
+ }
400
+ }
401
+ handleKeyUp (event) {
402
+ this.dragging = false
403
+ this.shiftPressed = false
404
+ }
405
+ handleMouseDown (event) {
406
+ if (this.shiftPressed === true && this.currentselection.length > 0) {
407
+ this.mouseDownId = this.currentselection[this.currentselection.length - 1]
408
+ this.selectDate(+event.target.id.split('_')[0])
403
409
  }
410
+ else {
411
+ this.mouseDown = true
412
+ this.dragging = false
413
+ if (event.target.classList.contains('websy-dp-date')) {
414
+ if (event.target.classList.contains('websy-disabled-date')) {
415
+ return
416
+ }
417
+ if (this.customRangeSelected === true) {
418
+ this.currentselection = []
419
+ this.customRangeSelected = false
420
+ }
421
+ this.mouseDownId = +event.target.id.split('_')[0]
422
+ this.selectDate(this.mouseDownId)
423
+ }
424
+ }
404
425
  }
405
426
  handleMouseOver (event) {
406
427
  if (this.mouseDown === true) {
@@ -449,8 +470,8 @@ class WebsyDatePicker {
449
470
  let d
450
471
  let rangeStart
451
472
  let rangeEnd
452
- if (this.options.mode === 'date') {
453
- d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + (i * this.oneDay)))
473
+ if (this.options.mode === 'date') {
474
+ d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + (i * this.oneDay)))
454
475
  d = d.getTime()
455
476
  rangeStart = this.selectedRangeDates[0].getTime()
456
477
  rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
@@ -462,7 +483,7 @@ class WebsyDatePicker {
462
483
  }
463
484
  let dateEl
464
485
  if (this.options.mode === 'date') {
465
- dateEl = document.getElementById(`${d.getTime()}_date`)
486
+ dateEl = document.getElementById(`${d}_date`)
466
487
  }
467
488
  else if (this.options.mode === 'year') {
468
489
  dateEl = document.getElementById(`${d}_year`)
@@ -756,7 +777,10 @@ class WebsyDatePicker {
756
777
  let range
757
778
  if (this.selectedRange === -1) {
758
779
  const list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(d => {
759
- if (this.options.mode === 'date') {
780
+ if (this.options.mode === 'date') {
781
+ if (!d.toLocaleDateString) {
782
+ d = new Date(d)
783
+ }
760
784
  return d.toLocaleDateString()
761
785
  }
762
786
  else if (this.options.mode === 'year') {
@@ -911,6 +935,9 @@ class WebsyDropdown {
911
935
  searchEl.value = ''
912
936
  }
913
937
  }
938
+ if (this.options.onClose) {
939
+ this.options.onClose(this.elementId)
940
+ }
914
941
  }
915
942
  handleClick (event) {
916
943
  if (this.options.disabled === true) {
@@ -2425,7 +2452,7 @@ class WebsyRouter {
2425
2452
  this.currentViewMain = this.options.defaultView
2426
2453
  }
2427
2454
  if (view !== '') {
2428
- this.showView(view, params)
2455
+ this.showView(view, params, 'main')
2429
2456
  }
2430
2457
  }
2431
2458
  handleFocus (event) {
@@ -2456,6 +2483,11 @@ class WebsyRouter {
2456
2483
  this.hideTriggerItems(view, group)
2457
2484
  this.hideViewItems(view, group)
2458
2485
  this.publish('hide', [view])
2486
+ }
2487
+ else if (group !== this.options.defaultGroup) {
2488
+ this.hideTriggerItems(view, group)
2489
+ this.hideViewItems(view, group)
2490
+ this.publish('hide', [view])
2459
2491
  }
2460
2492
  }
2461
2493
  // registerElements (root) {
@@ -2554,7 +2586,7 @@ class WebsyRouter {
2554
2586
  })
2555
2587
  }
2556
2588
  }
2557
- showView (view, params) {
2589
+ showView (view, params, group) {
2558
2590
  this.activateItem(view, this.options.triggerClass)
2559
2591
  this.activateItem(view, this.options.viewClass)
2560
2592
  let children = this.getActiveViewsFromParent(view)
@@ -2562,15 +2594,15 @@ class WebsyRouter {
2562
2594
  this.activateItem(children[c].view, this.options.triggerClass)
2563
2595
  this.activateItem(children[c].view, this.options.viewClass)
2564
2596
  this.showComponents(children[c].view)
2565
- this.publish('show', [children[c].view])
2597
+ this.publish('show', [children[c].view, null, group])
2566
2598
  }
2567
- if (this.previousView !== this.currentView) {
2599
+ if (this.previousView !== this.currentView || group !== 'main') {
2568
2600
  this.showComponents(view)
2569
- this.publish('show', [view, params])
2601
+ this.publish('show', [view, params, group])
2570
2602
  }
2571
2603
  }
2572
2604
  reloadCurrentView () {
2573
- this.showView(this.currentView, this.currentParams)
2605
+ this.showView(this.currentView, this.currentParams, 'main')
2574
2606
  }
2575
2607
  navigate (inputPath, group = 'main', event, popped) {
2576
2608
  if (typeof popped === 'undefined') {
@@ -2667,10 +2699,10 @@ class WebsyRouter {
2667
2699
  return
2668
2700
  }
2669
2701
  if (toggle === false) {
2670
- this.showView(this.currentView, this.currentParams)
2702
+ this.showView(this.currentView, this.currentParams, group)
2671
2703
  }
2672
2704
  else if (newPath && newPath !== '') {
2673
- this.showView(newPath)
2705
+ this.showView(newPath, null, group)
2674
2706
  }
2675
2707
  if (this.usesHTMLSuffix === true) {
2676
2708
  inputPath = window.location.pathname.split('/').pop() + inputPath
@@ -2789,7 +2821,7 @@ class Switch {
2789
2821
  this.render()
2790
2822
  }
2791
2823
  }
2792
- disabled () {
2824
+ disable () {
2793
2825
  this.options.enabled = false
2794
2826
  this.render()
2795
2827
  }
@@ -3588,7 +3620,7 @@ class WebsyTable2 {
3588
3620
  selectedItems: [pageOptions.indexOf(this.options.pageSize)],
3589
3621
  items: pageOptions.map(p => ({ label: p.toString(), value: p })),
3590
3622
  allowClear: false,
3591
- disableSearch: true,
3623
+ disableSearch: true,
3592
3624
  onItemSelected: (selectedItem) => {
3593
3625
  if (this.options.onChangePageSize) {
3594
3626
  this.options.onChangePageSize(selectedItem.value)
@@ -4227,8 +4259,11 @@ if (this.options.data[side].scale === 'Time') {
4227
4259
  this.options.data.series.forEach(s => {
4228
4260
  if (this.options.data[xData].scale !== 'Time') {
4229
4261
  xPoint = this[xAxis](this.parseX(xLabel))
4230
- s.data.forEach(d => {
4262
+ s.data.forEach(d => {
4231
4263
  if (d.x.value === xLabel) {
4264
+ if (!tooltipTitle) {
4265
+ tooltipTitle = d.x.value
4266
+ }
4232
4267
  if (!d.y.color) {
4233
4268
  d.y.color = s.color
4234
4269
  }
@@ -4930,7 +4965,7 @@ function getBarX (d, i) {
4930
4965
  }
4931
4966
  function getBarY (d, i) {
4932
4967
  if (this.options.orientation === 'horizontal') {
4933
- if (this.options.grouping !== 'stacked') {
4968
+ if (this.options.grouping === 'stacked') {
4934
4969
  return this[xAxis](this.parseX(d.x.value))
4935
4970
  }
4936
4971
  else {
@@ -5015,7 +5050,10 @@ if (this.options.showLabels) {
5015
5050
  .text(d => d.y.label || d.y.value)
5016
5051
  .each(function (d, i) {
5017
5052
  if (that.options.orientation === 'horizontal') {
5018
- if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
5053
+ if (that.options.grouping === 'stacked') {
5054
+ this.setAttribute('text-anchor', 'middle')
5055
+ }
5056
+ else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
5019
5057
  this.setAttribute('text-anchor', 'end')
5020
5058
  this.setAttribute('x', +(this.getAttribute('x')) - 8)
5021
5059
  }
@@ -5471,7 +5509,7 @@ class WebsyMap {
5471
5509
  render () {
5472
5510
  const mapEl = document.getElementById(`${this.elementId}_map`)
5473
5511
  const legendEl = document.getElementById(`${this.elementId}_map`)
5474
- if (this.options.showLegend === true) {
5512
+ if (this.options.showLegend === true && this.options.data.polygons) {
5475
5513
  let legendData = this.options.data.polygons.map((s, i) => ({value: s.label || s.key, color: s.color || this.options.colors[i % this.options.colors.length]}))
5476
5514
  let longestValue = legendData.map(s => s.value).reduce((a, b) => a.length > b.length ? a : b)
5477
5515
  if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
@@ -301,6 +301,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
301
301
  this.validDates = [];
302
302
  this.validYears = [];
303
303
  this.customRangeSelected = true;
304
+ this.shiftPressed = false;
304
305
  var DEFAULTS = {
305
306
  defaultRange: 0,
306
307
  minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
@@ -382,7 +383,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
382
383
  el.addEventListener('mousedown', this.handleMouseDown.bind(this));
383
384
  el.addEventListener('mouseover', this.handleMouseOver.bind(this));
384
385
  el.addEventListener('mouseup', this.handleMouseUp.bind(this));
385
- var html = "\n <div class='websy-date-picker-container'>\n <span class='websy-dropdown-header-label'>".concat(this.options.label || 'Date', "</span>\n <div class='websy-date-picker-header'>\n <span id='").concat(this.elementId, "_selectedRange'>").concat(this.options.ranges[this.options.mode][this.selectedRange].label, "</span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg>\n </div>\n <div id='").concat(this.elementId, "_mask' class='websy-date-picker-mask'></div>\n <div id='").concat(this.elementId, "_content' class='websy-date-picker-content'>\n <div class='websy-date-picker-ranges'>\n <ul id='").concat(this.elementId, "_rangelist'>\n ").concat(this.renderRanges(), "\n </ul>\n </div><!--\n --><div id='").concat(this.elementId, "_datelist' class='websy-date-picker-custom'>").concat(this.renderDates(), "</div>\n <div class='websy-dp-button-container'>\n <button class='").concat(this.options.cancelBtnClasses || '', " websy-btn websy-dp-cancel'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n <button class='").concat(this.options.confirmBtnClasses || '', " websy-btn websy-dp-confirm'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><polyline points=\"416 128 192 384 96 288\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n </div>\n </div> \n </div>\n ");
386
+ document.addEventListener('keydown', this.handleKeyDown.bind(this));
387
+ document.addEventListener('keyup', this.handleKeyUp.bind(this));
388
+ var html = "\n <div class='websy-date-picker-container'>\n <span class='websy-dropdown-header-label'>".concat(this.options.label || 'Date', "</span>\n <div class='websy-date-picker-header'>\n <span id='").concat(this.elementId, "_selectedRange'>").concat(this.options.ranges[this.options.mode][this.selectedRange].label, "</span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg>\n </div>\n <div id='").concat(this.elementId, "_mask' class='websy-date-picker-mask'></div>\n <div id='").concat(this.elementId, "_content' class='websy-date-picker-content'>\n <div class='websy-date-picker-ranges'>\n <ul id='").concat(this.elementId, "_rangelist'>\n ").concat(this.renderRanges(), "\n </ul>\n </div><!--\n --><div id='").concat(this.elementId, "_datelist' class='websy-date-picker-custom'>").concat(this.renderDates(), "</div>\n <div class='websy-dp-button-container'>\n <span class=\"dp-footnote\">Click and drag or hold Shift and click to select a range of values</span>\n <button class='").concat(this.options.cancelBtnClasses || '', " websy-btn websy-dp-cancel'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n <button class='").concat(this.options.confirmBtnClasses || '', " websy-btn websy-dp-confirm'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><polyline points=\"416 128 192 384 96 288\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n </div>\n </div> \n </div>\n ");
386
389
  el.innerHTML = html;
387
390
  this.render();
388
391
  } else {
@@ -451,24 +454,45 @@ var WebsyDatePicker = /*#__PURE__*/function () {
451
454
  this.close();
452
455
  }
453
456
  }
457
+ }, {
458
+ key: "handleKeyDown",
459
+ value: function handleKeyDown(event) {
460
+ console.log('key down', event);
461
+
462
+ if (event.key === 'Shift') {
463
+ this.dragging = true;
464
+ this.shiftPressed = true;
465
+ }
466
+ }
467
+ }, {
468
+ key: "handleKeyUp",
469
+ value: function handleKeyUp(event) {
470
+ this.dragging = false;
471
+ this.shiftPressed = false;
472
+ }
454
473
  }, {
455
474
  key: "handleMouseDown",
456
475
  value: function handleMouseDown(event) {
457
- this.mouseDown = true;
458
- this.dragging = false;
476
+ if (this.shiftPressed === true && this.currentselection.length > 0) {
477
+ this.mouseDownId = this.currentselection[this.currentselection.length - 1];
478
+ this.selectDate(+event.target.id.split('_')[0]);
479
+ } else {
480
+ this.mouseDown = true;
481
+ this.dragging = false;
459
482
 
460
- if (event.target.classList.contains('websy-dp-date')) {
461
- if (event.target.classList.contains('websy-disabled-date')) {
462
- return;
463
- }
483
+ if (event.target.classList.contains('websy-dp-date')) {
484
+ if (event.target.classList.contains('websy-disabled-date')) {
485
+ return;
486
+ }
464
487
 
465
- if (this.customRangeSelected === true) {
466
- this.currentselection = [];
467
- this.customRangeSelected = false;
468
- }
488
+ if (this.customRangeSelected === true) {
489
+ this.currentselection = [];
490
+ this.customRangeSelected = false;
491
+ }
469
492
 
470
- this.mouseDownId = +event.target.id.split('_')[0];
471
- this.selectDate(this.mouseDownId);
493
+ this.mouseDownId = +event.target.id.split('_')[0];
494
+ this.selectDate(this.mouseDownId);
495
+ }
472
496
  }
473
497
  }
474
498
  }, {
@@ -547,7 +571,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
547
571
  var dateEl = void 0;
548
572
 
549
573
  if (this.options.mode === 'date') {
550
- dateEl = document.getElementById("".concat(d.getTime(), "_date"));
574
+ dateEl = document.getElementById("".concat(d, "_date"));
551
575
  } else if (this.options.mode === 'year') {
552
576
  dateEl = document.getElementById("".concat(d, "_year"));
553
577
  }
@@ -901,6 +925,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
901
925
  if (this.selectedRange === -1) {
902
926
  var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
903
927
  if (_this5.options.mode === 'date') {
928
+ if (!d.toLocaleDateString) {
929
+ d = new Date(d);
930
+ }
931
+
904
932
  return d.toLocaleDateString();
905
933
  } else if (_this5.options.mode === 'year') {
906
934
  return d;
@@ -1042,6 +1070,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
1042
1070
  searchEl.value = '';
1043
1071
  }
1044
1072
  }
1073
+
1074
+ if (this.options.onClose) {
1075
+ this.options.onClose(this.elementId);
1076
+ }
1045
1077
  }
1046
1078
  }, {
1047
1079
  key: "handleClick",
@@ -2842,7 +2874,7 @@ var WebsyRouter = /*#__PURE__*/function () {
2842
2874
  }
2843
2875
 
2844
2876
  if (view !== '') {
2845
- this.showView(view, params);
2877
+ this.showView(view, params, 'main');
2846
2878
  }
2847
2879
  }
2848
2880
  }, {
@@ -2885,6 +2917,10 @@ var WebsyRouter = /*#__PURE__*/function () {
2885
2917
  this.hideTriggerItems(view, group);
2886
2918
  this.hideViewItems(view, group);
2887
2919
  this.publish('hide', [view]);
2920
+ } else if (group !== this.options.defaultGroup) {
2921
+ this.hideTriggerItems(view, group);
2922
+ this.hideViewItems(view, group);
2923
+ this.publish('hide', [view]);
2888
2924
  }
2889
2925
  } // registerElements (root) {
2890
2926
  // if (root.nodeName === '#document') {
@@ -2988,7 +3024,7 @@ var WebsyRouter = /*#__PURE__*/function () {
2988
3024
  }
2989
3025
  }, {
2990
3026
  key: "showView",
2991
- value: function showView(view, params) {
3027
+ value: function showView(view, params, group) {
2992
3028
  this.activateItem(view, this.options.triggerClass);
2993
3029
  this.activateItem(view, this.options.viewClass);
2994
3030
  var children = this.getActiveViewsFromParent(view);
@@ -2997,18 +3033,18 @@ var WebsyRouter = /*#__PURE__*/function () {
2997
3033
  this.activateItem(children[c].view, this.options.triggerClass);
2998
3034
  this.activateItem(children[c].view, this.options.viewClass);
2999
3035
  this.showComponents(children[c].view);
3000
- this.publish('show', [children[c].view]);
3036
+ this.publish('show', [children[c].view, null, group]);
3001
3037
  }
3002
3038
 
3003
- if (this.previousView !== this.currentView) {
3039
+ if (this.previousView !== this.currentView || group !== 'main') {
3004
3040
  this.showComponents(view);
3005
- this.publish('show', [view, params]);
3041
+ this.publish('show', [view, params, group]);
3006
3042
  }
3007
3043
  }
3008
3044
  }, {
3009
3045
  key: "reloadCurrentView",
3010
3046
  value: function reloadCurrentView() {
3011
- this.showView(this.currentView, this.currentParams);
3047
+ this.showView(this.currentView, this.currentParams, 'main');
3012
3048
  }
3013
3049
  }, {
3014
3050
  key: "navigate",
@@ -3128,9 +3164,9 @@ var WebsyRouter = /*#__PURE__*/function () {
3128
3164
  }
3129
3165
 
3130
3166
  if (toggle === false) {
3131
- this.showView(this.currentView, this.currentParams);
3167
+ this.showView(this.currentView, this.currentParams, group);
3132
3168
  } else if (newPath && newPath !== '') {
3133
- this.showView(newPath);
3169
+ this.showView(newPath, null, group);
3134
3170
  }
3135
3171
 
3136
3172
  if (this.usesHTMLSuffix === true) {
@@ -3287,8 +3323,8 @@ var Switch = /*#__PURE__*/function () {
3287
3323
  }
3288
3324
 
3289
3325
  _createClass(Switch, [{
3290
- key: "disabled",
3291
- value: function disabled() {
3326
+ key: "disable",
3327
+ value: function disable() {
3292
3328
  this.options.enabled = false;
3293
3329
  this.render();
3294
3330
  }
@@ -4847,6 +4883,10 @@ var WebsyChart = /*#__PURE__*/function () {
4847
4883
  xPoint = _this33[xAxis](_this33.parseX(xLabel));
4848
4884
  s.data.forEach(function (d) {
4849
4885
  if (d.x.value === xLabel) {
4886
+ if (!tooltipTitle) {
4887
+ tooltipTitle = d.x.value;
4888
+ }
4889
+
4850
4890
  if (!d.y.color) {
4851
4891
  d.y.color = s.color;
4852
4892
  }
@@ -5539,7 +5579,7 @@ var WebsyChart = /*#__PURE__*/function () {
5539
5579
 
5540
5580
  function getBarY(d, i) {
5541
5581
  if (this.options.orientation === 'horizontal') {
5542
- if (this.options.grouping !== 'stacked') {
5582
+ if (this.options.grouping === 'stacked') {
5543
5583
  return this[xAxis](this.parseX(d.x.value));
5544
5584
  } else {
5545
5585
  return this[xAxis](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
@@ -5586,7 +5626,9 @@ var WebsyChart = /*#__PURE__*/function () {
5586
5626
  return d.y.label || d.y.value;
5587
5627
  }).each(function (d, i) {
5588
5628
  if (that.options.orientation === 'horizontal') {
5589
- if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
5629
+ if (that.options.grouping === 'stacked') {
5630
+ this.setAttribute('text-anchor', 'middle');
5631
+ } else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
5590
5632
  this.setAttribute('text-anchor', 'end');
5591
5633
  this.setAttribute('x', +this.getAttribute('x') - 8);
5592
5634
  }
@@ -6050,7 +6092,7 @@ var WebsyMap = /*#__PURE__*/function () {
6050
6092
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
6051
6093
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
6052
6094
 
6053
- if (this.options.showLegend === true) {
6095
+ if (this.options.showLegend === true && this.options.data.polygons) {
6054
6096
  var legendData = this.options.data.polygons.map(function (s, i) {
6055
6097
  return {
6056
6098
  value: s.label || s.key,