AshReports.ChartEngine.ChartConfig (ash_reports v0.1.0)
Configuration structure for chart generation in AshReports.
Defines the chart type, data, styling options, and behavioral configuration for generating server-side SVG charts using Contex across all renderers.
Summary
Functions
Create a configuration for an interactive chart.
Create a new ChartConfig with default values.
Create a configuration for real-time updating charts.
Validate chart configuration and ensure all required fields are present.
Types
@type chart_type() ::
:line | :bar | :pie | :area | :scatter | :histogram | :boxplot | :heatmap
@type interaction_type() :: :none | :hover | :click | :drill_down | :filter | :zoom
@type t() :: %AshReports.ChartEngine.ChartConfig{ animation: boolean(), auto_type_selection: boolean(), cache_enabled: boolean(), colors: list(), confidence: float(), created_at: DateTime.t() | nil, custom_css: String.t() | nil, data: list() | map(), datasets: list(), export_formats: [atom()], exportable: boolean(), height: integer() | nil, interactions: [interaction_type()], interactive: boolean(), labels: list(), lazy_loading: boolean(), locale_aware: boolean(), options: map(), real_time: boolean(), reasoning: String.t() | nil, rtl_support: boolean(), subtitle: String.t() | nil, theme: atom(), title: String.t() | nil, type: chart_type(), update_interval: integer() | nil, updated_at: DateTime.t() | nil, width: integer() | nil }
Functions
@spec interactive(chart_type(), list() | map(), keyword()) :: t()
Create a configuration for an interactive chart.
Examples
config = ChartConfig.interactive(:bar, sales_data,
interactions: [:hover, :click, :drill_down],
real_time: true,
update_interval: 30_000
)
@spec new(chart_type(), list() | map(), keyword()) :: t()
Create a new ChartConfig with default values.
Examples
config = ChartConfig.new(:line, chart_data)
config = ChartConfig.new(:pie, chart_data, title: "Sales Distribution")
@spec real_time(chart_type(), list() | map(), keyword()) :: t()
Create a configuration for real-time updating charts.
Examples
config = ChartConfig.real_time(:line, stream_data,
update_interval: 5000,
max_data_points: 100
)
Validate chart configuration and ensure all required fields are present.