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

CustomGridLine Dashed line

1 Answer 62 Views
Chart
This is a migrated thread and some comments may be shown as answers.
rahul
Top achievements
Rank 1
rahul asked on 06 Sep 2011, 07:15 AM
I have CustomGridLine to draw the the line(dashed line across Y-Axis on Bar Chart, this chart get changed according to the value selected in the Combobox and so the line,
First time the chart and the dashed line works perfect, but when I change the value in combo box, charts get redraw and also the line, problem here is the dashed line convert into one continious line (but I want the dashed line). However the line gets generated at the correct point.

Below is the code snippet:

 

CustomGridLine

 

 

customGridLineOverall =

 

new CustomGridLine

 

{

Visibility =

 

Visibility.Visible,

 

Stroke =

 

new SolidColorBrush(Colors.Gray),

 

StrokeThickness = 3,

ElementStyle =

 

this.Resources[lineType] as Style

 

};

On Selection Changed in combo box:

 

myRadChart.DefaultView.ChartArea.Annotations.Clear();  //clear the annotation
customGridLineClient.YIntercept = avg;

 

 

 

myRadChart.DefaultView.ChartArea.Annotations.Add(customGridLineClient);

 

 

 


 

1 Answer, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 08 Sep 2011, 04:13 PM
Hello Rahul,

It seems that the reported issue is not related to the RadChart control but is a problem within the Silverlight framework itself. Silverlight does not handle properly the following scenarios:
  • First create Line shape, set its Line.Style property to a style instance for dashed line, then add the Line to a Canvas -- the line is correctly displayed as dashed (and the applied style becomes sealed as it was applied to FrameworkElement).
  • Now, clear the Canvas.Children, and create new Line shape but apply the same style instance that was created in Step1 (the style that is now sealed); when you add it to the Canvas you will notice that this time the line is not dashed (we believe the framework does not handle properly the StrokeDashArray value once the style becomes sealed).
The described scenario is actually what happens behind the scenes when you use the zoom/scroll feature of RadChart and that is why it behaves in the same erroneous way. As a workaround we suggest you to recreate the already sealed style instance and apply it to the grid line on the ZoomScrollSettingsPropertyChanged event.

All the best,
Sia
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Chart
Asked by
rahul
Top achievements
Rank 1
Answers by
Sia
Telerik team
Share this question
or