devanshukumar / flot

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

Pie Charts #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I didn't notice pie charts in the todo. I think they would be a great addition.

Original issue reported on code.google.com by mmihajlo...@gmail.com on 6 Dec 2007 at 6:39

GoogleCodeExporter commented 8 years ago

Original comment by olau%iol...@gtempaccount.com on 10 Dec 2007 at 9:55

GoogleCodeExporter commented 8 years ago
I have added pie chart + multiple bars chart support functions.  Please take a 
look
at demo.html, and also svn diff in diff.txt file.

Original comment by trie...@gmail.com on 7 Feb 2008 at 9:22

Attachments:

GoogleCodeExporter commented 8 years ago
Looks fantastic! Have you tried it with a shadow effect?

Original comment by mmihajlo...@gmail.com on 7 Feb 2008 at 9:31

GoogleCodeExporter commented 8 years ago
It is the next step of my experiment. 

Original comment by trie...@gmail.com on 7 Feb 2008 at 9:35

GoogleCodeExporter commented 8 years ago
Shadow, shadow and shadow everywhere

Original comment by trie...@gmail.com on 27 Feb 2008 at 9:02

Attachments:

GoogleCodeExporter commented 8 years ago
Lookin good. Only I don't think the shadow should show between the pie pieces. 
Is
there a way to change the direction?

Original comment by mmihajlo...@gmail.com on 28 Feb 2008 at 5:18

GoogleCodeExporter commented 8 years ago
how about a diff against flot 0.4

Original comment by mainstre...@gmail.com on 11 Mar 2008 at 3:53

GoogleCodeExporter commented 8 years ago
Here is the diff.  FYI, the code also has functionality to show data click 
point but
I don't have time to make a demo page.

Original comment by trie...@gmail.com on 11 Mar 2008 at 8:17

Attachments:

GoogleCodeExporter commented 8 years ago
It's really cool. If you can provide the uncompressed version of modified 
flot.js
i'll be very thankful to you.

Original comment by samithav...@gmail.com on 26 Mar 2008 at 3:26

GoogleCodeExporter commented 8 years ago
What do you patch diff04.txt against? I tried patching the patched v0.3 version 
and
the current v0.4 version and both did not fully patch, can you provide a pre 
patched
unpacked version or instructions on what to patch and in what order?

Original comment by row....@gmail.com on 1 Apr 2008 at 6:26

GoogleCodeExporter commented 8 years ago
Here is the unpack version of modified jquery.flot.js

Original comment by trie...@gmail.com on 3 Apr 2008 at 1:50

Attachments:

GoogleCodeExporter commented 8 years ago
It seems that the pie graph cannot work with one series of data? Am I missing 
something?

Original comment by mmihajlo...@gmail.com on 16 Jul 2008 at 11:27

GoogleCodeExporter commented 8 years ago
It seems that the pie graph cannot work with one series of data? Am I missing 
something?

Original comment by mmihajlo...@gmail.com on 16 Jul 2008 at 11:28

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
var dataSet = [{label:"title1", data:[[0, 100]]},
{label:"title2", data:[[1, 200]]},
{label:"title3", data:[[2, 300]]}];
var options = {
    pies: { show: true, autoScale: true, fillOpacity: 1 }
};
$.plot($("#pieChart"), dataSet, options );

Original comment by jimmy...@gmail.com on 23 Jul 2008 at 11:01

GoogleCodeExporter commented 8 years ago
How can we get the location i mean the label when mouseover on particular arc ?

anyone have idea?

Original comment by koneru.chowdary on 25 Aug 2008 at 10:04

GoogleCodeExporter commented 8 years ago
how can i change the color of any specific series

Original comment by youak...@gmail.com on 16 Sep 2008 at 7:53

GoogleCodeExporter commented 8 years ago
Does the latest flot version 0.5 support pie charts?

Original comment by ari...@gmail.com on 21 Nov 2008 at 10:13

GoogleCodeExporter commented 8 years ago
same question - does .5 support pie charts? anybody want to answer this one?

Original comment by Luc.Pett...@gmail.com on 8 Dec 2008 at 10:27

GoogleCodeExporter commented 8 years ago
No, I haven't had time to work on flot since the latest patch I made in Feb.

Original comment by trie...@gmail.com on 9 Dec 2008 at 2:38

GoogleCodeExporter commented 8 years ago
to change colors for any specific series, you can define option as follows:

