I am more of a DBA and not a PHP type of person. I tried pasting the sample in from the API.txt document into a normal page. I set the input format to PHP but nothing displays. I checked that the query did indeed return some records. Is it possible to create a chart in this way or am I barking up the wrong tree?
This is what my page content had in it:
function fusioncharts_example1() {
return fusioncharts_render(FUSIONCHART_QUERY, 'example1');
}
function example1_fusionchart_callback($args = NULL) {
$query = "SELECT t.name AS name, COUNT(*) as value FROM {term_data} t JOIN {term_node} tn ON t.tid = tn.tid WHERE t.vid=2 GROUP BY t.tid";
$type = 'Column 3D';
$settings = array('Caption' => 'Sample chart using the API and a query to generate the data');
$attributes = array();
$width = 500;
$height = 300;
return array($query, $type, $settings, $attributes, $width, $height);
}
Comments
Comment #1
aaron1234nz commentedYes you can create charts in this way.
To use this function by entering PHP into a page, You need to echo the result of the fusionchart_render function, and take it outside the function definition. Try using this code:
Note: this code is for the Drupal 5 version of this module only. The API has changed for the Drupal 6 version.
Comment #2
msimanga commentedThank you very much, your code worked.
Comment #4
fryswe commentedi have the same problem..i am using the following code (example2 of the documentation) in a drupal-5.x-node/site:
but my chart won't be displayed :-/
Comment #5
fryswe commentedComment #6
aaron1234nz commentedSee comment #1. The code you pasted is for the Drupal 6 version of fusioncharts.
Comment #7
fryswe commentedyep i know..but how looks it in my example?...#1 doesnt works....
Comment #8
aaron1234nz commentedAre you sure you installed the Drupal 5 version. The code in comment #1 should work. The reason I ask is that if you found the code you pasted in #4 in the api file, then you have the wrong version.
Comment #9
msimanga commentedTry the following
Comment #10
giomorelli commented...I paste this example im my drupal 6 but no charts is displayed !?!
Comment #11
aaron1234nz commentedIf you are referring to the code in comment#9 then you will also need to call this function. add this line at at the top or bottom
Comment #12
giomorelli commentedYes , code is from comment #9....I add yor line, but this is the output..
START Code Block for Chart DrupalFusionChart_1
END Code Block for Chart DrupalFusionChart_1
the previus line are coment .
...and no picture !
Comment #13
bigknot33 commentedThe code in #9 shows blank - the line
$info->type = 'Column 3D';should be
$info->chart_type = 'Column 3D';This code (Drupal 6) should work:
Comment #14
aaron1234nz commentedThere has been no traffic on this issue for 2 years so closing.