Automatically determine the optimal LabelStep to use

15 posts, 0 answers
  1. Tony
    Tony avatar
    21 posts
    Member since:
    Oct 2011

    Posted 12 Feb 2012 Link to this post

    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
  2. Nikituki
    Nikituki avatar
    34 posts
    Member since:
    Nov 2011

    Posted 14 Feb 2012 Link to this post

    Try to use "LabelInterval" property
  3. DevCraft banner
  4. Tony
    Tony avatar
    21 posts
    Member since:
    Oct 2011

    Posted 14 Feb 2012 Link to this post

    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
  5. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 16 Feb 2012 Link to this post

    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 >>
  6. Tony
    Tony avatar
    21 posts
    Member since:
    Oct 2011

    Posted 03 May 2012 Link to this post

    Hi Giuseppe,

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

    Thanks,

    Tony
  7. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 07 May 2012 Link to this post

    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 >>

  8. Tony
    Tony avatar
    21 posts
    Member since:
    Oct 2011

    Posted 07 May 2012 Link to this post

    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

  9. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 10 May 2012 Link to this post

    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 >>

  10. Tony
    Tony avatar
    21 posts
    Member since:
    Oct 2011

    Posted 10 May 2012 Link to this post

    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
  11. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 15 May 2012 Link to this post

    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 >>

  12. Christian
    Christian avatar
    52 posts
    Member since:
    Apr 2011

    Posted 27 Aug 2013 Link to this post

    Are there any updates on this topic?
  13. Christian
    Christian avatar
    52 posts
    Member since:
    Apr 2011

    Posted 27 Aug 2013 Link to this post

    Labels should adjust when the user zooms in or out, so LabelInterval is not really helpful
  14. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 30 Aug 2013 Link to this post

    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 >>
  15. Christian
    Christian avatar
    52 posts
    Member since:
    Apr 2011

    Posted 30 Aug 2013 Link to this post

    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
  16. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 03 Sep 2013 Link to this post

    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 >>
Back to Top
DevCraft banner