PolarSeries Closed Line

6 posts, 0 answers
  1. James
    James avatar
    22 posts
    Member since:
    Mar 2013

    Posted 19 Feb 2015 Link to this post

    Hi, 

    When creating my polar charts I sometimes need them to be open ended (if say I only have 180 degrees of data). Currently when I plot them they automatically close (image attached). Is there an "IsClosed" property for the series? I'm using the ChartSeriesProvider.

    Thanks,

    James
  2. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 20 Feb 2015 Link to this post

    Hello James,

    Yes, the PolarLineSeries and the PolarAreaSeries expose IsClosed property that determines whether the line curve will be closed. The default value of this property is True. However, as this property is not a DependencyProperty it can't be set in Style. To resolve this you can create an attached property and use it to set the IsClosed property in the Style of the series descriptor.

    Here is an example:
    <telerik:PolarSeriesDescriptor.Style>
        <Style TargetType="telerik:PolarLineSeries">
            <Setter Property="local:PolarChartUtilities.IsSeriesClosed" Value="False" />                                   
        </Style>
    </telerik:PolarSeriesDescriptor.Style>

    public class PolarChartUtilities
    {
        public static bool GetIsSeriesClosed(DependencyObject obj)
        {
            return (bool)obj.GetValue(IsSeriesClosedProperty);
        }
     
        public static void SetIsSeriesClosed(DependencyObject obj, bool value)
        {
            obj.SetValue(IsSeriesClosedProperty, value);
        }
     
        public static readonly DependencyProperty IsSeriesClosedProperty =
            DependencyProperty.RegisterAttached("IsSeriesClosed", typeof(bool), typeof(PolarChartUtilities), new PropertyMetadata(true, OnIsSeriesClosedChanged));
     
        private static void OnIsSeriesClosedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == null) { return; }
            var series = (PolarLineSeries)d;
            series.IsClosed = (bool)e.NewValue;
        }
    }

    Please try this approach and let me know if it works for you.

    Regards,
    Martin
    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. James
    James avatar
    22 posts
    Member since:
    Mar 2013

    Posted 23 Feb 2015 in reply to Martin Link to this post

    Thanks Martin that works for me!
  5. Marcello
    Marcello avatar
    58 posts
    Member since:
    Apr 2013

    Posted 18 Oct Link to this post

    Hi,

     

    exists a similar strategy in Windows Forms version?

    thanks.

  6. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 18 Oct Link to this post

    Hi Marcello,

    Can you post your question in the WinForms section of the forums? This way more people from the WinForms community could see your question and the chance to get a suitable answer increases. Thank you for the cooperation.

    Regards,
    Martin
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  7. Marcello
    Marcello avatar
    58 posts
    Member since:
    Apr 2013

    Posted 18 Oct in reply to Martin Link to this post

    Moved, thanks
Back to Top
UI for WPF is Visual Studio 2017 Ready