The title says it all. The reason is that _webform_analysis_grid() does not return data, just an HTML table. The solution? Redirect the hook to a our own processing function in webform_gchart. I made some other modifications to webform_results_gchart() to account for a grid containing a bunch of questions and looping through the grid array returned from our custom hook function, as well as shimming our custom hook function if the type is a grid when calling webform_component_invoke(). theme_webform_results_gchart() has a couple of changes, namely having the components available as part of the $data array, and adding the description to the name of the chart component if available.
Patch attached.
Comments
Comment #1
argiro commentedHello,
I have applied the other two patches but when I tried to apply this one i got the following error:
grid.diff:95: trailing whitespace.
Checking patch webform_gchart.info...
Checking patch webform_gchart.module...
error: while searching for:
$item = menu_get_item('node/' . $node->nid . '/webform-results/gchart');
menu_set_item(NULL, $item);
}
$components = isset($analysis_component) ? array($analysis_component['cid'] => $analysis_component) : $node->webform['components'];
$data = array();
foreach ($components as $cid => $component) {
// Do component specific call.
if ($row_data = webform_component_invoke($component['type'], 'analysis', $component, $sids, isset($analysis_component))) {
$data[$cid] = $row_data;
}
}
return theme('webform_results_gchart', array('node' => $node, 'data' => $data, 'sids' => $sids, 'component' => $analysis_component));
}
error: patch failed: webform_gchart.module:78
error: webform_gchart.module: patch does not apply
How could i solve it? Thank you in advance.
Comment #2
hotspoons commentedargiro, I posted a sandbox project that includes this fix, along with a lot more functionality, here. If you install my sandbox project, make sure you uninstall this one as I changed the module name and this will not overwrite the existing module. I am talking to ccoppen (this module's author) regarding an actual release of this project using the additional functionality I coded in, so stay tuned!
Comment #3
argiro commentedThank you hotspoons. It works fine!