date range on chart x-axis

Stimulsoft Reports.WEB discussion
Post Reply
cbrydon
Posts: 176
Joined: Fri May 30, 2014 4:37 pm

date range on chart x-axis

Post by cbrydon »

Hi I'm trying to set a date range on the x-axis for a clustered column chart. I've played around
with the Date Time Step and Range properties, but can't seem to get it to work the way I want it to.

I'd like to be able to set the minimum range value to a specific date (chosen by a user and stored in a variable)
and the maximum to be 12 months later. For the maximum, I know I can use a DateAdd or AddMonths kind of
function. I'm just not sure how to go about setting the axis-range.

Hope you can help.

Thanks,
Carl
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: date range on chart x-axis

Post by Andrew »

Hello, Carl,

Thank you for the good question.

There are a couple ways to resolve your issue. Before we answer, we would like to clarify what exactly do you need to get? This will help us give you the best answer.

Thank you.
cbrydon
Posts: 176
Joined: Fri May 30, 2014 4:37 pm

Re: date range on chart x-axis

Post by cbrydon »

Thanks Andrew.

The graph I need to create represents a count of activities for each month in a given 12-month period. Some months may not have any data.
The 12 month period could start in any month based on a user choice, and I'd like the x-axis to be labeled as follows:
Sept-2016, Oct-2016, Nov-2016... Aug-2017 (as an example).

Does this help?
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: date range on chart x-axis

Post by Andrew »

Okay, here is a report sample.

Let us know whether it is good for you?
Thank you.
Attachments
test.mrt
(797.08 KiB) Downloaded 661 times
cbrydon
Posts: 176
Joined: Fri May 30, 2014 4:37 pm

Re: date range on chart x-axis

Post by cbrydon »

Sorry for the delay in responding...

This didn't quite work, but it did point me in the right direction. I ended up making the range auto to false, min range 0 and max range 13 - this allows me to display a bar
for each month without the bars overlapping the edge of the chart. Maybe there are other/better ways to do this, but it worked for this case anyway.

I have another question (somewhat related) and if I need to open another thread, please let me know...

If I have a group of activities and a date for each activity, is there a way to get the chart to group them by month?
For example, if I have 3 activities occurring on March 3 and 2 activities occurring on March 7, can I get the bar chart
to just show 1 bar for the month of March with a value of 5? I know I can summarize the data in the datasource to give
me this information, but was hoping the chart might be able to do this automatically. I did try using the following
expression {Month(Datasource1.BeginDate)} in the Argument expression of the Clustered Column series, but it complained
that... "The name 'Month' does not exist in the current context." Using this expression {Datasource1.BeginDate.ToString("M")}
is accepted, but doesn't actually group the bars into 1 for each month.

Hope you can help!
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: date range on chart x-axis

Post by Andrew »

Hello,

At this moment, you cannot automatically group the data in a chart.

However, if we understand you correctly, we can suggest you using a virtual data source. For this you need to do the following:
1 Select the New Data Source command;
2 In the Objects group, click the Data from other Data Source button;
3 Define settings of the virtual data source - grouping, sorting, and filtering;
4 Use this virtual source in the chart.

In this case, when rendering the report, a virtual data source will be processed, and a chart will be rendered based on the virtual source.

Thank you.
cbrydon
Posts: 176
Joined: Fri May 30, 2014 4:37 pm

Re: date range on chart x-axis

Post by cbrydon »

Sorry for the delay in responding Andrew. Your suggestion of using a virtual datasource pointed me in the right direction - Thank You!
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: date range on chart x-axis

Post by Andrew »

Great! Have a nice weekend!
Post Reply