Hiding the x and y axis

2 posts, 1 answers
  1. Matt
    Matt avatar
    11 posts
    Member since:
    Feb 2015

    Posted 07 Jul 2016 Link to this post

    I don't want to show the x or y axis. I see that you can turn off the labels easily and set the color, but it doesn't look like you can set the visibility. I set the LineColor to white to try to imitate hiding the axis but that doesn't hide the little tick marks:
    chart.HorizontalAxis.ShowLabels = false;
    chart.VerticalAxis.ShowLabels = false;
    chart.HorizontalAxis.LineColor = Color.White;
    chart.VerticalAxis.LineColor = Color.White;

    See the attachment to see the little grey tick marks at the bottom even though the axes are set to white.

    Is there a way to make the axes invisible?

  2. Answer
    Rosy Topchiyska
    Rosy Topchiyska avatar
    586 posts

    Posted 13 Jul 2016 Link to this post

    Hello Matt,

    Thank you for contacting us.

    The chart does not provide styling mechanism for the axis ticks, but the desired look can be easily achieved with a custom chart renderer.

    I have attached a sample to demonstrate this. Please, take a look at the AppDelegate.cs file. The CustomChartRenderer inherits from the default CartesianChartRenderer class and updates the chart axes whenever the chart or its axes are updated.

    Also, don't forget to use the custom renderer in the ExportRenderer attribute:
    [assembly: ExportRenderer(typeof(RadCartesianChart), typeof(CustomChartRenderer))]

     I hope this helps. Please, let us know if you have further questions.

    Rosy Topchiyska
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top