use super::{
configuration::figureconfig::FigureConfig,
drawers::drawer::Drawer,
figuretypes::{
areachart::AreaChart, cartesiangraph::CartesianGraph, groupbarchart::GroupBarChart,
histogram::Histogram, piechart::PieChart, scattergraph::ScatterGraph,
},
};
pub enum FigureType {
GroupBarChartVertical,
GroupBarChartHorizontal,
CartesianGraph,
PieChart,
ScatterGraph,
AreaChart,
Histogram,
}
pub enum OutputFormat {
PixelCanvas,
Svg,
}
pub struct FigureFactory;
impl FigureFactory {
pub fn create_figure(plot_type: FigureType) -> Box<dyn Drawer> {
match plot_type {
FigureType::GroupBarChartHorizontal => Box::new(GroupBarChart::new(
"Bar Chart",
"X Axis",
"Y Axis",
super::utilities::orientation::Orientation::Horizontal,
FigureConfig::default(),
)),
FigureType::GroupBarChartVertical => Box::new(GroupBarChart::new(
"Bar Chart",
"X Axis",
"Y Axis",
super::utilities::orientation::Orientation::Vertical,
FigureConfig::default(),
)),
FigureType::CartesianGraph => Box::new(CartesianGraph::new(
"Cartesian Graph",
"X Axis",
"Y Axis",
&FigureConfig::default(),
)),
FigureType::PieChart => Box::new(PieChart::new("Pie Chart", FigureConfig::default())),
FigureType::ScatterGraph => Box::new(ScatterGraph::new(
"Scatter Graph",
"X Axis",
"Y Axis",
FigureConfig::default(),
)),
FigureType::AreaChart => Box::new(AreaChart::new(
"Area Chart",
"X Axis",
"Y Axis",
FigureConfig::default(),
)),
FigureType::Histogram => Box::new(Histogram::new(
"Histogram",
"Bins",
"Frequency",
0,
[0, 0, 255],
FigureConfig::default(),
)),
}
}
}