Y-Axis Label Scaling

6 posts, 1 answers
  1. Mike
    Mike avatar
    28 posts
    Member since:
    Apr 2013

    Posted 11 Sep 2013 Link to this post

    I've just started with the chart control, but seem to be hitting a brick wall. I'm trying to get the labels, primarily on the Y-Axis to scale properly. Skip entries is probably a better term than scale possibly.

    When the window size is changed the charts scale with the window, but the labels don't and they end up all compressed and scrunched up. I don't know if it's the parent control that's causing this or some other issue.

    I've attached a couple of files showing the normal view (uncompressed) and then when I resize the window (compressed). The charts are in a standard WPF grid, which is in a RadPane. I can post the XAML if needs be, but it's doing nothing more than binding to the data at present.


  2. Answer
    Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 15 Sep 2013 Link to this post

    Hi Mike,

    I have attached a sample project that shows how you can achieve such skipping label fit mode.

    I hope this helps.
     
    Regards,
    Petar Kirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Mike
    Mike avatar
    28 posts
    Member since:
    Apr 2013

    Posted 25 Sep 2013 Link to this post

    Excellent, thanks.

    Is this functionality likely to reach the actual product as a feature? I would image it's a common "ask".
  5. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 30 Sep 2013 Link to this post

    Hi Mike,

    I'm glad that the solution I provided was helpful. 

    I agree that it would be nice if the control provided this functionality out-of-the-box. That's why I logged this as a feature request in our Public Issue Tracker on this link. You are invited to vote for it and promote it. More votes will push it with a higher priority in our backlog.

    Regards,
    Petar Kirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    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 >>
  6. Andrew
    Andrew avatar
    37 posts
    Member since:
    Dec 2012

    Posted 16 Apr 2015 Link to this post

    I'm having a similar problem but in reverse. 

    My application opens in a windowed state so the chart starts out with the y axis labels compressed but looks fine when maximised. 

    I've tried implementing the sample code but find that I can't adapt it to work for the first display of a chart as labels.Count() always returns 0 and the chart.PlotAreaClip is not yet set. 

    The provided code works perfectly when I maximise the window then return it to a windowed state. 

    Could you recommend a way to stop the axis titles from compressing together to begin with before resizing? 

  7. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 20 Apr 2015 Link to this post

    Hello Andrew,

    I tested your scenario with the Petar's project and our latest release Q1 2015 SP1 and everything works as expected on load of the window. The SizeChanged event is called when the chart is measured and the custom logic is executed properly. 

    Also keep in mind that currently we are working on such functionality to be supported out of the box by the chart. We have it logged in our feedback portal where you can track its status. If you follow the item you will be notified as soon as there is any change in the feedback item's status.

    In the mean time you can always show only several labels so that they never overlap. Or you can try to execute the logic from the Petar's project in a Dispatcher in the Loaded event of the chart. For example:
    void chart_Loaded(object sender, System.Windows.RoutedEventArgs e)
    {
        Dispatcher.BeginInvoke(new Action(() => {
            CalculateVerticalLabelInterval();
        }));
    }

    Regards,
    Martin
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready