-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move axis definition to separate file
- Loading branch information
Ralf Grubenmann
committed
Dec 28, 2023
1 parent
fbf2b53
commit 39bdd25
Showing
4 changed files
with
129 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use leptos::component; | ||
use leptos::{svg::*, *}; | ||
|
||
#[component] | ||
pub fn YAxis(ticks: Memo<Vec<(f64, String)>>) -> impl IntoView { | ||
view! { | ||
<svg y="10%" height="80%" overflow="visible"> | ||
<line | ||
x1="9.8%" | ||
y1="0%" | ||
x2="9.8%" | ||
y2="100%" | ||
stroke="black" | ||
stroke-width="1px" | ||
vector-effect="non-scaling-stroke" | ||
></line> | ||
{move || { | ||
ticks | ||
.get() | ||
.into_iter() | ||
.map(|(t, s)| { | ||
view! { | ||
<line | ||
x1="7%" | ||
y1=format!("{}%", t) | ||
x2="9.8%" | ||
y2=format!("{}%", t) | ||
stroke="black" | ||
strocke-width="1px" | ||
vector-effect="non-scaling-stroke" | ||
></line> | ||
<text | ||
x="6.9%" | ||
y=format!("{}%", t) | ||
font-size="20px" | ||
dy="5px" | ||
text-anchor="end" | ||
vector-effect="non-scaling-stroke" | ||
> | ||
{s} | ||
</text> | ||
} | ||
}) | ||
.collect_view() | ||
}} | ||
|
||
</svg> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters