By kannanraj on
i used to Libchart for display a chart. i got a error in this line $chart->render(DRUPAL_ROOT.$file_name); The error is "Call to undefined function imageftbbox() in ..sites/all/libraries/libchart/libchart/classes/view/text/Text.php on line 67"
This is my coding
$form['sample_table'] = array(
'#theme' => 'table',
'#header' => $header_result,
'#rows' => $fin,
'#empty' => t('page is not Present'),
'#prefix' => '<div id="box" class="table">',
'#suffix' => '</div>',
);
$name=views_get_view_result('views');
if(!empty($name)){
// Generation of picture
require_once (DRUPAL_ROOT."/sites/all/libraries/libchart/libchart/classes/libchart.php");
$chart = new LineChart();
$dataSet = new XYSeriesDataSet();
$serie = new XYDataSet();
$serie2 = new XYDataSet();
foreach ($nameIDS as $key_index4=> $row_value4) {
$serie->addPoint(new Point($row_value4, $fin['average']['data'][$key_index4]['data']));
$serie2->addPoint(new Point($row_value4, $avgIDS[$key_index4]));
}
$dataSet->addSerie("Average1', $serie);
$dataSet->addSerie('Average2', $serie2);
$chart->setDataSet($dataSet);
$chart->setTitle("Average");
$chart->getPlot()->setGraphCaptionRatio(0.62);
$file_name = "/sites/default/files/chart/".time().'.png';
<strong> $chart->render(DRUPAL_ROOT.$file_name);</strong>
global $base_url;
$form['picture_gen'] = array(
'#type'=>"markup",
"#markup" => '<img border="0" src='.$base_url.$file_name.' alt="Pulpit rock" width="600" height="250" />',
'#prefix' => '<div id="box" class="table">',
'#suffix' => '</div>',
);
Comments
A few things: 1) Issues
A few things:
1) Issues related to a specific module are best posted in the module's issue queue on the module project page
2) Your code has some errors in it. Look at the formatting int he code you posted, the colors will show you pretty quickly that you have typos in there somewhere
3) The error you gave us was for a function you are calling named imageftbbox(), however you have not called that function inside the code you showed us, which leads me to suspect you aren't even showing the right code.
Contact me to contract me for D7 -> D10/11 migrations.