Open incanus opened 1 month ago
Ok, looking into the source, I can see that this is non-trivial, but would be doable. The first-pass approach would be:
graph
struct allocate and track an additional member of type uint32_t*
alongside its existing y
value float*
storage (so graph->width * sizeof(uint32_t)
additional RAM allocation). graph_push_back()
could potentially push a color value into this member for each data point. A 0
or some other infrequently-used value could be set to indicate to use the default graph color for that y
value. graph_draw()
would probably require the most work, since potentially many CGPath
could have to be drawn instead of just one to fill. handle_domain_push()
to parse out the pushed values, including an optional data point color. I might still give it a shot, but just wanted to summarize for anyone else thinking about it. And totally understandable @FelixKratz if this is out of scope & you want to close the issue.
Alternatively, another way to tackle this could be the ability to set one or more threshold/color combinations, then instead of storing the color for a data point, it could be drawn based on meeting thresholds instead.
I think from the code point-of-view this is doable, I however wonder what a proper syntax for this would look like?
I hadn’t yet checked for support of optional arguments, but for direct color I imagined it would just be:
sketchybar push <name> <data point> <optional point-specific color>
For the idea of thresholds, the syntax does get messier. Maybe an added property syntax like this?
sketchybar —set <name> graph.fill_color=0xffffcccc graph.fill_threshold=90:0xffff000000:80:0xffffff00
(or 0.9
or whatever makes the most sense for range)
I searched and didn't see a history of discussion about this feature, but I would be interested in the ability to plot values of varying color (fill, at least) for graphs. For example, graphing CPU a certain color, but then yellow when >80% and red when >90%.
Has this been looked into at all? Just wondering as I might take a crack at it and submit a PR if there is interest.