Repository navigation
allow reversing the area chart fill baseline #2837
Unanswered
samfrjn11
asked this question in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Currently,
flux:chart.area's fill always renders from the line down to the axis minimum (domain[0]), with no way to configure it otherwise. This works well for typical "value grows fromzero" charts, but breaks down for data where larger magnitude means worse, not better — the most common case being RF/network signal strength in dBm, which is always negative (e.g. -30 dBm
= excellent, -130 dBm = no signal).
For that kind of data, the natural chart convention is to put the best reading at the top of the y-axis and the worst at the bottom (which Flux already does correctly, since it sorts
numerically and -30 > -130). But because the area fill baseline is hardcoded to whichever value sits at the bottom of the axis, the fill ends up anchored to the worst reading — meaning the
shaded area is large during good signal and shrinks to nothing during bad signal. For a chart whose whole purpose is to highlight how bad a signal got, that's backwards.
Workaround we're using today
Plot
abs(value)instead of the real signed value (so the axis's numeric ordering flips), and usetick-prefix="-"to restore the correct-looking negative labels. It works, but it's a hack —it also means we now have to pin
tick-start/tick-endexplicitly, since the "auto-anchor to 0" behavior (tickStart === "auto" && min > 0 && max > 0) kicks in for all-positive plottedvalues and produces a meaningless "0" tick.
Requested feature
A way to control the area's fill baseline independently of which end of the domain is "first" — e.g.:
baselineprop onflux:chart.area:baseline="min"(current/default),baseline="max", or an explicitbaseline="{value}"reverseoption onflux:chart.axisthat flips which domain endpoint the area treats as its baseline, without changing tick/label orderingEither would let us drop the abs-value workaround entirely.
Desired result:

All reactions