Drawing multiple series incorrectly

5 posts, 1 answers
  1. Shane
    Shane avatar
    3 posts
    Member since:
    Jan 2012

    Posted 06 Jan 2012 Link to this post


    Hi

    I have a RadChart to display multiple series of items
    These series are not symetrical, i.e. there are X values in some series which are not in others.

    My issue is that, when the series are drawn, the X axis is not sorted correctly. It seems that X values are added for the first series and any values which occur in the second series, but not the first, are added to the end of the X axis.

    Please see attached image for details

    Can you help me with this issue?

    Cheers
    Shane
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 11 Jan 2012 Link to this post

    Hi,

    It seems that you are actually using XCategory and not XValue. If you use XValue no such issue should arise.

    If you insist on using XCategory then a small work around would be to insert all possible categories in the first series source (with null values) .

    Hope this helps.

    Kind regards,
    Petar Marchev
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
  4. Shane
    Shane avatar
    3 posts
    Member since:
    Jan 2012

    Posted 11 Jan 2012 Link to this post

    Hi Petar,

    Thank you for the reply.
    I am now using XValue instead of XCategory, however this is bringing a new problem.
    The chart now draws an extra x axis point at the end of the chart, which I do not want.

    In the attached image this is Q4 - 2011.
    Is there something I can set to remove this empty space?

    Extra info:
    Chart X values are DateTime objects.
    The x axis labels are derived from these objects by overriding the "AxisLabel2D" style in xaml

    Thank you for your help
    Shane
  5. Answer
    Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 16 Jan 2012 Link to this post

    Hello Shane,

    As I have none of your code and none of your input data - I will again have to do some guessing, so please do excuse me if I make some wrongful assumptions.

    The label that says "Q3 - 2011" probably represents a day in July. Let's say it represents the 15th of July. The data item in the chart's items source also represents some day, apparently very close to 15th of July but seems that is some day after this. So the label is there to mark the 15th but the input data is for the 16th. So the chart does not want to clip your data and this is why it seems that it is showing an extra quarter.

    I think now the problem is obvious to you, too. To solve this you need to somehow synchronize the input data and the axis' step.

    I have to guess your next question, too - "How do I do that?" - Well, there is no easy way - because of the nature of the axis(ticks need to be evenly distributed). You can try to manipulate your input data to fit the axis, but this would be a cumbersome workaround.

    If this empty space at the end is not a huge problem I suggest you leave it as it is. If you insist on removing it - my suggestion to you would be to get back to "XCategory" and use the simple work-around that I suggested in my previous response.

    Hope this helps.

    Kind regards,
    Petar Marchev
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  6. Shane
    Shane avatar
    3 posts
    Member since:
    Jan 2012

    Posted 16 Jan 2012 Link to this post

    Hi Petar,

    Thanks for the feedback.

    In the end I used a combination of two solutions:
    The first was to alter my data source to ensure that the 16th of July would not occur. This was not an issue as we use quarterly increments.
    The second was to force draw the X axis I wanted using "AxisX.AddRange(...)".

    Thanks for your help on this matter, (especially as you were going at it blindly), it certainly helped my project along.

    Regards
    Shane
Back to Top
DevCraft banner