Skip to content

Commit 0ad9419

Browse files
authored
Merge pull request #7 from openmc-data-storage/rename-axis-for-heating-dpa
Rename axis for heating dpa
2 parents b2b5e1c + 9ba8965 commit 0ad9419

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

src/sauce/home.rs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,35 @@ pub fn plot_component(props: &PlotProps) -> Html {
5353
let id = "plot-div";
5454
let mut plot = Plot::new();
5555

56+
let mut heat_or_damage_plotted: bool = false;
57+
let mut cross_section_plotted: bool = false;
58+
5659
for (i, (energy, cross_section)) in cache.energy_values.iter().zip(&cache.cross_section_values).enumerate() {
5760
if cache.checkbox_selected[i] {
5861
let trace = Scatter::new(energy.clone(), cross_section.clone())
5962
.name(&format!("{}", cache.labels[i]));
6063
plot.add_trace(trace);
64+
if cache.labels[i].contains("heat") || cache.labels[i].contains("damage") {
65+
heat_or_damage_plotted = true;
66+
}
67+
if !cache.labels[i].contains("heat") && !cache.labels[i].contains("damage") {
68+
cross_section_plotted = true;
69+
}
6170
}
6271
}
6372

73+
let x_axis_title = if cross_section_plotted && heat_or_damage_plotted {
74+
"Microscopic Cross Section [barns], Heating Cross Section [eV-barn]"
75+
} else if cross_section_plotted {
76+
"Microscopic Cross Section [barns]"
77+
} else if heat_or_damage_plotted {
78+
"Heating Cross Section [eV-barn]"
79+
} else {
80+
"" // no data plotted
81+
};
82+
6483
let y_axis = plotly::layout::Axis::new()
65-
.title("Cross section [barns]")
84+
.title(x_axis_title)
6685
// .show_line(true)
6786
.zero_line(true)
6887
// .range(0) not sure how to set lower value
@@ -401,7 +420,9 @@ pub fn home() -> Html {
401420

402421
html!(
403422
<>
404-
<h1>{"Nuclide microscopic cross section plotter"}</h1>
423+
<h1>{"Nuclide Microscopic Cross Section Plotter"}</h1>
424+
425+
<h5>{"A searchable database of neutron cross sections with interactive plotting created by Jon Shimwell."}</h5>
405426

406427

407428
<div class="d-flex mb-2">
@@ -483,7 +504,7 @@ pub fn home() -> Html {
483504
data={paginated_data}
484505
orderable={true}
485506
/>
486-
<h5>{"Selected"} <span class="badge text-bg-secondary">{sum}</span>{" from 41337 available database entries."}</h5>
507+
<h5>{sum}{" / 41337"}</h5>
487508
</div>
488509
<div class="flex-grow-1 p-2 input-group">
489510

@@ -500,7 +521,11 @@ pub fn home() -> Html {
500521
clear_plot_callback={clear_plot_callback}
501522
/>
502523
</div>
503-
<h5><a href="https://github.com/openmc-data-storage/nuclide_cross_section_plotter.rs/">{"Help improve this website by contributing to the repository,"}</a></h5>
524+
// <h5>{"Created by Jon Shimwell, source code available "}</h5>
525+
// <a href="https://github.com/openmc-data-storage/nuclide_cross_section_plotter.rs/" target="_blank">
526+
// <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Octicons-mark-github.svg/240px-Octicons-mark-github.svg.png" alt="GitHub" style="width: 30px; height: 30px;"/>
527+
// </a>
528+
504529
</div>
505530
</div>
506531
</>

0 commit comments

Comments
 (0)