7 Answers, 1 is accepted
0
berry
Top achievements
Rank 1
answered on 13 Jul 2015, 03:38 PM
Please see this example: http://docs.roguewave.com/jviews/8.9/jviews-charts89/codefragments/chart/rendering-hint/data/sample.gif
0
berry
Top achievements
Rank 1
answered on 13 Jul 2015, 03:47 PM
BTW i want to add it via code behind
0
Hello Berry,
You can use the PointTemplate property of the series to define its visual element. For example:
To add this in code you can define the template in XAML and get it through the Resources' dictionary of the view:
Or you can define the template as string and use the XamlReader.Parse() method.
I hope this is useful.
Regards,
Martin
Telerik
You can use the PointTemplate property of the series to define its visual element. For example:
<
telerik:LineSeries.PointTemplate
>
<
DataTemplate
>
<
Ellipse
Fill
=
"Red"
Width
=
"10"
Height
=
"10"
/>
</
DataTemplate
>
</
telerik:LineSeries.PointTemplate
>
<
Window.Resources
>
<
DataTemplate
x:Key
=
"pointTemplate"
>
<
Ellipse
Fill
=
"Red"
Width
=
"10"
Height
=
"10"
/>
</
DataTemplate
>
</
Window.Resources
>
series.PointTemplate = (DataTemplate)
this
.Resources[
"pointTemplate"
];
Or you can define the template as string and use the XamlReader.Parse() method.
string
pointTemplateString = @
"<DataTemplate xmlns="
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
" xmlns:x="
"http://schemas.microsoft.com/winfx/2006/xaml"
">"
+
@
"<Ellipse Fill="
"Red"
" Width="
"10"
" Height="
"10"
" /></DateTemplate>"
;
series.PointTemplate = (DataTemplate)XamlReader.Parse(pointTemplateString);
I hope this is useful.
Regards,
Martin
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
berry
Top achievements
Rank 1
answered on 16 Jul 2015, 09:55 AM
When i try the lase option using "define the template as string and use the XamlReader.Parse() method":
string
pointTemplateString = @
"<DataTemplate xmlns="
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
" xmlns:x="
"http://schemas.microsoft.com/winfx/2006/xaml"
">"
+
@
"<Ellipse Fill="
"Red"
" Width="
"10"
" Height="
"10"
" /></DateTemplate>"
;
series.PointTemplate = (DataTemplate)XamlReader.Parse(pointTemplateString);
XamlParseException occurred:
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: The 'DataTemplate' start tag on line 1 position 2 does not match the end tag of 'DateTemplate'. Line 1, position 183.
0
Hello,
This is caused by a typo in my code snippet. The closing tag in the string should be </DataTemplate> instead of </DateTemplate>.
Regards,
Martin
Telerik
This is caused by a typo in my code snippet. The closing tag in the string should be </DataTemplate> instead of </DateTemplate>.
Regards,
Martin
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
berry
Top achievements
Rank 1
answered on 16 Jul 2015, 01:31 PM
OK that's works now.
BTW how can i replave the "Red" with string of my own ? (i want each pointTemplateSeries i have will be the same color as my Series Stroke)
0
Hello Berry,
In order to do this you can just modify the string. Here is an example:
I hope this helps.
Regards,
Martin
Telerik
In order to do this you can just modify the string. Here is an example:
string
series1Color =
"#FF0000"
;
string
series2Color =
"Green"
;
string
series1pointTemplateString = @
"<DataTemplate xmlns="
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
" xmlns:x="
"http://schemas.microsoft.com/winfx/2006/xaml"
">"
+
@
"<Ellipse Fill="
""
+ series1Color +
""
" Width="
"10"
" Height="
"10"
" /></DatŠ°Template>"
;
string
series2pointTemplateString = @
"<DataTemplate xmlns="
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
" xmlns:x="
"http://schemas.microsoft.com/winfx/2006/xaml"
">"
+
@
"<Ellipse Fill="
""
+ series2Color +
""
" Width="
"10"
" Height="
"10"
" /></DatŠ°Template>"
;
I hope this helps.
Regards,
Martin
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items