What is the different between xvalue and XCategory?

6 posts, 0 answers
  1. PEIYANG
    PEIYANG avatar
    65 posts
    Member since:
    Jul 2012

    Posted 14 Nov 2012 Link to this post


    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));
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 15 Nov 2012 Link to this post

    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.

  3. DevCraft banner
  4. PEIYANG
    PEIYANG avatar
    65 posts
    Member since:
    Jul 2012

    Posted 15 Nov 2012 Link to this post

    Thank you,Petar Marchev.
  5. Ashna
    Ashna avatar
    5 posts
    Member since:
    Oct 2012

    Posted 12 Feb 2013 Link to this post

    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.
  6. Ashna
    Ashna avatar
    5 posts
    Member since:
    Oct 2012

    Posted 12 Feb 2013 Link to this post

    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.
  7. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 14 Feb 2013 Link to this post

    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.

Back to Top
DevCraft banner