93

I want to create a pie chart in JavaScript. On searching I found the Google Charts API. Since we are using jQuery I found that there is jQuery integration for Google Charts available.

But my problem is here the actual data is sent to the Google server for creating the charts. Is there a way to prevent the data from being sent to Google? I am concerned about sending my data to a third party.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Arun P Johny
  • 384,651
  • 66
  • 527
  • 531

7 Answers7

95

Flot

Limitations: lines, points, filled areas, bars, pie and combinations of these

From an interaction perspective, Flot by far will get you as close as possible to Flash graphing as you can get with jQuery. Whilst the graph output is pretty slick, and great looking, you can also interact with data points. What I mean by this is you can have the ability to hover over a data point and get visual feedback on the value of that point in the graph.

The trunk version of flot supports pie charts.

Flot Zoom capability.

On top of this, you also have the ability to select a chunk of the graph to get data back for a particular “zone”. As a secondary feature to this “zoning”, you can also select an area on a graph and zoom in to see the data points a little more closely. Very cool.


Sparklines

Limitations: Pie, Line, Bar, Combination

Sparklines is my favourite mini graphing tool out there. Really great for dashboard style graphs (think Google Analytics dashboard next time you login). Because they’re so tiny, they can be included in line (as in the example above). Another nice idea which can be used in all graphing plugins is the self-refresh capabilities. Their Mouse-Speed demo shows you the power of live charting at its best.


Query Chart 0.21

Limitations: Area, Line, Bar and combinations of these

jQuery Chart 0.21 isn’t the nicest looking charting plugin out there it has to be said. It’s pretty basic in functionality when it comes to the charts it can handle, however it can be flexible if you can put in some time and effort into it.

Adding values into a chart is relatively simple:

.chartAdd({

    "label"  : "Leads",
    "type"   : "Line",
    "color"  : "#008800",
    "values" : ["100","124","222","44","123","23","99"]
});

jQchart

Limitations: Bar, Line

jQchart is an odd one, they’ve built in animation transistions and drag/drop functionality into the chart, however it’s a little clunky – and seemingly pointless. It does generate nice looking charts if you get the CSS setup right, but there are better out there.


TufteGraph

Limitations: Bar and Stacked Bar

Tuftegraph sells itself as “pretty bar graphs that you would show your mother”. It comes close, Flot is prettier, but Tufte does lend itself to be very lightweight. Although with that comes restrictions – there are few options to choose from, so you get what you’re given. Check it out for a quick win bar chart.

Community
  • 1
  • 1
Sorantis
  • 14,496
  • 5
  • 31
  • 37
  • Thanks for your answer. I'm checking jqPlot now it seems to solve my problem. But 1 issue still remains, I need the chart legends to appear with in the chart than outside. – Arun P Johny Aug 03 '09 at 17:55
  • 7
    Whenever I see a nice list like this I find myself wishing each item was a separate answer so they could be voted on independently. It would be so much more efficient to simply use the lib with the highest score. – Jesse Aldridge Sep 18 '12 at 10:12
  • 2
    Chiming in here as someone who's used Flot and found it to be a good solid lib. – Brighid McDonnell Nov 01 '12 at 17:58
  • grr i tried flot but ditched it as I could not customize axis labels – chiliNUT Jun 18 '15 at 04:34
  • Sorantis, link to Query Chart 0.21 is dead. – jawo Aug 11 '15 at 06:29
48

jqPlot looks pretty good and it is open source.

Here's a link to the most impressive and up-to-date jqPlot examples.

kevinmicke
  • 5,038
  • 2
  • 20
  • 22
Thomas Bratt
  • 48,038
  • 36
  • 121
  • 139
  • note: in most versions (recent too at the moment) it's using a $ reference outside of a (function($)..) declaration, so it might conflict with prototype or anything else – Mario Peshev Nov 25 '12 at 16:22
5

Tons of great suggestions here, just going to throw ZingChart onto the stack for good measure. We recently released a jQuery wrapper for the library that makes it even easier to build and customize charts. The CDN links are in the demo below.

I'm on the ZingChart team and we're here to answer any questions any of you might have!

$('#pie-chart').zingchart({
  "data": {
    "type": "pie",
    "legend": {},
    "series": [{
      "values": [5]
    }, {
      "values": [10]
    }, {
      "values": [15]
    }]
  }
});
<script src="http://cdn.zingchart.com/zingchart.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.zingchart.com/zingchart.jquery.min.js"></script>

<div id="pie-chart"></div>
Jailbot
  • 2,538
  • 19
  • 19
4

A few others that have not been mentioned:

For mini pies, lines and bars, Peity is brilliant, simple, tiny, fast, uses really elegant markup.

I'm not sure of it's relationship with Flot (given its name), but Flotr2 is pretty good, certainly does better pies than Flot.

Bluff produces nice-looking line graphs, but I had a bit of trouble with its pies.

Not what I was after, but another commercial product (much like Highcharts) is TeeChart.

Synchro
  • 35,538
  • 15
  • 81
  • 104
4

Chart.js is quite useful, supporting numerous other types of charts as well.

It can be used both with jQuery and without.

Timotheos
  • 405
  • 3
  • 8
  • 1
    Excellent pie chart library. I use charts.js for pie charts, and morris.js for everything else. morris.js is fantastic, except for those stupid f!&*# doughnut charts. When I want an actual pie chart without a f!^&*@ doughnut hole in it, I look no further than charts.js. Charts.js is probably a great solution for other types of charts as well, but you just can't beat the intentionally incredibly easy to use API of morris.js – chiliNUT Jun 18 '15 at 04:37
3

There is a new player in the field, offering advanced Navigation Charts that are using Canvas for super-smooth animations and performance:

https://zoomcharts.com/

Example of charts:

interactive pie chart

Documentation: https://zoomcharts.com/en/javascript-charts-library/charts-packages/pie-chart/

What is cool about this lib:

  • Others slice can be expanded
  • Pie offers drill down for hierarchical structures (see example)
  • write your own data source controller easily, or provide simple json file
  • export high res images out of box
  • full touch support, works smoothly on iPad, iPhone, android, etc.

enter image description here

Charts are free for non-commercial use, commercial licenses and technical support available as well.

Also interactive Time charts and Net Charts are there for you to use. enter image description here

enter image description here

Charts come with extensive API and Settings, so you can control every aspect of the charts.

jancha
  • 4,916
  • 1
  • 24
  • 39
0

Check TeeChart for Javascript

  • Free for non-commercial use.

  • Includes plugins for jQuery, Node.js, WordPress, Drupal, Joomla, Microsoft TypeScript, etc...

  • Interactive demos here and here.

  • Some screenshots of some of the demos:

TeeChart Javascript - Bars

TeeChart Javascript - Pie

TeeChart Javascript - Points

Yeray
  • 5,009
  • 1
  • 13
  • 25