RavenRS · Rust GUI

Histogram

Edit and run the Histogram RavenRS example in your browser. Explore its Rust code and download a Cargo project for desktop and WebAssembly.

One declarative Rust interface, GPU rendering, reactive state and semantic design tokens. Free and open source under MIT OR Apache-2.0.

Rust source

fn histogram() -> impl View {
    let hill = |center: f32| -> Vec<f32> {
        (0..256).map(|i| 400.0 * (-((i as f32 - center) / 40.0).powi(2)).exp() + 10.0).collect()
    };
    Histogram::new([
        HistogramChannel::new("Red", Color::rgb(0.9, 0.15, 0.15), hill(90.0)),
        HistogramChannel::new("Green", Color::rgb(0.15, 0.8, 0.2), hill(128.0)),
        HistogramChannel::new("Blue", Color::rgb(0.2, 0.3, 0.95), hill(170.0)),
    ])
    .zones(5)
    .height(110.0)
}

The interactive preview loads when JavaScript and WebGPU or WebGL2 are available. You can read the guide and examples here at any time.

More examples