Pie charts examples using Flot / jrGraph?

SteveX
SteveX
@ultrajam
9 years ago
2,584 posts
Do any Jamroom modules use pie charts drawn by Flot in jrGraph?

Thanks!


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

updated by @ultrajam: 05/21/16 06:44:10AM
michael
@michael
9 years ago
7,793 posts
Not that I'm aware of. jrGraph needs a re-look-at. I remember trying to setup a graph with double axis stuff a while back and the x stuff and y stuff wasn't getting through.

So if your trying something that you expect should work, but its not, it could well be jrGraph not getting your variables through to Flot.
brian
@brian
9 years ago
10,149 posts
Pie charts are not supported by Flot without a plugin, so right now there is no pie chart support.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
SteveX
SteveX
@ultrajam
9 years ago
2,584 posts
I have registered my graph function and added my graph template to my module.

In the graph function I add the flot pie chart js to the javascript_href_footer (the pie plugin script is already in the flot contrib directory).

If I hard code my data into my graph template it works ok, but I'm stuck with passing graph data into the template either via the jrGraph_embed function or via my custom graph function.

What I'd like to be able to do is pass in $override_data in some way, maybe in the smarty function eg:
{$override_data='[{ label: "Series1",  data: 10},{ label: "Series2",  data: 30},{ label: "Series3",  data: 90},{ label: "Series4",  data: 70},{ label: "Series5",  data: 80},{ label: "Series6",  data: 110}]' }
{jrGraph_embed module="ujPlanner" name="graph_pie_chart" override_data=$override_data}
Or in the registered function, eg:
$_rs['override_data'] = array("Series1" => 10,"Series2" => 5,"Series3" => 11,"Series4" => 7);

For now though I think I'm going to have to parse a non-jrGraph graph template within my module so that I can get my item data to appear as a pie.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
SteveX
SteveX
@ultrajam
9 years ago
2,584 posts
I actually ended up bypassing jrGraph js by using php to draw the pie chart and save it as an item image when saving or updating the item. That way I don't need to cache it and can use the same image to print into a pdf (one of the requirements of the design is for the item to be saveable as a pdf).


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
brian
@brian
9 years ago
10,149 posts
Glad it is at least working for you now - down the road here when I get some time I can revisit the jrGraph module and look at bundling in the pie chart module.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

Tags