wijjit.elements.display.columnchart.ColumnChart

class wijjit.elements.display.columnchart.ColumnChart(id=None, classes=None, data=None, width=60, height=15, column_width=3, spacing=1, show_labels=True, show_axis=True, axis_width=6, show_grid=False, color_mode='default', color_scale='green', border_style='single', bind=True)[source]

ColumnChart element for vertical column visualization.

This element displays data as vertical columns with support for: - Labels on the x-axis (bottom) - Y-axis with scaled values - Single color, gradient, or threshold-based coloring - Optional grid lines - Configurable column width and spacing

Parameters:
  • id (str, optional) – Element identifier

  • classes (str or list of str, optional) – CSS class names for styling

  • data (list, optional) – Data as numbers, tuples (label, value), or dicts (default: [])

  • width (int, optional) – Display width in columns (default: 60)

  • height (int, optional) – Display height in rows (default: 15)

  • column_width (int, optional) – Width of each column in characters (default: 3)

  • spacing (int, optional) – Spacing between columns (default: 1)

  • show_labels (bool, optional) – Show labels on x-axis (default: True)

  • show_axis (bool, optional) – Show y-axis with values (default: True)

  • axis_width (int, optional) – Width reserved for y-axis (default: 6)

  • show_grid (bool, optional) – Show horizontal grid lines (default: False)

  • color_mode (str, optional) – Color mode: “default”, “gradient”, “threshold” (default: “default”)

  • color_scale (str, optional) – Color scale for gradient mode (default: “green”)

  • border_style (str, optional) – Border style drawn around the chart (e.g. “single”, “double”, “rounded”, “none”). The border is drawn within width/height, insetting the content region (default: “single”).

  • bind (bool | str)

Variables:
  • data (list) – Raw data

  • values (list of float) – Extracted numeric values

  • labels (list of str) – Extracted labels

  • width (int) – Display width

  • height (int) – Display height

Examples

Simple column chart:

>>> chart = ColumnChart(data=[10, 20, 30, 40, 50])

With labels:

>>> chart = ColumnChart(data=[
...     ("Jan", 100), ("Feb", 150), ("Mar", 200)
... ])

Gradient coloring:

>>> chart = ColumnChart(data=[10, 50, 90], color_mode="gradient")
__init__(id=None, classes=None, data=None, width=60, height=15, column_width=3, spacing=1, show_labels=True, show_axis=True, axis_width=6, show_grid=False, color_mode='default', color_scale='green', border_style='single', bind=True)[source]
Parameters:
Return type:

None

Methods

__init__([id, classes, data, width, height, ...])

add_class(class_name)

Add a CSS class to this element.

apply_props(props)

Apply props from a VNode, skipping ephemeral props.

get_ephemeral_state()

Get ephemeral state that should survive reconciliation.

get_hardware_cursor_position()

Absolute screen cell where the hardware terminal cursor should park.

get_height_for_width(width)

Return the height this element needs when laid out at width.

get_intrinsic_size()

Get the intrinsic size of the chart.

handle_key(key)

Handle a key press.

handle_mouse(event)

Handle a mouse event.

has_class(class_name)

Check if element has a CSS class.

on_blur()

Called when element loses focus.

on_focus()

Called when element gains focus.

on_hover_enter()

Called when mouse enters element.

on_hover_exit()

Called when mouse exits element.

on_mount()

Called when element is first added to the element tree.

on_unmount()

Called when element is removed from the element tree.

on_update(changed_props)

Called when element props are updated during reconciliation.

remove_class(class_name)

Remove a CSS class from this element.

render_signature()

Paint memo for the skip-unchanged fast path.

render_to(ctx)

Render the column chart using cell-based rendering.

restore_ephemeral_state(state)

Restore ephemeral state after reconciliation.

set_bounds(bounds)

Set the element's screen bounds.

set_data(data)

Update chart data.

toggle_class(class_name)

Toggle a CSS class on this element.

Attributes

captures_tab

Whether this element wants the Tab key instead of focus movement.

data

Get the raw data values.

parent_frame

Get the parent Frame if this element is inside a scrollable frame.

supports_dynamic_sizing

Whether this element supports dynamic sizing.

property data: list[Any]

Get the raw data values.

Returns:

Raw data values

Return type:

list

set_data(data)[source]

Update chart data.

Parameters:

data (list) – New data values

Return type:

None

get_intrinsic_size()[source]

Get the intrinsic size of the chart.

Returns:

(width, height) in characters

Return type:

tuple of int

render_signature()[source]

Paint memo for the skip-unchanged fast path.

Captures the extracted values and labels, the chart/column geometry (width, height, column width, spacing, axis width), the label/axis/grid toggles, the coloring inputs (mode, scale), the border style, and the style-affecting state. See wijjit.elements.base.Element.render_signature().

Return type:

Any

render_to(ctx)[source]

Render the column chart using cell-based rendering.

Parameters:

ctx (PaintContext) – Paint context with buffer, style resolver, and bounds

Return type:

None

Notes

Theme styles:

This element uses the following theme style classes: - columnchart: Base column chart style - columnchart.column: Column fill style - columnchart.column.empty: Empty column portion style - columnchart.axis: Axis line and text style - columnchart.label: X-axis label style - columnchart.grid: Grid line style