siric

Piechart and MySQL

Recommended Posts

Hi,

I am trying to create a piechart under the following circumstances:

My each row in my table contains a gender.  I want to be able to sum up the number of males and females and then plot that in a pie chart.

The query that I am using

SELECT SUM(gender = 'male') AS male, SUM(gender = 'female') AS female FROM markers;

presents 2 columns (male and female) with a count below.  How is it possible to get this into the array for the chart seeing that the data required should be by row rather than column?

Query Results:

| male |  female |

| 23    |   43       |

 

 

Should be

| male    |   23  |

| female |  43  |

 

Thanks

 

Steve

Share this post


Link to post
Share on other sites

FusionCharts can be rendered using many server side language like  Asp.net, PHP, Java and Python, and the data can be fetched from the database as well.

For fetching data from the database and rendering  pie chart based , try to fetch the data from the data base using sql query and then structure the data in FusionCharts format using the data structure of the server side language. Then finally apply this datasource in the FusionCharts constructor object.

If you are still facing any problem, please let us know which server side language you are using also the sql file so that we can assist you further.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now