SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

Answered
1
0

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>

  • You must to post comments
Best Answer
0
0

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

Images
  • You must to post comments
0
0

Thanks much, will update now!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.