Skip to main content

plotly_table/
plotly_table.rs

1use plotlars::{Cell, CsvReader, Header, Plot, Rgb, Table, Text};
2
3fn main() {
4    let dataset = CsvReader::new("data/employee_data.csv").finish().unwrap();
5
6    let header = Header::new()
7        .values(vec![
8            "Employee Name",
9            "Department",
10            "Annual Salary ($)",
11            "Years of Service",
12        ])
13        .align("center")
14        .font("Arial Black")
15        .fill(Rgb(70, 130, 180));
16
17    let cell = Cell::new()
18        .align("center")
19        .height(25.0)
20        .fill(Rgb(240, 248, 255));
21
22    Table::builder()
23        .data(&dataset)
24        .columns(vec!["name", "department", "salary", "years"])
25        .header(&header)
26        .cell(&cell)
27        .plot_title(
28            Text::from("Employee Data")
29                .font("Arial")
30                .size(20)
31                .color(Rgb(25, 25, 112)),
32        )
33        .build()
34        .plot();
35}