aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Google Charts: Problem in Pie chart Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Google Charts: Problem in Pie chart " Watch "Google Charts: Problem in Pie chart " New topic
Author

Google Charts: Problem in Pie chart

suraj savaratkar
Ranch Hand

Joined: May 17, 2010
Posts: 67
Hi,

I'm trying to Create a Pie chart using google api. I have a table named concurrent_monitoring and it contains 27 column.

I need to create a pie chart depends on number of forms are inserted in table
Here is 2 levelType and 8 ParameterName 'WC', 'PIA' and 'EPA','DPR','LAP','CB','NRM','FUN','VIB','MGMT' respectively.

I'm trying to do based on leveltype 'wc' if three form are inserted as( 'EPA','DPR','LAP') only that much displayed in the pie chart...
If forth form is inserted then pie chart shows four slice in pie chart.

I tried the following code,,





how to do please help me....
Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42278
    
  64
What does the code do now, and how is that different from what you expected?

I'm moving the question to a more suitable forum, as it has nothing to do with servlets.


Ping & DNS - my free Android networking tools app
suraj savaratkar
Ranch Hand

Joined: May 17, 2010
Posts: 67
i want to add the slice which only in the database i fetched data but how to assign to the chart api instead of literal value ???


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42278
    
  64
So the question is how to create a data structure in JavaScript that you can pass to arrayToDataTable? Or is it how to write Java code that can generate this JavaScript code? (I'm sort of guessing because I'm unfamiliar with the API, but then, most folks here probably are.)

What do you think you need to change, and where are you stuck making those changes? TellTheDetails.
suraj savaratkar
Ranch Hand

Joined: May 17, 2010
Posts: 67
Thank you; join my question and helped me..

Same as I want to create a data structure in JavaScript that pass the values to arrayToDataTable coming from database..

Anybody can help me ???

If any another way please tell me !!!


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42278
    
  64
What do you mean, "other way"? It seems you haven't tried any way (at least I'm assuming that, because you didn't answer anything to my question of what you have tried to change).

So the task -as I understand it- is to replace lines 87 - 94 by rows of your own data of two columns each; is that correct? If so, you already have the loop that iterates over the ResultSet. One major problem right now is that each loop iteration outputs vast chunks of JavaScript - the result you're getting right now must have lots of garbage in it. Each iteration of the ResultSet loop should output exactly one line of JavaScript code, namely something that looks like lines 87-94.

Or should this code create JavaScript code for several charts, one chart for each DB record? If so, is the data that goes into each chart somehow part of the DB record as well? As I said before, TellTheDetails (<-- this is a link)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Google Charts: Problem in Pie chart