Skip to content

Commit

Permalink
🚧 Made a very simple working implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
BattleCh1cken committed Jan 11, 2024
1 parent 7fb5487 commit 6e6059c
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions themes/radial/components/graphs.typ
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,54 @@
},
)
}


#let parse_timestamp(timestamp) = {
let data = timestamp.matches(regex("(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})"))
let captures = data.at(0).captures

datetime(
year: int(captures.at(0)),
month: int(captures.at(1)),
day: int(captures.at(2)),
hour: int(captures.at(3)),
minute: int(captures.at(4)),
second: int(captures.at(5)),
)
}

#let plot(file_path) = {
//let timestamp = "2023-12-13 20:16:40"
//let thingy = parse_timestamp(timestamp)

let file = csv(file_path)
let data1 = ();
let data2 = ();
let data3 = ();
for (index, row) in file.enumerate() {
if index == 0 {continue}
data1.push((index, float(row.at(1))))
data2.push((index, float(row.at(2))))
data3.push((index, float(row.at(3))))
}

//let results = csv("/Flywheel PID-data-2023-12-13 20 18 27.csv")
//[#results]

set align(center)
cetz.canvas(length: 1cm, {
import cetz.draw: *
import cetz.plot
plot.plot(
size: (10, 6),
axis-style: "left",
x-grid: "both",
y-grid: "both",
{
plot.add(data1)
plot.add(data2)
plot.add(data3)
})
//plot.plot(size: (10, 6), x-tick-step: 1, grid: "major", {})
})
}

0 comments on commit 6e6059c

Please sign in to comment.