chart.events.click

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« 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 Arnaud on 1st August 2013
Hi

I was thinking how it would be possible to know on with canvas we are clicking when we have mutiple displays of canvas.

I am displaying 4 pies and i would like when i click on a slice on 1 pie to make a zoom and display some details corresponding to the slice the pie on which I clicked;

chart.events.click method let me know the index on which I clicked but not the pie name/object to which belongs the slice.

REgards,

Arnaud
Posted by Arnaud on 1st August 2013
Got it !

function myFunc (e, shape)
     {
         // If you have multiple charts on your canvas the .__object__ is a reference to
         // the last one that you created
         var obj = e.target.__object__
        
         var index = shape['index'];
         var value = obj.data[index];
        
         alert('Value is: ' + value);
     }
Posted by RGraph support on 2nd August 2013
Hi there,

You can use the __object__ reference - but it points to the last object that was added to your canvas - which may o may not be the one you want.

The object is also held in the shape variable:


function myFunc (e, shape)
{
     var obj = shape['object'];
         
     var index = shape['index'];
     var value = obj.data[index];
         
     alert('Value is: ' + value);
}



Richard, RGraph Support

Help support RGraph - single site license only £99!
   www.rgraph.net/license#single-site
Posted by Rodrigo Santos on 2nd August 2013
I created a graph dynamically update the value when the screen works, but when I click on the graph screen appears antigo.eu created a graph dynamically update the value when the screen works, but when I click on the screen appears the old graph.
I'm using: stou using:

RGraph.Clear(this.simulador);
     pie = new RGraph.Pie('simulador',[contribuicao, rentabilizacao])
     .Set('tooltips', ['Contribuições: R$ '+moeda(contribuicao,2,',','.')+"\n - Porcentagem: "+moeda(porContribuicao,2,',','.')+ "%",'Rentabilização: R$ ' +moeda(rentabilizacao,2,',','.')+"\n - Porcentagem: "+moeda(porRentabilizacao,2,',','.')+"%"])
     .Set('colors',['Gradient(#E1E1E1:rgb(82,173,196))','Gradient(#E1E1E1:rgb(189,98,98)'])
     .Set('chart.strokestyle', 'white')
     .Set('chart.linewidth', 3)
     .Set('chart.shadow', true)
     .Set('chart.tooltips.event', 'onmousemove')
     .Set('chart.exploded', 2)
     .Draw();
Posted by RGraph support on 5th August 2013
Hi there,

Maybe change your .Clear() call to a .Reset call():

RGraph.Reset(canvas);

PS: Very handy: translate.google.com/ :-)




Richard, RGraph Support

Help support RGraph - single site license only £99!
   www.rgraph.net/license#single-site
Posted by Rodrigo Santos on 5th August 2013
it worked, thank you very much.
.Reset() solved the problem

Add a reply




« Back to message list