Skip to content

Commit 093ba74

Browse files
Hovering over nodes will zoom their text and show a tooltip
1 parent f62a25b commit 093ba74

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iknow-entity-browser",
3-
"version": "0.7.3",
3+
"version": "0.7.4",
44
"description": "Visualizer for iKnow entities",
55
"main": "gulpfile.babel.js",
66
"scripts": {

src/static/js/graph/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,16 @@ export function update (g = lastGraph, reset = false) {
281281
.attr("dy", ".3em")
282282
.attr("style", d => `font-size:${ Math.round(d.radius / 2) }px`)
283283
.text(d => d.label);
284+
285+
nodeEnter.each(function (d) {
286+
if (d.type !== "folder")
287+
return;
288+
d3.select(this).append("text")
289+
.classed("tooltip", () => true)
290+
.attr("dy", "-0.7em")
291+
.attr("style", d => `font-size:${ Math.round(d.radius / 2) }px`)
292+
.text(d => `Double-click to display more`);
293+
});
284294
node = nodeEnter.merge(node);
285295

286296
if (reset)

src/static/js/model/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function toTree (graph, parent) {
8080
);
8181
} catch (e) {
8282
console.error(`Error! Most likely, one of the graph nodes does not has any entities.`
83-
+ ` The folding criteria displayed on the diagram would be random.`);
83+
+ ` The folding criteria displayed on the diagram will be random.`);
8484
}
8585

8686
return parent;

src/static/scss/graph.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@
5353
text-anchor: middle;
5454
pointer-events: none;
5555
fill: black;
56+
transition: transform .3s ease, opacity .3s ease;
57+
}
58+
59+
&:hover text {
60+
transform: scale(2);
61+
}
62+
63+
.tooltip {
64+
visibility: hidden;
65+
opacity: 0;
66+
fill: gray;
67+
}
68+
69+
&:hover .tooltip {
70+
visibility: visible;
71+
opacity: 1;
5672
}
5773

5874
&.highlighted circle {

0 commit comments

Comments
 (0)