Hi, Guys First of all I am new on this forum, but I hope you people will help me. My question is regarding Google Chart api.
I would like to generate this <http://www.psa.rwth-aachen.de/gChartExample.php>graph, right now values are hard coded. $piChart->addDataSet(array(300,315,606,400,500)); $piChart->setLegend(array("first","second","third","fourth","fifth")); $piChart->setLabels(array("first", "second", "third", "fourth", "fifth")); $piChart->setColors(array("ff3344", "11ff11", "22aacc", "3333aa", "3375bb")); With hard coded value it works fine. but I would like to generate arrays dynamically from my SQL Database, for testing purpose I wrote this code and with the help of for loop I would like to populate the Data. Right now i populated the Array manually. $array_value[0] = 300; $array_value[1] = 315; $array_value[2] = 606; $array_value[3] = 400; $array_value[4] = 500; $array_leg[0] = "First,"; $array_leg[1] = "Second,"; $array_leg[2] = "Third,"; $array_leg[3] = "Fifth,"; $array_leg[4] = "Sixth"; $array_col[0] = "ff3344"; $array_col[1] = "11ff11"; $array_col[2] = "22aacc"; $array_col[3] = "3333aa"; $array_col[4] = "3375bb"; for ( $counter = 0; $counter <= 4; $counter ++) { $piChart->addDataSet($array_value[$counter]); $piChart->setLegend(array($array_leg[$counter])); $piChart->setLabels(array($array_leg[$counter])); $piChart->setColors(array($array_col[$counter])); } But what happen is that it took only Last Legend, Lebel and Colour value from the Arrays. add Data Set is working fine. The End Results are this<http://localhost/gChartExample2.php> Complete code is also attached, if some one have some other solution please let me know. PLEASE HELP -- Atif Musaddaq Master in Media Informatics, RWTH Aachen & University of Bonn, Germany. [email protected] -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
<<attachment: gChartExample2.php>>
