Skip to main content

Crate ferrochart_winit

Crate ferrochart_winit 

Source
Expand description

Desktop host for FerroChart on winit + wgpu.

  • show opens a window with the defaults and shows a chart until it is closed.
  • run opens a window with a wgpu surface and drives the chart: winit events become InputEvents, frames are built and rendered only when Chart::needs_redraw says so (which includes kinetic scrolling), chart events are handed to your ChartApp, and ChartApp::update can ask to be woken at a given time (e.g. for a real-time feed).
  • InputConverter is the event conversion on its own, for hosts that own the event loop themselves (an egui app, a custom window).

All times passed to the chart (InputEvent::time_ms, build_frame) come from one monotonic clock: milliseconds since run started.

§Examples

use ferrochart_core::{Chart, ChartOptions};
use ferrochart_winit::{ChartApp, WindowOptions, run};

struct App;
impl ChartApp for App {}

run(WindowOptions::default(), Chart::new(ChartOptions::default()), App)?;

Re-exports§

pub use wgpu;
pub use winit;

Structs§

InputConverter
Converts winit window events into InputEvents. Keeps the state winit does not put on each event: modifiers, the pointer position, and the last press (to synthesize InputEvent::DoubleClick).
WindowOptions
Window settings for run.

Enums§

HostError
Errors from run.

Traits§

ChartApp
Application callbacks of run. All methods have empty defaults.

Functions§

cursor_icon
The winit cursor for a chart cursor.
run
Opens a window showing chart and runs until it is closed.
show
Opens a window with the default options and shows chart until the window is closed: run with WindowOptions::default and no callbacks.