Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class TreemapSeries
- Object
- Series
- HierarchySeries
- TreemapSeries
A squarified treemap: every node is a rectangle whose area is proportional to its value, nested inside its parent. Branches large enough get a header with their name; leaves show their name and value when the text fits, and the tooltip always does.
Chart chart = new Chart();
TreeNode root = new TreeNode("All");
root.add(new TreeNode("Photos", 40));
TreeNode apps = root.add(new TreeNode("Apps"));
apps.add(new TreeNode("Games", 15));
apps.add(new TreeNode("Tools", 10));
root.add(new TreeNode("Music", 20));
chart.addSeries(new TreemapSeries("Portfolio", root));
Constructors
public TreemapSeries(String name, TreeNode root) | Creates a treemap. |
Methods
public void paint(ChartContext ctx) | Paints the series. |
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 boolean contains(float[] r, float x, float y) | True if the absolute point lies in a recorded geometry. |
protected float[] anchor(float[] r) | The anchor point of a recorded geometry, {x, y} absolute. |
Inherited methods
From HierarchySeries
isCartesian, setRoot, attached, detached, getRoot, getCurrent, setCurrent, crumbContains, setDrillDown, setMaxDepth, getMaxDepth, captureEntryStart, captureTransitionStart, transitionEnded, tween, growth, colorOf, paintBreadcrumb, record, hitTest, isPointCountFromLayout, getPointCount, getPoint, getNode, handleTap, formatTooltip, collectTableRows
From Series
getName, setName, getColor, setColor, isVisible, setVisible, isSecondaryAxis, setSecondaryAxis, isShowValues, setShowValues, getValueFormatter, setValueFormatter, getChart, getXBounds, getXBoundsWithin, getYBounds, getSelectablePointCount, paintLegendSymbol, getLegendEntryCount, getLegendEntryName, paintLegendEntrySymbol, isLegendEntryVisible, toggleLegendEntry, formatValue, dataChanged, repaintChart, getVisibilityFraction, isGap, lerp
Constructor details
TreemapSeries
public TreemapSeries(String name, TreeNode root)Parameters
nameString- the series name
rootTreeNode- the tree’s root
Method details
paint
public void paint(ChartContext ctx)Parameters
ctxChartContext- the current frame: graphics, plot area, axes and animation progress
collapsed
protected float[] collapsed(float[] r)Parameters
rfloat[]- the node’s geometry after the change
Returns
contains
protected boolean contains(float[] r, float x, float y)Parameters
rfloat[]- a recorded geometry
xfloat- absolute x
yfloat- absolute y
Returns
anchor
protected float[] anchor(float[] r){x, y} absolute.Parameters
rfloat[]- a recorded geometry