I've got a chart showing the number (count) of people by age working, but I'm now trying to get it to display the number of people of each age group by gender.
I have created a query for each gender and it basically works except that it charts the bars for the first series (female) and then starts over charting the bars for the second series (male) instead of integrating them. I suspect this is because it's from two query's but am not sure.
Can someone steer me in the right direction? Thanks,
Current Query's
--------------------
<cfquery name="getfemaleages" datasource="">
SELECT age_group, count(age_group) AS count
FROM client_info
WHERE gender = 'female'
GROUP BY age_group
</cfquery>
<cfquery name="getmaleages" datasource="">
SELECT age_group, count(age_group) AS count
FROM client_info
WHERE gender = 'male'
GROUP BY age_group
</cfquery>
Current Chart Code:
---------------------
<cfchart chartwidth="200" showBorder = "no" format="png" title = "Age Doesn't Matter" show3d = "yes" showlegend="yes" backgroundColor="##f8f8f8" xaxistitle="Age Group">
<cfchartseries
seriesColor="##0092CE"
paintStyle="light"
type="Bar"
query="getmaleages"
itemcolumn="age_group"
valuecolumn="count"
serieslabel="Males"
>
<cfchartseries
seriesColor="Red"
paintStyle="light"
type="Bar"
query="getfemaleages"
itemcolumn="age_group"
valuecolumn="count"
serieslabel="Females"
>
</cfchart>
I have created a query for each gender and it basically works except that it charts the bars for the first series (female) and then starts over charting the bars for the second series (male) instead of integrating them. I suspect this is because it's from two query's but am not sure.
Can someone steer me in the right direction? Thanks,
Current Query's
--------------------
<cfquery name="getfemaleages" datasource="">
SELECT age_group, count(age_group) AS count
FROM client_info
WHERE gender = 'female'
GROUP BY age_group
</cfquery>
<cfquery name="getmaleages" datasource="">
SELECT age_group, count(age_group) AS count
FROM client_info
WHERE gender = 'male'
GROUP BY age_group
</cfquery>
Current Chart Code:
---------------------
<cfchart chartwidth="200" showBorder = "no" format="png" title = "Age Doesn't Matter" show3d = "yes" showlegend="yes" backgroundColor="##f8f8f8" xaxistitle="Age Group">
<cfchartseries
seriesColor="##0092CE"
paintStyle="light"
type="Bar"
query="getmaleages"
itemcolumn="age_group"
valuecolumn="count"
serieslabel="Males"
>
<cfchartseries
seriesColor="Red"
paintStyle="light"
type="Bar"
query="getfemaleages"
itemcolumn="age_group"
valuecolumn="count"
serieslabel="Females"
>
</cfchart>