-
Notifications
You must be signed in to change notification settings - Fork 11
feat(chart): Implement axis labels rendering for all chart types #2
Copy link
Copy link
Open
Description
Implement axis labels rendering for all chart types in the makepad-chart library to provide proper visual context for data visualization.
Motivation
Currently, charts render data points but lack axis labels, making it difficult for users to:
- Understand the scale of values on the Y-axis
- Identify categories/data points on the X-axis
- Interpret the data being visualized
Axis labels are essential for any production-ready charting library.
Proposed Solution
Add comprehensive axis label rendering support with the following components:
ChartAxis Component
ChartAxisstruct with configurable orientation (Horizontal/Vertical)- Position support (
Bottom,Top,Left,Right) - Customizable styling (colors, fonts, padding)
- Show/hide options for line, ticks, and labels
AxisRenderer
- Coordinated rendering of X and Y axes
- Automatic tick label positioning
- Support for different axis positions
DrawLabel Element
- Text label rendering element for charts
AxisLabelRendererfor batch label rendering- Configurable text styling
Label Formatting
- Automatic number formatting with
K(thousands) andM(millions) suffixes - Custom label formatter support via closures
- Configurable font size and colors
Implementation Details
// Example usage
let axis = ChartAxis::new()
.with_orientation(AxisOrientation::Vertical)
.with_position(AxisPosition::Left)
.with_label_formatter(|v| format!("${:.0}", v));
// Render labels
axis.render_labels(cx, &ticks, chart_area, scale);
--- PR: #3 Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels