Composing RGraphs Why they have the same pie

122 views
Skip to first unread message

wang dapeng

unread,
May 14, 2013, 1:59:36 AM5/14/13
to javascript-information...@googlegroups.com
Hi all:

In this example  :


Why they have the same chartpie , if i wanna display different ones, what should do  ?

thks very much




09nadita

unread,
May 15, 2013, 4:56:30 PM5/15/13
to javascript-information...@googlegroups.com
Hi,

i have the same problem as you.
 i'm trying to modify the code given but i haven't succeeded yet.

 Does anyone know how can it be done?

Thank you.


 




Wang Dapeng

unread,
May 22, 2013, 4:53:07 AM5/22/13
to javascript-information...@googlegroups.com
Nothing done !!! Oh god  ~~~


2013/5/16 09nadita <nadia...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "JavaScript InfoVis Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information-visua...@googlegroups.com.
To post to this group, send email to javascript-information...@googlegroups.com.
Visit this group at http://groups.google.com/group/javascript-information-visualization-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

John Bell

unread,
Jul 15, 2013, 6:11:35 PM7/15/13
to javascript-information...@googlegroups.com
Have you managed to make any progress with this issue?

Nate B

unread,
Aug 7, 2013, 9:02:07 PM8/7/13
to javascript-information...@googlegroups.com
I'm working this one out at the moment...

The "issue" is that the render function is somewhat "inbuilt" into the program, so I cant feed it in an extra value to do anything with.  I was going to feed in the "current level" & if the node is at the current level of +1 level, then draw.
The shortnodepide.render function is called for EVERY node, so if you have heaps of tree children - they ALL get passed to render EVERY node.

The workaround I though of is this...
There's 2 vars - json & jsonPIE
The JSON is used to generate the tree structure, JSONPIE used to create the pie graphs.

So think of the JSONPIE data as the colouring data, and generate/manipulate that on the fly.  i.e.:
node.onClick = <var JSONPIE = [node.children.data]>

You'll also need to reduce the tree depth to 1, as the colouring wouldnt make sense otherwise.

Will post up how I go.

Nate B

unread,
Aug 8, 2013, 3:34:20 AM8/8/13
to javascript-information...@googlegroups.com
yeah it works....
insert a pie load & computer within the onClick function:

Change:
            domElement.onclick = function() {
              st.onClick(node.id, {
                    Move: {
                        offsetY: -90
                    }
                }); 
            };

to:
            domElement.onclick = function() {
        jsonpie2 = {'id':'root', 'name':'test', 'data':{}, 'children':[{'id':'pie1', 'name':'pie1', 'data':{'$angularWidth': 20,'$color':'#55f'}},{'id':'pie2', 'name':'pie2', 'data':{'$angularWidth': 40,'$color':'#f5f'}}]};
        pie.loadJSON(jsonpie2);
        pie.compute();

              st.onClick(node.id, {
                    Move: {
                        offsetY: -90
                      }
        });
        };

and it behaves as required, however - just need to start auto generating the pie2 stuff.

John Bell

unread,
Aug 18, 2013, 5:43:57 PM8/18/13
to javascript-information...@googlegroups.com
Any luck?

I started another thread recently on this problem, looking at my approach as i wasn't sure how old this original thread was.


How is your approach working? Could we make all different pies generate "onInit()"?

John Bell

unread,
Aug 19, 2013, 6:09:07 PM8/19/13
to javascript-information...@googlegroups.com
Ok.

So in the section of the events. Where it says pie.plot(). 

LoadJSON and compute must be called for each node.

Have a list of json strings, one for each node and then set it during the render function.
charts[node.id]=jsonpie1
charts[node.id]=jsonpie2
charts[node.id]=jsonpie3

Where node.id is the node id, "root" or "pie1" etc, defined in the original json for the rgraph..


pie.loadJSON(charts[node.id])
pie.compute()
pie.plot()

Job done. :)

Liev Garcia

unread,
Jun 27, 2014, 11:29:56 AM6/27/14
to javascript-information...@googlegroups.com
Hi John, 

It seems you were successful in making this work. Could you kindly paste the code you used? Trying to do something very similar unsuccessfully so far!

Thank you!
Reply all
Reply to author
Forward
0 new messages