Fusuma

Components / Components

bar_chart

One bar for each value.

Try it

This is the Data page of the gallery, running in your browser: bar_chart is on it, and it is the real widget. Press Run, then use it.

Live: Data, where bar_chart is usedOpen full size

Also on this pagespinnerkbdratingcarouseltimelinetableline_chartarea_chart

One bar for each value. Bars start at the bottom, so the smallest value is a short bar and not none: give a range from 0 with Chart::range when the bars should show proportions.

Signature

pub fn bar_chart(values: &[i32]) -> Chart

Methods

  • .range(values: &[i32], lo: i32, hi: i32) -> Self — Scales between lo and hi instead of the data's own smallest and largest, so two charts of the same thing agree and a bar chart can start at 0.
  • .size(width: u32, height: u32) -> Self — width x height pixels (the theme's size by default).

Example

use fusuma::bar_chart;
let values = [3, 5, 4, 8, 6];
let view = bar_chart(&values).range(&values, 0, 10);
let built = fusuma::doc::built::<(), _>(&view);
assert_eq!(built.nodes(), 1);

All components · Source