This is a migrated thread and some comments may be shown as answers.

X-Axis group by week

7 Answers 258 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
SapDev
Top achievements
Rank 1
SapDev asked on 06 Jan 2016, 02:23 AM

Hi, I'm trying to produce the attached report, and as you can see the x-axis in this is grouped by a week (starting with Monday). I have written an extension method for determining the first day of the week for a date and given a DayOfWeek to treat as the "start of the week".

I have two questions, please:

1. I can get a chart working where it groups together all data for each week, so there is just one point for each week (for each series).  However as you can see I need to still plot the series data on a day-by-day basis, so it's just the labelling of the x-axis that i want to be at a weekly level.  Can you please advise if there is a way to do this?

2. How can I format the area series so that it fills the entire space for a given date? See second attachment for a (hopefully) better explanation of what I mean, comparing it with the "Chart requirements" JPG.

Thanks

7 Answers, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 08 Jan 2016, 04:07 PM
Hi SapDev,

In response to  your questions:

1. The Label Step can be controlled with a LabelStep property (Axix properties --> Scale --> LabelStep). But because of the specifics of Category Scale there is no such property for it and this is why you get a label for each data point. We could suggest to switch to a NumericalScale or DateTimeScale and rearrange your data according to your needs.

2. If we understood you correctly you want to avoid the gap at the begging and the ending. In this case position of the series can be changed by using a DatetimeScale or NumericScale, or by setting X0 property to a valid value (Graph properties --> Series --> SeriesItem --> X0). Please find more detailed information in How to: Add Series help article.

We hope this information will help you with implementation of your report.

Regards,
Katia
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
SapDev
Top achievements
Rank 1
answered on 11 Jan 2016, 10:46 PM

Thanks, a couple of follow ups:

1. Rearranging our data wouldn't get past the fact that we want to hvae more data points than x-axis labels, unless I'm missing something?  Is there a way for us to set labels to invisible based on a formula that checks the day of the date? 

2.  What formula would I use, then, to set the X0 value to the first value of the series and also ensuring that there IS a first value? Or is there a way to set this programatically?  I tried accescessing chart.Series["seriesname"].X0 but said property doesn't exist.

 

Thanks

0
SapDev
Top achievements
Rank 1
answered on 12 Jan 2016, 07:30 AM

Also (if you want me to open a separate forum question, let me know)... how can I set the colour of each of the series in the series group for the area series, so that they are set based on a field in the data object?  I.e. the data i'm plotting is a data source that contains objects which include the date, value and also the colour required.

 

Thanks.

0
SapDev
Top achievements
Rank 1
answered on 12 Jan 2016, 07:38 AM
Regarding 1. above, I undertstand now about the label step - and can see that if we ensure we always start our data on the first 'day' of a week, it should work as required.  However the label step isn't working as expected.  if changed to "7", for example, I'd expect it to only show every 7th date, but it's still showing them all. What else needs changing?
Note that I have changed the scale to a DateTime Scale.
0
Katia
Telerik team
answered on 13 Jan 2016, 03:49 PM
Hi SapDev,

In regards to your questions:

Labels placements on xAxis: in order to show every 7th date on your DateTimeScale you need to set LabelUnit property to Days and LabelStep to 7.

Setting value for X0: the sample expression you can use in your case is = IsNull(First(Fields.Value), defaultValue). You can find out more about build-in functions in Expressions Functions help article.

Setting colors of the series: The Graph item in Telerik Reporting does not support setting the color members directly. The Graph item uses Color Palettes to set the series colors. For more information on the topic, please refer to the Formatting Series Colors help article.
Note that there is no option to set a distinct color per specific data item in the series from a color palette. However, you can set the colors of different data points depending on their data using Conditional Formatting.

Please let us know if you need any additional information.

Regards,
Katia
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
SapDev
Top achievements
Rank 1
answered on 14 Jan 2016, 03:29 AM

Thanks for your responses...

Labels placements on xAxis: GREAT! That is working now, I know i had tried setting that to Days previously but obviously not at the same time as using a step of 7.  Hooray!

Setting value for X0: having this Y0 value set does all sorts of odd things to my data (note that I am setting Y0 not X0, as it complained when I sest X0 to a numeric value, so I presume I actually want to set the 0 value for the Y axis).  I'll have more of a play but perhaps would this not work for a stacked area chart?

Setting colors of the series: OK frustrating but I'll deal with it some other way.

Thanks,

0
Katia
Telerik team
answered on 18 Jan 2016, 04:52 PM
Hi SapDev,

In order to provide more accurate suggestions we would like to ask you to open a support ticket. Please attach to the ticket a sample project representing the issue with the gap in the beginning of xAxis.

We will be waiting for your update.


Regards,
Katia
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
SapDev
Top achievements
Rank 1
Answers by
Katia
Telerik team
SapDev
Top achievements
Rank 1
Share this question
or