ChartData

Summary

Defines individual data points within a chart series. This component must be nested within a bx:chartseries component and represents a single data point with a label and value(s). For most chart types, only item and value are needed. For bubble charts, use x, y, and r coordinates instead.

Syntax

<!-- Standard data point -->
<bx:chartdata item="Label" value="100">

<!-- Bubble chart data point -->
<bx:chartdata item="Label" x="10" y="20" r="5">

Attributes

Attribute
Type
Required
Default
Description

item

string

Yes

-

Data point label/name displayed in tooltips and legends

value

number

Conditional

-

Data point value. Required for all chart types except bubble charts

x

number

Conditional

-

X-coordinate. Required for bubble charts, ignored for other chart types

y

number

Conditional

-

Y-coordinate. Required for bubble charts, ignored for other chart types

r

number

Conditional

-

Bubble radius. Required for bubble charts, ignored for other chart types

Usage by Chart Type

Standard Charts (pie, bar, line, doughnut, radar, polarArea, area, horizontalbar, scatter)

For all standard chart types, use item and value:

Bubble Charts

For bubble charts, use item, x, y, and r:

Where:

  • x represents the horizontal position (e.g., risk level)

  • y represents the vertical position (e.g., return rate)

  • r represents the bubble size (e.g., investment amount)

Examples

Pie Chart Data Points

Bar Chart Data Points

Line Chart Time Series

Bubble Chart Portfolio Analysis

Radar Chart Multi-Variable Comparison

Multi-Series Data Comparison

Data Validation

The component automatically validates data based on the parent series chart type:

  • Standard charts: Requires item and value attributes

  • Bubble charts: Requires item, x, y, and r attributes

  • Value types: Numeric values are automatically converted to numbers

  • Missing data: Missing required attributes will throw validation errors

Notes

  • The item attribute provides the label shown in tooltips, legends, and axis labels

  • Numeric values are automatically converted to appropriate types for Chart.js

  • For bubble charts, the r value determines the relative size of bubbles

  • Data points are rendered in the order they appear in the component tree

  • Empty or invalid numeric values may cause rendering issues

  • bx:chart - Main chart container component

  • bx:chartseries - Chart series container that holds chartdata components

Last updated

Was this helpful?