Radar dynamic data

Share RGraph:   Share or Like RGraph on Facebook!

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Benoit on 10th April 2013
hello,

I'm new in php and javascript. I'm trying to display a radar graph dynamicly but i have a problem.

Can you please help me to fix it.

if i make this, it's working proprely : var radar3 = new RGraph.Radar('cvs',[0,0,1,0],[0,1,0,0],[0,0,0,0],[0,0,0,0],[1,0,0,0]);

but if i do this :
var data = [[0,0,1,0],[0,1,0,0],[0,0,0,0],[0,0,0,0],[1,0,0,0]];
var radar3 = new RGraph.Radar('cvs',data);

it's not working.

can you please help me ?



here is my "real" code :

$('#simuler').click(function()
{
$.post('SimulationGraph.php',$('.cours:checked,#prop').serialize(),function(result){
 
          /* i'll show you what i have in result :
[[[0,0,1,0],[0,1,0,0],[0,0,0,0],[0,0,0,0],[1,0,0,0]],[['Competence1','Competence2','Competence3','Competence4']]] */
        
        
         var tableau = eval(result); // here i put the result in a object
  var radar3 = new RGraph.Radar('cvs',tableau[0]);
             radar3.Set('chart.labels',tableau[1][0]);
             radar3.Set('chart.background.circles.poly', true);
             radar3.Set('chart.background.circles.spacing', 30);
             radar3.Set('chart.colors', ['transparent']);
             radar3.Set('chart.axes.color', 'transparent');
             radar3.Set('chart.highlights', true);
             radar3.Set('chart.strokestyle', ['#FEFCB0','#FEF600','#F70000','#FEBA00','#42C601']);
             radar3.Set('chart.linewidth', 2);
             radar3.Set('chart.linewidth', 2);
             RGraph.Effects.Radar.Grow(radar3);
  });

thanks you
Posted by RGraph support on 10th April 2013
Hi there,

In your first example you're passing each dataset as a separate argument to the constructor - but in the second you're passing each dataset as part of one big array. The Radar chart doesn't support this type of dataset passing.



Richard, RGraph Support
Posted by Benoit on 10th April 2013
thanks you for your answer.

can you tell me how can i manage to pass each dataset as a separate argument to the constructor please? i mean dynamicly ? is it possible?

Benoit
Posted by RGraph support on 10th April 2013
Hi there,

As of the next beta, which will be this weekend (or thereabouts), it will be possible. So what you're after will be feasible:

data = [
         [4,5,8,6,3,5,2], // First dataset
         [4,8,6,4,3,2,4], // Second dataset
         [1,2,3,8,9,4,5] // Third dataset
        ]
obj = new RGraph.Radar('cvs', data);



Richard, RGraph Support
Posted by Benoit on 10th April 2013
ok thanks you.

i'll wait the next beta.


Benoit
Posted by RGraph support on 10th April 2013
Hi there,

There's a demo of it working in this way in the demo area.

Richard, RGraph Support
Posted by Benoit on 11th April 2013
nice, it's what i want. thanks you

So it'll be available next week?

Benoit
Posted by RGraph support on 11th April 2013
Hi there,

It'll be in the next beta - so whenever that's available. Usually they happen at weekends.


Richard
Posted by Benoit on 16th April 2013
hi,

I have tried your beta and it work perfectly. thank you.
I have a last question about your graphs.

How can i clear the radar? or maybe the canvas ?

i need to reset it every time i click on a button.

Benoit
Posted by RGraph support on 16th April 2013
Hi there,

To clear the canvas you can use either the RGraph.Clear() function or the RGraph.Reset() function. The API documentation is here:

www.rgraph.net/docs/api.html

PS - cheers!

Richard, RGraph Support

Add a reply




« Back to message list