1pub use crate::math::{Math, Number, NumericConversion};
125
126pub use crate::chart::traits::{
128 Chart, ChartBuilder, ChartConfig, IncrementalChart, Margins, StylableChart,
129};
130
131#[cfg(feature = "animations")]
132pub use crate::chart::traits::{AnimatedChart, StreamingChart};
133
134pub use crate::chart::traits::{AxisChart, LegendChart};
135
136pub use crate::legend::{
138 BackgroundStyle, CompactLegend, CompactLegendBuilder, CustomLegend, CustomLegendBuilder,
139 DefaultLegend, DefaultLegendEntry, DefaultLegendRenderer, Legend, LegendAlignment,
140 LegendBuilder, LegendEntry, LegendEntryType, LegendMargins, LegendOrientation, LegendRenderer,
141 LegendStyle, PositionCalculator, SpacingStyle, StandardLegend, StandardLegendBuilder,
142 StandardLegendRenderer, SymbolStyle, TextStyle,
143};
144
145pub use crate::legend::types::{
146 CompactLegendEntry, CustomLayoutParams, CustomLegendEntry, MarkerShape as LegendMarkerShape,
147 MarkerStyle as LegendMarkerStyle, StandardLegendEntry, SymbolShape,
148};
149
150pub use crate::legend::position::LegendPosition as LegendPos;
151
152pub use crate::axes::{
154 AxisConfig, AxisOrientation, AxisPosition, AxisStyle, AxisValue, CustomAxisBuilder,
155 CustomTickGenerator, LinearAxis, LinearAxisBuilder, LinearTickGenerator, TickStyle,
156};
157
158pub use crate::axes::builder::presets;
159
160pub use crate::axes::traits::{Axis, AxisRenderer, Tick, TickGenerator};
161
162pub use crate::axes::range::{
164 calculate_nice_range, calculate_nice_ranges_from_bounds, calculate_nice_ranges_separate_config,
165 RangeCalculationConfig,
166};
167
168pub use crate::grid::{
170 CustomGrid, CustomGridBuilder, GridBuilder, GridContainer, GridLineStyle, GridSpacing,
171 GridStyle, GridSystem, GridType, GridVisibility, LinearGrid, LinearGridBuilder, MajorGridStyle,
172 MinorGridStyle, TickBasedGrid, TickBasedGridBuilder,
173};
174
175pub use crate::grid::traits::{
176 DefaultGridRenderer, Grid, GridConfiguration, GridOrientation, GridRenderer,
177};
178
179pub use crate::grid::traits::TickAlignedGrid;
180
181#[cfg(feature = "line")]
183pub use crate::chart::{LineChart, LineChartBuilder, LineChartStyle, MarkerShape, MarkerStyle};
184
185#[cfg(feature = "line")]
186pub use crate::chart::{CurveChart, CurveChartBuilder};
187
188#[cfg(feature = "line")]
189pub use crate::math::interpolation::{InterpolationConfig, InterpolationType};
190
191#[cfg(all(feature = "line", feature = "animations"))]
192pub use crate::chart::{AnimatedLineChart, AnimatedLineChartBuilder};
193
194#[cfg(feature = "bar")]
195pub use crate::chart::{BarChart, BarChartBuilder, BarChartStyle, BarOrientation};
196
197#[cfg(all(feature = "bar", feature = "animations"))]
198pub use crate::chart::{AnimatedBarChart, AnimatedBarChartBuilder};
199
200#[cfg(feature = "bar")]
201pub use crate::chart::bar::BarWidth;
202
203#[cfg(feature = "pie")]
204pub use crate::chart::{PieChart, PieChartBuilder, PieChartStyle};
205
206#[cfg(feature = "scatter")]
207pub use crate::chart::{
208 CollisionSettings, CollisionStrategy, ColorMapping, ColorMappingStrategy, PointShape,
209 PointStyle, ScatterChart, ScatterChartBuilder, ScatterChartStyle, SizeMapping, SizeScaling,
210};
211
212#[cfg(feature = "gauge")]
213pub use crate::chart::{
214 ArcStyle, CenterStyle, GaugeChart, GaugeChartBuilder, GaugeChartStyle, GaugeType, NeedleShape,
215 NeedleStyle, ThresholdZone, TickStyle as GaugeTickStyle, ValueDisplayStyle, ValueRange,
216};
217
218#[cfg(feature = "stacked-charts")]
219pub use crate::chart::stacked::{
220 AnimatedStackedBarChart, AnimatedStackedBarChartBuilder, AnimatedStackedLineChart,
221 AnimatedStackedLineChartBuilder, StackedBarWidth, StackedData,
222};
223
224pub use crate::data::{
226 calculate_bounds, calculate_multi_series_bounds, DataBounds, DataPoint, DataSeries,
227 FloatBounds, IntBounds, IntPoint, MultiSeries, Point2D, StaticDataSeries, TimestampedPoint,
228};
229
230#[cfg(feature = "animations")]
231pub use crate::data::SlidingWindowSeries;
232
233#[cfg(feature = "animations")]
235pub use crate::data::streaming::{
236 ChartInstance, ChartInstanceConfig, ChartType, ErrorRecovery, ManagerConfig, ManagerMetrics,
237 MemoryStrategy, MonitoringLevel, PipelineConfig, PipelineMetrics, SourceConfig, SourceState,
238 StreamingChartManager, StreamingConfig, StreamingDataPipeline, StreamingDataSource,
239 StreamingMetrics, SyncMode, SyncState, UnifiedStreamingBuffer,
240};
241
242pub use crate::style::{
244 BorderStyle, ColorInterpolation, ColorPalette, ColorUtils, FillPattern, FillStyle, LineCap,
245 LineJoin, LinePattern, LineStyle, StrokeStyle,
246};
247
248pub use crate::style::themes::Theme;
250
251#[cfg(feature = "color-support")]
252pub use crate::style::rgb565_palettes;
253
254pub use crate::layout::{ChartLayout, ComponentPositioning, Viewport};
256
257pub use crate::render::{
259 ChartRenderer, ClippingRenderer, EnhancedChartRenderer, PrimitiveRenderer,
260};
261
262#[cfg(feature = "animations")]
263pub use crate::render::AnimationFrameRenderer;
264
265pub use crate::render::text::TextRenderer;
266
267pub use crate::memory::{
269 ChartMemoryManager, FixedCapacityCollections, LabelStorage, ManagedSlidingWindow, MemoryStats,
270};
271
272pub use crate::error::{
274 ChartError, ChartResult, DataError, DataResult, LayoutError, LayoutResult, RenderError,
275 RenderResult,
276};
277
278#[cfg(feature = "animations")]
279pub use crate::error::{AnimationError, AnimationResult};
280
281#[cfg(feature = "animations")]
283pub use crate::animation::{
284 ChartAnimator, EasingFunction, Interpolatable, MultiStateAnimator, Progress, StreamingAnimator,
285 TimeBasedProgress,
286};
287
288pub use crate::time::{
290 ManualTimeProvider, Microseconds, Milliseconds, MonotonicTimeProvider, TimeProvider,
291};
292
293#[cfg(feature = "std")]
294pub use crate::time::StdTimeProvider;
295
296pub use crate::fluent::quick as fluent_quick;
298pub use crate::fluent::{Chart as FluentChart, ChartPreset};
299
300pub use embedded_graphics::{
302 pixelcolor::{BinaryColor, Rgb565},
303 prelude::*,
304 primitives::{Circle, Line, Rectangle},
305};
306
307pub use heapless::{String, Vec};
309
310pub use crate::heapless_utils::{sizes, string, vec, CircularBuffer, HeaplessConfig, HeaplessPool};
312
313pub use crate::{heapless_string, heapless_vec};
315
316pub mod types {
318 use super::*;
319
320 #[cfg(feature = "line")]
322 pub type Rgb565LineChart = LineChart<Rgb565>;
323
324 #[cfg(feature = "line")]
326 pub type Rgb565LineChartBuilder = LineChartBuilder<Rgb565>;
327
328 #[cfg(feature = "line")]
330 pub type Rgb565CurveChart = CurveChart<Rgb565>;
331
332 #[cfg(feature = "line")]
334 pub type Rgb565CurveChartBuilder = CurveChartBuilder<Rgb565>;
335
336 pub type StandardDataSeries = StaticDataSeries<Point2D, 256>;
355
356 pub type StandardMultiSeries = MultiSeries<Point2D, 8, 256>;
358
359 pub type StandardColorPalette = ColorPalette<Rgb565, 8>;
361
362 #[cfg(feature = "animations")]
364 pub type StandardSlidingWindow = SlidingWindowSeries<Point2D, 100>;
365
366 pub type StandardMemoryManager = ChartMemoryManager<4096>;
368
369 pub type StandardLabelStorage = LabelStorage<16, 32>;
371}
372
373pub mod constants {
375 use super::*;
376
377 pub const DEFAULT_MARGINS: Margins = Margins {
379 top: 10,
380 right: 10,
381 bottom: 10,
382 left: 10,
383 };
384
385 pub const MINIMAL_MARGINS: Margins = Margins {
387 top: 5,
388 right: 5,
389 bottom: 5,
390 left: 5,
391 };
392
393 pub const DEFAULT_GRID_SPACING: Size = Size::new(20, 20);
395
396 pub const FINE_GRID_SPACING: Size = Size::new(10, 10);
398
399 pub const COARSE_GRID_SPACING: Size = Size::new(50, 50);
401}
402
403pub mod quick {
405 use super::*;
406
407 #[cfg(feature = "line")]
409 pub fn line_chart() -> LineChartBuilder<Rgb565> {
410 LineChart::builder()
411 }
412
413 #[cfg(feature = "line")]
415 pub fn professional_line_chart() -> LineChartBuilder<Rgb565> {
416 LineChart::builder()
417 .line_color(Rgb565::new(70 >> 3, 130 >> 2, 180 >> 3)) .line_width(2)
419 }
420
421 #[cfg(feature = "line")]
423 pub fn curve_chart() -> CurveChartBuilder<Rgb565> {
424 CurveChart::builder()
425 }
426
427 #[cfg(feature = "line")]
429 pub fn professional_curve_chart() -> CurveChartBuilder<Rgb565> {
430 CurveChart::builder()
431 .line_color(Rgb565::new(70 >> 3, 130 >> 2, 180 >> 3)) .line_width(2)
433 .interpolation_type(InterpolationType::CubicSpline)
434 .subdivisions(12)
435 }
436
437 pub fn data_series_from_tuples(data: &[(f32, f32)]) -> ChartResult<types::StandardDataSeries> {
439 StaticDataSeries::from_tuples(data).map_err(ChartError::from)
440 }
441
442 #[cfg(feature = "color-support")]
444 pub fn default_colors() -> types::StandardColorPalette {
445 rgb565_palettes::default_palette()
446 }
447
448 #[cfg(feature = "color-support")]
450 pub fn professional_colors() -> types::StandardColorPalette {
451 rgb565_palettes::professional_palette()
452 }
453
454 #[cfg(feature = "color-support")]
456 pub fn pastel_colors() -> types::StandardColorPalette {
457 rgb565_palettes::pastel_palette()
458 }
459
460 #[cfg(feature = "color-support")]
462 pub fn vibrant_colors() -> types::StandardColorPalette {
463 rgb565_palettes::vibrant_palette()
464 }
465
466 #[cfg(feature = "color-support")]
468 pub fn nature_colors() -> types::StandardColorPalette {
469 rgb565_palettes::nature_palette()
470 }
471
472 #[cfg(feature = "color-support")]
474 pub fn ocean_colors() -> types::StandardColorPalette {
475 rgb565_palettes::ocean_palette()
476 }
477
478 #[cfg(feature = "color-support")]
480 pub fn sunset_colors() -> types::StandardColorPalette {
481 rgb565_palettes::sunset_palette()
482 }
483
484 #[cfg(feature = "color-support")]
486 pub fn cyberpunk_colors() -> types::StandardColorPalette {
487 rgb565_palettes::cyberpunk_palette()
488 }
489
490 #[cfg(feature = "color-support")]
492 pub fn minimal_colors() -> ColorPalette<Rgb565, 6> {
493 rgb565_palettes::minimal_palette()
494 }
495
496 #[cfg(feature = "color-support")]
498 pub fn retro_colors() -> types::StandardColorPalette {
499 rgb565_palettes::retro_palette()
500 }
501
502 pub fn light_theme() -> Theme<Rgb565> {
504 Theme::light()
505 }
506
507 pub fn dark_theme() -> Theme<Rgb565> {
509 Theme::dark()
510 }
511
512 pub fn vibrant_theme() -> Theme<Rgb565> {
514 Theme::vibrant()
515 }
516
517 pub fn pastel_theme() -> Theme<Rgb565> {
519 Theme::pastel()
520 }
521
522 pub fn nature_theme() -> Theme<Rgb565> {
524 Theme::nature()
525 }
526
527 pub fn ocean_theme() -> Theme<Rgb565> {
529 Theme::ocean()
530 }
531
532 pub fn sunset_theme() -> Theme<Rgb565> {
534 Theme::sunset()
535 }
536
537 pub fn cyberpunk_theme() -> Theme<Rgb565> {
539 Theme::cyberpunk()
540 }
541
542 pub fn minimal_theme() -> Theme<Rgb565> {
544 Theme::minimal()
545 }
546
547 pub fn retro_theme() -> Theme<Rgb565> {
549 Theme::retro()
550 }
551}
552
553#[macro_export]
555macro_rules! data_points {
556 [$(($x:expr, $y:expr)),* $(,)?] => {
557 {
558 let mut series = $crate::data::StaticDataSeries::<$crate::data::Point2D, 256>::new();
560 $(
561 series.push($crate::data::Point2D::new($x, $y)).unwrap();
562 )*
563 series
564 }
565 };
566}
567
568#[macro_export]
584macro_rules! chart_config {
585 (
586 $(title: $title:expr,)?
587 $(background: $bg:expr,)?
588 $(margins: $margins:expr,)?
589 $(grid: $grid:expr,)?
590 ) => {
591 {
592 let mut config = $crate::chart::traits::ChartConfig::default();
593 $(
594 config.title = Some($crate::heapless::String::try_from($title).unwrap());
595 )?
596 $(
597 config.background_color = Some($bg);
598 )?
599 $(
600 config.margins = $margins;
601 )?
602 $(
603 config.show_grid = $grid;
604 )?
605 config
606 }
607 };
608}
609
610pub use chart_config;
611pub use data_points;