I've setup a chart here: http://www.concordconserves.org/carbon/chart-test by placing the php code into the page's body field, but when I try and use that exact same code in a node-mycontentype.tpl.php file, I just get a blank white area where the chart should be. I think it is throwing some kind of error which I can't see.
Any idea why it doesn't work in the tpl.php file?
Here's the code for the chart:
<?php
$homeeff=500;
$food=200;
$travel=85;
$example = array(
'#type' => 'pie3D', // Display a 3D pie chart
'#color' => 'f0f0f0', // Background color, in RRGGBB format
'#height' => 290, // in pixels
'#width' => 590, // in pixels
'#title' => t('Carbon Footprint Breakdown'), // Chart title
array(
array('#value' => $homeeff, '#label' => t('Home and Utilities')),
array('#value' => $travel, '#label' => t('Food and Diet')),
array('#value' => $food, '#label' => t('Travel')),
),
);
return charts_chart($example);
?>
Comments
Comment #1
brmassa commentedFletcher,
I dont see any reason for not working, except the fact that node-mycontentype.tpl.php is never called. Can you confirm that something else like "return 'test testing';" return but not the chart?
regards,
massa
Comment #2
gthing commentedDid you get this working? I'm having the same problem. Charts will show up in $content or in a block, but not when I add them directly to my theme file.
Comment #3
dhallennem commentedsame problem.
Why ?
Comment #4
botrisUse print instead off return?
Comment #5
quicksketchThe D6 version of the module is no longer being updated. If this problem exists in the 7.x-2.x branch of the module please reopen.