Pre loader

Problem with horizontal line annotations on vertically stacked axes

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

Hi,

I’m having the same problem as corvex here: https://www.scichart.com/questions/question/problem-with-the-horizontal-line-annotations-on-vertically-stacked-axes, but I wasn’t sure if replying to his topic (which is older) would get the support team’s attention.

I am basically combining the VerticallyStackedAxes example with the SeriesTooltipsExample. The labels for the annotations are drawn in the wrong place below the chart. The main difference is that I am running 3.42.0.6778 (Runtime version v4.0.30319) and he was running an older version.

Attached is an image and my XAML

<Window.DataContext>

</Window.DataContext>

<Window.Resources>
    <Style x:Key="YAxisStyle" TargetType="s:AxisBase">
        <Setter Property="HorizontalAlignment" Value="Right" />
        <Setter Property="AutoRange" Value="Never" />
        <Setter Property="AxisAlignment" Value="Right" />
        <Setter Property="DrawMinorGridLines" Value="False" />
        <Setter Property="DrawMinorTicks" Value="False" />
        <Setter Property="DrawMajorGridLines" Value="True" />
        <Setter Property="DrawMajorBands" Value="False" />
    </Style>
    <ItemsPanelTemplate x:Key="YAxesPanel">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="10" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
        </Grid>
    </ItemsPanelTemplate>
</Window.Resources>

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <!--  Create the chart surface  -->
    <s:SciChartSurface x:Name="MassChart" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="2"
                       s:ThemeManager.Theme="Chrome" LeftAxesPanelTemplate="{StaticResource YAxesPanel}" RightAxesPanelTemplate="{StaticResource YAxesPanel}">
        <!--  Create an X Axis with Growby  -->
        <s:SciChartSurface.XAxis>
            <s:NumericAxis GrowBy="0.1, 0.1" TextFormatting="#" ScientificNotation="None" MaxAutoTicks="30"
                           DrawMinorTicks="False" DrawMinorGridLines="False" AutoRange="Never"
                           VisibleRange="0,29" />
        </s:SciChartSurface.XAxis>

        <!--  Create a Y Axis with Growby. Optional bands give a cool look and feel for minimal performance impact  -->
        <s:SciChartSurface.YAxes>
            <s:NumericAxis x:Name="Precut" AxisTitle="Precut" Id="Precut" Style="{StaticResource YAxisStyle}" GrowBy="0.5, 0.5"
                           DrawMajorBands="True" TextFormatting="#.#" VisibleRange="14,22" Grid.Row="0" />
            <s:NumericAxis x:Name="Postcut" AxisTitle="Postcut" Id="Postcut" Style="{StaticResource YAxisStyle}" GrowBy="0.5, 0.5" 
                           DrawMajorBands="True" TextFormatting="#.#" VisibleRange="9.6,14" Grid.Row="2" />
        </s:SciChartSurface.YAxes>

        <s:SciChartSurface.RenderableSeries>
            <s:FastLineRenderableSeries DataSeries="{Binding WaferPrecutMassSeries}" SeriesColor="Blue" YAxisId="Precut" />
            <s:FastLineRenderableSeries DataSeries="{Binding WaferPostcutMassSeries}" SeriesColor="Blue" YAxisId="Postcut" />
        </s:SciChartSurface.RenderableSeries>
        <s:SciChartSurface.Annotations>
            <s:HorizontalLineAnnotation HorizontalAlignment="Stretch"
                                        FontSize="12"
                                        LabelPlacement="Axis"
                                        LabelTextFormatting="0.0"
                                        ShowLabel="True"
                                        Stroke="#E53333"
                                        StrokeThickness="2"
                                        YAxisId="Postcut"
                                        Y1="{Binding LowThreshold, Mode=OneWay}" />
            <s:HorizontalLineAnnotation HorizontalAlignment="Stretch"
                                        FontSize="12"
                                        LabelPlacement="Axis"
                                        LabelTextFormatting="0.0"
                                        ShowLabel="True"
                                        Stroke="#33C833"
                                        StrokeThickness="2"
                                        YAxisId="Postcut"
                                        Y1="{Binding HighThreshold, Mode=OneWay}" />
        </s:SciChartSurface.Annotations>
    </s:SciChartSurface>
</Grid>

I’m afraid I don’t know why the code boxes are nested in the question, but in any case, I think it gets the point across.

Images
  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies