This relates to my How do I achieve a pivot report in Crystal Reports for Visual Studio? The data is the same, but they want a line chart as well.
So, my data is {datetime}
, {car-id}
. The X -axis of the chart must show the hour of {datetime}, the Y axis the number of cars that entered the park at that hour, and I must have seven data series, lines, one for each day of the week. So, e.g. the x/y
point on the green line shows that on Wednesday, at hour x
, y
cars entered the car park.
Common sense tells me that I can kludge this by transforming the data source so that each day has its own column in a table, a table like this:
DateTime WeekDay CarCount
Yet the Crystal line chart doesn't seem to support more than one column, so there must be a different and better way of doing this. The weekday is part of {datetime}
after all.
How can I achieve this chart? I am a rank amateur at charting, and Crystal's idiosyncrasies really aggravate my lack of skills and experience in this area.
It's not obvious how to get multiple series to show up properly.
First, create a formula that will extract the day of week from the datetime: dayofweek({datetime})
and then create another that will extract just the hour: hour({datetime})
.
From there, insert a chart from scratch and make the following settings in the Chart Expert
(Note: in the screenshot below, you would just replace {Customer.Customer_Name} with {car-id}