Skip to content

Commit f6dcd07

Browse files
committed
WIP: bootstrap tour
1 parent 2e2bdb6 commit f6dcd07

File tree

5 files changed

+103
-49
lines changed

5 files changed

+103
-49
lines changed

visualise/static/js/visualise/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ Main.setBindings = function() {
185185
}
186186
});
187187

188-
$("#help-icon").click(startIntro);
188+
$("#help-icon").click(function() {startTour(true)});
189+
$(function() {startTour(false)});
189190

190191
$("#matrix").click(function(e) {
191192
if (!$(e.target).hasClass("matrix-div")){

visualise/static/js/visualise/tour.js

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
function startTour(force_start){
2+
function autoScrollSideBar(t) {
3+
// to be called onShow, hence the currentstep + 1 below
4+
var element = t.getStep(t.getCurrentStep() + 1).element;
5+
if (!element) {
6+
console.warn("autoScrollSideBar called, but can't get element");
7+
return;
8+
}
9+
var element_offset = $(element).offset().top;
10+
$("#sidebar-container").animate({scrollTop: element_offset}, 200);
11+
}
12+
13+
function fixupSVGHighlighting(t) {
14+
// to be called onShown
15+
var element = t.getStep(t.getCurrentStep()).element;
16+
if (!element) {
17+
console.warn("fixupSVGHighlighting called, but can't get element");
18+
return;
19+
}
20+
console.log('dim:');
21+
console.log($(element).width());
22+
console.log($(element).height());
23+
$(".tour-step-background").width($(element).width()).height($(element).height());
24+
}
25+
26+
var tour = new Tour({
27+
backdrop: true,
28+
backdropPadding: 5,
29+
// autoscroll: true, // doesn't seem to work
30+
orphan: true,
31+
debug: true,
32+
steps: [
33+
{
34+
content: "Welcome to the result visualisation of our <a href='https://w3id.org/associations/#gp_learner'>graph pattern learner</a>.<br>As the interface is quite powerful, this tour will briefly explain its components."
35+
},
36+
{
37+
element: '#sidebar-global-info-panel',
38+
onShow: autoScrollSideBar,
39+
placement: 'left',
40+
title: "Result step selection",
41+
content: "Let's start on the right. As you might know our evolutionary algorithm operates in several runs to cover the input source-target-pairs. Here you can select individual generations from each run, the results of each run or the overall aggregated results."
42+
},
43+
{
44+
element: '#sidebar-select-panel',
45+
onShow: autoScrollSideBar,
46+
placement: 'left',
47+
content: "Once the selected results are loaded, you can select the individual patterns in this panel."
48+
},
49+
{
50+
element: '#sidebar-fitness-panel',
51+
onShow: autoScrollSideBar,
52+
placement: 'left',
53+
content: "In this panel you will see the fitness of the currently selected pattern."
54+
},
55+
{
56+
element: '#sidebar-pairs-panel',
57+
onShow: autoScrollSideBar,
58+
placement: 'left',
59+
content: "Here you can see which of the ground truth source-target-pairs are matched by the selected pattern."
60+
},
61+
{
62+
element: '#sidebar-pairs-panel .pair-link:first',
63+
placement: 'left',
64+
content: "You can also execute the SPARQL query for the current pattern pre-filled with the individual source node."
65+
},
66+
{
67+
element: '#graph svg>g',
68+
onShown: fixupSVGHighlighting,
69+
content: "This is a tooltip."
70+
},
71+
{
72+
element: document.querySelectorAll('#step2')[0],
73+
content: "Ok, wasn't that fun?",
74+
position: 'right'
75+
},
76+
{
77+
element: '#step3',
78+
content: 'More features, more fun.',
79+
position: 'left'
80+
},
81+
{
82+
element: '#step4',
83+
content: "Another step.",
84+
position: 'bottom'
85+
},
86+
{
87+
element: '#step5',
88+
content: 'Get it, use it.'
89+
}
90+
]
91+
});
92+
tour.init();
93+
if (force_start) {
94+
tour.restart(0);
95+
}
96+
tour.start(force_start);
97+
}

0 commit comments

Comments
 (0)