ShiboBrady / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

Expose pie highlight and unhighlight as public methods #673

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
For most chart types, you can do flotObj.highlight or flotObj.unhighlight, but 
it seems like that is not done for pies.  It results in nasty questions (and 
horrible hacky answers) like this one coming up:

http://stackoverflow.com/questions/8771361/flot-pie-charts-externally-selecting-
slices/8782008#8782008

Original issue reported on code.google.com by ryl...@gmail.com on 5 Mar 2012 at 6:34

GoogleCodeExporter commented 8 years ago

Original comment by dnsch...@gmail.com on 7 May 2012 at 11:58

GoogleCodeExporter commented 8 years ago
Hi Dave,

We've looked into this issue and found:

1) The un/highlight functions were not working when called with a numeric 
argument. This can be fixed by replacing s = series[s]; in jquery.flot.pie.js 
with s = plot.getData()[s];

2) The un/highlight functions were not getting set on the plot object passed 
into init in jquery.flot.pie.js.

3) If we set plot.highlight to equal the highlight function defined in 
jquery.flot.pie.js, then highlighting works for pie plots but not other types 
of plots.

How should we proceed? 

A) Should we rename the highlight function in jquery.flot.pie.js to something 
like pieHighlight? 

B) Should we rewrite the highlight function in jquery.flot.pie.js to delegate 
to the old highlight function if called on a non-pie type of plot? If we do 
this, how should we determine if the plot is a pie plot? Is checking 
plot.getOptions().series.pie.show sufficient? Also, given that the two 
highlight functions take a different number of arguments, is it better to add a 
third named argument to the highlight function in flot.pie.js or to use the 
arguments object?

Happy to provide a patch once we know the best way to proceed.

Thanks!
Trucy

Original comment by trucy.p...@gmail.com on 13 Jul 2012 at 8:46