| Crates.io | oak-visualize |
| lib.rs | oak-visualize |
| version | 0.0.1 |
| created_at | 2025-10-22 07:03:04.740498+00 |
| updated_at | 2026-01-23 05:21:44.447038+00 |
| description | High-performance visualization and layout algorithms for the oak ecosystem with flexible configuration, emphasizing tree and graph visualization. |
| homepage | https://github.com/ygg-lang/oaks |
| repository | https://github.com/ygg-lang/oaks |
| max_upload_size | |
| id | 1895154 |
| size | 151,336 |
Advanced visualization and layout algorithms for Oak language constructs, including AST visualization, dependency graphs, and code structure diagrams.
Oak Visualization is a comprehensive library designed to create beautiful and informative visualizations of programming language constructs. Built on the solid foundation of oak-core, it provides advanced layout algorithms for trees, graphs, and geometric structures, enabling developers to visualize code structures, dependencies, and complex relationships.
Basic example using oak-core integration:
use oak_visualize::{to_svg, Visualize};
use oak_core::tree::RedNode;
fn main() -> oak_visualize::Result<()> {
// Assume you have a RedNode from oak-core
let tree: &RedNode<MyKind> = get_tree();
// One-line visualization to SVG
let svg = tree.visualize()?;
std::fs::write("tree.svg", svg).unwrap();
Ok(())
}
use oak_visualize::tree::{TreeLayout, TreeLayoutAlgorithm, TreeNode};
let mut root = TreeNode::new("root", "Binary Expression (+)", "op")
.with_child(TreeNode::new("l", "42", "num"))
.with_child(TreeNode::new("r", "8", "num"));
let layout = TreeLayout::new()
.with_algorithm(TreeLayoutAlgorithm::Layered)
.with_spacing(50.0, 80.0);
let svg = layout.visualize(&root)?;
use oak_visualize::graph::{Graph, GraphNode, GraphEdge, GraphLayout, GraphLayoutAlgorithm};
let mut graph = Graph::new(true);
graph.add_node(GraphNode::new("a", "Module A"));
graph.add_node(GraphNode::new("b", "Module B"));
graph.add_edge(GraphEdge::new("a", "b"));
let svg = GraphLayout::new()
.with_algorithm(GraphLayoutAlgorithm::ForceDirected)
.with_repulsion(200.0)
.visualize(&graph)?;
use oak_visualize::{Style, Color, NodeStyle};
let style = Style::new()
.with_node_style(NodeStyle {
fill_color: Color::rgb(70, 130, 180),
stroke_color: Color::rgb(25, 25, 112),
stroke_width: 2.0,
font_size: 14.0,
font_family: "Arial".to_string(),
});
let layout = TreeLayout::new().with_style(style);
use oak_visualize::{HtmlRenderer, InteractiveFeatures};
let features = InteractiveFeatures {
zoom: true,
pan: true,
tooltips: true,
highlight_on_hover: true,
clickable_nodes: true,
};
let html = HtmlRenderer::new()
.with_interactive_features(features)
.render_visualization(&layout)?;
Contributions are welcome! Please feel free to submit issues or pull requests.
Oak Visualization - Bringing code structure to life 🚀