@progress/kendo-charts 2.2.0 → 2.3.0-dev.202402161236
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/es/sankey/sankey.js
CHANGED
|
@@ -77,7 +77,8 @@ export var Sankey = (function (Observable) {
|
|
|
77
77
|
Sankey.prototype._createSurface = function _createSurface () {
|
|
78
78
|
return drawing.Surface.create(this.surfaceElement, {
|
|
79
79
|
mouseenter: this._mouseenter.bind(this),
|
|
80
|
-
mouseleave: this._mouseleave.bind(this)
|
|
80
|
+
mouseleave: this._mouseleave.bind(this),
|
|
81
|
+
mousemove: this._mousemove.bind(this),
|
|
81
82
|
});
|
|
82
83
|
};
|
|
83
84
|
|
|
@@ -100,8 +101,11 @@ export var Sankey = (function (Observable) {
|
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
Sankey.prototype.trigger = function trigger (name, ev) {
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
var event = Object.assign({}, ev,
|
|
105
|
+
{type: name,
|
|
106
|
+
dataItem: ev.element.dataItem});
|
|
107
|
+
|
|
108
|
+
return Observable.prototype.trigger.call(this, name, event);
|
|
105
109
|
};
|
|
106
110
|
|
|
107
111
|
Sankey.prototype._mouseenter = function _mouseenter (ev) {
|
|
@@ -139,6 +143,10 @@ export var Sankey = (function (Observable) {
|
|
|
139
143
|
return;
|
|
140
144
|
}
|
|
141
145
|
|
|
146
|
+
if (isLink || isNode) {
|
|
147
|
+
this.trigger('hideTooltip', ev);
|
|
148
|
+
}
|
|
149
|
+
|
|
142
150
|
if ((isLink && this.trigger('linkLeave', ev)) ||
|
|
143
151
|
(isNode && this.trigger('nodeLeave', ev))) {
|
|
144
152
|
return;
|
|
@@ -149,6 +157,16 @@ export var Sankey = (function (Observable) {
|
|
|
149
157
|
}
|
|
150
158
|
};
|
|
151
159
|
|
|
160
|
+
Sankey.prototype._mousemove = function _mousemove (ev) {
|
|
161
|
+
var element = ev.element;
|
|
162
|
+
|
|
163
|
+
if (element.type === NODE) {
|
|
164
|
+
this.trigger('nodeTooltip', ev);
|
|
165
|
+
} else if (element.type === LINK) {
|
|
166
|
+
this.trigger('linkTooltip', ev);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
152
170
|
Sankey.prototype.highlightLinks = function highlightLinks (node, highlight) {
|
|
153
171
|
var this$1 = this;
|
|
154
172
|
|
|
@@ -356,6 +374,12 @@ export var Sankey = (function (Observable) {
|
|
|
356
374
|
var nodeVisual = nodeInstance.exportVisual();
|
|
357
375
|
nodeVisual.links = [];
|
|
358
376
|
nodeVisual.type = NODE;
|
|
377
|
+
|
|
378
|
+
nodeVisual.dataItem = Object.assign({}, data.nodes[i],
|
|
379
|
+
{color: nodeOps.color,
|
|
380
|
+
opacity: nodeOps.opacity,
|
|
381
|
+
sourceLinks: node.sourceLinks.map(function (link) { return ({ sourceId: link.sourceId, targetId: link.targetId, value: link.value }); }),
|
|
382
|
+
targetLinks: node.targetLinks.map(function (link) { return ({ sourceId: link.sourceId, targetId: link.targetId, value: link.value }); })});
|
|
359
383
|
visualNodes.set(node.id, nodeVisual);
|
|
360
384
|
|
|
361
385
|
visual.append(nodeVisual);
|
|
@@ -375,6 +399,11 @@ export var Sankey = (function (Observable) {
|
|
|
375
399
|
var linkVisual = linkInstance.exportVisual();
|
|
376
400
|
|
|
377
401
|
linkVisual.type = LINK;
|
|
402
|
+
linkVisual.dataItem = {
|
|
403
|
+
source: Object.assign({}, sourceNode.dataItem),
|
|
404
|
+
target: Object.assign({}, targetNode.dataItem),
|
|
405
|
+
value: link.value
|
|
406
|
+
};
|
|
378
407
|
linksVisuals.push(linkVisual);
|
|
379
408
|
|
|
380
409
|
sourceNode.links.push(linkVisual);
|
|
@@ -69,7 +69,8 @@ export class Sankey extends Observable {
|
|
|
69
69
|
_createSurface() {
|
|
70
70
|
return drawing.Surface.create(this.surfaceElement, {
|
|
71
71
|
mouseenter: this._mouseenter.bind(this),
|
|
72
|
-
mouseleave: this._mouseleave.bind(this)
|
|
72
|
+
mouseleave: this._mouseleave.bind(this),
|
|
73
|
+
mousemove: this._mousemove.bind(this),
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -90,8 +91,11 @@ export class Sankey extends Observable {
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
trigger(name, ev) {
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
const event = Object.assign({}, ev,
|
|
95
|
+
{type: name,
|
|
96
|
+
dataItem: ev.element.dataItem});
|
|
97
|
+
|
|
98
|
+
return super.trigger(name, event);
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
_mouseenter(ev) {
|
|
@@ -128,6 +132,10 @@ export class Sankey extends Observable {
|
|
|
128
132
|
return;
|
|
129
133
|
}
|
|
130
134
|
|
|
135
|
+
if (isLink || isNode) {
|
|
136
|
+
this.trigger('hideTooltip', ev);
|
|
137
|
+
}
|
|
138
|
+
|
|
131
139
|
if ((isLink && this.trigger('linkLeave', ev)) ||
|
|
132
140
|
(isNode && this.trigger('nodeLeave', ev))) {
|
|
133
141
|
return;
|
|
@@ -138,6 +146,16 @@ export class Sankey extends Observable {
|
|
|
138
146
|
}
|
|
139
147
|
}
|
|
140
148
|
|
|
149
|
+
_mousemove(ev) {
|
|
150
|
+
const element = ev.element;
|
|
151
|
+
|
|
152
|
+
if (element.type === NODE) {
|
|
153
|
+
this.trigger('nodeTooltip', ev);
|
|
154
|
+
} else if (element.type === LINK) {
|
|
155
|
+
this.trigger('linkTooltip', ev);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
141
159
|
highlightLinks(node, highlight) {
|
|
142
160
|
if (node) {
|
|
143
161
|
this.setLinksOpacity(highlight.inactiveOpacity);
|
|
@@ -322,6 +340,12 @@ export class Sankey extends Observable {
|
|
|
322
340
|
const nodeVisual = nodeInstance.exportVisual();
|
|
323
341
|
nodeVisual.links = [];
|
|
324
342
|
nodeVisual.type = NODE;
|
|
343
|
+
|
|
344
|
+
nodeVisual.dataItem = Object.assign({}, data.nodes[i],
|
|
345
|
+
{color: nodeOps.color,
|
|
346
|
+
opacity: nodeOps.opacity,
|
|
347
|
+
sourceLinks: node.sourceLinks.map(link => ({ sourceId: link.sourceId, targetId: link.targetId, value: link.value })),
|
|
348
|
+
targetLinks: node.targetLinks.map(link => ({ sourceId: link.sourceId, targetId: link.targetId, value: link.value }))});
|
|
325
349
|
visualNodes.set(node.id, nodeVisual);
|
|
326
350
|
|
|
327
351
|
visual.append(nodeVisual);
|
|
@@ -340,6 +364,11 @@ export class Sankey extends Observable {
|
|
|
340
364
|
const linkVisual = linkInstance.exportVisual();
|
|
341
365
|
|
|
342
366
|
linkVisual.type = LINK;
|
|
367
|
+
linkVisual.dataItem = {
|
|
368
|
+
source: Object.assign({}, sourceNode.dataItem),
|
|
369
|
+
target: Object.assign({}, targetNode.dataItem),
|
|
370
|
+
value: link.value
|
|
371
|
+
};
|
|
343
372
|
linksVisuals.push(linkVisual);
|
|
344
373
|
|
|
345
374
|
sourceNode.links.push(linkVisual);
|