diff --git a/graphael.jquery.js b/graphael.jquery.js index 54f7fa2..e6f06ea 100644 --- a/graphael.jquery.js +++ b/graphael.jquery.js @@ -28,6 +28,9 @@ * 'opts': Options that are passed directly to the gRaphael method. * 'padding': Pixels of padding to add to the inside of the gRaphael element. * Defaults to 10. Set to 0 to draw the chart from edge to edge. + * 'label': Label information for barcharts, separated into 'values' + * (non-associative array) and 'isBottom' (flag to indicate if the + * labels must be located below the bars). * * Events * ------ @@ -139,6 +142,9 @@ switch (method) { case 'bar': chart = r.g.barchart(x, y, w, h, values, params.opts); + if (params.label) { + chart.label(params.label.values, params.label.isBottom); + } break; case 'dot': chart = r.g.dotchart(x, y, w, h, values[0], values[1], values[2], params.opts); diff --git a/graphael_example/graphael_example.graphs.inc b/graphael_example/graphael_example.graphs.inc index b78b7ac..a987847 100644 --- a/graphael_example/graphael_example.graphs.inc +++ b/graphael_example/graphael_example.graphs.inc @@ -22,6 +22,10 @@ function graphael_example_graphs_page() { 'opts' => array( 'gutter' => '80%', ), + 'label' => array( + 'values' => array('Africa', 'Asia', 'Europe', 'L. America', 'N. America', 'Oceania'), + 'isBottom' => TRUE, + ), ), array( 'label' => array( 'values' => array('Africa', 'Asia', 'Europe', 'Latin America', 'Northern America', 'Oceania'), @@ -32,6 +36,36 @@ function graphael_example_graphs_page() { ), )); + $output[] = '