Emoncms Graph module developments

(Paul) #48

Pulled in these changes at last, the collapsing menu of feeds is much much better :smile:

(Paul) #49

You are right, this is a known issue, I think it’s mentioned earlier in this thread somewhere, but worth a bump! .

(Shane Kuzmanic) #50

These graphs are looking great, is there any way i can generate a URL to show just the graph ether as an image or simple page just showing the graph after i have saved the name. I use openhab2 dashboards and can insert an image or url in a window and would like to have my power and solar in that dashboard with other things.



(Trystan Lea) #51

@Shane_Kuzmanic I’ve made a couple of small changes to the graph module so that its easier to find the graph id to use in the url. You can pull in the changes with an emonpi update.

You will then see the selected graph id displayed below the graph name:

The URL to view a graph is:

(Shane Kuzmanic) #52

Thanks so much i will give it a go.

(Trystan Lea) #53

I have made a couple of changes to the emoncms graph module, partly for use in the up and coming updated feed list interface (see Forum topic: Development: Devices, Inputs and Feeds in emoncms ).
The work was done a while ago - only just had the chance to merge.

The new features include:

  • Ability to open the graph view with multiple feeds specified in the URL - this will be used by the new feed list interface where you can select multiple feeds from the feed list and then click on the graph icon.

  • Ability to view public feeds in the graph interface without login, for example to view the solar and wind feeds from the account recording data for our ukgrid visualisation, just list the feedid’s for the public feeds you wish to view in the URL:,67087. This can be particularly useful if you want to give public access to particular feeds and want to provide interested users with an interface from which the data can be explored including access to the basic graph module CSV export tool. Of course if the feed/feeds in question have not been made public they will not be available through the public graph view.

  • Improved responsive design for graph options and statistics view so that they are more usable on a mobile.

(Paul) #54

Interesting stuff…

Just tried the publc urll on and deselected “wind” in the lefthand panel and couldn’t get it back after reselecting, neither in the left y-axix nor the right y-axis nor when both the left and right y-axix are selected at once (I don’t think that is supposed to happen)

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


How difficult would it be to have the graph module open publicly with all public feeds available (but unselected) in the lefthand panel if the userid is defined in the url?


Also could it be made possible to define the second axis feeds


or combined


would list all public feeds for user 10125 with feeds 114934 & 67087 pre-selected for the left scale and 12345 & 67890 pre-selected for the right scale.

Please also take a look at the Indicating left or right x-axis in the graph legends thread, it would be real useful to colour code the left and right scales along with the legend text to indicate which scale each legend entry is using.

Plus, While we’re at it, is it possible to maybe make the LH panel hideable like the apps list?

(Trystan Lea) #55

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.

(Paul) #56


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.

(Trystan Lea) #57

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

Luckily not too hard:,67087?userid=8862

(Paul) #58

Fantastic! I just tried 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

(Trystan Lea) #59

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

You can now either use the short hand:,67087

or for the same result:,67087

(Trystan Lea) #60

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

(Paul) #61


Just tested with 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 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” ?

(Trystan Lea) #62

The above features are specific to the full graph view rather than the embeded version of saved graphs, so I dont think 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 that should be possible, good idea!

(Paul) #63

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.

(Trystan Lea) #64

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


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.

(Paul) #65


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)

(Paul) #66

I tried the graph module on Android (whilst looking at the '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?

(Trystan Lea) #67

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