Automatically choose the optimal LabelStep in a scatter graph

4 posts, 0 answers
  1. Jeroen
    Jeroen avatar
    50 posts
    Member since:
    Feb 2012

    Posted 07 Aug 2014 Link to this post


    I'm trying to create a scatter graph with DateTime points on the x-axis. A problem here is that the labels on the x-axis overlap when there are to many data points.

    A solution that I found was to manually determine my Labelsteps, this solutions doesn't work for all my use cases. Is there a way to auto-scale the labelsteps? I've read on the forum that the "Axis AutoStep Functionality" could be a solution. Is this feature available for reporting graph? I cannot seem to find this functionality.

    Thanking you for your asssitance.
  2. Ivan Hristov
    Ivan Hristov avatar
    204 posts

    Posted 12 Aug 2014 Link to this post

    Hi Jeroen,

    The LabelUnit property depends on the selected MajorStep and MajorUnit properties, which are set to Auto by default. However, the LabelStep property by default is set to 1, which could cause label overlapping as in your case. Please note that the LabelStep is applied only when the LabelUnit is not Auto.

    The mentioned AutoScale functionality exists in the obsolete Chart item and it acts similarly to the Auto setting of the BaseUnit.

    Auto-scaling the label is not a trivial task, since it depends on the label angle, its font size and the axis size. That's why we can suggest you as a workaround to set your LabelStep property programmatically prior to report processing right after the InitializeComponent() call. You can set the appropriate label step based on your preference for font, axis size and label spacing.

    Hope it helps.

    Ivan Hristov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Jonathan
    Jonathan avatar
    6 posts
    Member since:
    Oct 2018

    Posted 06 Apr in reply to Ivan Hristov Link to this post

    How do you access the label step programmatically?  I've been searching and searching, but cannot find it.  Can only seem to set it via the designer.
  4. Ivan Hristov
    Ivan Hristov avatar
    204 posts

    Posted 08 Apr Link to this post

    Hello Jonathan,

    The designer works with the same reporting model so everything you can set in the designer can be accessed programmatically in the report definition. The LabelStep is a property of the DateTime (or Numerical) Scale and can be accessed via the coordinate system of the graph item. Here is how to set it programmatically for the numerical scale of the X axis of the graph named SalesPersonQuarterBar in our Dashboard example:
    public Dashboard()
        /// <summary>
        /// Required for Telerik Reporting designer support
        /// </summary>
        var ccs = (CartesianCoordinateSystem)this.SalesPersonQuarterBar.CoordinateSystems[0];
        ((NumericalScale)ccs.XAxis.Scale).LabelStep = 200;

    Please note that in DateTime scale the LabelStep property is respected only when the LabelUnit property is other than Auto.

    Ivan Hristov
    Progress Telerik
    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