Class FlameGraphSeries
A flame graph: each node is a bar as wide as its share of its parent, and its children sit
on top of it, so the widest stacks are where the time (or memory, or any other total) goes.
The root is the bottom row. With setInverted(true) the root is the top row and the
children hang below it, which is usually called an icicle chart.
Tapping a bar zooms into it: that node becomes the bottom row and spans the full width. Tapping the breadcrumb goes back up. A branch is as wide as the sum of its children, so time a function spends in its own code goes in a leaf child of its own, conventionally named "self". Bars too narrow for their text show none, and the tooltip always shows the name and value.
Bars take the node's own color when it has one. Otherwise they get warm colors, picked from
the node's name so the same function keeps its color between captures; setWarmColors(false)
uses the theme's palette by top level branch instead, as a treemap does.
TreeNode main = new TreeNode("main");
TreeNode load = main.add(new TreeNode("load"));
load.add(new TreeNode("parse", 30));
load.add(new TreeNode("decode", 20));
TreeNode render = main.add(new TreeNode("render"));
render.add(new TreeNode("layout", 25));
render.add(new TreeNode("paint", 15));
Chart chart = new Chart();
chart.addSeries(new FlameGraphSeries("CPU", main));

-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected float[]anchor(float[] r) The anchor point of a recorded geometry,{x, y}absolute.protected float[]collapsed(float[] r) The geometry a node added by a data change grows from: by default the geometry itself, so the node appears in place.protected booleancontains(float[] r, float x, float y) True if the absolute point lies in a recorded geometry.booleanTrue when the root is drawn at the top.booleanTrue when bars get warm colors picked from their names.voidpaint(ChartContext ctx) Paints the series.setInverted(boolean inverted) Draws the root at the top and the children below it (an icicle chart) instead of the root at the bottom.setWarmColors(boolean warm) Chooses between warm colors picked from each node's name, the default, and the theme's palette by top level branch.Methods inherited from class HierarchySeries
attached, captureEntryStart, captureTransitionStart, collectTableRows, colorOf, crumbContains, detached, formatTooltip, getCurrent, getMaxDepth, getNode, getPoint, getPointCount, getRoot, growth, handleTap, hitTest, isCartesian, isPointCountFromLayout, paintBreadcrumb, record, setCurrent, setDrillDown, setMaxDepth, setRoot, transitionEnded, tweenMethods inherited from class Series
dataChanged, formatValue, getChart, getColor, getLegendEntryCount, getLegendEntryName, getName, getSelectablePointCount, getValueFormatter, getVisibilityFraction, getXBounds, getXBoundsWithin, getYBounds, isGap, isLegendEntryVisible, isSecondaryAxis, isShowValues, isVisible, lerp, paintLegendEntrySymbol, paintLegendSymbol, repaintChart, setColor, setName, setSecondaryAxis, setShowValues, setValueFormatter, setVisible, toggleLegendEntry
-
Constructor Details
-
FlameGraphSeries
-
-
Method Details
-
setInverted
Draws the root at the top and the children below it (an icicle chart) instead of the root at the bottom.
Parameters
inverted: true for the root at the top
Returns
this series
-
isInverted
public boolean isInverted()True when the root is drawn at the top.
Returns
true for an icicle chart
-
setWarmColors
Chooses between warm colors picked from each node's name, the default, and the theme's palette by top level branch.
Parameters
warm: false for the theme's palette
Returns
this series
-
isWarmColors
public boolean isWarmColors()True when bars get warm colors picked from their names.
Returns
true by default
-
paint
Description copied from class:SeriesPaints the series.
Parameters
ctx: the current frame: graphics, plot area, axes and animation progress
-
collapsed
protected float[] collapsed(float[] r) Description copied from class:HierarchySeriesThe geometry a node added by a data change grows from: by default the geometry itself, so the node appears in place.
Parameters
geometry: the node's geometry after the change
Returns
a new array of the same length
- Overrides:
collapsedin classHierarchySeries
-
contains
protected boolean contains(float[] r, float x, float y) Description copied from class:HierarchySeriesTrue if the absolute point lies in a recorded geometry.
Parameters
-
geometry: a recorded geometry -
x: absolute x -
y: absolute y
Returns
true on a hit
- Specified by:
containsin classHierarchySeries
-
-
anchor
protected float[] anchor(float[] r) Description copied from class:HierarchySeriesThe anchor point of a recorded geometry,
{x, y}absolute.Parameters
geometry: a recorded geometry
Returns
the point a tooltip points at
- Specified by:
anchorin classHierarchySeries
-