jQuery Plug-in

Bar Fly

A flyweight bar chart plug-in for jQuery. Bar Fly supports multiple data sets and can animate the transition between sets.

Bar Fly is only 3 KB when minified. It draws charts using only CSS so it can be used in browsers without Flash or Canvas support.

Bar Fly’s only requirement is jQuery, v1.3 or newer. The jQuery easing plug-in can be used for smoother animation:

Bar Fly is intentionally minimal and won’t be appropriate for everyone. For a more complete graphing solution, check out flot or jqPlot:

Usage

Include the Bar Fly plug-in after jQuery:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.barfly-1.0.min.js"></script>

Select an element and create a chart:

$('#foo').barfly({ data: [1,2,3,4,5,6,7,8,9] });

There are a variety of configuration options available:

When there are multiple charts on a page, some common settings can be specifed through $.barflyDefaults:

Once a Bar Fly chart has been created, it can be controlled or queried through its public methods:

Before the public methods of a chart can be called, the chart object must be retrieved. Accessing the Bar Fly chart instance can be accomplished in two ways:

A Bar Fly chart will trigger events at various points in its lifecycle. See the examples for

Tutorial

Check out the Bar Fly tutorial for an introduction to jQuery plug-in development as well as an examination of the Bar Fly code.

Support

Let's Work Together…

We're available for Javascript, Ruby on Rails and iPhone development projects.