SpiderChart
SpiderChart in UIToolbox is a radar chart of stats, as on a character sheet. Each SpiderAxis is a spoke from the center. The first axis points up, and the others follow clockwise. The chart fills a polygon through the values. With ShowCompare, it also outlines the Compare values, for example the stats with an item tried on. The Character sheet example uses it.


Video tutorial: Spider chart. All videos: Video tutorials.
<tb:SpiderChart name="stats" max-value="20" rings="4">
<tb:SpiderAxis text="Strength" />
<tb:SpiderAxis text="Agility" />
<tb:SpiderAxis text="Vitality" />
</tb:SpiderChart>
var luck = chart.AddAxis("Luck", 3);
luck.Compare = 5;
chart.ShowCompare = true;
| Member | Description |
|---|---|
MaxValue (max-value) |
The value at the tip of a spoke. Default 10. A larger value stops at the tip. |
Rings (rings) |
The number of grid rings. Default 4. |
LabelSpace (label-space) |
The pixels between the tips and the sides of the chart, for the axis labels. Default 48. |
ShowCompare (show-compare) |
True outlines the Compare values, and each axis shows "value → compare" where the two differ. |
FormatString (format-string) |
The number format of the values. Default "0". |
Animate (animate) |
True moves the shape and the compare outline from the old values to the new values, with the curve of AnimationEasing. False makes the shape jump. Default true. |
AnimationDuration (animation-duration) |
The time of the move, in milliseconds. Default 300. 0 makes the shape jump. |
AnimationEasing (animation-easing) |
The curve of the move, one of the easing curves. Default OutCubic. With OutBack or OutElastic, the shape goes past the new values and comes back. It stays between the center and the tips. |
Axes, AddAxis(text, value) |
The axes (a copy of the list), clockwise from the top. A child SpiderAxis in UXML is an axis too. |
AxisPoint(index, value) |
The local point of a value on an axis. |
SpiderAxis.Text, Value, Compare |
The label, the value and the compare value. A change draws the chart again. |
SpiderAxis.ValueText |
The value text that the axis shows. |
SpiderAxis.ShownValue, ShownCompare |
The values that the shape shows now. During a move, they go from the old values to Value and Compare, and past them with a curve such as OutBack. |
- The chart draws at least 3 axes. The chart is square: the smaller side of the content, less
LabelSpace, sets the radius. - Each axis sits past the tip of its spoke, with its label and its value. A value under the compare value gets the
--upclass, and a value over it gets the--downclass. - The chart draws with
Painter2Dand places the axes withleftandtop. - In the UI Builder, a chart without axes shows five sample axes in a dashed outline. The sample does not show in Play mode or in a build, and the UI Builder does not save it to the UXML file.
Animation
<tb:SpiderChart name="weapons" animate="true" animation-duration="600" />
- When you change a
Valueor aCompare, the value text changes at once. The shape moves to the new values inAnimationDuration, with the curve ofAnimationEasing. - A change during a move starts from the shape that the chart shows at that time. The shape does not jump back.
- A chart that is not in a panel shows a new value at once.
- Set
Animateto false to stop a move. The shape then shows the values at once.
No data
A spider chart with no axes draws a faint web of two rings and spokes and a centered pill with the text "No data".
<tb:SpiderChart />
<tb:SpiderChart no-data-text="No stats yet" />
| Member | Description |
|---|---|
NoDataText (no-data-text) |
The text of the pill. Empty (the default) shows the translated "No data" (the ToolboxText key tb.no-data, in nine languages), which follows a language change. |
ShowNoData (show-no-data) |
True (the default) shows the faint shape and the pill. False leaves an empty chart. |
- A spider chart is empty while it has no axes (
SpiderAxischildren). - The pill hides as soon as data arrives, and shows again when the data goes. No code runs per frame.
- The pill needs a chart of at least 72 × 36 pixels (for a graph and a Sankey chart, the plot). A smaller chart shows no pill.
- An axis with the value 0 is data: it draws, and no pill shows.
- The classes are
tb-chart-no-data(the overlay, in--tb-color-text-muted) andtb-chart-no-data__pill(the pill). Restyle them for the look of your game.
In the examples

Styling
| Class | Element |
|---|---|
tb-spider-chart |
The chart: 300 px. The variables are --tb-spider-chart-grid, the rings and the spokes (--tb-color-border); --tb-spider-chart-fill, the value polygon (--tb-color-preview); --tb-spider-chart-line, its outline (--tb-color-accent); and --tb-spider-chart-compare, the compare outline (--tb-color-warning). |
tb-spider-chart__axes |
The layer of the axes. It fills the chart and has no look of its own. |
tb-spider-chart__axis |
An axis, centered past the tip of its spoke with translate: -50% -50%. |
tb-spider-chart__axis-label |
The axis label, in --tb-color-text-muted. |
tb-spider-chart__axis-value |
The value, or "value → compare": bold, --tb-color-text. |
tb-spider-chart__axis-value--up |
A value under its compare value: --tb-color-success. |
tb-spider-chart__axis-value--down |
A value over its compare value: --tb-color-text-danger. |
The SpiderChartDemo scene shows the stats of a hero with only the axes in the UXML, a skill wheel that adds and removes axes, a level up that previews a talent with the compare outline and the easing of the move, and three looks.