1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
//! Chart types and implementations.
//!
//! This module provides all chart types supported by the embedded-charts library.
//! Each chart type is feature-gated to allow fine-grained control over binary size
//! and memory usage.
//!
//! ## Available Chart Types
//!
//! ### Line Charts (feature: "line")
//! Multi-series line charts with markers, area filling, and smooth curves:
//! ```rust,ignore
//! use embedded_charts::prelude::*;
//! use embedded_graphics::pixelcolor::Rgb565;
//!
//! let chart = LineChart::builder()
//! .line_color(Rgb565::BLUE)
//! .line_width(2)
//! .with_markers(MarkerStyle {
//! shape: MarkerShape::Circle,
//! size: 6,
//! color: Rgb565::RED,
//! visible: true,
//! })
//! .build()?;
//! # Ok::<(), embedded_charts::error::ChartError>(())
//! ```
//!
//! ### Bar Charts (feature: "bar")
//! Vertical and horizontal bar charts with customizable spacing:
//! ```rust,no_run
//! # #[cfg(feature = "bar")]
//! # fn test() -> Result<(), embedded_charts::error::ChartError> {
//! use embedded_charts::prelude::*;
//! use embedded_graphics::pixelcolor::Rgb565;
//!
//! let chart = BarChart::builder()
//! .orientation(BarOrientation::Vertical)
//! .bar_width(BarWidth::Fixed(20))
//! .colors(&[Rgb565::GREEN])
//! .spacing(5)
//! .build()?;
//! Ok(())
//! # }
//! ```
//!
//! ### Pie Charts (feature: "pie")
//! Full circle and donut charts with custom slice styling:
//! ```rust,no_run
//! # #[cfg(feature = "pie")]
//! # fn test() -> Result<(), embedded_charts::error::ChartError> {
//! use embedded_charts::prelude::*;
//! use embedded_graphics::pixelcolor::Rgb565;
//!
//! let chart = PieChart::builder()
//! .donut(30) // Donut chart with inner radius of 30
//! .start_angle(0.0)
//! .colors(&[Rgb565::BLUE, Rgb565::RED, Rgb565::GREEN])
//! .build()?;
//! Ok(())
//! # }
//! ```
//!
//! ### Scatter Charts (feature: "scatter")
//! Data point visualization with clustering and collision detection:
//! ```rust,no_run
//! # #[cfg(feature = "scatter")]
//! # fn test() -> Result<(), embedded_charts::error::ChartError> {
//! use embedded_charts::prelude::*;
//! use embedded_graphics::pixelcolor::Rgb565;
//!
//! let chart = ScatterChart::builder()
//! .point_shape(PointShape::Circle)
//! .point_size(8)
//! .point_color(Rgb565::BLUE)
//! .with_collision_detection(CollisionSettings {
//! enabled: true,
//! min_distance: 5,
//! strategy: CollisionStrategy::Hide,
//! })
//! .build()?;
//! Ok(())
//! # }
//! ```
//!
//! ### Gauge Charts (feature: "gauge")
//! Semicircle gauges with threshold zones and custom indicators:
//! ```rust,no_run
//! # #[cfg(feature = "gauge")]
//! # fn test() -> Result<(), embedded_charts::error::ChartError> {
//! use embedded_charts::prelude::*;
//! use embedded_graphics::pixelcolor::Rgb565;
//!
//! let chart = GaugeChart::builder()
//! .gauge_type(GaugeType::Semicircle)
//! .value_range(0.0, 100.0)
//! .add_threshold_zone(70.0, 100.0, Rgb565::RED)
//! .needle_style(NeedleShape::Arrow, Rgb565::BLACK, 0.8, 2)
//! .build()?;
//! Ok(())
//! # }
//! ```
//!
//! ### Stacked Charts (feature: "stacked-charts")
//! Stacked bar and line charts for comparative data visualization:
//! ```rust,no_run
//! # #[cfg(feature = "stacked-charts")]
//! # fn test() -> Result<(), embedded_charts::error::ChartError> {
//! use embedded_charts::prelude::*;
//! use embedded_graphics::pixelcolor::Rgb565;
//!
//! let stacked_data: StackedData<Point2D, 256> = StackedData::new();
//! // Add data series...
//!
//! let chart: AnimatedStackedBarChart<Rgb565> = AnimatedStackedBarChart::builder()
//! .bar_width(StackedBarWidth::Fixed(25))
//! .spacing(5)
//! .build()?;
//! Ok(())
//! # }
//! ```
//!
//! ## Chart Traits
//!
//! All charts implement the core [`Chart`] trait, which provides:
//! - `draw()` - Render the chart to a display target
//! - `required_size()` - Calculate minimum size requirements
//! - `data_bounds()` - Get data bounds for scaling
//!
//! Additional traits provide extended functionality:
//! - [`StylableChart`] - Apply custom styling
//! - [`AxisChart`] - Configure chart axes
//! - [`LegendChart`] - Add legends
//! - [`AnimatedChart`] - Animation support (feature-gated)
//! - [`StreamingChart`] - Real-time data streaming (feature-gated)
//!
//! ## Builder Pattern
//!
//! All charts use the builder pattern for fluent configuration:
//! ```rust,no_run
//! # #[cfg(feature = "line")]
//! # fn test() -> Result<(), embedded_charts::error::ChartError> {
//! use embedded_charts::prelude::*;
//! use embedded_graphics::pixelcolor::Rgb565;
//!
//! let chart = LineChart::builder()
//! .line_color(Rgb565::BLUE)
//! .line_width(2)
//! .build()?;
//! Ok(())
//! # }
//! ```
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;