Page 1 of 1

Misc graphs (degree days) without values

Posted: Sat 02 Sep 2023 1:57 pm
by Dador
Hi,

I noticed that the degree days charts have no values. The graph is drawn, but the numbers are missing. I've looked at other users' websites and it works fine for them, e.g. in your site Hans.

As if you'd take a look at it
https://pogodarybnik.pl/graphsmisc.htm

Re: Misc graphs (degree days) without values

Posted: Sat 02 Sep 2023 5:36 pm
by HansR
There is a javascript function

Code: Select all

function DayNumber2Date(dayNumber, year) {
    const date = new Date(year, 0, dayNumber);
    return date.toLocaleDateString('nl-NL');
}
which resides in cumulusutils.js.

Originally it was copied several time in each graphs file where required (two at the moment) but I moved it to cumulusutils.js to have only one entry point.

You have two options (as you create your own CUtils environment more or less):
  1. You include the function in your file where you need it as a <script>
  2. You include cumulusutils.js in your file. The advantage of this is that if I make changes you will have them automatically, the disadvantage is a performance penalty (though that may that may not be too big). I have no idea about secondary effects. If any you may have to switch back to the
    previous point.
And the nl-NL is generated automatically by CUtils but of course is your language locale.

Re: Misc graphs (degree days) without values

Posted: Sat 02 Sep 2023 5:50 pm
by HansR
I assume you just include graphsmisc.txt in your webpage? Do you edit this manually?

I'll have to find a better method for inclusion of this function I assume.

Re: Misc graphs (degree days) without values

Posted: Sat 02 Sep 2023 6:27 pm
by Dador
HansR wrote: Sat 02 Sep 2023 5:36 pm You have two options (as you create your own CUtils environment more or less):
  1. You include the function in your file where you need it as a <script>
  2. You include cumulusutils.js in your file. The advantage of this is that if I make changes you will have them automatically, the disadvantage is a performance penalty (though that may that may not be too big). I have no idea about secondary effects. If any you may have to switch back to the
    previous point.
I used the second way. Works. Once again thanks for your help :) .
HansR wrote: Sat 02 Sep 2023 5:50 pm I assume you just include graphsmisc.txt in your webpage? Do you edit this manually?
I do that

Code: Select all

<?php include('graphsmisc.txt');?>
I don't know if it's professional or not. It just works and I leave it at that.

Re: Misc graphs (degree days) without values

Posted: Sat 02 Sep 2023 7:00 pm
by HansR
Dador wrote: Sat 02 Sep 2023 6:27 pm I used the second way. Works. Once again thanks for your help :) .
Good.
Dador wrote: Sat 02 Sep 2023 6:27 pm

Code: Select all

<?php include('graphsmisc.txt');?>
That's what I suggested originally a long time ago so I can live with that :D
It only means I have to find the solution within the graphmisc module to maintain modularity.

I'll look at it, if anything found you'll see it in the release notes.

Re: Misc graphs (degree days) without values

Posted: Sat 02 Sep 2023 7:09 pm
by HansR
And looking back at the code: are you generating the module graphs separately or are you generating website and using the files resulting from that?

The solution should already be there if you generate graphs (or at least it should be) and include the resulting graphsmisc.txt in which case you do not need to include cumulusutils.js

I don't think anybody used this before so it has not been verified.

Re: Misc graphs (degree days) without values

Posted: Sat 02 Sep 2023 8:31 pm
by Dador
In fact, I've been using Extrasensors Top10 Graphs modules since it's possible. I am not generating the entire website.

Re: Misc graphs (degree days) without values

Posted: Sun 03 Sep 2023 1:32 am
by HansR
Dador wrote: Sat 02 Sep 2023 8:31 pm In fact, I've been using Extrasensors Top10 Graphs modules since it's possible. I am not generating the entire website.
OK. I'll look at it again, it should work without the additional inclusion of the runtime.