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

CustomLine repeats

13 Answers 73 Views
Chart
This is a migrated thread and some comments may be shown as answers.
FENWICK
Top achievements
Rank 1
FENWICK asked on 06 Aug 2013, 09:32 AM
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

13 Answers, 1 is accepted

Sort by
0
Rosko
Telerik team
answered on 08 Aug 2013, 09:01 AM
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 >>
0
FENWICK
Top achievements
Rank 1
answered on 08 Aug 2013, 09:49 AM
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
0
Rosko
Telerik team
answered on 12 Aug 2013, 11:36 AM
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 >>
0
FENWICK
Top achievements
Rank 1
answered on 12 Aug 2013, 02:45 PM
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

0
Rosko
Telerik team
answered on 15 Aug 2013, 09:55 AM
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 >>
0
FENWICK
Top achievements
Rank 1
answered on 19 Aug 2013, 09:38 AM
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
0
Ves
Telerik team
answered on 21 Aug 2013, 03:53 PM
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 >>
0
FENWICK
Top achievements
Rank 1
answered on 22 Aug 2013, 04:09 PM
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.

0
Ves
Telerik team
answered on 27 Aug 2013, 11:47 AM
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 >>
0
FENWICK
Top achievements
Rank 1
answered on 28 Aug 2013, 08:37 AM
HI,

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

Thanks to your investigation
0
Ves
Telerik team
answered on 30 Aug 2013, 03:29 PM
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 >>
0
FENWICK
Top achievements
Rank 1
answered on 02 Sep 2013, 08:04 AM
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
0
Ves
Telerik team
answered on 05 Sep 2013, 07:16 AM
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 >>
Tags
Chart
Asked by
FENWICK
Top achievements
Rank 1
Answers by
Rosko
Telerik team
FENWICK
Top achievements
Rank 1
Ves
Telerik team
Share this question
or