Skip to content

acaird/timeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timelines

Wikipedia has cool timelines for organizations, like bands. For an example, see https://en.wikipedia.org/wiki/Joy_Division#Timeline

The format for this is defined in the specification described at https://en.wikipedia.org/wiki/Help:EasyTimeline_syntax

The code here cannot parse everything as defined in the specification, but it can parse enough to get something useful from files of this type.

Examples

The data files in /examples are copied directly from Wikipedia. The graphics are generated by the code here.

Timeline for The Cure

Timeline for Franz Ferdinand

Timeline for Joy Division

Timeline for R.E.M.

Installation and execution

Building from source

  1. Install a version of Go at or greater than 1.25.0 from https://go.dev/
  2. Clone this repository
  3. Run the program with the command
    go run cmd/main.go /path/to/data/file
    
    or compile the program with the command
    go build -o timeline cmd/main.go
    

Using pre-compiled binaries

  1. Choose a pre-compiled version from the Releases page that is suitable for your computer
  2. Download it and rename the download to timeline
  3. Open the Terminal.app program (on a Mac) or the command shell (on Windows)
  4. Using the cd command, navigate to where you downloaded the program (cd ~/Downloads or cd ~/Desktop on a Mac)

Running timeline

To

  1. To see the options, run:

    timeline --help
    

    Currently the options are:

    • -font; this sets the font for the text in the chart. The options are limited to one of: DMSans, ComputerModernRoman, Luxi (default "DMSans") with DMSans being a nice sans serif font, ComputerModernRoman which is a nice serifed font, and Luxi, which is built in
    • -j enable verbose JSON output; this is generally not useful but if you want to see the internal representation of the data this is how to do it
    • -labelbargap ; this is an integer that sets the size of the gap between the label and the start of the bar in pixels. It is 5px by default. This is also used in many other places in the chart to define spacing
    • -o the name of the output file, this defaults to the name of the input file (including any extensions) with the ending .png
    • -t this enables verbose text output; this is also generally not useful, but it is another representation of the data that was read from the input file
    • -tM this sets length of major tics on x-axis in pixels, the default is 8px
    • -tm this sets length of minor tics on x-axis in pixels, the default is 5px

    for example, you can produce the_cure.png (as shown above) with the command:

    timeline -o the_cure.png ./examples/the_cure.data
    

To-do

  1. Clean up draw.go which is a damn travesty of Go
  2. Write a PEG for the specification so everything can be parsed (there is some early drafts of this in peg/, but there is a way to go
    1. Write the code to handle all of the options in the spec that were parsed by the PEG
  3. Support PDF output
  4. Don't make the image bigger than the chart plus the legend

About

Parse Wikipedia-style timeline files and produce png files that match those Wikipedia produces

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages