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

Entering non-contiguous values in Axis

7 Answers 81 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Michel
Top achievements
Rank 1
Michel asked on 11 Nov 2011, 06:42 PM
Hi,

When I have non-contiguous values for X axis, the chart fills in the gaps.

ie: 2011.50, 2011.51, 2011.52, 2012,01, 2012.02...

The Chart adds values for : 2011.53, 2011.54, 2011.55, etc...

Is it possible to tell the Chart NOT to fill those gaps ?

Thanks !

Michel

7 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 14 Nov 2011, 09:29 AM
Hello Michel,

You can achieve the desired behavior using the empty values feature. Choosing EmptyPointBehavior.Gap would clip the sections of the chart, corresponding to a set of empty values.

You can find an example of how the chart would appear in our demo, simply navigate to Chart -> Empty Values. Hope this helps.

Kind regards,
Nikolay
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Michel
Top achievements
Rank 1
answered on 14 Nov 2011, 02:38 PM
Hello and thank you again for your help.

I have seen the demo with the 3 options Gap, Zero and Drop.

Unfortunately, the dates with empty values in the X axis still appear...

I do not wish for the "empty" dates to appear in the labels of the x axis.

The reason is I display Week Numbers in the bottom. I do not want the Chart to display Weeks 54 - 99 in the bottom when I display values for 2 years...

Thanks,

Michel

0
Nikolay
Telerik team
answered on 15 Nov 2011, 08:35 AM
Hello Michel,

Presently, the way to solve this issue would be to remove the entries with no data from the underlying data source, so that the data the chart is bound to is continuous. You can do this manually or try creating an if statement, which would remove all entries that have a value of null, for example.

Greetings,
Nikolay
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Michel
Top achievements
Rank 1
answered on 15 Nov 2011, 02:52 PM
Hi,

Maybe I did not explain the problem properly...

Here is the data I am sending where the Period is a double representing the Year.Week :

Period   Quantity
2011.50  100
2011.51  200
2011.52  300
2012,01  400
2012.02  500

The Chart adds XAxis labels for Periods : 2011.53, 2011.54, 2011.55, which I am NOT sending...

Thanks,

Michel


0
Nikolay
Telerik team
answered on 16 Nov 2011, 10:18 AM
Hi Michel,

In this case the best approach would be to map to XCategory, instead of XValue. This way the chart is able to plot not only values(e.g. number of sales, etc.), but also categories (e.g. months of the year, units, people, etc.) and the it treats the data as a sequence of non-numerical text labels. In this manner there would be no data for periods such as 2011.53, 2011.54, etc. and you would only get the data points which represent each period.

Kind regards,
Nikolay
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Michel
Top achievements
Rank 1
answered on 17 Nov 2011, 03:13 PM
Thanks !

Works perfectly !

Now I need to tell the Chart not to round-off values like week number 50. I need "2011.50" and the Chart displays "2011.5"...

Thanks again !

Michel
0
Nikolay
Telerik team
answered on 21 Nov 2011, 09:25 AM
Hi Michel,

There are two ways to handle this issue - the first would be to parse the doubles to strings ( or alternatively use DateTime values if applicable ), the other possibility would be to assign a label format expression , that would display the values 2 or 3 digits after the decimal point.

Generally, in case you need to use these types of values ( 2011.50, 2011.51, etc. ) as categories , we would recommend using string or parsing them to a string and mapping to XCategory.

All the best,
Nikolay
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Chart
Asked by
Michel
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Michel
Top achievements
Rank 1
Share this question
or