var options = {colors: ["#9440ed","#4da74d", "#edc240","#afd8f8","#cb4b4b"]}

the order of colors corresponded of data order defined in data set variable.

Original comment by trie...@gmail.com on 9 Dec 2008 at 2:53

GoogleCodeExporter commented 8 years ago
Would be really helpful if the code could be either supplied in a .js file that 
could 
be used next to jquery.flot.js (version 0.5) or included in this file, so 
webapps can 
use the pie chart together with the flot chart more easily. Is this do-able?

Original comment by bertvand...@gmail.com on 15 Dec 2008 at 5:18

GoogleCodeExporter commented 8 years ago
It is a highly desirable feature....

Original comment by singh.gu...@gmail.com on 5 Jan 2009 at 6:27

GoogleCodeExporter commented 8 years ago
I'm available to integrate the diff04.txt into the newer 0.5 jquery.flot.js. 
Please write me to coordinate for this issue, cause I wish to know if is 
possible to
integrate directly in the development version.

Original comment by fabrizio...@gmail.com on 8 Jan 2009 at 10:45

GoogleCodeExporter commented 8 years ago
Hi Farbrizio, unfortunately I don't have any email address from you but I need 
pie
charts within the next week for flot so I will do at least port it to 0.5. If 
you
need help just contact me directly at felix.schwarz@oss.schwarz.eu. Resources 
like hg
repository with patch queue containing initial merge with 0.5 available at my 
site.

Original comment by felix.sc...@oss.schwarz.eu on 8 Jan 2009 at 10:52

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I have modified the r120 applying the patch. All seems to work perfectly. 

Here the patch, jquery (r120) patched and a demo.

I have cutted the DrawBar improvement cause it doesnt work under the demo, so I
prefer to make pie chart working (and I dont need the Bar improvement).

Please advise me if this changes will be merged in the SVN, so I will continue 
to use
latest version insted of mine.

I suggest also to change the release number (0.6?), due to the fact that 0.5 
has no
pie support.

Original comment by fabrizio...@gmail.com on 8 Jan 2009 at 3:51

Attachments:

GoogleCodeExporter commented 8 years ago
Fabrizio, thanks for your patch porting. I continued your work because your 
patch is
not fully aligned to flot's coding style (bracket placement, tab/space usage).
Furthermore it still contains some pieces from the bar chart patch. I also 
built an
HTML example page suitable (hopefully) for inclusion in flot's example directory
which just shows the pie chart usage.

I'm not yet finished with the cleanup but I wanted to avoid duplicate work so I
pushed my patches in a hg repository where you can always access the latest 
version:
http://oss.schwarz.eu/cgi-bin/hgwebdir.cgi/flot_charts/

My patches diffed against float 0.5 because I need this working on a stable 
version
but I think it is quite easy re-doing them against SVN trunk)

Issues still open:
- pie chart patch still contains unrelated things (random color)
- data interface for pie charts is not that nice: Currently it is the same as 
for
normal time series. But pie charts should imho just get a single value. There is
another pie chart implementation
(http://groups.google.com/group/flot-graphs/browse_thread/thread/9b1e73e4025b376
c)
which gets this right. Probably I will try to port this interface.

Original comment by felix.sc...@oss.schwarz.eu on 12 Jan 2009 at 5:10

