load target image path from config
This commit is contained in:
parent
fe3cbc7fc3
commit
1d4e450c99
|
|
@ -8,6 +8,7 @@ use crate::Container;
|
||||||
|
|
||||||
pub struct StackedConfig {
|
pub struct StackedConfig {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
pub path: String,
|
||||||
pub width_px_per_sample: u32,
|
pub width_px_per_sample: u32,
|
||||||
pub height_px: u32,
|
pub height_px: u32,
|
||||||
pub series: Vec<StackedSeriesConfig>,
|
pub series: Vec<StackedSeriesConfig>,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ pub struct Config {
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct GraphConfig {
|
pub struct GraphConfig {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
pub path: String,
|
||||||
pub width_px: u16,
|
pub width_px: u16,
|
||||||
pub height_px: u16,
|
pub height_px: u16,
|
||||||
pub samples: u16,
|
pub samples: u16,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ impl Graph {
|
||||||
pub fn new(config: &GraphConfig, proto: &mut Protocol) -> Graph {
|
pub fn new(config: &GraphConfig, proto: &mut Protocol) -> Graph {
|
||||||
let stacked_config = StackedConfig {
|
let stacked_config = StackedConfig {
|
||||||
name: config.name.to_string(),
|
name: config.name.to_string(),
|
||||||
|
path: config.path.to_string(),
|
||||||
height_px: config.height_px as u32,
|
height_px: config.height_px as u32,
|
||||||
max_samples: config.samples as u32,
|
max_samples: config.samples as u32,
|
||||||
width_px_per_sample: (config.width_px / config.samples) as u32,
|
width_px_per_sample: (config.width_px / config.samples) as u32,
|
||||||
|
|
@ -90,7 +91,7 @@ impl Runner {
|
||||||
.map_err(|e| RunnerError::CouldNotGetData(e.to_string()))?;
|
.map_err(|e| RunnerError::CouldNotGetData(e.to_string()))?;
|
||||||
g.series.push(sample);
|
g.series.push(sample);
|
||||||
let img = stacked(&g.series);
|
let img = stacked(&g.series);
|
||||||
img.save("cpu.png".to_string())
|
img.save(g.series.config.path.to_string())
|
||||||
.map_err(|e| RunnerError::CouldNotSaveImage(e.to_string()))?;
|
.map_err(|e| RunnerError::CouldNotSaveImage(e.to_string()))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue