This is a migrated thread and some comments may be shown as answers.

Automatically choose the optimal LabelStep in a scatter graph

3 Answers 125 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jeroen
Top achievements
Rank 1
Jeroen asked on 07 Aug 2014, 02:21 PM
Hi,

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.

3 Answers, 1 is accepted

Sort by
0
Ivan Hristov
Telerik team
answered on 12 Aug 2014, 08:46 AM
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.

Regards,
Ivan Hristov
Telerik
 

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.

 
0
Jonathan
Top achievements
Rank 1
answered on 06 Apr 2019, 11:24 PM
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.
0
Ivan Hristov
Telerik team
answered on 08 Apr 2019, 10:58 AM
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>
    InitializeComponent();
 
    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.

Regards,
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
Tags
General Discussions
Asked by
Jeroen
Top achievements
Rank 1
Answers by
Ivan Hristov
Telerik team
Jonathan
Top achievements
Rank 1
Share this question
or