Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bar Chart Colors based on group or field? 2

Status
Not open for further replies.

theDeej

Technical User
Aug 21, 2001
51
0
0
US
Crystal Reports 8

Let's say I have 50 customers. These customers can be one of 2 types - typeA or typeB and each customer has a distinct size.

I want a bar chart detailing the size of each customer, and for typeA customers I want the bar color to be blue and for typeB customers I want the bar color to be green.

The customer type is defined in the database and I have grouped on the type field.

Is there anyway at all to do what I want to do?

NOTE: It could very well be that since it's Friday I'm missing something quite obvious!



Thanks!!
-Deej
 
Many colors in Crystal can be controlled via condition formula, but not the color of bars (that I know of). Sorry. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
In crystal Reports 8.5, you can control the colour by giving condition.There is a analyzer through which you can do this.Not possible in CR 8.0
Khushi
 
Thank you both for responding. It's good to know that it is available in CR 8.5.

-Deej
 
There is a workaround that I use based off of numbers. Say I want to use a bar graph to represent my class of 30 students and their respective averages. I want all grades 90 and above to be represented by a green bar and all other represented by a red bar.

I create two formula fields:

1. @gradesAbove90
Code:
if {GRADEBOOK.courseAverage >= 90) then GRADEBOOK.courseAverage else 0

2. @gradesLowerThan90
Code:
if {GRADEBOOK.courseAverage < 90) then GRADEBOOK.courseAverage else 0

Now under the 'Chart Wizard' I select the stacked bar chart (3D Stacked will work as well) just preference :)
Once per report, on change of GRADEBOOK.student, show values: @gradesAbove90 and @gradesLowerThan90.
Now you will have for each student a bar representing the average. All bars above 90 will be one color, all below will be another.

Now as far as specifying blue or green. This is where I hop into the 'Chart Analyzer' and update one bar which will change all above 90 and also update another which updates all bars below 90. I'm not sure if CR8.0 has this Analyzer functionality. I've only worked with 8.5.

Now in your case you could probably set two formulas up like so:

1. @typeA
Code:
if {'typeA' in DB.fieldname) then DB.size else 0[\code]

2. @typeB
[code]if {'typeB' in DB.fieldname) then DB.size else 0[\code]

Then graph both values in a stacked bar chart. Hope this helps :)

snazzyCrunch
bobbyf24@yahoo.com
 
snazzyCrunch,

THANKS A MILLION! Your suggestion worked like a charm! I appreciate you taking the time to respond.

:)

-Deej
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top