pyrochlore/obsidian-tracker

Is it possible to render line graphs with a shaded reference band?

ThornedRose opened this issue · 0 comments

First just want to say thanks so much for this excellent plugin!

Expected Behavior

When using a line graph, it can be useful to set a reference band (aka goal or target range) in the background. For example:
image
Image source: https://help.datylon.com/tutorials/add-reference-band-to-line-chart

Context

Example 1: Measuring meditation time - someone tracks how much time they meditate per day on a line graph. But they also have a goal of between 10 and 20 mins. This would be shown on the graph as coloured bar in the background with the line of actual time spent meditating over the top to see how much the goal has been achieved over time.

Example 2: Tracking blood test results - tracking a particular blood test such as blood glucose, TSH, ferritin, etc. as a line graph to see changes over time. The lab range (e.g. 11-22pmol/L) is shown as a shaded area in the background so you can track whether any results fall outside the normal range over time.

Current Behavior

I can make line graphs all good (again, thanks for this plugin!). I can kinda add this functionality by putting a minimum and maximum static data point on every entry but that only gives me a straight line as opposed to a shaded background area. (e.g. If I was tracking meditation time, every day I will add my actual meditation time but I would also have a lower_meditation_time:10 and a upper_meditation_time:20 that is the same for every single day and thus renders two straight lines.

It would be even more awesome to have multiple reference bands. For example, with blood tests you can have the lab range and also a functional range - the functional range is narrower than the lab range and sometimes it's useful to have different bands or bands within bands. (Example: https://img.chandoo.org/c/line-chart-with-bands-to-depict-kpi-or-goals.png)

Possible Solution

Hoping the functionality already exists and I'm just not seeing it in the documentation. Otherwise it's not something I can unfortunately help directly with coding as it's not something I have any skills with. As above, a sort of work around is to include a min/max static amount on every note to include in the graph so that you can get a line representing the upper and lower amounts of the range or goal that you want but it's not ideal since it can visually merge with existing lines (particularly if lines are relatively flat and close to the min or max of the reference/goal range) or if the graph has multiple lines. I would also imagine it's a lot less efficient to call on these data points rather than just baking it into the rendering of the graphs.