aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: e9798c5f3dbb3cdd097d0de5a04e31db23a9fe5c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use textgraph::graph;
use textgraph::parseopts::parseopts;

fn main() {
    let opts = parseopts();

    let mut y_values: Vec<f64> = Vec::new();
    let mut x_values: Vec<f64> = Vec::new();
    for i in 0..600 {
        y_values.push((i as f64 * std::f64::consts::PI / 120.0).sin());
        x_values.push(i as f64);
    }

    //let y_values: [f64; 6] = [1.0, 10.0, 40.0, 0.0, 30.0, 15.0];
    //let x_values: [f64; 6] = [1.0, 2.0,  3.0,  4.0, 5.0,  6.0];

    let graph_options: textgraph::graph::GraphOptions = (&opts).into();
    let g = match opts.graph_type {
        textgraph::parseopts::GraphType::Ascii => {
            graph::ascii(&y_values, &x_values, &graph_options)
        }
        textgraph::parseopts::GraphType::Star => graph::star(&y_values, &x_values, &graph_options),
    };

    println!("{}", g);
}