Hi! first of all thanks about this module it´s great.
I want to add filters to the chart so i want to use ahah to replace my chart for the new chart filtered.
i used the code example and at the first time the chart works great but when i click the button ( to apply filter like views ), it shows the link to get adobe flash.
if i checkuot the "Use SWFObject to embed charts". it shows the box of the chart but with this error: "Open Flash Chart IO ERROR Loading test data Error #2032. ../../data-files/y-axis-auto-steps.txt".
In this example i only want to replace my chart with the same chart ( only to knows that works ).
I use data file method.
Here is my code:
function estadisticas_dinamicas_menu() {
$items = array();
$items['reports'] = array(
'title' => t('Reports'),
'page callback' => 'drupal_get_form',
'page arguments' => array('estadisticas_dinamicas_form'),
'access arguments' => array('access content'),
'description' => t('Reports'),
'type' => MENU_CALLBACK,
);
$items['reports/ahah'] = array(
'page callback' => 'estadisticas_dinamicas_ahah',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function estadisticas_dinamicas_form($form_state) {
//fieldset
$form['filterset'] = array(
'#title' => 'Select filters',
'#weight' => '0',
'#type' => 'fieldset',
'#collapsible' => '1',
);
$form['go'] = array(
'#weight' => '5',
'#type' => 'submit',
'#value' => 'Go',
'#ahah' => array(
'event' => 'click',
'path' => 'reports/ahah',
'wrapper' => 'report_content',
'progress' => array('type' => 'bar', 'message' => t('Please wait...')),
),
);
$form['report_content'] = array(
'#weight' => '10',
'#type' => 'markup',
'#prefix' => '<div id="report_content">',
'#suffix' => '</div>',
'#value' => ofc_api_render(estadisticas_dinamicas_line()),
);
return $form;
}
/**
* callback function for reports/ahah
* The return HTML will be outputted by AHAH
*/
function estadisticas_dinamicas_ahah() {
// $bob1 = $_POST['datefrom'] . ' '; here i will catch the filters
return drupal_json (ofc_api_render(estadisticas_dinamicas_line()));
//drupal_json (array('status' => TRUE, 'data' =>ofc_api_render(estadisticas_dinamicas_line())));
}
function estadisticas_dinamicas_line() {
$data = array();
for($i = 0; $i < 6.2; $i += 0.2) {
$data[] = (sin($i) * 1.9) + 4;
}
$line = ofc_api_element('line');
$line->set('values', $data);
$line->set('width', 2);
$line->set('colour', '#3d5c56');
$dot = ofc_api_element('solid-dot');
$dot->set('dot-size', 3);
$dot->set('halo-size', 1);
$dot->set('colour', '#3d5c56');
$line->set('dot-style', $dot);
$y_axis = ofc_api_element();
$y_axis->set('min', 0);
$y_axis->set('max', 8);
$y_axis->set('steps', 4);
$title = array(
'text' => date("D M d Y"),
);
$chart = ofc_api_chart();
$chart->add('element', $line);
$chart->set('title', $title);
$chart->set('y_axis' , $y_axis);
return $chart;
}
function estadisticas_dinamicas_ofc_api_data() {
return array('estadisticas_dinamicas_line');
}
Do you use filter charts with ahah?, Do you know something about these errors?,
Thanks for all this module it´s great,
Nicolás.