my requirement :
I am creating chart to display digital waveform output ( 0,1) for N number of points.I need to highlight only certain points(index).(see attached).
I have done this with the help of Point template and update done at code behind chart loaded event.This is working perfectly at loading . But after zooming the highlighting point is moved from one point another point and it is not refreshed properly.Please see below code.
Please help to fix this issue...
<
Grid
><
br
> <
telerik:RadCartesianChart
Height
=
"1"
Loaded
=
"RadCartesianChart_Loaded"
Palette
=
"Arctic"
ZoomChanged
=
"RadCartesianChart_ZoomChanged"
><
br
> <
telerik:RadCartesianChart.HorizontalAxis
><
br
> <
telerik:CategoricalAxis
VerticalLocation
=
"Top"
Visibility
=
"Visible"
LabelFitMode
=
"None"
LabelRotationAngle
=
"-90"
/><
br
> </
telerik:RadCartesianChart.HorizontalAxis
><
br
> <
telerik:RadCartesianChart.VerticalAxis
><
br
> <
telerik:LinearAxis
Minimum
=
"-1"
Maximum
=
"2"
MajorStep
=
"1"
MajorTickOffset
=
"5"
ElementBrush
=
"Orange"
/><
br
> </
telerik:RadCartesianChart.VerticalAxis
><
br
> <
telerik:RadCartesianChart.Series
><
br
> <
telerik:StepLineSeries
><
br
> <
telerik:StepLineSeries.DataPoints
><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"1"
/><
br
> <
telerik:CategoricalDataPoint
Value
=
"0"
/><
br
><
br
> </
telerik:StepLineSeries.DataPoints
><
br
><
br
> <
telerik:StepLineSeries.PointTemplate
><
br
> <
DataTemplate
><
br
> <
StackPanel
><
br
>
<!--Fill="{Binding Presenter, Converter={StaticResource SeriesToPaletteColorConverter}}"-->
<
br
> <
Rectangle
Height
=
"126"
Width
=
"10"
Stroke
=
"Transparent"
Fill
=
"Transparent"
/><
br
> </
StackPanel
><
br
>
<!--<DataTemplate.Triggers><br> <DataTrigger Value="1" Binding="{Binding Index}" ><br> <Setter Property="Opacity" Value="0.01" /><br> </DataTrigger><br> </DataTemplate.Triggers>-->
<
br
> </
DataTemplate
><
br
> </
telerik:StepLineSeries.PointTemplate
><
br
> </
telerik:StepLineSeries
><
br
> </
telerik:RadCartesianChart.Series
><
br
><
br
> <
telerik:RadCartesianChart.Behaviors
><
br
> <
telerik:ChartPanAndZoomBehavior
x:Name
=
"panZoomBehavior"
Changed
=
"panZoomBehavior_Changed"
><
br
> </
telerik:ChartPanAndZoomBehavior
><
br
> </
telerik:RadCartesianChart.Behaviors
><
br
> <
telerik:RadCartesianChart.Resources
><
br
> <
local:SeriesToPaletteColorConverter
x:Key
=
"SeriesToPaletteColorConverter"
/><
br
> </
telerik:RadCartesianChart.Resources
><
br
> <
telerik:RadCartesianChart.Grid
><
br
> <
telerik:CartesianChartGrid
MajorLinesVisibility
=
"XY"
StripLinesVisibility
=
"XY"
IsTabStop
=
"False"
IsManipulationEnabled
=
"False"
><
br
> <
telerik:CartesianChartGrid.YStripeBrushes
><
br
> <
SolidColorBrush
Color
=
"#FFD7D7D7"
Opacity
=
"0.3"
/><
br
> <
SolidColorBrush
Color
=
"Transparent"
/><
br
> </
telerik:CartesianChartGrid.YStripeBrushes
><
br
><
br
> <
telerik:CartesianChartGrid.XStripeBrushes
><
br
> <
SolidColorBrush
Color
=
"#FFD7D7D7"
Opacity
=
"0.3"
/><
br
> <
SolidColorBrush
Color
=
"Transparent"
/><
br
> </
telerik:CartesianChartGrid.XStripeBrushes
><
br
><
br
> </
telerik:CartesianChartGrid
><
br
> </
telerik:RadCartesianChart.Grid
><
br
> <
telerik:RadCartesianChart.SelectionPalette
><
br
> <
telerik:ChartPalette
><
br
> <
telerik:ChartPalette.GlobalEntries
><
br
> <
telerik:PaletteEntry
Fill
=
"Red"
/><
br
> </
telerik:ChartPalette.GlobalEntries
><
br
> </
telerik:ChartPalette
><
br
> </
telerik:RadCartesianChart.SelectionPalette
><
br
> </
telerik:RadCartesianChart
><
br
> </
Grid
>
private void RadCartesianChart_Loaded(object sender, RoutedEventArgs e)<
br
> {<
br
><
br
> RadCartesianChart chart = (RadCartesianChart)sender;<
br
> StepLineSeries series = chart.Series.FirstOrDefault() as StepLineSeries;<
br
><
br
> //Get the Content Presenter of the series<
br
><
br
> var pointPresenter1 = series.ChildrenOfType<
ContentPresenter
>().ToList();<
br
> int count = 0;<
br
> pointPresenter1.ForEach(x =><
br
> {<
br
> var ellipseElement1 = x.ChildrenOfType<
Rectangle
>().FirstOrDefault();<
br
><
br
> //Logic from view model to decide which index need to be higlighted<
br
> if (count % 2 == 0 && ellipseElement1 != null)<
br
> ellipseElement1.Fill = new SolidColorBrush(Colors.Red);<
br
> count++;<
br
> });<
br
> <
br
> }<
br
><
br
> private void panZoomBehavior_Changed(object sender, EventArgs e)<
br
> {<
br
> <
br
> }<
br
><
br
> private void RadCartesianChart_ZoomChanged(object sender, ChartZoomChangedEventArgs e)<
br
> {<
br
> <
br
> }