Parse front matter and plot to a chart


#1

I can’t seem to find any way of doing this. I have some front matter that I would like to parse and then compile into a chart. For example, if I journal and include a 'Weight:" key followed by a number I would like to create a line chart for each month. X axis would be weight, Y axis would be the day. Something like that.

I’m also trying to keep it simple. I LOVE how the ‘tasks’ package does some really cool processing while keeping everything simple - one text file. Any idea how I could use Atom to do something similar for a weight log/journal?


#2

Do you think you would want to mimic Hydrogen?


#3

That’s possible! If I had a file which contained code that basically said “parse all files in this folder and display results as a line chart” I could then execute it at will. I don’t necessarily need one per month, but if I had the option to pick date ranges that would really work for me. Then I just open that file, execute the command, see my results. Save image or just close the file.

Having said that, I would prefer not having to install huge programs like Anaconda or even Python, especially at work. Something contained in a package would be better.


#4

No worries. These days, there’s a JavaScript library for everything, like Chart.js or this list of 50 charting libraries.

Here’s what I think would work:

  1. You can have the data in CSON format, CSV, or a custom format. I like CSON because it’s very attractive and you can easily convert it to JSON and then use the data directly in your code without having to worry about translating from one format to another. CSV is hard for humans to read, and if you make up your own thing it might require too much work to get the computer to read it.
  2. You can write a package that creates a modal dialog and gives you options for chart type, time range, which key goes with which axis, whatever else.
  3. The package can then plug your settings and data through whatever charting library you decide to go with and display the results in a new pane.

Possible additional features:

  • Converting to and from CSV (it’s very popular for plain-text tabular data). Like most things, this path has already been trod.
  • Saving charts as HTML Canvas instances or SVG files for easy sharing.

#5

Were I a javascript coder, that would all be good. But that’s not me. :frowning:

I did manage to hack around in the todo-show package and get it to produce a table displaying weight and date columns, using tags. I can’t find any easy way to produce a chart from that, however. I’ll keep looking I guess…

But thank you for your suggestions.