use docxcraft::{chart::Chart, document::Document, paragraph::Paragraph};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let locale = String::from("en");
let mut document = Document::new(&locale);
document.add_paragraph(Paragraph::new("Quarterly sales".into()));
let option = r#"{
"xAxis": { "type": "category", "data": ["Q1", "Q2"] },
"yAxis": { "type": "value" },
"series": [{ "name": "Revenue", "type": "bar", "data": [120, 180] }]
}"#;
document.add_chart(Chart::from_echart_option("Revenue", option, None)?);
std::fs::create_dir_all("target/examples")?;
document.save("target/examples/chart.docx")?;
Ok(())
}