4 releases (2 breaking)

0.3.0 Feb 16, 2024
0.2.0 Dec 12, 2022
0.1.1 Nov 5, 2022
0.1.0 Nov 3, 2022

#260 in Visualization

Download history 69/week @ 2024-07-01 33/week @ 2024-07-08 21/week @ 2024-07-15 42/week @ 2024-07-22 30/week @ 2024-07-29 36/week @ 2024-08-05 72/week @ 2024-08-12 53/week @ 2024-08-19 73/week @ 2024-08-26 63/week @ 2024-09-02 38/week @ 2024-09-09 124/week @ 2024-09-16 79/week @ 2024-09-23 12/week @ 2024-09-30 33/week @ 2024-10-07 99/week @ 2024-10-14

232 downloads per month

MIT license

14KB

yew-plotly

GitHub open issues

Example

use yew::prelude::*;
use yew_plotly::plotly::common::Mode;
use yew_plotly::plotly::{Plot, Scatter};
use yew_plotly::Plotly;

#[function_component]
fn App() -> Html {
    let mut plot = Plot::new();
    let x_values = vec![1, 2, 3];
    let y_values = vec![1, 3, 2];

    let trace = Scatter::new(x_values, y_values)
        .mode(Mode::LinesMarkersText)
        .name("Scatter");
        
    plot.add_trace(trace);

    html! { <Plotly plot={plot}/> }
}

fn main() {
    yew::Renderer::<App>::new().render();
}

Setup

Load plotly.js in index.html

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>Yew App</title>
    <script src="https://cdn.plot.ly/plotly-2.16.1.min.js"></script>
</head>

</html>

Install yew-plotly

cargo add yew-plotly

Dependencies

~18–27MB
~341K SLoC