Can ChartView categories with the same name be treated as different categories?

2 posts, 0 answers
  1. Asti
    Asti avatar
    12 posts
    Member since:
    Dec 2007

    Posted 22 Nov 2012 Link to this post

    Hi, this might sound like a strange question but

    If I have a CartesianChart bound to the following sample data:

    category (DateTime): 01.01.2000 value 1
    category (DateTime): 01.01.2000 value 2

    this data is bound to a barseries and the categorybinding and valuebinding are set to the respective fields,
    the horizontal x axis contains a DateTimeCategoriesAxis.

    When i run this two bars are together and one category is shown which is kind of logical in the sense that it's the same category.

    Is there however some way of forcing the x-axis to treat each category as a separate category instead? so that the two bars have spacing between them and are in their respective "category" similar to how Excel does things.
  2. Petar Marchev
    Petar Marchev avatar
    1014 posts

    Posted 23 Nov 2012 Link to this post

    Hi Asti,

    I suggest that you define a GenericDataPointBinding for the CategoryBinding. You can use it to return a different value (different category) for each item (based on some custom logic). Later you can use the LabelFormat of the axis to make ti look as if the categories are the same. I have attached a simple app demonstrating this. Let us know how it goes. 

    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top