Hide Minor Ticks X-Axis RadChart

Thread is closed for posting
4 posts, 0 answers
  1. Rakesh
    Rakesh avatar
    6 posts
    Member since:
    Aug 2012

    Posted 03 Jan 2012 Link to this post


    I have a requirement of binding Daily points on to the Charts. On the X-Axis i am trying to show the Label of some 5 dates and hiding all the other labels. I want to show the major ticks for which Dates are being displayed and hide all the minor ticks. Is this possible to show only Major and not the Minor ticks when binding dynamically. 
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Jan 2012 Link to this post


    XAxis has only a MajorTick property. Take a look into the following documentation for more.

  3. DevCraft R3 2016 release webinar banner
  4. Rakesh
    Rakesh avatar
    6 posts
    Member since:
    Aug 2012

    Posted 04 Jan 2012 Link to this post

    Please find the below code, suggest me if anything is missing in acheving my requirement.

    <PlotArea XAxis-LayoutMode="Normal" Appearance-FillStyle-FillType="Solid" Appearance-Border-Visible="false">
                                                                <XAxis DataLabelsColumn="Timeline" AxisLabel-TextBlock-Text="Timeline" Appearance-MinorTick-Visible="false"
                                                                    Appearance-MinorGridLines-Visible="false" Appearance-MajorGridLines-Visible="false" Appearance-MajorTick-Visible="true">
                                                                <YAxis IsZeroBased="false" Appearance-MinorGridLines-Visible="false" Appearance-MajorGridLines-Visible="false"
                                                                    AxisLabel-Marker-Visible="false" Appearance-MajorTick-Visible="false" Appearance-MinorTick-Visible="false"

       ChartSeries s = Chart.Series[0];
                for (int i = 0; i < List.Count; i++)
                    ChartSeriesItem item = new ChartSeriesItem();
                    item.YValue = List[i].Views;
                    item.ActiveRegion.Tooltip = List[i].Views.ToString("#,#", CultureInfo.InvariantCulture) + " views on " + List[i].Week.ToShortDateString();
                    if (i % mod == 0)
                        Chart.PlotArea.XAxis.GetItem(i).Visible = true;
                        Chart.PlotArea.XAxis.GetItem(i).Visible = false;
  5. Peshito
    Peshito avatar
    493 posts

    Posted 06 Jan 2012 Link to this post


    You can hide some of the axis labels by wiring to the chart's BeforeLayout event like this:
    void radChart_BeforeLayout(object sender, EventArgs e)
            foreach (var item in radChart.PlotArea.XAxis.Items)
                if ((double)item.Value > new DateTime(2009, 8, 1, 0, 0, 0).ToOADate())
                    item.TextBlock.Text = " ";

    The code above will hide all XAxis labels with date value bigger than 2009/08/01.

    Regarding your other questions about hiding some of the major ticks, there is no way to loop through MajorTicks of the axes which means that you can either make all of them invisible or nor of them.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top