Preparing for different styles of visualization (e.g. sankey, tree map), moves the existing graph visualization logic into src/visualize/graph.rs
C43IWI7GMF6UEKGTXTK4GSQLAFD2SH6BKQRGR4ZQNITYSUK6RMXAC
OPTMCUTBEZQT3HETRWVBU4HYSB7NNBA4TY7QOOKCN3YLSMDKNM2QC
475UXTLYE5LQTMOGOFYC5Z5Z45YJ32M4GD2WOBTXZRBXKUSWFW2AC
7CVIL7UJBYEZ4KHKPJ7ZYSVQ7BLQWWUSJLJR5FOXBICQTD5ETK4QC
UXJFRBBL7IZ2PR7ZYNFGOJ6A7EH5ZVLYVFLA3HNFCNRVL6KWJUDAC
LOR3KOXGQ2VYGDHXQ6MG22ZME5TMPFTUW7A5OG36IAVQANOCXBRAC
UQJO24KBYI77E4J6LXWX2IUN7VABQKG6PGKBKWEPDCH5CKYBTC4AC
JVYWRCPTXQUCJ2BYOWAU36BM5ZKJ5FLKHIKMLSJA7XWOVIY2DMDQC
Q3Z6XMP5FFCC3PWC5FSV4C6ICNDPMKMELOV7MYQGC5A42LVHGVPAC
ZPFD3275NTWST7F5YCWYOOUS3QB5HE23LUOZXZIND4HBFSX62NCQC
use crate::timings;
use charming::series::{GraphLayoutForce, Series};
use charming::{series, Chart, HtmlRenderer};
use guppy::graph::PackageGraph;
mod graph;
#[derive(Clone, Copy, Debug)]
pub enum Style {
Graph,
}
pub fn for_style(style: Style, graph: &PackageGraph, timings: &timings::Output) {
let series: Series = match style {
Style::Graph => {
series::Graph::new()
// Use charming's force-directed layout, in combination with
// `graph::layout()` using `forceatlas2`, as they seem to get the best results
// when used together.
.layout(charming::series::GraphLayout::Force)
.force(GraphLayoutForce::new().layout_animation(false))
.roam(true)
.data(graph::data(graph, timings))
.into()
}
};
let chart = Chart::new().series(series);
let mut renderer = HtmlRenderer::new("Cargo dependencies", 1000, 800);
renderer.save(&chart, "/tmp/chart.html").unwrap();
}
let chart = Chart::new().series(
charming::series::Graph::new()
.name("Cargo dependencies")
// Use charming's force-directed layout, in combination with
// `graph::layout()` using `forceatlas2`, as they seem to get the best results
// when used together.
.layout(charming::series::GraphLayout::Force)
.force(GraphLayoutForce::new().layout_animation(false))
.roam(true)
.data(graph::data(&package_graph, &timings)),
);
let mut renderer = HtmlRenderer::new("Cargo dependencies", 1000, 800);
renderer.save(&chart, "/tmp/chart.html").unwrap();
visualize::for_style(visualize::Style::Graph, &package_graph, &timings);