Highcharts - yAxis 0 value at bottom

66 views
Skip to first unread message

Xant

unread,
Oct 19, 2019, 2:14:00 AM10/19/19
to weewx-user

Even if placing "yAxis_min = 0" on Graphs.conf of Belchertown skin, Highcharts place a line right at the middle of the chart, instead of a line at the bottom when value is at timeframe is all "zero". Also of much distress when graph actually refers to "Area", then Highchart paint solid color under line.




This seems a "normal" behaviour for Highcharts, as many also complaining (https://stackoverflow.com/questions/13991873/highcharts-ensure-y-axis-0-value-is-at-chart-bottom). I tried many combinations and options into Graphs.conf, at no solution.

Suggestions?

Xant

Pat

unread,
Oct 19, 2019, 8:56:15 PM10/19/19
to weewx-user
I see that an empty Belchertown rain chart will have the y axis 0 at the bottom of the chart. So I played with jsfiddle for a few minutes and think I have 2 ideas for you. Option #1 is the easiest fix. 

There's 2 bits to it that may work for you:

1. If you split your observations so that they use both yAxis = 0 and yAxis = 1, then it'll force the 0 to the bottom of the chart. Here you can see I have removed all yAxis options, except left the series on opposite yAxis
2. Or you can try a manual override with like the rain code is doing with minRange. You'll need to define also the min = 0 or the chart won't be at the bottom. Here is a chart with the minRange and min defined in yAxis. and ... Here you can see what I mean if you leave min omitted. 

Making minRange and min = 0 a global option is not advised since some charts will go into the negative - like outTemp. Setting the min to 0 will hide negative values. 

Xant

unread,
Oct 19, 2019, 10:08:42 PM10/19/19
to weewx-user

Ha! I went to the "easy solution for now", yAxis = 0, yAxis =1, and it works!!!  (geee... I tried so many ways...)

Awkward that we have to go through this "creative ways" for Highcharts, but a solution never the less.

I definitely understand your concern regarding "min = 0", but for some, there is no negative numbers whatsoever (lightning count, illuminance at night, etc). For others of concern, there are "yAxis _softmin and yAxis_softmax", which you also kindly made available.

Thank you always for B-skin and time,

Xant

Xant

unread,
Oct 20, 2019, 12:18:15 AM10/20/19
to weewx-user

Just passed midnight, reset data for next day and Illuminance = 0 (night). That is, another Graph check and the moment of truth...





And the yAxis = 0 / yAxis = 1 trick works! That is, no more half-graph painted solid color when data = 0.
Reply all
Reply to author
Forward
0 new messages