CUI

Components / Charts

Treemap and radar

A treemap shows the parts of a whole as rectangles sized by value. A radar chart compares items across several axes.

Functions: cui_radar_chart, cui_treemap

Treemap and radar

Usage

static const cui_viz_item mods[] = { { "Layout", 55 }, { "Text", 42 }, { "Draw", 35 } /* ... */ };
cui_treemap(ui, "bundle", mods, 10, .height = 290, .format = "%.0f KB");

cui_series releases[] = { { "1.0", a, 6 }, { "1.1", b, 6 } };
cui_radar_chart(ui, "radar", releases, 2, axes, 6, .size = 210, .max = 100);

The treemap uses a squarified layout, so rectangles stay close to square; labels appear where they fit and the text color follows the fill. Give an item a color to pick it out. The radar draws a ring per tick with its value, fills each series lightly and lists them in a legend; hovering near an axis shows every series' value on it.

Options of cui_radar_chart

OptionTypeDefaultDescription
.sizefloatSize in points; 0 uses the component's own.
.maxfloatvalue at the outer ring; 0 picks a round number above the largest value
.formatconst char *A printf format for the values, such as "%.0f ms".
.no_legendboolHides the legend.

Options of cui_treemap

OptionTypeDefaultDescription
.widthcui_sizeWidth: CUI_FILL, CUI_FIT, CUI_PX(n) or CUI_PCT(n); unset uses the component's own.
.heightfloatHeight in points; 0 uses the component's own.
.formatconst char *A printf format for the values, such as "%.0f ms".

cui_series

FieldTypeDescription
nameconst char *shown in the legend and in the hover tooltip
valuesconst float *the series' data, one value per point
countintnumber of values
colorcui_colordefault: series palette

cui_viz_item

FieldTypeDescription
labelconst char *A label shown above or beside the control.
valuefloatthe item's amount: its area, length or share, by chart (activity rings: 1 is a full turn)
colorcui_colorA theme color such as CUI_COLOR_ACCENT, or CUI_RGB(0x7747ff); unset uses the theme's.

Related

  • Funnel, split bar and waffle: Three charts for shares: a funnel for the steps of a conversion, a single bar split into parts, and a waffle of 100 squares.
  • Calendar heatmap: A year of days as small squares colored by activity.
  • Sankey: Flows between stages, drawn as ribbons whose width follows the amount.
  • Heatmap: A grid of cells colored by value, for one category against another.