Class HierarchySeries
- Direct Known Subclasses:
FlameGraphSeries, SunburstSeries, TreemapSeries
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHierarchySeries(String name, TreeNode root) Creates the series. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract float[]anchor(float[] geometry) The anchor point of a recorded geometry,{x, y}absolute.protected voidattached()Called by the chart when this series is added to it, and again when the chart comes back on screen (itsinitComponent); a series may be told more than once.protected voidRecords a zero baseline as the start of the entry animation.protected voidRecords the values currently on screen as the start of the next transition.protected float[]collapsed(float[] geometry) The geometry a node added by a data change grows from: by default the geometry itself, so the node appears in place.voidcollectTableRows(List<String[]> rows) Adds this series' data to an accessible table, one{series, item, value}row per point.protected intcolorOf(ChartContext ctx, TreeNode n) The colour of a node: its own, its nearest coloured ancestor's tinted by depth, or the palette colour of its top level branch.protected abstract booleancontains(float[] geometry, float x, float y) True if the absolute point lies in a recorded geometry.protected booleancrumbContains(float ax, float ay) True when a point, in screen coordinates, is on the breadcrumb that goes back up.protected voiddetached()Called by the chart when this series is removed from it, or the chart leaves the screen (itsdeinitialize); a series may be told more than once.formatTooltip(ChartContext ctx, ChartPoint p) The tooltip row for a point: the series or point name and its formatted value.The node currently zoomed into.intThe number of levels drawn.The node behind a point fromhitTestor a selection event.getPoint(ChartContext ctx, int index) The point atindexfor a shared tooltip, or null.intThe number of points along x, for a shared tooltip; -1 when not index aligned.getRoot()The root node.protected floatgrowth(ChartContext ctx) The fraction of the zoom or entry animation done, 1 when idle.booleanCalled when a point of this series is tapped, before the chart selects it.hitTest(ChartContext ctx, int x, int y, int radius) Finds the data point nearest a screen position.booleanTrue for series drawn against x and y axes; false for pies, treemaps and other series that fill the plot themselves.protected booleanTrue whengetPointCount()counts points a paint laid out (treemap, sunburst, Sankey) rather than the model's points, so an index past it may exist after the next paint.protected intPaints the breadcrumb row when zoomed in and returns its height.protected voidsetCurrent(TreeNode node) Zooms into a node, animated.setDrillDown(boolean d) Enables zooming into a node by tapping it.setMaxDepth(int depth) How many levels below the current node are drawn.Replaces the tree and zooms back out to its root.protected voidCalled by the chart when a transition has finished, so a subclass can drop the start values it captured; a later change that forgot to snapshot then shows its new values instead of replaying a transition from long gone data.protected final voidtween(ChartContext ctx, TreeNode n, float[] geometry) Moves a node's geometry, in place, part of the way from where the node was drawn before the data changed togeometry, by the progress of the change.Methods inherited from class Series
dataChanged, formatValue, getChart, getColor, getLegendEntryCount, getLegendEntryName, getName, getSelectablePointCount, getValueFormatter, getVisibilityFraction, getXBounds, getXBoundsWithin, getYBounds, isGap, isLegendEntryVisible, isSecondaryAxis, isShowValues, isVisible, lerp, paint, paintLegendEntrySymbol, paintLegendSymbol, repaintChart, setColor, setName, setSecondaryAxis, setShowValues, setValueFormatter, setVisible, toggleLegendEntry
-
Constructor Details
-
HierarchySeries
-
-
Method Details
-
isCartesian
public boolean isCartesian()Description copied from class:SeriesTrue for series drawn against x and y axes; false for pies, treemaps and other series that fill the plot themselves.- Specified by:
isCartesianin classSeries
-
setRoot
Replaces the tree and zooms back out to its root.
Parameters
root: the new root
Returns
this series
-
attached
protected void attached()Description copied from class:SeriesCalled by the chart when this series is added to it, and again when the chart comes back on screen (itsinitComponent); a series may be told more than once. A series that listens to a model outliving it (aTreeNodetree) registers here, so the model does not keep a discarded chart reachable: a chart taken off screen, or a series removed from its chart, stops listening. -
detached
-
getRoot
The root node. -
getCurrent
The node currently zoomed into. -
setCurrent
Zooms into a node, animated.
Parameters
node: a node of this tree, or null for the root
Returns
this series
-
crumbContains
protected boolean crumbContains(float ax, float ay) True when a point, in screen coordinates, is on the breadcrumb that goes back up.
Parameters
-
ax: the x coordinate -
ay: the y coordinate
Returns
true on the breadcrumb
-
-
setDrillDown
Enables zooming into a node by tapping it.
Parameters
d: true to allow drill down
Returns
this series
-
setMaxDepth
How many levels below the current node are drawn.
Parameters
depth: 1 or more
Returns
this series
-
getMaxDepth
public int getMaxDepth()The number of levels drawn. -
captureEntryStart
protected void captureEntryStart()Description copied from class:SeriesRecords a zero baseline as the start of the entry animation.- Overrides:
captureEntryStartin classSeries
-
captureTransitionStart
protected void captureTransitionStart()Description copied from class:SeriesRecords the values currently on screen as the start of the next transition. Called by the chart before data changes; a subclass with animated data overrides it.- Overrides:
captureTransitionStartin classSeries
-
transitionEnded
protected void transitionEnded()Description copied from class:SeriesCalled by the chart when a transition has finished, so a subclass can drop the start values it captured; a later change that forgot to snapshot then shows its new values instead of replaying a transition from long gone data.- Overrides:
transitionEndedin classSeries
-
tween
Moves a node's geometry, in place, part of the way from where the node was drawn before the data changed to
geometry, by the progress of the change. A node the change added starts fromcollapsed(geometry). Does nothing when no change is animating.Parameters
-
ctx: the paint context -
n: the node -
geometry: the node's geometry after the change, replaced by this frame's
-
-
collapsed
protected float[] collapsed(float[] geometry) The 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
-
growth
The fraction of the zoom or entry animation done, 1 when idle.
Parameters
ctx: the paint context
Returns
0 to 1
-
colorOf
The colour of a node: its own, its nearest coloured ancestor's tinted by depth, or the palette colour of its top level branch.
Parameters
-
ctx: the paint context -
n: the node
Returns
an RGB colour
-
-
paintBreadcrumb
Paints the breadcrumb row when zoomed in and returns its height.
Parameters
ctx: the paint context
Returns
the height used, 0 at the root
-
record
-
contains
protected abstract boolean contains(float[] geometry, float x, float y) True 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
-
-
anchor
protected abstract float[] anchor(float[] geometry) The anchor point of a recorded geometry,
{x, y}absolute.Parameters
geometry: a recorded geometry
Returns
the point a tooltip points at
-
hitTest
Description copied from class:SeriesFinds the data point nearest a screen position.
Parameters
-
ctx: the frame the series was last painted in -
x: chart relative x -
y: chart relative y -
radius: how far from the point a touch may land and still hit it
Returns
the point, or null
-
-
isPointCountFromLayout
protected boolean isPointCountFromLayout()Description copied from class:SeriesTrue whengetPointCount()counts points a paint laid out (treemap, sunburst, Sankey) rather than the model's points, so an index past it may exist after the next paint.- Overrides:
isPointCountFromLayoutin classSeries
-
getPointCount
public int getPointCount()Description copied from class:SeriesThe number of points along x, for a shared tooltip; -1 when not index aligned.- Overrides:
getPointCountin classSeries
-
getPoint
Description copied from class:SeriesThe point atindexfor a shared tooltip, or null. -
getNode
The node behind a point from
hitTestor a selection event.Parameters
p: the point
Returns
the node, or null
-
handleTap
Description copied from class:SeriesCalled when a point of this series is tapped, before the chart selects it. A series that navigates on tap (drilling into a treemap node) returns true to stop the selection.
Parameters
p: the tapped point
Returns
true if the tap was consumed
-
formatTooltip
Description copied from class:SeriesThe tooltip row for a point: the series or point name and its formatted value. Series with several values per point (open/high/low/close, ranges, box plots) override this.
Parameters
-
ctx: the last paint context -
p: the point
Returns
one line of text
- Overrides:
formatTooltipin classSeries
-
-
collectTableRows
Description copied from class:SeriesAdds this series' data to an accessible table, one
{series, item, value}row per point. Used byChart.toTable()and the chart's accessibility text.Parameters
rows: the list to append rows to
- Overrides:
collectTableRowsin classSeries
-