CustomLine repeats

14 posts, 0 answers
  1. FENWICK
    FENWICK avatar
    30 posts
    Member since:
    Jul 2010

    Posted 06 Aug 2013 Link to this post

    Hi,

    I try to create a trend line annotation. So I use Customline annotation
    To create this line, I set only "Slope" and "Y-Intercept" properties : 

    private static void AddTrendAnnotation(this RadChart chart, double a, double b)
        {
            chart.DefaultView.ChartArea.Annotations.Clear();
            var trend = new CustomLine()
            {
                YIntercept      = b,
                Slope           =   a,
                Stroke          = ColorHelper.CreateSolidColorBrush(Colors.Blue),
                StrokeThickness = 1
            };
            chart.DefaultView.ChartArea.Annotations.Add(trend);
        }

    This line was created successfuly but seems to be repeated. I don't know why ?! (Show the attached picture)

    Have you an idea to solve this problem ? 

    Thanks
  2. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 08 Aug 2013 Link to this post

    Hello FENWICK,

    By repeated you mean that you have more than one annotation line?

    If it is that, from the details provided so far, it is hard to diagnose the behavior. I can only guess that it is related to how many times you call the AddTrendAnnotation method, which seems fine.

    Regards,
    Rosko
    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 >>
  3. DevCraft banner
  4. FENWICK
    FENWICK avatar
    30 posts
    Member since:
    Jul 2010

    Posted 08 Aug 2013 Link to this post

    Hi,

    Yes, visually I have multiple annotations lines but in fact I have only created one "Annotation line" .
    Beside the first line of my method is : chart.DefaultView.ChartArea.Annotations.Clear();
    So I clean all annotations before recreate it.

    Finally I checked in debug mode and I have one item in chart.DefaultView.ChartArea.Annotations collection.

    Regards
  5. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 12 Aug 2013 Link to this post

    Hello FENWICK,

    Can you please provide the complete source code of your project so that we can diagnose the described behavior? If you provide a reduced version of the code, it will be the best.

    Regards,
    Rosko
    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 >>
  6. FENWICK
    FENWICK avatar
    30 posts
    Member since:
    Jul 2010

    Posted 12 Aug 2013 Link to this post

    Hi,

    I realized a Sandbox to reproduce this problem. You could download this project at this url:here

    My sandbox uses random data. So the problem occurs sometimes not ever.
    I hope you can find a solution to this issue with this sample.

    Thanks you
    Regards

  7. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 15 Aug 2013 Link to this post

    Hi FENWICK,

    Thank you for providing the isolated project.
     
    The behavior is related to Silverlight framework, when the line becomes too long. You can work around this in two distinct ways:
     1. Set some MinX and MaxX for each annotation line, this way they will not become too long.
    or
     2. Make sure that the slope is outside the following range: (-0.05, 0.05), i.e. not this close to 0.

    Regards,
    Rosko
    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 >>
  8. FENWICK
    FENWICK avatar
    30 posts
    Member since:
    Jul 2010

    Posted 19 Aug 2013 Link to this post

    Hi,

    I tried to set MinX and maxX with my first OA Date and my last OA Date. that's not work.
    So I Tried to set minX = 1 and maxX = number of elements. That's work but not solve the problem. Sometimes I have multiple lines ...

    I checked your second point and my slope is not between -0.05 and 0.05.


    Have you another idea ?

    Thanks
  9. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 21 Aug 2013 Link to this post

    Hi,

    The slope values, mentioned by Rosko are not strictly defined and the problem might arise for other values too -- this will also depend on the zoom and the chart size. However, setting the MinX and MaxX should solve the problem. Can you send us an example, so that we can review it? Thanks.

    Best regards,
    Ves
    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 >>
  10. FENWICK
    FENWICK avatar
    30 posts
    Member since:
    Jul 2010

    Posted 22 Aug 2013 Link to this post

    Hi,

    Here my code which create my custom line : 
    chart.DefaultView.ChartArea.Annotations.Clear();
                var trend = new CustomLine()
                {
                    YIntercept      = b,
                    Slope           =   a,
                    Stroke          = ColorHelper.CreateSolidColorBrush(Colors.Red),
                    StrokeThickness = 1,
                    MinX = 0,
                    MaxX = dataNumber
                };
                chart.DefaultView.ChartArea.Annotations.Add(trend);

    So I Set maxX with the number of data shown.

    I found a concret sample : With slope = -14.147 and Y-Intercept = 396.155, I have the bug.

    I do not know if it can help you..

    Thanks.

  11. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 27 Aug 2013 Link to this post

    Hi,

    The image attached to your initial message shows that you are plotting a line against DateTime values, so it is still possible that the range is quite large, making the line too long (i.e. over 32000 pixels in width) thus manifesting the problem in Silverlight framework, mentioned by my colleague Rosko. I am afraid the link you have provided earlier is not valid anymore. Can you please re-upload the example, so that we can have another look at it and get back to you with a specific suggestion. Thank you.

    Best regards,
    Ves
    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 >>
  12. FENWICK
    FENWICK avatar
    30 posts
    Member since:
    Jul 2010

    Posted 28 Aug 2013 Link to this post

    HI,

    Your hypothesis is consistent. I think the problem is with date in Xaxis.
    I have reuploaded my sandbox : here

    Thanks to your investigation
  13. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 30 Aug 2013 Link to this post

    Hi,

    Thank you for the project. I am afraid this behavior is caused by the already mentioned problem with Silverlight being unable to display large objects and unfortunately setting MinX and MaxX will not always fix it. I have notified our developers of the problem, but I am afraid I cannot provide a specific time frame for the fix.

    Best regards,
    Ves
    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 >>
  14. FENWICK
    FENWICK avatar
    30 posts
    Member since:
    Jul 2010

    Posted 02 Sep 2013 Link to this post

    Hi,

    Thanks you to your searches. I Found a workaround. Instead the custom line, I create another serie by calculating all points.
    is it possible to provide my points to the bug report ?

    Thanks
  15. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 05 Sep 2013 Link to this post

    Hi,

    I have updated your account.

    Best regards,
    Ves
    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