GoogleCodeExporter commented 8 years ago
Hi Felix, I can't seem to apply your patches to the released 0.5, is there 
something
special I should be doing :( ... even when I strip out the 'diff -r xxx' lines 
and
apply the patches individually in the order specified in 'series' I get invalid 
hunk
complaints :( 

I'd really like to get the pie-charts working from your patch, with the gradient
support provided in the trunk. (p.s. I'm loving the new charts in Agilo)

Original comment by ciar...@gmail.com on 30 Jan 2009 at 9:20

GoogleCodeExporter commented 8 years ago
After looking at my patches, I noticed that - opposed to my previous post - I 
diffed
them against trunk (r122).

Btw: I did some serious cleanup on my patches so the only outstanding issue is 
the
data interface for piecharts.

Original comment by felix.sc...@oss.schwarz.eu on 30 Jan 2009 at 9:55

GoogleCodeExporter commented 8 years ago
Hi,
here I have worked on the patch diff for r132

There are some hacks for multibar, due to some bug i have found (like labels not
exactly under the bars), and for these reasons multibar is not perfect. I use
currently the pie-chart for my project and I have no side-effect (like the 
multi-bar
instead).

-Fabrizio.

Original comment by fabrizio...@gmail.com on 18 Feb 2009 at 2:49

Attachments:

GoogleCodeExporter commented 8 years ago
Can the pie chart support json data? :). I will test it.
Also, I suggest that we can make a change to the json data input to select the 
column
that will be plotted.

Original comment by hui...@gmail.com on 21 Feb 2009 at 5:36

GoogleCodeExporter commented 8 years ago
Here the updated version (r136) of the patch

Original comment by fabrizio...@gmail.com on 23 Feb 2009 at 9:08

Attachments:

GoogleCodeExporter commented 8 years ago
The X labels on multibar charts are not offset correctly.  Quite frustrating.

Original comment by jno...@gmail.com on 24 Feb 2009 at 9:19

GoogleCodeExporter commented 8 years ago
I've created a new patch based upon r136 and the code in Comment 34 by
fabrizio.ciacchi that adds some new features that I needed.

Pies now support hovering if "hoverable" is set to true in the grid options, 
though
it doesn't work in IE because excanvas doesn't support the isPointInPath 
function
(just never gives a hover event or effect).  options.pies supports two new 
options,
"highlightColor" and "highlightOpacity" which control the look of the hover 
effect. 
The datapoint passed in the item to the hover event handler will have the first 
value
as the percentage, and the second value as the actual summarized value.

The series data can now be either a raw number or a normal data array that is
summarized.  The percentage that is calculated is also stored on the series 
object as
"percent" during rendering for later reference.

options.pies now supports an optional "labelFormatter" function that formats the
label that is displayed for each series.  The first parameter is the calculated
percentage, the second parameter is the series object.  If no function is 
supplied,
the label is formatted the same as before (just a percent sign).

Original comment by btburnett3 on 25 Feb 2009 at 9:13

Attachments:

GoogleCodeExporter commented 8 years ago
Hi guys,

I really like that so many people try to improve and extend this but let's have 
a
simple pie chart thing in Flot before making even more changes. If you really 
want to
extend the current base, I suggest you open an account on bitbucket or github 
with a
patch queue so the new additions can be marked clearly. The current attachment 
flood
is a mess.

I did not have the time to review Fabrizio's changes but in my repository
(http://oss.schwarz.eu/cgi-bin/hgwebdir.cgi/flot_charts/) you find nicely 
separated
patches by feature. Let's work in a structured way otherwise this will never be 
done.

Original comment by felix.sc...@oss.schwarz.eu on 25 Feb 2009 at 9:22

GoogleCodeExporter commented 8 years ago
Based on felix's comment above, I checked out github and found another branch 
of flot
that seems to have more functionality at 
http://github.com/thenduks/flot/tree/master.
 There was some discussion there about adding pie charts, and the conclusion was that
due to size flot should probably be broken out into multiple modules for 
different
chart types.  I've forked the project at
http://github.com/btburnett3/flot/tree/master while I work on it.  I'll 
hopefully
have something in a few days.

Original comment by btburnett3 on 26 Feb 2009 at 2:00

GoogleCodeExporter commented 8 years ago
Hi all,
I have updated the patch to r139. There are some bug i have no time to fix:
- the X labels on multibars are not aligned (yes, I know that is very 
frustrating);
- for piechart i disable the points valutation in for-cicle (I try to pass from 
data
to datapoints);

I have made a bit of refactoring, so all the "new" functions are at the end of 
the
file, and the other patched part contains "added" part, not sostitution, so I 
think
could be simpler to mantain the future patch.

I'm thinking about mantaining this patch and I wish to fix the multibar chart, 
that
is "orrible" coded. I dont understand however, why pie-chart are not merged into
flot, I use this patched version of flot for a webanalytics project and 
pie-chart
seems not to be affected by bugs.

I wish to find a way to mantain a patched version, perhaps I need to think to a 
way
of using different chart with a sort of plugin system, so we can have the core 
flot
regulary updated by this svn, and the patched version only as an adding file to 
use.
I talk about this, cause there are a lot of functionality developed by good
programmer (have you seen flot on github?), but is stupid not to mantain link to
original project. Another good reason is also that, for example, btburnett3 is
adpating flot for YUI framework, not Jquery, so could be beautiful to make flot
js-platform-independent.

Original comment by fabrizio...@gmail.com on 2 Mar 2009 at 2:11

Attachments:

GoogleCodeExporter commented 8 years ago
The first step in getting this merged is a critical review. The code must be in 
good
condition, and it needs to be on par with the rest of Flot when it comes to API
quality/usage.

Original comment by olau%iol...@gtempaccount.com on 2 Mar 2009 at 3:36

GoogleCodeExporter commented 8 years ago
In this weeks I try to bring pie chart to this level and I will give you a 
patch.
For multibar I think it need a complete redesign.

Original comment by fabrizio...@gmail.com on 2 Mar 2009 at 3:49

GoogleCodeExporter commented 8 years ago
We should really work on coming up with a good plug-in system for flot. It 
would be
nice to just be able to add a js file like 'flot.chart.pie.js after 
'flot.core.js'
and be able to call $('#placeholder').plot('pie', data, options).

Original comment by JACortinas on 2 Mar 2009 at 5:12

GoogleCodeExporter commented 8 years ago
I will use jfreechart and keep on my interest on javascript charting.

Yeah, I agree with a complete redesign to learn some from jfreechart and from
dojox.charting. I think if it is depedent on jquery is a good idea.

Original comment by grailsfo...@gmail.com on 5 Mar 2009 at 5:55

GoogleCodeExporter commented 8 years ago
I have updated the patch to r144. I wish this week I can send the patch for pie 
chart
only.

Original comment by fabrizio...@gmail.com on 9 Mar 2009 at 11:29

Attachments:

GoogleCodeExporter commented 8 years ago
Updated to r146. The r144 has a bug that make flot not working under IE.

Original comment by fabrizio...@gmail.com on 10 Mar 2009 at 5:32

Attachments:

GoogleCodeExporter commented 8 years ago
Updated to r147. Attached also a minified version.

Original comment by fabrizio...@gmail.com on 13 Mar 2009 at 10:54

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Fabrizio, it seems that the patch 147 is ... the source of JQuery.
flot is a great lib btw. congrats.

Original comment by jcheu...@gmail.com on 19 Mar 2009 at 11:02

GoogleCodeExporter commented 8 years ago
Congratulations for this great job.

I used it the simply way :
var data_pie_0 = [
 { label: 'Niveau A', data: [[0,2]]},
 { label: 'Niveau B', data: [[1,2]]},
 { label: 'Niveau C', data: [[2,1]]},
 { label: 'Niveau D', data: [[3,0]]}
];
$.plot($('#pie_graph_0'), data_pie_0, {
 pies: {show: true, labelWidth: 30, fontSize: 10, autoScale: true, fillOpacity: 1}
});

You noticed the ZERO data value ---> The last slice recover all the over (under 
IE)
if the zero value is the last data entry, and will be slightly present under the
others if it is the first data enry.

I corrected this in the drawMyPieSeries functions:
...
startAngle=endAngle;
if (series[j].data == 0)
    endAngle+=0.0001*(2*Math.PI);
else
    endAngle+=pct*(2*Math.PI);
...

Hope this help.

Original comment by fx.n...@free.fr on 26 Mar 2009 at 4:47

GoogleCodeExporter commented 8 years ago
Hi, I'm developing flot wrapper of Ext JS
http://code.google.com/p/extflot/

Now, I'm working to migrate pie chart support.
I use pathed r148.
But it does not work well.

 * The series[i].data is overwrited internally, but my wrapper recycles series that
is got by getData(), and calls plot() many times...
   So I propose that the calcurated values from data are hold in another member.

{{{
        function preparePieData(series)
        {
            for(i = 0; i < series.length; i++)
            {
                var ratio = 0;
                for(j = 0; j < series[i].data.length; j++)
                    ratio += parseInt(series[i].data[j][1]);

                series[i].ratio = ratio;
            }
        }
}}}

 * The bar graph does not work well in patched r148.
   Grid and ticks calcurations are wrong.
   Please see the following demo...
   http://extflot.googlecode.com/svn/trunk/pie.html

I think the pie chart support is very good job.
So I hope that it is released as official.

I'm sorry my poor English.
Thanks,

Original comment by kiyot...@gmail.com on 27 Mar 2009 at 6:46

GoogleCodeExporter commented 8 years ago
Hi Fabrizio,

As you may see that I initiated multi bar and pie chart support code, I would 
like to
jump back to the board again because I have a project which involves with graph
presentation.  Do you want to work together on the "to do" list to improve the 
code?
 If so please shoot me email at trieutn@gmail.com. Thanks.

Original comment by trie...@gmail.com on 27 Mar 2009 at 6:57