After doing few experiments I have decided to go with http://www.maani.us/charts/index.php
I don’t have any problem in showing data from mysql data base but there are few pages for which I want to show visitors some chart and graph from the inputs provided by the users and w/o saving it in database.

Let me explain with an example
On node1 visitors are provided with few questions. After proving the answers and clicking on submit button they will be taken to node 2 where all the calculations (no of correct answers, % of accuracy , ranks etc are calculated) and on this node2 I want to show the visitors some graphs/charts with these datas.

The problem is on node 2 I will be calling an external page1 with few details of the chart and before that I need to move some data from node 2 to page 1 (is it complex)

How to go about this?
Which in is a better choice to work with drupal – cookies or sessions

Comments

icarus75’s picture

I am trying to use the same charting flash application [PHP/SWF Charts] for my site. In order to render a graph, I have to provide the chart data in an array. However, I'm currently not able to obtain it from the DB. I'm using the views module, which allows to build a query in a straightforward way. Showing the output as a table in a page is no problem:

$view = views_get_view('measurement_data');
$content = views_build_view('embed', $view, array(), false, false);
print $content;

But how do I get a hold of the data itself contained within this table?
Is this the proper/efficient way to obtain the needed data?

Bart.

nishitdas’s picture

In my case it different as I am putting all the relevant data for this chart in a different data base (not in drupall)

So it is quite easy to open that database in any node and produce the chart.
I am not sure how efficient and secured is this but I have no other option

harry slaughter’s picture

if you're interested in helping develop it or test it out, let me know:

http://drupal.org/project/swfcharts

--
Drupal tips, tricks and services
http://devbee.com/ - Effective Drupal

--
Devbee - http://devbee.net/

doublejosh’s picture

Part of the problem is that views integration isn't going to be in 5.x from what I understand.

One could use db_fetch_object() to grab stuff from the database. But, we all know we should be integrating views.

Here is the basic idea... HOWEVER, I haven't gotten it to work properly.

$view_name= 'NAME_OF_VIEW';
$view_args= array();
$view= views_get_view($view_name);
$view_object= views_build_view('result', $view, $view_args, FALSE);

$skills= db_fetch_object($view_object['query']);

//GENERATE THE CHART HERE

Use the view, then pass that to the database function, then use the data to create the chart.

I think this is our only way to do dynamic charts in 5.x!
Please help everyone.

kaffeen’s picture

This chart capability is something I would like to implement as well. I'm sure there are many others, come on code warriors, show us what you got... :)

babusaheb.vikas’s picture

$chart = array(
'#chart_id' => 'test_chart',
'#title' => chart_title(t('Answers'), 'cc0000', 15),
'#type' => CHART_TYPE_PIE,
'#size' => chart_size(400, 200),
);

$result = db_query("select field_p_like_value, count(field_p_like_value) as times_entered from field_revision_field_p_like group by field_p_like_value");

//while( $resquery_res = db_fetch_object($resquery) ) {

foreach ($result as $resquery_res) {

$chart['#data'][$resquery_res->field_p_like_value] = $resquery_res->times_entered;

$chart['#labels'][] = t($resquery_res->field_p_like_value);

}
return theme('chart', array('chart' => $chart));

Vikas kumar