PointCategoryChart
The PointCategoryChart component displays categorized points on a 2D plane, allowing for flexible visual encoding using color, symbol type, or symbol size. It is ideal for representing multi-category scatter plots, surveys, or segmented data comparisons.
Usage Example
Props
marks: Array<object> (required)
Each mark defines a data point on the chart and must include:
-
x: numberThe value on the horizontal axis (e.g., age, time, score). -
y: numberThe value on the vertical axis (e.g., quantity, percentage). -
category: stringA grouping key. Each category may be visually differentiated using color, symbol, or size. -
Additional optional properties from
ChartMarkPropscan be used for further customization:foregroundStylesymbolsymbolSizeannotationopacity, etc.
representsDataUsing?: "foregroundStyle" | "symbol" | "symbolSize"
Controls how the chart visually distinguishes different categories:
"foregroundStyle"– uses different colors per category."symbol"– uses different shapes (e.g., circles, squares) per category."symbolSize"– varies the size of symbols based on the category (or data magnitude).
This is an alternative to setting
foregroundStyleBy,symbolBy, orsymbolSizeBymanually.
Full Example
You can dynamically switch how data is represented using a <Picker> and bind it to the representsDataUsing prop.
Use Cases
PointCategoryChart is suitable for:
- Comparing multiple categories over time or value ranges
- Visualizing multivariate distributions
- Highlighting categorical distinctions within scatter plots
