Emoncms Graph module developments

I thought I would add your suggestion @pb66 to emoncms.org as I think It makes a nice way of accessing the graph without having to remember the userid.

Example:

https://emoncms.org/ukelectricitygrid/graph

Code modification in index.php:

// If no controller of this name - then try username
// need to actually test if there isnt a controller rather than if no content
// is returned from the controller.
if ($output['content'] == "#UNDEFINED#" && $public_profile_enabled && $route->controller!='admin')
{
    $userid = $user->get_id($route->controller);
    if ($userid) {
        $route->subaction = $route->action;
        $session['userid'] = $userid;
        $session['username'] = $route->controller;
        $session['read'] = 1;
        $session['profile'] = 1;
        $route->controller = $public_profile_controller;
        $route->action = $public_profile_action;
        
        $output = controller($route->controller);
        
        if ($output["content"]=="" && $route->subaction=="graph") {
            $route->controller = "graph";
            $route->action = "";
            $_GET['userid'] = $userid;
            $output = controller($route->controller);
        }
    }
}

Edit: I’ve changed the implementation above to allow for the case where a user has called a dashboard ‘graph’ - in this case the dashboard will be shown instead of the graph interface.

Cool…

I have created a PR for this on the emoncms/emoncms repo so we can try it.

I have also added a PR for a related item for consideration, it may not be everyones cuppa tea but I find it really useful when managing lots of accounts. I’ve altered my Theme so that a friendly name can be displayed on the navbar, even when (especially when?) public.

Did you have any thoughts about colour coding the legend entry text and the left/right scales to indicate which scale applies to which values? (Sorry that was a long thread I linked)

I tried the graph module on Android (whilst looking at the Emoncms.org 'Graphs' with Android browser not showing 'feeds in view' thread) and noticed the collapsed left hand panel and burger button, could this be considered for the desktop view?

It should be possible yes, it should be a matter of not hiding the button when the screen size is large. I will have a look at in the next few days

Can I resurface a suggestion to have the minimum time on zoom in (+) as 10s and not 5s as this matches the 10s minimum collection interval ‘default’ of emoncms.org. Thanks.

Need to be careful how that would be done as IoTaWatt local graphing does have 5 sec resolution.

Both emoncms and emoncms.org can graph data down to 1 second intervals.

The fedault/minimum you refer to is the phpfina feed fixed interval which can be 5s on (self-hosted) emoncms, on emoncms.org the 5s option is masked from the dropdown box to block discourage it’s use to ease the load on the server.

A resolution of down to 1s is required to accurately chart phptimeseries data which may not be on a fixed interval.

For emoncms variant only: My 10s ‘minimum’ is related to the auto adjustment of ‘fixed interval’ of ‘graphs’ on selecting a period for display. Selecting ‘D,W,M,Y’ sets a particular ‘fixed interval’ (‘D’ sets 120).

The ‘fixed interval’ will drop to 5s once less than around 1h45m is displayed. Further zooming does not see lower ‘fixed interval’.

A 10s minimum would, perhaps, fit better with most (9 out of 10) emoncms.org feed-interval - admittedly there is a 15s option.

My experience is that to ‘see’ data points there is need to override the auto ‘fixed interval’ from 5s to 10s and reload when zoomed in so as to better see the data points.

Other options are to have a minimum enterable on the page - with a default of 10s - so I do not have to change it :wink:

Or not…

Hi,
I like the module but have one request:
not sure this was discussed before: I would love to have a view shorter than 1day, something like 4/6/8/12 hours? Is that possible already or would that be a feature request?
regards

Hello @TrystanLea,

I’m not sure where to post this. Is it possible to change the background color of graphs? If not, is this something that could be included in a future update?

Thanks, have a great day,

Neil

Thank you so much for fixing this!!!

1 Like