Skip to content

Commit

Permalink
flamegraph: Retain inversion when toggling filters
Browse files Browse the repository at this point in the history
Previously clicking the "Hide Irrelevant Frames" or "Hide Import System
Frames" checkboxes would switch the flame graph back to icicle mode.
Ensure we retain flame mode when the user has chosen it.
  • Loading branch information
ZeroIntensity authored and godlygeek committed Aug 2, 2024
1 parent fc06d9d commit 260b8d5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions news/656.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ensure flame graphs stay in flame mode when the user has selected it.
Previously clicking the "Hide Irrelevant Frames" or "Hide Import System Frames"
checkboxes would switch the flame graph back to icicle mode.
6 changes: 4 additions & 2 deletions src/memray/reporters/assets/flamegraph_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ export function initThreadsDropdown(data, merge_threads) {
}

export function drawChart(chart_data) {
// Retain the "invertedness" if there's an existing graph.
let invert = chart ? chart.inverted() : true;

// Clear any existing chart
if (chart) {
chart.destroy();
Expand All @@ -270,8 +273,7 @@ export function drawChart(chart_data) {
// smooth transitions
.transitionDuration(250)
.transitionEase(d3.easeCubic)
// invert the graph by default
.inverted(true)
.inverted(invert)
// make each row a little taller
.cellHeight(20)
// don't show elements that are less than 5px wide
Expand Down
2 changes: 1 addition & 1 deletion src/memray/reporters/templates/assets/flamegraph.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/memray/reporters/templates/assets/flamegraph_common.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 260b8d5

Please sign in to comment.