@progress/kendo-charts 2.3.0-dev.202403071434 → 2.3.0-dev.202403191229

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.
@@ -8,6 +8,7 @@ import removeClass from './remove-class';
8
8
 
9
9
  var KICON = 'k-icon';
10
10
  var KI_PREFFIX = 'k-i-';
11
+ var KFONTICON = 'k-font-icon';
11
12
  var KSVGICON = 'k-svg-icon';
12
13
  var KSVG_PREFFIX = 'k-svg-i-';
13
14
 
@@ -55,6 +56,7 @@ var HTMLFontIcon = (function (HTMLBaseIcon) {
55
56
  this._className = className;
56
57
 
57
58
  addClass(this.element, KICON);
59
+ addClass(this.element, KFONTICON);
58
60
  removeClass(this.element, currentIconClass); // Remove any existing icons.
59
61
  addClass(this.element, className);
60
62
  addClass(this.element, this.options.iconClass || '');
@@ -146,7 +146,12 @@ export var Sankey = (function (Observable) {
146
146
  }
147
147
 
148
148
  if (isLink || isNode) {
149
- this.trigger('hideTooltip', ev);
149
+ if (this.tooltipTimeOut) {
150
+ clearTimeout(this.tooltipTimeOut);
151
+ this.tooltipTimeOut = null;
152
+ }
153
+ this.tooltipShown = false;
154
+ this.trigger('tooltipHide', ev);
150
155
  }
151
156
 
152
157
  if ((isLink && this.trigger('linkLeave', ev)) ||
@@ -160,13 +165,57 @@ export var Sankey = (function (Observable) {
160
165
  };
161
166
 
162
167
  Sankey.prototype._mousemove = function _mousemove (ev) {
168
+ var this$1 = this;
169
+
163
170
  var element = ev.element;
164
171
 
165
- if (element.type === NODE) {
166
- this.trigger('nodeTooltip', ev);
167
- } else if (element.type === LINK) {
168
- this.trigger('linkTooltip', ev);
172
+ var tooltipElType = element.type;
173
+ if (tooltipElType !== LINK && tooltipElType !== NODE) {
174
+ return;
169
175
  }
176
+
177
+ ev.tooltipTargetType = tooltipElType;
178
+ var mouseEvent = ev.originalEvent;
179
+ var rect = this.element.getBoundingClientRect();
180
+ var isLeft = mouseEvent.clientX - rect.left < rect.width / 2;
181
+ var ref = this.options.tooltips;
182
+ var offset = ref.offset;
183
+ var followPointer = ref.followPointer;
184
+ var delay = ref.delay;
185
+
186
+ if (this.tooltipShown && !followPointer) {
187
+ return;
188
+ }
189
+
190
+ ev.tooltipData = {
191
+ popupOffset: {
192
+ left: mouseEvent.pageX + (isLeft ? offset : (-1 * offset)),
193
+ top: mouseEvent.pageY
194
+ },
195
+ popupAlign: {
196
+ horizontal: isLeft ? 'left' : 'right',
197
+ vertical: 'center'
198
+ }
199
+ };
200
+
201
+ if (tooltipElType === NODE) {
202
+ var ref$1 = element.dataItem;
203
+ var sourceLinks = ref$1.sourceLinks;
204
+ var targetLinks = ref$1.targetLinks;
205
+ var links = targetLinks.length ? targetLinks : sourceLinks;
206
+ ev.nodeValue = links.reduce(function (acc, link) { return acc + link.value; }, 0);
207
+ }
208
+
209
+ if (this.tooltipTimeOut) {
210
+ clearTimeout(this.tooltipTimeOut);
211
+ this.tooltipTimeOut = null;
212
+ }
213
+
214
+ this.tooltipTimeOut = setTimeout(function () {
215
+ this$1.trigger('tooltipShow', ev);
216
+ this$1.tooltipShown = true;
217
+ this$1.tooltipTimeOut = null;
218
+ }, delay);
170
219
  };
171
220
 
172
221
  Sankey.prototype.highlightLinks = function highlightLinks (node, highlight) {
@@ -539,5 +588,10 @@ setDefaultOptions(Sankey, {
539
588
  opacity: 0.8,
540
589
  inactiveOpacity: 0.2
541
590
  }
591
+ },
592
+ tooltips: {
593
+ offset: 10,
594
+ followPointer: false,
595
+ delay: 1000
542
596
  }
543
597
  });
@@ -1,7 +1,7 @@
1
1
  import { Title as ChartTitle } from "../core";
2
2
  import { SankeyElement } from "./element";
3
3
  import { setDefaultOptions, getSpacing } from '../common';
4
- import { CENTER, TOP } from "../common/constants";
4
+ import { CENTER } from "../common/constants";
5
5
 
6
6
  export var Title = (function (SankeyElement) {
7
7
  function Title () {
@@ -8,6 +8,7 @@ import removeClass from './remove-class';
8
8
 
9
9
  const KICON = 'k-icon';
10
10
  const KI_PREFFIX = 'k-i-';
11
+ const KFONTICON = 'k-font-icon';
11
12
  const KSVGICON = 'k-svg-icon';
12
13
  const KSVG_PREFFIX = 'k-svg-i-';
13
14
 
@@ -53,6 +54,7 @@ class HTMLFontIcon extends HTMLBaseIcon {
53
54
  this._className = className;
54
55
 
55
56
  addClass(this.element, KICON);
57
+ addClass(this.element, KFONTICON);
56
58
  removeClass(this.element, currentIconClass); // Remove any existing icons.
57
59
  addClass(this.element, className);
58
60
  addClass(this.element, this.options.iconClass || '');
@@ -135,7 +135,12 @@ export class Sankey extends Observable {
135
135
  }
136
136
 
137
137
  if (isLink || isNode) {
138
- this.trigger('hideTooltip', ev);
138
+ if (this.tooltipTimeOut) {
139
+ clearTimeout(this.tooltipTimeOut);
140
+ this.tooltipTimeOut = null;
141
+ }
142
+ this.tooltipShown = false;
143
+ this.trigger('tooltipHide', ev);
139
144
  }
140
145
 
141
146
  if ((isLink && this.trigger('linkLeave', ev)) ||
@@ -151,11 +156,48 @@ export class Sankey extends Observable {
151
156
  _mousemove(ev) {
152
157
  const element = ev.element;
153
158
 
154
- if (element.type === NODE) {
155
- this.trigger('nodeTooltip', ev);
156
- } else if (element.type === LINK) {
157
- this.trigger('linkTooltip', ev);
159
+ const tooltipElType = element.type;
160
+ if (tooltipElType !== LINK && tooltipElType !== NODE) {
161
+ return;
162
+ }
163
+
164
+ ev.tooltipTargetType = tooltipElType;
165
+ const mouseEvent = ev.originalEvent;
166
+ const rect = this.element.getBoundingClientRect();
167
+ const isLeft = mouseEvent.clientX - rect.left < rect.width / 2;
168
+ const { offset, followPointer, delay } = this.options.tooltips;
169
+
170
+ if (this.tooltipShown && !followPointer) {
171
+ return;
158
172
  }
173
+
174
+ ev.tooltipData = {
175
+ popupOffset: {
176
+ left: mouseEvent.pageX + (isLeft ? offset : (-1 * offset)),
177
+ top: mouseEvent.pageY
178
+ },
179
+ popupAlign: {
180
+ horizontal: isLeft ? 'left' : 'right',
181
+ vertical: 'center'
182
+ }
183
+ };
184
+
185
+ if (tooltipElType === NODE) {
186
+ const { sourceLinks, targetLinks } = element.dataItem;
187
+ const links = targetLinks.length ? targetLinks : sourceLinks;
188
+ ev.nodeValue = links.reduce((acc, link) => acc + link.value, 0);
189
+ }
190
+
191
+ if (this.tooltipTimeOut) {
192
+ clearTimeout(this.tooltipTimeOut);
193
+ this.tooltipTimeOut = null;
194
+ }
195
+
196
+ this.tooltipTimeOut = setTimeout(() => {
197
+ this.trigger('tooltipShow', ev);
198
+ this.tooltipShown = true;
199
+ this.tooltipTimeOut = null;
200
+ }, delay);
159
201
  }
160
202
 
161
203
  highlightLinks(node, highlight) {
@@ -503,5 +545,10 @@ setDefaultOptions(Sankey, {
503
545
  opacity: 0.8,
504
546
  inactiveOpacity: 0.2
505
547
  }
548
+ },
549
+ tooltips: {
550
+ offset: 10,
551
+ followPointer: false,
552
+ delay: 1000
506
553
  }
507
554
  });
@@ -1,7 +1,7 @@
1
1
  import { Title as ChartTitle } from "../core";
2
2
  import { SankeyElement } from "./element";
3
3
  import { setDefaultOptions, getSpacing } from '../common';
4
- import { CENTER, TOP } from "../common/constants";
4
+ import { CENTER } from "../common/constants";
5
5
 
6
6
  export class Title extends SankeyElement {
7
7
  getElement() {