How to achieve a multi-line line chart in Crystal Reports?

This applies to my How to get a summary report in Crystal Reports for Visual Studio? The data is the same, but they also need a line chart.

So, my data is {datetime} , {car-id} . The x-axis of the chart should show the hour {datetime}, the Y-axis is the number of cars that entered the park at that hour, and I should have seven rows of data, rows, one for each day of the week. So, for example, the point x/y on the green line indicates that on Wednesday, at hour x , cars y entered the parking lot.

Common sense tells me that I can destroy this by converting the data source so that every day has its own column in the table, such a table:

DateTime WeekDay CarCount

However, Crystal's graphic ruler does not support more than one column, so there should be a different and better way to do this. Day of the week is part of {datetime} after all.

How can I reach this chart? I am a lover of rank on the chart, and Crystal's distinctive features really exacerbate my lack of skills and experience in this area.

+6
source share
1 answer

It is not clear how to display multiple rows correctly.

First, create a formula that will extract the day of the week from datetime: dayofweek({datetime}) , and then create another that will extract only the hour: hour({datetime}) .

From there, insert the chart from scratch and make the following settings in Chart Expert

  • Select Line on the Type tab
  • On the Data tab, select On Change and select the formula {@HourOfDay}. This will create every hour as a point on the X axis.
  • Add the formula {@DayofWeek} at the same place. This will create a new line for each day of the week. This, in my opinion, is an unobvious part.
  • Finally, to select the values โ€‹โ€‹of the Y-axis, select {car-id}, where it says "Show values โ€‹โ€‹(values)". It should by default count the sum of this field.

(Note: in the screenshot below, you simply replace {Customer.Customer_Name} with {car-id}

How to set up the chart expert

+3
source

Source: https://habr.com/ru/post/950645/


All Articles