Hi guys
Using in my own module
$chart = array(
'#chart_id' => 'test_chart',
'#title' => t('Servings'),
'#type' => CHART_TYPE_PIE_3D,
);
$chart['#data']['fruits'] = 3;
$chart['#data']['meats'] = 2;
$chart['#data']['dairy'] = 5;
$chart['#labels'][] = t('Fruits');
$chart['#labels'][] = t('Meats');
$chart['#labels'][] = t('Dairy');
return theme('chart', array('chart' => $chart));
i get
Notice: Uninitialized string offset: 0 in _chart_is_valid_size() (line 755 of \sites\all\modules\chart\chart.module).
Notice: Uninitialized string offset: 0 in _chart_is_valid_size() (line 755 of \sites\all\modules\chart\chart.module).
the pie chart does display but how to get rid of these notices please
Comments
Comment #1
mineshaftgap commentedI did not find this documented, but this fixed if for me:
Comment #2
maori commentedThanks that worked a treat here also
Comment #3
pelonbiologo commentedHi,
This solution also worked for me, but it still does not allow for the chart to be re-sized. It seems that the Uninitialized string notice disappears when adding the '#size' key/value pair to the array, but the values for #width and #height are ignored.
Any ideas on how to change the size of the charts?
Comment #4
13rac1 commentedPatch for 7.x-1.x-dev is attached. Fixes original problem of notices and adds a watchdog call when size is greater than 300,000 pixels.
@pelonbiologo If size (heightXwidth) is greater than 300,000 pixels, it will be ignored. Is it?
Comment #5
13rac1 commentedCommitted to 7.x-1.x-dev. Probably needed in 6.x-1.x-dev.
Comment #6
13rac1 commentedApplied to 6.x-1.x.
Comment #8
leszek.hanusz commentedHmm it seems the problem is not fixed for the latest 7.x-1.x-dev version.
I think you should replace
if(!empty($value))by
if(empty($size))Comment #9
Merick commentedI agree with #8. I also changed the following line in
chart_build()and the notice message has gone away:To:
Comment #10
13rac1 commentedAh ha! Fixed in 6.x and 7.x.
http://drupalcode.org/project/chart.git/commit/8408f06
http://drupalcode.org/project/chart.git/commit/678869f