|
<Grid.Resources>
<ControlTemplate TargetType="chart:SfChart" x:Key="seriesUpTemplate">
<Grid>
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Margin="{TemplateBinding Margin}"
KeyboardNavigation.TabNavigation="None">
…
</Grid>
</Border>
</Grid>
</ControlTemplate>
</Grid.Resources>
<chart:SfChart Template="{StaticResource seriesUpTemplate}" Grid.Row="1"
Header="Series Up Template"> |
|
<chart:SfChart >
. . .
<chart:SfChart.SecondaryAxis>
<chart:NumericalAxis Maximum="50" Minimum="0">
<chart:NumericalAxis.StripLines>
<chart:ChartStripLine Width="2" Start="25" Background="Blue" x:Name="A"/>
</chart:NumericalAxis.StripLines>
</chart:NumericalAxis>
</chart:SfChart.SecondaryAxis>
<chart:SfChart.Annotations>
<chart:HorizontalLineAnnotation x:Name="B" Y1="10" StrokeThickness="20" Stroke="Blue" />
</chart:SfChart.Annotations>
. . .
</chart:SfChart> |
|
<chart:SfChart x:Name="chart" >
<chart:SfChart.Annotations>
<chart:EllipseAnnotation X1="3.5" Y1="20" X2="4.6" Y2="30" />
<chart:EllipseAnnotation X1="1.5" Y1="35" X2="2.5" Y2="45"/> </chart:SfChart.Annotations>
<chart:FastLineBitmapSeries StrokeDashArray="4,4" ItemsSource="{Binding LineData}" XBindingPath="XValue" YBindingPath="LineVal1" />
<chart:FastLineBitmapSeries StrokeDashArray="4,4” ItemsSource="{Binding LineData}" XBindingPath="XValue" YBindingPath="LineVal2" />
<chart:FastLineBitmapSeries StrokeDashArray="4,4" ItemsSource="{Binding LineData}" XBindingPath="XValue" YBindingPath="LineVal3" />
</chart:SfChart> |
|
<chart:SfChart x:Name="chart" Header="Series Down Template" >
…
<chart:FastLineBitmapSeries StrokeDashArray="4,4" StrokeThickness="4"
ItemsSource="{Binding LineData}" XBindingPath="XValue"
YBindingPath="LineVal1" >
<chart:FastLineBitmapSeries.XAxis>
<chart:CategoryAxis ShowGridLines="False" Visibility="Collapsed"/>
</chart:FastLineBitmapSeries.XAxis>
</chart:FastLineBitmapSeries>
</chart:SfChart> |
|
public class ViewModel
{
public void GenerateData()
{
…
LineData.Add(new Model() {XValue = 0, LineVal1 = 30 });
LineData.Add(new Model() {XValue = 1, LineVal1 = 30 });
}
} |
Is it possible to get a real Z position for annotations? I would like to drag an EllipseAnnotation over/under ScatterSeries, because I need a circle around a point cloud, unfortunately the ToolTip of the individual points is then no longer displayed because it is covered by the annotation.
I would be grateful for an answer.
Markus
Hi Markus Knauer,
We can position the annotation under the series by extending SfChart as per in below code example.
|
public class SfChartExt : SfChart { public override void OnApplyTemplate() { base.OnApplyTemplate(); Canvas.SetZIndex(GetTemplateChild("Part_SeriesAnnotationCanvas") as Canvas, -1); } } |
|
<local:SfChartExt x:Name="chart"> … <chart:SfChart.Annotations> <chart:EllipseAnnotation X1="50" Y1="50" X2="60" Y2="60" CanDrag="True" HorizontalAlignment="Center" VerticalAlignment="Center"/> </chart:SfChart.Annotations> </local:SfChartExt> |
Please find the sample from the attachment below and let us know if you need any further assistance.
Regards,
Devakumar D
Thank you Devakumar Dhanapoosanam,
this works perfect.
Just a small comment on the first example with the template:
The circle annotation no longer had exactly the right X orientation. When the circle annotation was at X = 0, it was shifted to the right by the width of the X axis. The data points were exact.
With the example of the derived class it works perfectly.
Thanks again
Markus
Hi Markus Knauer,
We are glad to know that the provided solution works.
Please let us know if you need any further assistance.
Regards,
Devakumar D