Skip to content

Commit 571bf71

Browse files
committed
hellow world
1 parent cac4145 commit 571bf71

File tree

6 files changed

+30
-88
lines changed

6 files changed

+30
-88
lines changed

.github/workflows/continuous_deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: jetli/[email protected]
1818
- uses: jetli/[email protected]
1919

20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121

2222
- run: trunk build --release
2323

Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
[package]
2-
name = "isotope_plotter"
2+
name = "isotope-plotter"
33
version = "0.1.0"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
plotly = { version = "0.8.3", features = ["wasm"] }
10-
yew = "0.19.0"
11-
yew-hooks = "0.1.56"
12-
log = "0.4.6"
13-
wasm-logger = "0.2"
9+
yew = "0.18"

README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

index.html

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
<!doctype html>
2-
<html lang="en">
3-
4-
<head>
5-
<meta charset="utf-8" />
6-
<title>Plotly Yew</title>
7-
<script src="https://cdn.plot.ly/plotly-2.14.0.min.js"></script>
8-
</head>
9-
10-
<body></body>
11-
12-
</html>
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Hello, World!</title>
6+
</head>
7+
</html>

out.html

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/main.rs

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
1-
use plotly::{Plot, Scatter};
21
use yew::prelude::*;
32

4-
#[function_component(App)]
5-
pub fn plot_component() -> Html {
6-
let p = yew_hooks::use_async::<_, _, ()>({
7-
let id = "plot-div";
8-
let mut plot = Plot::new();
9-
let trace = Scatter::new(vec![0, 1, 2], vec![2, 1, 0]);
10-
plot.add_trace(trace);
3+
struct Index;
4+
impl Component for Index {
5+
type Message = ();
6+
type Properties = ();
117

12-
let layout =
13-
plotly::Layout::new().title(plotly::common::Title::new("Displaying a Chart in Yew"));
14-
plot.set_layout(layout);
8+
fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
9+
Self
10+
}
1511

16-
async move {
17-
plotly::bindings::new_plot(id, &plot).await;
18-
Ok(())
19-
}
20-
});
12+
fn update(&mut self, _: Self::Message) -> ShouldRender {
13+
false
14+
}
2115

22-
use_effect_with_deps(
23-
move |_| {
24-
p.run();
25-
|| ()
26-
},
27-
(),
28-
);
16+
fn change(&mut self, _: Self::Properties) -> ShouldRender {
17+
false
18+
}
2919

30-
html! {
31-
<div id="plot-div"></div>
20+
fn view(&self) -> Html {
21+
html! {
22+
<div>
23+
{ "Hello, World!" }
24+
</div>
25+
}
3226
}
3327
}
3428

3529
fn main() {
36-
wasm_logger::init(wasm_logger::Config::default());
37-
yew::start_app::<App>();
30+
yew::start_app::<Index>();
3831
}

0 commit comments

Comments
 (0)