Community Documentation

Using Bluff Charts

Last updated February 9, 2011. Created by irakli on January 11, 2010.
Edited by ookami.kb, garpy, Roger Saner. Log in to edit this page.

Installation

You should download Bluff library from: http://bluff.jcoglan.com/ grab following three javascript files:

bluff-min.js
excanvas.js
js-class.js

and place them under sites/all/modules/charts_graphs/apis/charts_bluff/bluff folder.

Usage

The quickest code to get something graphed using bluff:

<?php
function charts_graphs_test() {
 
$canvas = charts_graphs_get_graph('bluff');
   
 
$canvas->title = "Bluff Chart";
 
$canvas->type = "line"; // a chart type supported by the charting engine. See further in the doc for the list.
 
$canvas->y_legend = "Y Legend";
 
$canvas->colour = '#D54C78';
 
$canvas->theme = 'keynote'
 
$canvas->series = array(
   
'Some Value' => array(9,6,7,9,5,7,6,9,7),
   
'Page Views' => array(6,7,9,5,7,6,9,7,3),
  );
 
$canvas->x_labels = array('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
 
 
$out = $canvas->get_chart();

  return
$out;
}
?>

Chart Types Supported

[line] => Line
[bar] => Bar
[pie] => Pie
[area] => Area
[sidebar] => Sidebar
[side_stacked_bar] => Side Stackedbar
[stacked_area] => Stacked Area
[stacked_bar] => Stacked Bar

Comments

This example is returning an

This example is returning an error:

Fatal error: Cannot redeclare charts_graphs_test() (previously declared in /home/public_html/sites/all/modules/charts_graphs/charts_graphs.module:116) in /home/public_html/includes/common.inc(1696) : eval()'d code on line 19

The function is being declared twice; I'll put together a working example and post later.

Commenting out the first part

Commenting out the first part resolves the error.

i.e. function charts_graphs_test() {

Thats because the function is already declared. I'm running 6.19

luka wanjohi

Alternately, change the name

Alternately, change the name of the function, e.g. to charts_graphs_test2(). Then you need to invoke the function and echo the return value (add this line after the function definition):

echo charts_graphs_test2();

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 6.x
Audience
Developers and coders

Site Building Guide

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here