Horizontal line with Highcharts

60 görüntüleme
İlk okunmamış mesaja atla

Andre

okunmadı,
18 Haz 2020 12:40:1918.06.2020
alıcı weewx-user
Is it possible to draw a horizontal colored line on specific yaxis value?
I need a fixed line to show peak values.

Regards Andre

Manfred Maier

okunmadı,
18 Haz 2020 12:43:2818.06.2020
alıcı weewx-user
Hi,
a line like on my barometer chart (www.wetter-zorneding.de)?

If so: Yes, that's possible but requires some additional lines in the belchertown.js.tmpl

In case this is what you are looking for, I can copy my code here.


Manfred 

Andre

okunmadı,
18 Haz 2020 12:49:1518.06.2020
alıcı weewx-user
Yes, this is excacly what I'm looking for.
Your code sharing will be very nice.

Manfred Maier

okunmadı,
18 Haz 2020 12:57:1618.06.2020
alıcı weewx-user
Here you go:

                // Barometer chart plots get a higher precision yAxis tick
                if (s.obsType == "barometer") {
                    if ( typeof s.yAxis_tickInterval === "undefined" ) { 
                        // If no tick interval override, set 0.01 as default tick interval to satisfy an old request for this level of precision. 
                        options.yAxis[this_yAxis].tickInterval = 0.01;
                    }
                    // Define yAxis label float format if rounding is defined. Default to 2 decimals if nothing defined
                    if ( typeof s.rounding !== "undefined" ) {
                        options.yAxis[this_yAxis].labels = { format: '{value:.'+s.rounding+'f}' }
                    } else {
                        options.yAxis[this_yAxis].labels = { format: '{value:.2f}' }
                    }
                    options.yAxis[this_yAxis].plotLines = [{
                        value: 1013.25,
                        color: '#E5544E',
                        width: 1,
                        dashStyle: 'ShortDash',
                        zIndex: 0,
                    }]
                }

                // Dewpoint chart plots get Schwuele indicator for the yAxis
                if (s.obsType == "dewpoint") {
                    options.yAxis[this_yAxis].plotLines = [{
                        value: 17,
                        color: '#E5544E',
                        width: 1,
                        dashStyle: 'ShortDash',
                        zIndex: 0,
                    },
                    {
                        value: 19.9,
                        color: '#E5544E',
                        width: 1,
                        dashStyle: 'ShortDash',
                        zIndex: 0,
                    }]
                }



The first 10 lines or so are already part of the belchertown.js.tmpl (in the 'js' folder) - from line 1374 onwards (in my case). 
The code in bold writing adds a line to the barometer chart. And the next section adds two lines to the Dewpoint chart.

You probably will want to adapt this 'dewpoint' part to your needs.

Manfred 

Andre

okunmadı,
18 Haz 2020 13:02:0018.06.2020
alıcı weewx-user
Many thanks, Manfred.
So langsam muss ich mal über eine eigene Danksagungseite nur für Dich nachdenken. ;)

Manfred Maier

okunmadı,
18 Haz 2020 13:04:3318.06.2020
alıcı weewx-user
Keine Sache. Ich habe hier auch unzählige Fragen gestellt und war froh, wenn mir jemand geholfen hat.
Einige meiner Fragen hast Du jetzt auch und ich kenne mittlerweile die Antworten :)

Tümünü yanıtla
Yazarı yanıtla
Yönlendir
0 yeni ileti