lodviz_components
High-level Leptos components for data visualization, built on top of lodviz_core.
Renders pure SVG — no JavaScript charting library required.
Target:
wasm32-unknown-unknown(Leptos 0.8 CSR). Requires Trunk to build.
Chart Components
| Component | Description |
|---|---|
LineChart |
Multi-series line chart with LTTB auto-downsampling |
BarChart |
Grouped and stacked bar chart |
ScatterChart |
X/Y scatter plot with configurable point shapes |
AreaChart |
Filled area chart, supports stacking |
BoxPlot / ViolinChart |
Statistical distribution charts |
Histogram |
Frequency distribution with configurable bins |
PieChart |
Pie and donut charts |
RadarChart |
Multi-axis radar / spider chart |
CandlestickChart |
OHLC financial chart with M4 downsampling |
WaterfallChart |
Running total waterfall |
HeatmapChart |
2-D grid heatmap with perceptually uniform ColorMap and optional ColorBar |
StripChart |
Strip / beeswarm plot for categorical group distributions |
SankeyChart |
Flow diagram with proportional nodes and cubic Bézier ribbons |
ChordChart |
Circular chord diagram for symmetric flow matrices |
ContourChart |
Iso-line and filled iso-band visualization via marching squares |
SmartChart |
Facade that selects the renderer from a ChartSpec |
Interactive Features
- Zoom & Pan —
ZoomPanwrapper with mouse/touch support - Brush selection —
Brushfor range selection across linked charts - Linked dashboards —
LinkedDashboard+DashboardContextfor synchronized crosshair/selection - Draggable cards —
DraggableCardlayout component for resizable dashboard panels - Tooltips — Per-chart tooltip overlays with hover state
- Legend toggle — Click legend entries to show/hide series
Zoom Interactions
Charts wrapped with ZoomPan support the following mouse interactions:
| Interaction | Behavior |
|---|---|
Ctrl + drag |
Box zoom to selected area |
Double click |
Reset to original zoom level |
Mouse wheel |
Zoom in/out at cursor position |
use ;
use *;
let = signal;
let original = transform.read_only;
view!
Installation
[]
= "0.2"
= "0.2"
Configure your Trunk.toml to target WASM:
[]
= "index.html"
Quick Start
use LineChart;
use ;
use *;
Data Input
Components accept data exclusively as Signal<T>, where T is one of the chart-ready
types defined in lodviz_core::core::data. No parsing happens inside components.
| Component | Signal type |
|---|---|
LineChart, AreaChart, ScatterChart |
Signal<Dataset> |
BarChart |
Signal<BarDataset> |
CandlestickChart |
Signal<Vec<OhlcBar>> |
WaterfallChart |
Signal<Vec<WaterfallBar>> |
Histogram, BoxPlot, ViolinChart |
Signal<Vec<f64>> |
HeatmapChart, ContourChart |
Signal<GridData> |
StripChart |
Signal<Vec<StripGroup>> |
SankeyChart |
Signal<SankeyData> |
ChordChart |
Signal<ChordData> |
SmartChart |
Signal<ChartSpec> (generic facade) |
From static data
use ;
use LineChart;
use *;
let data = derive;
view!
From a remote CSV (browser fetch)
This crate performs no I/O. Data loading is the application's responsibility:
use parse_csv;
use ;
use *;
// LocalResource performs the fetch in WASM
let dataset = new;
For the full pipeline (CSV → DataTable → Dataset → downsampling)
see the Data Pipeline section in the lodviz_core README.
Color Maps
HeatmapChart and ContourChart accept a color_map: ColorMap prop for encoding scalar values
as perceptually uniform colors (Oklab interpolation).
use ;
// Sequential
<HeatmapChart color_map=Sequential ... />
<ContourChart color_map=Sequential ... />
// Diverging (good for data centered around zero)
<HeatmapChart color_map=Diverging ... />
// Custom anchors
<HeatmapChart color_map=Custom ... />
Available sequential palettes: Viridis, Plasma, Inferno, Magma, Cividis, Turbo, Grayscale.
Available diverging palettes: RdBu, PuOr, PiYG, BrBG.
Theming
Wrap your app in ThemeProvider for automatic light/dark mode support:
use ThemeProvider;
view!
Charts respond to the prefers-color-scheme media query automatically.
Demo App
See apps/web_dashboard for a full working demo with routing,
multiple chart types, theme switching, and interactive dashboards.
License
MIT — see LICENSE