Multi - Multigraphs. I found it very useful in the past to have a number of multigraph.php files e.g. multigraph2.php etc. In the older emoncms releases I could simply copy multigraph.php file and add feeds I wanted to my new multigraph2.php file and it could be added to web page showing the specified feeds and option to check these feeds or not.
Vey useful where many feeds are involved. In may case 12CT providing 48 feeds looks very cluttered it would be great to be able to divide into main groups - mains users. The new emoncms offers so much more so I won't revert. It would be much appreciated if someone could make above available in latest release or provide some guidence as to where I could start to add this feature again.
As always thanks in advance. Cheers
Peter
Re: Multi Multigraph
Hello Peter, its still there. available in views/vis/multigraph_manual.php,
Re: Multi Multigraph
Great.
Is this the only code I change for feed id 3 and 9 with names Mains and Coldroom in multigraph_manual.php file. Appologies if I missed something obvious.
var feedlist = [];
feedlist[0] = {id: 3, selected: 1, plot: {data: null, label: "Mains", lines: { show: true, fill: true } } };
feedlist[1] = {id: 9, selected: 1, plot: {data: null, label: "Coldroom", lines: { show: true, fill: false }, yaxis:2} };
vis_feed_data();
http://mysite/Veiws/vis/multigraph_manual.php
get multigraph heading and D W M Y | + - < > but with no graph or check boxes
Extract diplayed source code
<script id="source" language="javascript" type="text/javascript">
$('#graph').width($('#graph_bound').width());
$('#graph').height($('#graph_bound').height());
var path = "";
var apikey = "";
var timeWindow = (3600000*24.0*7); //Initial time window
var start = ((new Date()).getTime())-timeWindow; //Get start time
var end = (new Date()).getTime(); //Get end time
var timeWindowChanged = 0;
var feedlist = [];
feedlist[0] = {id: 3, selected: 1, plot: {data: null, label: "Bar", lines: { show: true, fill: true } } };
feedlist[1] = {id: 9, selected: 1, plot: {data: null, label: "Bar1", lines: { show: true, fill: false }, yaxis:2} };
vis_feed_data();
/*
I notice path and apikey are empty in page source code, could this be issue???
Cheers
Peter
Re: Multi Multigraph
Its been a while since I tried the manual script did it work for you putting in the path and apikey?
Re: Multi Multigraph
No Luck with multigraph_manual.php, see link below:
http://weir.wedo.ie/Views/vis/multigraph_manual.php?&apikey=504f029f7747...
see also link to multigraph which does work
http://weir.wedo.ie/vis/multigraph?&apikey=504f029f7747076d984def220d315...
Re: Multi Multigraph
ok, I see the error's , I think they are path errors in the js scripts, will try and fix and push up to github. You could probably copy the inculded js script paths from multigraph.php to get it running in the meantime.
Re: Multi Multigraph
Tried cutting over all code except var feedlist code above. Didn't work. I think its time to learn code a bit more so will start with Emoncms from scratch and go from there. If I get a working solution before you I'll post same.
Thanks
Peter
Re: Multi Multigraph
To access multigraph_manual you need to include Views in URL e.g.
http://ahtrial.wedo.ie/Views/vis/multigraph_manual.php?feedid=1&apikey=3f580e5bc52d85ba8c7aa08829b5f5c2&embed=1
the page source code shows incomplete scr address for javascripts:
<script language="javascript" type="text/javascript" src="Includes/flot/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="Includes/flot/jquery.flot.min.js"></script>
<script language="javascript" type="text/javascript" src="Includes/flot/jquery.flot.selection.min.js"></script>
<script language="javascript" type="text/javascript" src="Views/vis/common/api.js"></script>
<script language="javascript" type="text/javascript" src="Views/vis/common/inst.js"></script>
when compared to working multigraph url src using normal vis/multigraph the src is complete with mysite
Note also when normal multigraph file is accessed using Views in url it does not work either with incomplete javascripts also.
http://ahtrial.wedo.ie/Views/vis/multigraph.php?feedid=1&apikey=3f580e5bc52d85ba8c7aa08829b5f5c2&embed=1
Hope this helps, if I only stating obvious or confusing issue please ignore.
Cheers
Peter
Re: Multi Multigraph
Hi,
looks like the multigraph_manual code below needs to be added to vis_controller.php file to point to multigraph_manual.php file
if ($action == 'multigraph_manual' && $session['read'])
{
$output['content'] = view("vis/multigraph_manual.php", array());
}
To add additional multigraph :
First create new vis/multigraph_manual.php file with required feeds and then change multigraph_manual to new name in code above and add to vis_controller.php file e.g. multigraph2 and add destination address for new multigraph file e.g. vis/multigraph2.php in /Views/vis/ folder
example :
if ($action == 'multigraph2&& $session['read'])
{
$output['content'] = view("vis/multigraph2.php", array());
}
Note the multigraph_manual.php file needs to be updated, I copied multigraph.php file and replaced the // Load list of feeds from server code with desired feeds.
Needs further testing but I'm sure Trystan will come up with a better way. Hope above is of some use in mean time.
var feedlist = [];
feedlist[0] = {id: 3, selected: 1, plot: {data: null, label: "Main", lines: { show: true, fill: true } } };
feedlist[1] = {id: 9, selected: 1, plot: {data: null, label: "Coldroom", lines: { show: true, fill: false }, yaxis:2} };
vis_feed_data();
Re: Multi Multigraph
Hello Peter, good work on getting it to work, your solution is probably the best one for single user installs.
I have updated the script to allow direct access which although not ideal in the long term (it might be good to have an option to create multiple multigraphs in the GUI itself) makes it relatively straight forward to use now.
To access a manual multigraph you would enter the following in the browser:
http://localhost/emoncms3/Views/vis/multigraph_manual.php?apikey=YOURAPIKEY
To create additional multigraphs its just a matter of creating multiple copies of the file.
Thanks for going through it and posting a solution.
Re: Multi Multigraph
Hi Trystan, Thanks Multigraph GUI sounds great. Will try above as soon as you add to openenergymonitor-emoncms3 release available on github.
Cheers
Peter
Re: Multi Multigraph
Hi,
There is a slight bug on line 34 when calling the page directly:
PHP Notice: Undefined index: embed in /Views/vis/multigraph_manual.php on line 34
I fixed this by changing it to:
$embed = isset($_GET["embed"])?intval($_GET["embed"]):0;
Regards
Ian
--