There’s this little pie graph I want in my app that looks sorta like this:
Basically, it’s gonna be a stopwatch-like graph that tells you how much time is left for a particular food in a particular location. In this case, the pie would represent 1 month left. It’s convenient because there are 12 months in a year, 12 hours on a clock, etc. I can color the pie slice differently when it’s nearing its “out of season” time (as is the case here, so the slice should be a red-ish color in the final deal).
The chart API takes data, like (1,11) to represent the amount that’s colored one color versus colored another. But, unfortunately, the chart’s default orientation is at 3 o’clock. To rotate the chart, you supply it with a number in radians. So, after some research in radians, I determine that to rotate the slice 90 degrees clockwise, I give everything a radians of 4.712388975.
Unfortunately, that aligns the wrong side of the pie slice. Making it look like this:
So, now I need to figure out how to rotate it to the a little bit less than the default offset. Since I’m making one of these for each half-increment of a month, I’ll need 24 slices. So, each half month has its own correction of
1 radian * 15 (degrees) = 0.2617993875 radians
Each with a different radian correction to the offset. Or, rather, for each increment,
(default offset) – ((half month correction from above) * (number of half months))
So now I figure this all out in a Google Docs spreadsheet.
And for some reason, I find the whole process highly enjoyable.
Also, now that I’ve got this spreadsheet open, I’m interested in using this information to help determine the colors used for each slice. I have some colors that have been sampled from actual foods in nature and wonder how I might use math to simulate the changing colors of the season.
But I’m going to leave that for tomorrow because I want a drink right now. I feel like I’m in that weird nerd limbo… nerdy enough to come up with a really convoluted way to get something really simple, and yet still not nerdy enough to come up with the really easy way to get something really simple.