Generate charts from spec files.
You've got all your data collected, and now you want to make some charts. So you take your table to excel and you make some charts, awesome. Now what? You want to put it in your paper or upload it to your blog or whatever, so you export as an image. However, you want to keep the original data around so you can easily update the chart later, but this is a binary file format that can only be read by a specific program. Humans can't read that, and nor can git.
Enter stage left: charlt. Charlt lets you write chart "specs" in text formats (e.g. yaml). It also has lua support for more complex scripts in case you were missing excels math functions already.
- Supports multiple input formats, theoretically anything supported by
serde could be supported. Currently supported:
- yaml
- lua
- Support for multiple output formats via
plotters. Currently
supported:
- png
- svg
- Charts!!
- bar
- xy scatter
- Input format is designed to be human readable and git friendly
There is a base schema for all chart types:
interface Dataset<Pt> {
name: string // name of the dataset, for legend
colour: string // css colour value, also aliased to 'color' for the americans
values: []Pt
}
interface XY<T> {
x: T
y: T
}
interface Chart<Pt> {
// font for various text on the chart
font?: {
family: string // family
size: number // pt size
}
margins?: XY<number?> // margins for chart
caption?: string // caption for top of chart
datasets: []Dataset<Pt>
}
The bar chart dataset format has values corresponding to each category. The categories
are defined by the top-level value categories
type Bar = Chart<number>
examples:
type XYScatter = Chart<XY<number>>
examples: