Skip to content

Commit 67e90c3

Browse files
authored
Merge pull request #277 from plasma-umass/colors_plus_tooltips
Fix tooltip visibility and expand color palette (fixes #196)
2 parents 9dd3314 + ccb52cb commit 67e90c3

4 files changed

Lines changed: 40 additions & 18 deletions

File tree

viewer/css/plot.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ p.noseries {
216216
line-height: 1.5;
217217
backdrop-filter: blur(8px);
218218
-webkit-backdrop-filter: blur(8px);
219+
max-width: 320px;
220+
overflow-wrap: break-word;
221+
word-wrap: break-word;
219222
}
220223

221224
.d3-tip strong {

viewer/js/profile.js

Lines changed: 18 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

viewer/js/profile.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

viewer/ts/profile.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ class Profile {
11901190
// Remove the noseries class from legend entries
11911191
legend_entries_sel.classed('noseries', false).text('');
11921192
legend_entries_sel.append('i')
1193-
.attr('class', (d, i) => { return `fa fa-circle${this._disabled_progress_points.indexOf(d) !== -1 ? '-o' : ''} series${i % 4}`; })
1193+
.attr('class', (d, i) => { return `fa fa-circle${this._disabled_progress_points.indexOf(d) !== -1 ? '-o' : ''} series${i % 8}`; })
11941194
.on('click', (d, i) => {
11951195
const ind = this._disabled_progress_points.indexOf(d);
11961196
if (ind !== -1) {
@@ -1292,8 +1292,13 @@ class Profile {
12921292
let tip = (<any> d3).tip()
12931293
.attr('class', 'd3-tip')
12941294
.offset([-5, 0])
1295-
.html(function (d: Measurement) {
1296-
return '<strong>Line Speedup:</strong> ' + percentFormat(d.speedup) + '<br>' +
1295+
.html(function (d: any) {
1296+
let name = d.point_name || '';
1297+
// Show just filename:line, not the full path
1298+
let slash = name.lastIndexOf('/');
1299+
if (slash !== -1) name = name.substring(slash + 1);
1300+
return '<strong>Progress Point:</strong> ' + name + '<br>' +
1301+
'<strong>Line Speedup:</strong> ' + percentFormat(d.speedup) + '<br>' +
12971302
'<strong>Progress Speedup:</strong> ' + percentFormat(d.progress_speedup);
12981303
})
12991304
.direction(function (d: Measurement) {
@@ -1646,7 +1651,7 @@ class Profile {
16461651
series_sel.attr('class', function(d, k) {
16471652
// Use progress point's position in array to assign it a stable color, no matter
16481653
// which points are enabled for display.
1649-
return `series series${(progress_points.indexOf(d.name)) % 5}`; })
1654+
return `series series${(progress_points.indexOf(d.name)) % 8}`; })
16501655
.attr('style', 'clip-path: url(#clip);');
16511656
series_sel.exit().remove();
16521657

@@ -1681,17 +1686,21 @@ class Profile {
16811686
lines_sel.exit().remove();
16821687

16831688
/****** Add or update points ******/
1684-
let points_sel = series_sel.selectAll('circle').data(function(d) { return d.measurements; });
1689+
let points_sel = series_sel.selectAll('circle').data(function(d) {
1690+
return d.measurements.map(function(m) {
1691+
return { speedup: m.speedup, progress_speedup: m.progress_speedup, point_name: d.name };
1692+
});
1693+
});
16851694
points_sel.enter().append('circle').attr('r', radius);
16861695
points_sel.attr('cx', function(d) { return xscale(d.speedup); })
16871696
.attr('cy', function(d) { return yscale(d.progress_speedup); })
1688-
.on('mouseover', function(d, i) {
1697+
.on('mouseover', function(d) {
16891698
d3.select(this).classed('highlight', true);
1690-
tip.show(d, i);
1699+
tip.show(d, this);
16911700
})
1692-
.on('mouseout', function(d, i) {
1701+
.on('mouseout', function() {
16931702
d3.select(this).classed('highlight', false);
1694-
tip.hide(d, i);
1703+
tip.hide();
16951704
});
16961705
points_sel.exit().remove();
16971706

0 commit comments

Comments
 (0)