update code
This commit is contained in:
parent
e58a65369b
commit
1542e5bf48
8 changed files with 87 additions and 40 deletions
|
@ -101,7 +101,9 @@ impl<T> Rc<T> {
|
|||
pub fn new(inner: T) -> Self {
|
||||
Self(std::rc::Rc::new(std::cell::RefCell::new(inner)))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Rc<T> {
|
||||
pub fn into_inner(this: Rc<T>) -> T
|
||||
where
|
||||
T: Clone
|
||||
|
@ -111,7 +113,9 @@ impl<T> Rc<T> {
|
|||
Err(rc) => rc.borrow().clone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Rc<T> {
|
||||
pub fn with_mut<F>(&mut self, callback: F)
|
||||
where
|
||||
F: FnOnce(&mut T)
|
||||
|
|
|
@ -135,6 +135,13 @@ impl OutputPrinter for BarChartPrinter {
|
|||
E: IntoIterator<Item = (&'static str, int)>,
|
||||
W: Write
|
||||
{
|
||||
writeln!(out, "<!--")?;
|
||||
writeln!(out, "Output Variable Analysis:")?;
|
||||
for (key, stats) in list.stats() {
|
||||
writeln!(out, " {key}: {stats:?}")?;
|
||||
}
|
||||
writeln!(out, "-->")?;
|
||||
|
||||
let mut yaxis = YAxis::default();
|
||||
let mut xaxis = XAxis::default();
|
||||
let mut xaxis_name = None;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use super::{OutputList, OutputPrinter, Svg};
|
||||
use crate::int;
|
||||
use indexmap::IndexMap;
|
||||
use num_integer::div_ceil;
|
||||
use std::{fmt::Write as _, io};
|
||||
use svgwriter::{
|
||||
tags::{
|
||||
|
@ -9,7 +10,6 @@ use svgwriter::{
|
|||
},
|
||||
Data, Transform
|
||||
};
|
||||
use num_integer::div_ceil;
|
||||
|
||||
/// Output printer for SVG Bar Charts. Works only with two
|
||||
/// output variables.
|
||||
|
@ -76,6 +76,13 @@ impl OutputPrinter for BubbleChartPrinter {
|
|||
E: IntoIterator<Item = (&'static str, int)>,
|
||||
W: io::Write
|
||||
{
|
||||
writeln!(out, "<!--")?;
|
||||
writeln!(out, "Output Variable Analysis:")?;
|
||||
for (key, stats) in list.stats() {
|
||||
writeln!(out, " {key}: {stats:?}")?;
|
||||
}
|
||||
writeln!(out, "-->")?;
|
||||
|
||||
let mut percentages = Vec::new();
|
||||
let mut min_percentage: f32 = 100.0;
|
||||
let mut max_percentage: f32 = 0.0;
|
||||
|
@ -103,7 +110,7 @@ impl OutputPrinter for BubbleChartPrinter {
|
|||
let bubble_min_r: f32 = 2.5;
|
||||
let bubble_max_r: f32 = 15.0;
|
||||
let axis_step_dist = 40;
|
||||
let (xaxis_step, xaxis_step_count) = xaxis.step(8);
|
||||
let (xaxis_step, xaxis_step_count) = xaxis.step(7);
|
||||
let (yaxis_step, yaxis_step_count) = yaxis.step(6);
|
||||
let chart_width = axis_step_dist * xaxis_step_count as i32;
|
||||
let chart_height = axis_step_dist * yaxis_step_count as i32;
|
||||
|
|
Reference in a new issue