Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: combining stacked and clustered bar charts Post Reply Post New Topic
Author Message
jknockler
Newbie
Newbie


Joined: 05 Mar 2009
Location: Ireland
Online Status: Offline
Posts: 32
Quote jknockler Replybullet Topic: combining stacked and clustered bar charts
     Posted: 05 Mar 2009 at 3:55am
hi,

im wondering if it is possible to combine a tacked bar chart with a clustered bar chart?

i have a clustered bar chart that has 2 vertical bars for each customer on the x axis. what i want to do is to have one of these two bars stacked.

is this possible to do and how would i do it?

thanks

J
J
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 05 Mar 2009 at 3:58am
Hi
 
Please can you post sample data and let us know what goes on x-axis and y-axis.Also not clear when you say Clustered Bar chart?
 
cheers
Rahul


Edited by rahulwalawalkar - 05 Mar 2009 at 3:59am
IP IP Logged
jknockler
Newbie
Newbie


Joined: 05 Mar 2009
Location: Ireland
Online Status: Offline
Posts: 32
Quote jknockler Replybullet Posted: 05 Mar 2009 at 4:30am
hi,

on the x axis i have 3 customer names : bill,john,mary
on the y axis, i just have the usual numbers on a bar chart.

each client has 2 vertical bars. so bill has 2 vertical bars, mary has 2 vertical bars, john has 2 vertical bars. one bar represents a 'yes' value in a particular field in a database. the other bar represents a 'no' value.

in the chart expert, in the 'show value(s)' section i have 2 formulas, formula1 and formula2.

formula1 looks like : if ({dbfield} = 'yes') then 1 else 0
formula2 looks like : if ({dbfield}='no') then 1 else 0

in the chart expert, in the 'show value(s)' section, these two formulas are set to: 'sum of @formula1' and 'sum of @formula2'

in the 'on change of' section in the chart expert, i have the customer field which contains the customer names: john,mary,bill.

what i want is for one of the vertical bars of bill, mary and john to be stacked

(i.e, the bar is subdivided - as i want to add in more code that creates subdivisions on the bars based on other fields in the database)

and the other vertical bar of bill,mary,and john to just contain a single blue segment which corresponds to formula1 which was if{dbfield}='yes' then 1 else 0.


I know it may be hard to understand, so any suggestions on this are really really appreciated.
thanks.

j
J
IP IP Logged
jknockler
Newbie
Newbie


Joined: 05 Mar 2009
Location: Ireland
Online Status: Offline
Posts: 32
Quote jknockler Replybullet Posted: 05 Mar 2009 at 4:33am
by 'clustered' i mean 'side-by-side'. that is the chart has vertical bars that are side by side.

by 'stacked' i mean each vertical bar has subdivisions that are colour coded.
J
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 05 Mar 2009 at 7:51am
Hi
 
Hope this helps
 
Step 1
 
Create the formulas
 
Frm_Yes
if {table.fieldname} ='yes' then 1 else 0
 
Frm_No
if {table.fieldname} ='no' then 1 else 0
 
Frm_singlebaryes
if {table.fieldname} ='yes' then 1 else 0
 
Step2
Group by Custname
 
Insert summary for
Frm_yes
Frm_No
Frm_singlebaryes
 
Step3
Insert Chart
Select On type as  stacked bar chart
 
Go to Advanced Tab
 
OnChange of
Customername
Show Values
Frm_yes
Frm_No
Frm_singlebaryes
 
it will change to Sum of ..... keep as it is
 
you will get chart with three bars one for yes, one for no ,and one for yes again
 
Step4
right click the chart and select Chart Options
Go to Axes Tab Select Dual Axes
 
you will get blue bar for yes and stacked bar for yes no .
 
Then right click and select chart options then select the Multi Axes Tab and move the @sum_no to  Primary (Y1) axis .
 
This will create chart with yes no stacked bar chart and Yes single bar. side by side .....
 
let me know if it works send me a blank email i will send you the test report
 
 
Cheers
Rahul
 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum