Data viewer refresh with My Graphs

It seems that the default interval in Data Viewer doesn’t get updated when a stored graph is retrieved:

This shows the screen immediately after the graph is retrieved and is displaying 6 hours, as set-up.
If I now click the refresh button in the top left the timescale changes to ‘1 Week’ as this is what is listed.
Is this the expected behaviour, or should the default timescale be automatically restored with the graph?

Thanks
Martin

The interval updates ok for me here, but the time window selector e.g “1 week” does not update to reflect the saved graph. Is that what you are seeing?

Yes, that’s exactly what I’m seeing - apologies if my description was unclear :confused:

1 Like

I submitted a fix for the selector in this pull request - it might need separating into its own PR, as it only fixes the embedded version…

Refresh the graph every minute when embedded in a dashboard by MrTimbones · Pull Request #143 · emoncms/graph · GitHub
Bonus: it also attempts to update time selector to match the saved period instead of the default of “1 week”, which always bugged me.

Earlier today I added another value to the Data Viewer period (3 hours) in embed.php, but am struggling to get the new version displayed.
What do I need to do to refresh the web pages, a reboot doesn’t seem to be enough.

(I’m posting this question here as I came across this thread while looking in the forum for an answer, and have now also included the patch to embed.php that fixes this problem!)

Thanks,
Martin

This worked fine for me, adding 1 extra line to Modules/graph/embed.php:

index 4007ced..a0e2e62 100644
--- a/embed.php
+++ b/embed.php
@@ -65,6 +65,7 @@
         <button class='btn graph_time_refresh' title="<?php echo _('Refresh') ?>"><i class="icon-repeat"></i></button>
         <select class='btn graph_time' style="width:90px; padding-left:5px">
             <option value='1'><?php echo _('1 hour') ?></option>
+            <option value='3'><?php echo _('3 hours') ?></option>
             <option value='6'><?php echo _('6 hours') ?></option>
             <option value='12'><?php echo _('12 hours') ?></option>
             <option value='24'><?php echo _('24 hours') ?></option>

image

…although I’m not running the Pi version, so there might be some other thing I don’t know about.

Try clearing your browser cache, or pressing Ctrl+F5 to force it to load the new file.

Thanks Tim, that’s the change that I made; unfortunately I still can’t see the updated drop-down.

I’ve tried refreshing the page, clearing the cache and have even used another browser and PC.
I’ve also checked that the file on the Pi is definitely the updated one.

Does anyone have another suggestion to force the updated file to be picked up and used?

‘Caching problem’ solved - the clue is in the title of this thread.
The file I actually needed to change was view.php, rather than embed.php
This also means that the fix for my original query needs to be reworked for view.php - I’ll give it a go when I have a bit more time.

Martin

1 Like