Chart X Axis Labels

4 posts, 1 answers
  1. Willem
    Willem avatar
    12 posts
    Member since:
    Nov 2012

    Posted 29 Jul 2013 Link to this post

    Please see the attached screenshot of a chart. Using CartesianChart, RangeBarSeries and DateTimeCategoricalAxis

    Ideally we would like to be able to display x axis labels under the ticks as shown in the attached screenshot however we want the series to display between ticks (shifted to the left) and without the padding.  The combinations we have tried are as follows :

    - Use PlotMode = OnTicksPadded (Labels are fine but series are on the line and padding on either side is undesirable)
    - Use PlotMode = OnTicks (Labels are right and padding is gone but series on the far right is truncated)
    - Use PlotMode = OnTicks and add half a grid width to the bar series (labels look right, no padding and series look right but tool tips are still over the original series position)
    - Use PlotMode = BetweenTicks (Series look right but labels are in the center)
    - Use PlotMode = BetweenTicks and shift labels to the right by half a grid width (Labels, series and tooltips correct but missing the first date point (i.e. really need to add another date to the axis)

    None of the above give the desired functionalty, could you please advise how to achieve this.

    Regards

    Willem
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 31 Jul 2013 Link to this post

    Hi Willem,

    RadCartesianChart does not support this scenario. However if you really want implement it, you can use the following workaround:
    • RadCartesianChart.ClipToBounds = false (to prevent the clipping of the first label)
    • The default horizontal is with PlotMode set to OnTicks
    • Each series uses a different horizontal axis with PlotMode set to BetweenTicks. This axis is collapsed.
    • An additional placeholder series is added which works with the default axis (because if no series is associated with an axis, the axis doesn't display anything). The placeholder series is hidden by specifying an empty PointTemplate.

    I have attached a sample project demonstrating this.
     
    Regards,
    Petar Kirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Willem
    Willem avatar
    12 posts
    Member since:
    Nov 2012

    Posted 31 Jul 2013 Link to this post

    Hi Petar,

    Thanks for your response. 

    The proposed solution and sample project are not quite there however as you can see the series are offset by a small amount for each tick (i.e. the green series looks right in the first gridlines but then slowly crosses the gridlines in subsequent ticks). 

    Most likely because the visible axis and the invisible axes do not exactly align.

    Any other ideas?

    Regards

    Willem
  5. Answer
    Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 02 Aug 2013 Link to this post

    Hi Willem,

    This is because the two axes have different number of ticks (the axis with PlotMode = OnTicks has one less tick then the one with BetweenTicks). The workaround for this is to add one additional item to the invisible series. I have attached a modified version of the project that shows this. Probably you will need to further adjust the converter for your scenario. 

    Actually I had included this solution the first time but then I went back and forth on a couple of things in order to streamline the solution I forgot to include it in the final project, so please excuse me for the omission.
     
    Regards,
    Petar Kirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top