Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Defining bar colour in stacked bar chart Post Reply Post New Topic
Page  of 2 Next >>
Author Message
merlot
Newbie
Newbie
Avatar

Joined: 07 Dec 2009
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote merlot Replybullet Topic: Defining bar colour in stacked bar chart
     Posted: 14 Dec 2009 at 8:14am
Hi
Can anyone help with this problem?
I need to specify the colour of each element of a stacked bar chart. There are 5 different elements of data, all numeric that appear in a random order. Each element needs to be identified by its own unique colour.
The "Highlight" function cannot be used since the type of element cannot be identified from the data field relating to the element. I am also unable to find a way using "Formila Workshop".
Thanking you in anticipation.Embarrassed
merlot
Crystal Reports beginner
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Dec 2009 at 8:51am
One way.
If you do not have dupe values in your data you can create 5 distinct formulas (one per color value) to either SUM or COUNT your values and then add each of these formulas into your barchart under the values section. Since these are now unique values you can assign a color per item.
The order in which you add them also defines the order in which they will appear
 
IP IP Logged
merlot
Newbie
Newbie
Avatar

Joined: 07 Dec 2009
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote merlot Replybullet Posted: 14 Dec 2009 at 9:28am
Hello DB
 
The bar chart represents a time scale of 24 hours and the elements represent different work periods in hrs & mins throughout the 24 hrs. These work elements can be in any order and repeated many times within 24 hrs, equally there can and will be dupes.
If I could make the highligher reference to another field or even table it would be simple.
 
merlot
Crystal Reports beginner
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Dec 2009 at 9:46am
Please explain the "elements represent different work periods in hrs & mins throughout the 24 hrs" in more detail with a little sample data.
IP IP Logged
merlot
Newbie
Newbie
Avatar

Joined: 07 Dec 2009
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote merlot Replybullet Posted: 14 Dec 2009 at 9:56am
Eah element represents a different type of work and thus time period. e.g.
 
 
walking 2:44;  running 1:22;  driving 3:28;  Running 2:14; driving 1:52; walking 2:16;m driving 1:41 etc.
This is a typical example of the element types and data values. I want all like elements to be the same colour.
Crystal Reports beginner
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Dec 2009 at 10:39am

So is this a single text field of "walking 2:44" or is it 2 fields, 1 text and 1 time "walking" and  2:44?

My guess is this is a 1 text field and you are getting counts of each row and it is not grouping the way you want.
Use 2 formula fields to split this into 2 parts, 1 for the text which you can group on and 2 for the time value which you can SUM on.
text part (add as second group):
left(field,instr(field,' '))
Time part (minutes to SUM):
 
IP IP Logged
merlot
Newbie
Newbie
Avatar

Joined: 07 Dec 2009
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote merlot Replybullet Posted: 14 Dec 2009 at 11:45am

My appologies for making it more confusing.

The text (walking, driving etc) are the name of the events and are displayed in the legend only).
Each bar represents 24 hrs from midnight to midnight, (00:00 to 24:00).
 
The data fields are purely time (eg 02:13) which represent the period of the particular event and are concurrent.
 
Assuming the following data which could represent any of the events (not necessarilly all 5):
 
02:13, 01:57, 03:34, 02:23, 04:16 etc.
 
The first segment of the bar would begin at 00:00 and end at 02:13.
The second segment would begin at 02:13 and end at 04:10.
The third segment would begin at 04:10 etc etc.
 
I now want to colour each segment specific to its event. i.e walking = Red, running = Blue, driving = Green etc.
However the data value is not unique and maybe occur in another event and events will be in the order they took place which is not the same each day.
e.g.
on Monday the order maybe event 1; event2; event 1; event 4; event 3; event 2 etc etc
while Tuesday may be event 3; event 1; event 2; event 3; event 4 etc
 
In a typical day there will be between 50 and 90 data elements covering the 5 event types.
 
I hope this is understandable.
thanks,
Crystal Reports beginner
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Dec 2009 at 11:55am
So on any one day you do NOT want to group you walking data together to give you a total amount of time spent walking (versus any other activity) but rather you want each instance broken into the 'Time Slot' it occurred but you want all walking items to appear as Blue.
Is that correct?


Edited by DBlank - 14 Dec 2009 at 11:55am
IP IP Logged
merlot
Newbie
Newbie
Avatar

Joined: 07 Dec 2009
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote merlot Replybullet Posted: 14 Dec 2009 at 12:02pm
Yes, spot on.
I want to display a timeline of events in the order they took place, each event ype being identified by its  unique colour. Big%20smile
merlo
Crystal Reports beginner
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Dec 2009 at 12:29pm
I am not sure this is doable. I'll give it more thought but nothing is coming to mind. THe stacked bar chart usually groups the items togther and the coloring works that way. Have you considered or tried to use a a Gantt chart?
IP IP Logged
Page  of 2 Next >>
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