3 unstable releases

Uses new Rust 2021

0.2.0 Apr 10, 2022
0.1.4 Nov 12, 2021
0.1.3 Oct 17, 2021
0.1.2 Jul 2, 2021
0.1.1 Jun 30, 2021

#21 in Visualization

Download history 9/week @ 2022-01-28 4/week @ 2022-02-04 11/week @ 2022-02-11 12/week @ 2022-02-18 6/week @ 2022-02-25 10/week @ 2022-03-04 17/week @ 2022-03-11 24/week @ 2022-03-18 3/week @ 2022-03-25 9/week @ 2022-04-01 38/week @ 2022-04-08 9/week @ 2022-04-15 25/week @ 2022-04-22 26/week @ 2022-04-29 30/week @ 2022-05-06 65/week @ 2022-05-13

148 downloads per month

MIT license


Rust 1.5K SLoC // 0.1% comments C++ 1K SLoC // 0.2% comments


Test and Build Documentation Crates.io License

This is an implementation of an Iced backend for Plotters, for both native and wasm applications.

This backend has been optimized as for speed. Note that some specific plotting features supported in the Bitmap backend may not be implemented there, though.


CPU Monitor Example

WASM Example

What is Plotters?

Plotters is an extensible Rust drawing library that can be used to plot data on nice-looking graphs, rendering them through a plotting backend (eg. to a Bitmap image raw buffer, to your GUI backend, to an SVG file, etc.).

For more details on Plotters, please check the following links:

How to install?

Include plotters-iced in your Cargo.toml dependencies:

plotters-iced = "0.1"
iced = { version = "0.3", features = ["canvas", "tokio"] }

How to use?

First, import Chart and ChartWidget:

use plotters_iced::{Chart, ChartWidget, DrawingBackend, ChartBuilder};

Then, derive Chart trait and build your chart, and let plotters-iced takes care the rest:

struct MyChart;
impl Chart<Message> for MyChart {
    fn build_chart<DB:DrawingBackend>(&self, builder: ChartBuilder<DB>) {
        //build your chart here, please refer to plotters for more details

Finally, render your chart view:

impl MyChart {
    fn view(&mut self)->Element<Message> {

If you are looking for a full example of an implementation, please check cpu-monitor.rs.

How to run the examples?

Example #1: cpu-monitor

This example samples your CPU load every second, and renders it in a real-time chart:

cargo run --release --example cpu-monitor

From this example, you'll learn:

  • how to build charts by plotters-iced
  • how to feed data to charts
  • how to make layouts of charts responsive
  • how to use fonts with charts

Example #2: split-chart

This example shows you how to split drawing area.

  • Run as native application
cargo run --release --example split-chart
  • Run as wasm application

First, install wasm-bindgen-cli v0.2.69 (iced requires this version)

cargo install -f wasm-bindgen-cli --version 0.2.69

Then build the code and generate wasm bindings

cargo build --example split-chart --target wasm32-unknown-unknown
wasm-bindgen ./target/wasm32-unknown-unknown/debug/examples/split-chart.wasm --out-dir ./examples/js --target web

Then, host the examples folder with a http server

cargo install https
http examples

visit http://localhost:8000/web-demo.html in your browser.

Are there any limitations?

Limitation #1: No image rendering

No image rendering for native and wasm applications.

Limitation #2: Limited text rendering for native applications

Only TTF font family are supported for text rendering, which is a limitation of Iced, please look at cpu-monitor.rs. As well, font transforms are not supported,which is also a limitation of Iced.



~85K SLoC