Skip to content

Commit

Permalink
flamegraph: Clean up flameGraph.css patch (2)
Browse files Browse the repository at this point in the history
Follows-up 0ff9af8.

* Move the overrides to xhgui.css instead.
* Given the complexity of these overrides, don't try to undo
  each original style, but simply document that all
  d3-flame-graph-tip styles should be omitted when updating.
* Document the d3.flameGraph.js patch.

Ref #211.
  • Loading branch information
Krinkle committed Nov 13, 2017
1 parent 104f818 commit 7420e76
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 44 deletions.
44 changes: 4 additions & 40 deletions webroot/css/d3.flameGraph.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,43 +38,7 @@
background: transparent;
}

.d3-flame-graph-tip {
line-height: 1;
font-family: Verdana;
font-size: 12px;
padding: 12px;
background: #fff;
border-radius: 6px;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
border: 1px solid rgba(0, 0, 0, 0.2);
color: #000;
pointer-events: none;
}

/* Creates a small triangle extender for the tooltip */
.d3-flame-graph-tip:before,
.d3-flame-graph-tip:after {
pointer-events: none;
content: '';
position: absolute;
display: block;
width: 0;
height: 0;
border-width: 11px;
border-color: transparent;
border-style: solid;
left: 50%;
z-index: 2;
}
.d3-flame-graph-tip:after {
border-bottom-color: #fff;
margin-left: -11px;
top: -22px;
z-index: 2;
}
.d3-flame-graph-tip:before {
border-width: 12px;
border-bottom-color: #999;
margin-left: -12px;
top: -24px;
}
/**
* PATCH(xhgui): Remove all .d3-flame-graph-tip styles
* We have our own tip styles in xhgui.css instead.
*/
42 changes: 38 additions & 4 deletions webroot/css/xhgui.css
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,46 @@ body .d3-flame-graph .frame:hover .label {
color: #fff;
}

/* Inherit our font style instead of hardcoded Verdana 12px */
body .d3-flame-graph-tip {
font-family: inherit;
font-size: inherit;
.d3-flame-graph-tip {
line-height: 1;
padding: 12px;
background: #fff;
border-radius: 6px;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
border: 1px solid rgba(0, 0, 0, 0.2);
color: #000;
pointer-events: none;
}

/* Creates a small triangle extender for the tooltip */
.d3-flame-graph-tip:before,
.d3-flame-graph-tip:after {
pointer-events: none;
content: '';
position: absolute;
display: block;
width: 0;
height: 0;
border-width: 11px;
border-color: transparent;
border-style: solid;
left: 50%;
z-index: 2;
}
.d3-flame-graph-tip:after {
border-bottom-color: #fff;
margin-left: -11px;
top: -22px;
z-index: 2;
}
.d3-flame-graph-tip:before {
border-width: 12px;
border-bottom-color: #999;
margin-left: -12px;
top: -24px;
}


/**
* Run details
*/
Expand Down
1 change: 1 addition & 0 deletions webroot/js/d3.flameGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

var tip = d3.tip()
.direction("s")
// PATCH(xhgui): Override offset from 8 to 24.
.offset([24, 0])
.attr('class', 'd3-flame-graph-tip')
.html(function(d) { return label(d); });
Expand Down

0 comments on commit 7420e76

Please sign in to comment.