Skip to content

Commit

Permalink
Added some usage info to the Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ismasan committed Mar 18, 2010
1 parent 07f04c3 commit a2c90bc
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.markdown
@@ -1,3 +1,35 @@
# Peity # Peity


Peity (sounds like deity) is a simple jQuery plugin to create a mini pie chart from the contents of an element using canvas. Peity (sounds like deity) is a simple jQuery plugin to create a mini pie chart from the contents of an element using canvas.

## Usage


### HTML

<span class="chart_1">2/10</span>
<span class="chart_2">4/10</span>
<span class="chart_3">5/10</span>

### Javascript (jquery)

$(function(){
$('span').peity();
});

## Updating charts

Peity adds a "change" event trigger to your graph elements, so if you update their data your can regenerate one or more charts by triggering "change" on them.

$('span#chart_1').html("5/10").trigger('change')

## Subscribing to chart updates

After drawing the chart, Peity elements will trigger the event 'peity:changed', passing current and maximum values as event arguments. This is useful if you want to "listen" to chart updates elsewhere in your code:

$('span').bind('peity:changed', function(event, new_value, max_value){
$('p#notice').html("Chart updated: " + new_value + " out of " + max_value);
});

See a working example in examples/simple.html

0 comments on commit a2c90bc

Please sign in to comment.