Emoncms Graph module developments

Thanks for spotting Paul, fixed the feed toggle issue.

What will happen if one feed is not public? will it fail or show those that are public?

It shows the public ones and ignores the non-public or not existent feed.

I will have a quick look at your other ideas now while Im at it.

Great.

The main one would be the “all public feeds for user”, I specifically need to give multiple users access to do data queries without allowing them write access, we have many interested parties wanting to search the data and I cannot take a chance on giving everyone the username and password, so currently those users are restricted to using api calls only. The GUI would be very useful and save me having to produce something similar.

If you don’t have the time, please just point me to where I might be able to make the changes, I don’t mind doing it, it might just take a while though.

The main one would be the “all public feeds for user”

Luckily not too hard: Emoncms - user login

Fantastic! I just tried Emoncms - graph too, which works well, thanks.

What are your thought on the other “handed” feedids? No rush for implementation. I was just wondering about committing to a api structure that might not leave room for it to be added.

Making the LH panel hideable might also fix the hover over boxes being obscured sometimes

Thought I might as well have a go while this is still fresh and again luckily easy to add:

https://emoncms.org/graph?feedidsLH=114934&feedidsRH=67087

You can now either use the short hand:

https://emoncms.org/graph/114934,67087

or for the same result:

https://emoncms.org/graph?feedidsLH=114934,67087

It should be possible to provide the option for the left hand menu and I will have a look at the linked thread above.

Brilliant!

Just tested with Emoncms - graph and got the full list of public feeds with a single feed selected on each the left and right scales, perfect.

Tomorrow I will try and get https://emoncms.org/username/graph working, would I be right in thinking I just need to put an extra catch in the public dashboard by user section of index.php so it catches graph before looking for a dashboard called “graph” ?

The above features are specific to the full graph view rather than the embeded version of saved graphs, so I dont think https://emoncms.org/username/graph will work? is that what you mean?

Edit: Actually I think I know what you mean, yes if you can redirect to the graph view here emoncms/index.php at master · emoncms/emoncms · GitHub that should be possible, good idea!

No, I already have some dashboards set up as https://emoncms/username/dashA and https://emoncms/username/dashB etc, I just wanted to tell users to look at the “graph” page rather than DashA or DashB etc (KISS).

So I want to catch https://emoncms/username/graph as a special case and point it to https://emoncms/graph?userid=1234, where the userid is derived from the username in the same way the dashboard list is.

[edit] yes I think you got it with your edit, that’s where I meant.

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