I’m trying to place an image in the center of a graph but it isn’t positioning itself how I would expect, how do I correct this?
<Window x:Class="AnnoTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
Title="MainWindow" Height="350" Width="525">
<Grid>
<s:SciChartSurface x:Name="surface" s:ThemeManager.Theme="Chrome">
<s:SciChartSurface.Resources>
<DataTemplate x:Key="AnnotationTemplate">
<Image Source="/AnnoTest;component/Images/SciChartLogo_Dark.png" />
</DataTemplate>
</s:SciChartSurface.Resources>
<s:SciChartSurface.XAxis>
<s:NumericAxis VisibleRange="0,100"/>
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:NumericAxis VisibleRange="-5,5"/>
</s:SciChartSurface.YAxis>
<s:SciChartSurface.Annotations>
<s:CustomAnnotation
ContentTemplate="{StaticResource AnnotationTemplate}"
HorizontalAnchorPoint="Center"
VerticalAnchorPoint="Center"
AnnotationCanvas="BelowChart"
CoordinateMode="Relative"
Opacity="0.50"
X1="0.5"
Y1="0.5" />
<s:TextAnnotation FontSize="24" Text="Annotations are Confusing!" CoordinateMode="Relative" X1="0.5" Y1="0.5" HorizontalAnchorPoint="Center" VerticalAnchorPoint="Center"/>
</s:SciChartSurface.Annotations>
</s:SciChartSurface>
</Grid>
- Matt Brown asked 9 years ago
- You must login to post comments
UPDATE: A bug where CustomAnnotation did not position itself if ContentTemplate was set is now fixed in build v3.3.3.6281, available from our nightly build page.
Hi Matt,
We believe this is a bug. We took your code and pasted it into the designer, and did reproduce your issue where the annotation docks to the top-left (not centre).
Then I played around with it a bit and cut the annotation, pasted it back, cut it, pasted it back, re-arranged some properties, and suddenly got this (attached image)
So your code is correct, its just not working as expected. We will investigate and attempt to fix.
Apologies for the ‘confusion’ !
Best regards,
Andrew
- Andrew Burnett-Thompson answered 9 years ago
- last edited 9 years ago
- You must login to post comments
Please login first to submit.