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

What is the different between xvalue and XCategory?

5 Answers 66 Views
Chart
This is a migrated thread and some comments may be shown as answers.
PEIYANG
Top achievements
Rank 1
PEIYANG asked on 14 Nov 2012, 11:30 AM

What is the different between xvalue and  XCategory?Sometimes I can use both,but sometimes I can use one only!!!
sm.ItemMappings.Add(new ItemMapping("Date", DataPointMember.XCategory));
sm.ItemMappings.Add(new ItemMapping("Date", DataPointMember.XValue));

5 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 15 Nov 2012, 09:13 AM
Hi Peiyang,

Let's say you are using a bar chart. The bar chart shows 3 bars. Each bar corresponds to a DataPoint. A data point is an information unit that carries information about an underlying business item. If you business class is FruitInfo with two properties (Name and Value) and in your items source you have three items:
Bananas 4
Carrots 5
Tomatos 10

Three data points will be constructed out of this.In order for these data points to be constructed properly you need to define item mappings. In the item mapping you can specify from which property should the YValue be extracted - in this current scenario this is the Value property. You can also define how the item is distributed along the X-axis. This is where the XValue and XCategory kick in.

Lets say you have a third property Date for this FruitInfo class.

2012/11/15  Bananas 4
2012/11/26  Carrots 5
2012/11/27  Tomatos 10

If you map the Date property to XCategory - the dates are treated as simple categories. They are being positioned right next to each other. If you map the Date property to XValue - the X-axis will distribute them according to the values that the Dates present. In this case the Bananas and Carrots bars will be far away, while the Carrots and Tomatos bars will be right next to each other.

Basically this is the difference, I have also attached a snapshot of the different output these two produce.

Regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
PEIYANG
Top achievements
Rank 1
answered on 15 Nov 2012, 06:04 PM
Thank you,Petar Marchev.
0
Ashna
Top achievements
Rank 1
answered on 12 Feb 2013, 08:33 AM
Hello sir,
    I have an issue. Suppose i have 2 different YValues for same Xcategory. When i generate the chart, these 2 values overlap each other. Now what actually i want is that instead of overlapping, these 2 values should be displayed independently i.e. XCategory should be generated repeatedly over x-axis for the number of yValues it holds. Is it possible to do that?
I am attaching an image here along, which might better explain my problem .
Hope for a quick response.
0
Ashna
Top achievements
Rank 1
answered on 12 Feb 2013, 08:39 AM
Hello sir,
    I have an issue. Suppose i have 2 different YValues for same Xcategory. When i generate the chart, these 2 values overlap each other. Now what actually i want is that instead of overlapping, these 2 values should be displayed independently i.e. XCategory should be generated repeatedly over x-axis for the number of yValues it holds. Is it possible to do that?
I am attaching an image here along, which might better explain my problem .
Hope for a quick response.
0
Petar Kirov
Telerik team
answered on 14 Feb 2013, 12:19 PM
Hi Ashna,

By design RadChart and RadChartView position all data points with equal value on the same XCategory. If the data points come from different series they are clustered properly, but because the RadChart expects that each series has only a single data point per XCategory, it draws them on top of each other.

Basically you need to use separate series different YValues on the same XCategory.
 

Regards,
Petar Kirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart
Asked by
PEIYANG
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
PEIYANG
Top achievements
Rank 1
Ashna
Top achievements
Rank 1
Petar Kirov
Telerik team
Share this question
or