Support for minor grid lines in ChartView?

5 posts, 1 answers
  1. Don
    Don avatar
    4 posts
    Member since:
    May 2013

    Posted 10 Jun 2013 Link to this post

    How do I display minor gridlines in a ChartView?  The data is displayed in a standard cartesian grid with an X and Y axis.
  2. Answer
    Rosko avatar
    137 posts

    Posted 12 Jun 2013 Link to this post

    Hi Donald,

    Currently, we do not support minor ticks, thus, the same applies for minor gridlines.

    I can offer you the following workaround using CustomGridLines as part of the Annotations feature (demo and help topic) of ChartView.

    First of all, you need to have explicitly set Minimum, Maximum, and MajorStep of the axis:
                    <telerik:LinearAxis Maximum="100"

    Then, you can generate the custom grid lines in the constructor of the window:
    public MainWindow()
                var chartVerticalAxis = (this.chart.VerticalAxis as LinearAxis);
                var min = chartVerticalAxis.Minimum;
                var max = chartVerticalAxis.Maximum;
                var majorStep = chartVerticalAxis.MajorStep;
                var minorOffset = majorStep / 2;
                for (double i = minorOffset; i < max; i += majorStep)
                    chart.Annotations.Add(new CartesianGridLineAnnotation() { Value = i, Stroke = new SolidColorBrush(Colors.Red), StrokeThickness = 1, Axis = chartVerticalAxis});

    I hope that this will server you well.

    Regards, Rosko

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Don
    Don avatar
    4 posts
    Member since:
    May 2013

    Posted 12 Jun 2013 Link to this post

    Thanks.  Works for me. :)
  4. Saurabh
    Saurabh avatar
    10 posts
    Member since:
    Mar 2012

    Posted 04 Aug 2014 Link to this post

    I see this is still a non-implemented feature at Q2 2014 release. How and when are you planning to implement minor grid lines in Chart view? Also, the current workaround will be very tedious if I have to do it for live like in your example - (I know that is link to a silverlight demo)
  5. Martin Ivanov
    Martin Ivanov avatar
    1443 posts

    Posted 07 Aug 2014 Link to this post

    Hi Saurabh,

    I already answered your question in the Creating Custom Major Lines  when using LogarithmicAxis forum.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top