I am adding a CustomLine to my graph and am attempting to style it like I am styling a CustomGridLine as specified here: http://demos.telerik.com/silverlight/#Chart/CustomGridLines but it is not working. Is it possible to style a CustomLine as a dotted line or a dashed line, etc.?
Tks.
Tks.
3 Answers, 1 is accepted
0
Hi Brian,
Just add ElementStyle:
and put the following style in your resources:
Kind regards,
Sia
the Telerik team
Just add ElementStyle:
<
telerik:ChartArea.Annotations
>
<
telerik:CustomLine
Stroke
=
"Red"
Slope
=
"Infinity"
XIntercept
=
"2"
MinY
=
"100"
MaxY
=
"200"
ElementStyle
=
"{StaticResource DashedStyle}"
/>
</
telerik:ChartArea.Annotations
>
and put the following style in your resources:
<
Style
x:Key
=
"DashedStyle"
TargetType
=
"Line"
>
<
Setter
Property
=
"StrokeDashArray"
Value
=
"5,2"
/>
</
Style
>
Kind regards,
Sia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
Brian
Top achievements
Rank 1
answered on 24 Aug 2011, 08:10 PM
I have my CustomGridLines working correctly in that they now all show up and they can be styled (i.e. Dashed, Dotted). However, if I add two of them to the same chart and they are both specified as Dotted, for example, only one shows up as dotted and the other shows up slightly differently.
To give further example, I just added 3 CustomGridLines to my chart. All are built the same way and have been specified to show up as Dotted lines. The first one shows up dotted, the second one shows up as what appears to a solid line that is 2 pixels in width and the third shows up as a solid black line that is thinner. See the image attached for a screen shot. All three of the vertical black lines are added the exact same way other than their actual X value.
Does the chart control automatically change the style on CustomGridLines as they are added so that no 2 actually look the same?
To give further example, I just added 3 CustomGridLines to my chart. All are built the same way and have been specified to show up as Dotted lines. The first one shows up dotted, the second one shows up as what appears to a solid line that is 2 pixels in width and the third shows up as a solid black line that is thinner. See the image attached for a screen shot. All three of the vertical black lines are added the exact same way other than their actual X value.
Does the chart control automatically change the style on CustomGridLines as they are added so that no 2 actually look the same?
0
Hello Brian,
Thanks for your detailed explanation.
I created a sample project to reproduce your scenario. Well, actually the Style is applied for the second and third CustomGridLines as you can see the StrokeThickness and Stroke are changed. However the Style is not reusable when StrokeDashArray setter is used and this is actually an issue in Silverlight, we were able to isolate it outside RadChart.
To be able to have all of your GridLines dashed/dotted you should create three different styles.
Kind regards,
Evgenia
the Telerik team
Thanks for your detailed explanation.
I created a sample project to reproduce your scenario. Well, actually the Style is applied for the second and third CustomGridLines as you can see the StrokeThickness and Stroke are changed. However the Style is not reusable when StrokeDashArray setter is used and this is actually an issue in Silverlight, we were able to isolate it outside RadChart.
To be able to have all of your GridLines dashed/dotted you should create three different styles.
Kind regards,
Evgenia
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 >>