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

Automatically determine the optimal LabelStep to use

14 Answers 552 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 13 Feb 2012, 02:27 AM
Hi,

The x-axis on my chart is overlapping in cases where I have too many data points.

I realise that I can use LabelStep to force the chart to force some data points to be skipped.

My question is whether there is a setting on the chart to _autmatically_ make the x-axis labels fit (be it through the use of LabelStep, LabelRotationAngle, etc) depending on the size of the chart.

Thanking you for your asssitance.

Tony

14 Answers, 1 is accepted

Sort by
0
Nikituki
Top achievements
Rank 1
answered on 14 Feb 2012, 12:00 PM
Try to use "LabelInterval" property
0
Tony
Top achievements
Rank 1
answered on 14 Feb 2012, 01:00 PM
Thanks Nikituki but not exactly the answer I'm after.

From searching through the other sections of the forum, it seems like the property that I'm after is AutoStep but this is only available in RadChart.

Telerik support - are there any plans on making this property/functionality available in RadChartView and if so, is this already scheduled in your roadmap?

Cheers,

Tony
0
Giuseppe
Telerik team
answered on 16 Feb 2012, 01:21 PM
Hello Tony,

Currently you can control how RadCartesianChart deals with overlapping through the Axis.LabelFitMode property:
  • AxisLabelFitMode.None -- no action is taken.
  • AxisLabelFitMode.Rotate -- labels are rotated at Axis.LabelRotationAngle degrees.
  • AxisLabelFitMode.Multiline -- labels are arranged in multiple lines so the text does not overlap.

We will forward your feedback to our developers as well but currently we cannot commit specific enhancements to the auto-step logic for the next product release roadmap.



Greetings,
Giuseppe
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Tony
Top achievements
Rank 1
answered on 03 May 2012, 08:01 AM
Hi Giuseppe,

Any word from the devs as to whether they will be adding this feature in an upcoming release?

Thanks,

Tony
0
Giuseppe
Telerik team
answered on 07 May 2012, 09:25 AM
Hello Tony,

There are no planned enhancements with regards to automatic axis label arrangement for the Q2 2012 release as we are still focused on adding some missing core features like empty values to the control. Once we have covered the basics, we will revisit and discuss the availability of this feature again.


Greetings,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Tony
Top achievements
Rank 1
answered on 07 May 2012, 02:07 PM
Hi Giuseppe,

Thanks for the update.

So for the scenario where there are, let's say 60 labels to render, would you agree that the 3 existing LabelFitMode might not be sufficient?
  • AxisLabelFitMode.None - won't do anything to help with the label overlapping problem
  • AxisLabelFitMode.Rotate - even at 90 degrees, the labels would still overlap
  • AxisLabelFitMode.Multiline - the labels would still overlap?

Are there any other workarounds or alternative in the meantime?

Cheers,

Tony

0
Giuseppe
Telerik team
answered on 10 May 2012, 11:21 AM
Hello Tony,

Besides Axis.LabelFitMode you can use the Axis.LabelInterval property that specifies the step at which labels are positioned (e.g. LabelInterval = 4 means that every fourth label will be shown).

Could you elaborate what additional fit modes are you looking for that would address the overlapping issue better (besides automatically choosing a combination of the existing options for LabelInterval and LabelFitMode)?


Greetings,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Tony
Top achievements
Rank 1
answered on 10 May 2012, 12:50 PM
Hi Guiseppe,

The issue we have with label interval is that depending on the user screen resolution + the size of the chart, we might not be calculating the optimal interval (that plus we don't really want to start having code to get this information).

I'm thinking perhaps something similar to this feature that is available in the WPF RadChart:

Axis AutoStep Functionality - the AutoStep feature introduces new and improved level of re-scaling that allows the chart axes to automatically re-arrange their values. Thanks to this feature point labels overlapping is avoided and the information is presented clearly and neatly.

http://www.telerik.com/help/wpf/radchart-overview-key-features.html

Regards,

Tony
0
Giuseppe
Telerik team
answered on 15 May 2012, 10:10 AM
Hello Tony,

Thank you for elaborating on this. We will forward your feedback to our developers so they can take it in consideration when discussing the availability of this feature for future release.


Regards,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Christian
Top achievements
Rank 1
answered on 27 Aug 2013, 08:34 AM
Are there any updates on this topic?
0
Christian
Top achievements
Rank 1
answered on 27 Aug 2013, 08:36 AM
Labels should adjust when the user zooms in or out, so LabelInterval is not really helpful
0
Evgenia
Telerik team
answered on 30 Aug 2013, 07:41 AM
Hi Christian,

 The chart respects the number of datapoints you'd like visualized and it has some internal heuristics which make sure that there are a certain number of ticks on the axis. Otherwise, the chart will not make much sense if it has very few ticks on its axis. Please mind that even though it tries to control the labels for best visualization it's up to you to tweak them via the properties we exposed for better readability.

You might also fine-tune the number of labels/ticks being displayed in the following way: update your data accordingly to prevent too many data points visualized - e.g. you may remove the last data entry upon adding a new one if a certain threshold is exceeded. Also you might use our Pan and Zoom behaviour that provides zoom and scroll interactivity and allows users to zoom in the chart plot area when are there is a dense area of data points that can not be seen clearly at the normal chart scale.

Regards,
Evgenia
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Christian
Top achievements
Rank 1
answered on 30 Aug 2013, 09:36 AM
Hi,

thanks for your answer.
It works very well with my numerical y-axis, but I use a DateTimeCategoricalAxis as my x-axis.
I want to show all bars in by barseries, but I want to show as many labels as possible without overlapping each other.
I can set a LabelInterval depending on the number of data points to reduce the number of labels, but this does not help when I use zoom and pan. When I zoom in, the chart could display more labels, but it still sticks to the geiven labelinterval, so I may not see any labels at all when I zoom in deep enough.

Do you have a solution for this problem?
Thanks in advance & best regards
0
Evgenia
Telerik team
answered on 03 Sep 2013, 08:40 AM
Hi Christian,

There is a workaround actually but please mind that if you choose to use it any further code modifications are up to you as this is not a well-tested solution but just a suggestion to accomplish your requirement. 
The DateTimeCategoricalAxis (as in your case) has a MajorTickInterval property to specify the step at which ticks and labels are available. The DateTimeContinuousAxis has MajorStep and MajorStepUnit (Month vs. Day, etc) to fine-tune the ticks.

When you are using the DateTimeCategoricalAxis without setting its DateTimeComponent property, which default value is DateTimeComponent.Day.  the data is grouped by the Day value of each DateTime structure passed. If you want the entire Date value to be used, you should set the DateTimeComponent to Date. To specify tick interval you may use the MajorTickInterval property. For example:

private void UpdateTickInterval(CategoricalAxis axis)
{
    int dataPointCount = (this.radChart1.Series[0] as CategoricalSeries).DataPoints.Count;
    // round to 8 ticks
    int interval = dataPointCount / 8;
    axis.MajorTickInterval = Math.Max(1, interval);
}

You might use this and update the number of ticks to be displayed by wiring to ZoomChanged event of RadChartView.

Hope this helps.  

Regards,
Evgenia
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ChartView
Asked by
Tony
Top achievements
Rank 1
Answers by
Nikituki
Top achievements
Rank 1
Tony
Top achievements
Rank 1
Giuseppe
Telerik team
Christian
Top achievements
Rank 1
Evgenia
Telerik team
Share this question
or