I am making a graph in Python tk graphically show the movement of some trains.
Let's say we have train A, B and C. And their hourlyschedules are as follows:
Station 1 | Station 2 | Station 3 | |
---|---|---|---|
A | :35:00 | :38:18 | :45:06 |
B | :55:06 | :59:12 | :06:18 |
C | :12:00 | :18:12 | :23:18 |
At each station the train has a 42 second stop for passengers to get in and out of the train.
I tried to make a graphic representation but going from :59:12 to :06:18 gives a huge line through the graph. I know why but I dont know how to solve it.
It should look something like this (this is an example with more trains): enter image description here
Can anyone help me get the code to make this graph in Python?
Assign a Y value to each station. For example
Station 1 = 100
Station 2 = 200
Station 3 = 300
Define a function to convert your "times" to seconds from an epoch.
Define a function for each train that converts seconds to Y values. For example, in pseudo code, for train A.
Here is a C++ class that implements these ideas
Here is the output
The complete application code is at https://gist.github.com/JamesBremner/873e02020b369cb55e8b7915ca3d17cd