Pre loader

BoxAnnotation isn't editable

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

0
0
  <s:SciChartSurface x:Name="sciChart" Grid.Row="0"
                       s:ThemeManager.Theme="Chrome"
                       LeftAxesPanelTemplate="{StaticResource YAxesPanel}"
                       RightAxesPanelTemplate="{StaticResource YAxesPanel}">

        <s:SciChartSurface.RenderableSeries>
            <s:FastLineRenderableSeries SeriesColor="#FFFF1919" YAxisId="Ch0" />
            <s:FastLineRenderableSeries SeriesColor="#FFFC9C29" YAxisId="Ch1" />
            <s:FastLineRenderableSeries SeriesColor="#FFFF1919" YAxisId="Ch2" />
            <s:FastLineRenderableSeries SeriesColor="#FFFC9C29" YAxisId="Ch3" />
        </s:SciChartSurface.RenderableSeries>

        <s:SciChartSurface.YAxes>
            <s:NumericAxis x:Name="Ch0" Style="{StaticResource YAxisStyle}" Id="Ch0" Grid.Row="0" DrawMajorTicks="False" DrawLabels="False" />
            <s:NumericAxis x:Name="Ch1" Style="{StaticResource YAxisStyle}" Id="Ch1" Grid.Row="2" />
            <s:NumericAxis x:Name="Ch2" Style="{StaticResource YAxisStyle}" Id="Ch2" Grid.Row="4" />
            <s:NumericAxis x:Name="Ch3" Style="{StaticResource YAxisStyle}" Id="Ch3" Grid.Row="6" />
        </s:SciChartSurface.YAxes>

        <s:SciChartSurface.XAxis>
            <s:NumericAxis Name="xAxis" />
        </s:SciChartSurface.XAxis>


        <s:SciChartSurface.Annotations>
                    <s:BoxAnnotation YAxisId="Ch1" Name="boxAnnotationCh1" Background="#33FF6600" BorderBrush="#77FF6600" BorderThickness="1" CornerRadius="3" IsEditable="true" />
            <s:BoxAnnotation YAxisId="Ch2" Name="boxAnnotationCh2"  Background="#33FF6600" BorderBrush="#77FF6600" BorderThickness="1" CornerRadius="3" IsEditable="true" />
            <s:BoxAnnotation YAxisId="Ch3" Name="boxAnnotationCh3"  Background="#33FF6600" BorderBrush="#77FF6600" BorderThickness="1" CornerRadius="3" IsEditable="true" />
                     </s:SciChartSurface.Annotations>
    </s:SciChartSurface>

How can I make BoxAnnotations editable?
I can’t move the boxes in the chart.

  • You must to post comments
0
0

I found out, that the text annotations are the problem.
Thanks for your help!

  • You must to post comments
0
0

Hello Andrew,
the right BoxAnnotations are boxAnnotationCH1,boxAnnotationCH2,boxAnnotationCH3 and they are not set to AnnotationCanvas.BelowChart?

  • You must to post comments
0
0
<UserControl.Resources>
    <Style x:Key="RightAlignedLabelStyle" TargetType="s:DefaultTickLabel">
        <Setter Property="HorizontalAnchorPoint" Value="Right" />
    </Style>

    <Style x:Key="YAxisStyle" TargetType="s:AxisBase">
        <Setter Property="HorizontalAlignment" Value="Right" />
        <Setter Property="VisibleRange" Value="-2, 2" />
        <Setter Property="VisibleRangeLimit" Value="-2, 2" />
        <Setter Property="AutoRange" Value="Never" />
        <Setter Property="AxisAlignment" Value="Left" />
        <Setter Property="DrawMinorGridLines" Value="False" />
        <Setter Property="DrawMinorTicks" Value="False" />
        <Setter Property="DrawMajorGridLines" Value="False" />
        <Setter Property="DrawMajorBands" Value="False" />
        <Setter Property="TickLabelStyle" Value="{StaticResource RightAlignedLabelStyle}" />
    </Style>

    <ItemsPanelTemplate x:Key="YAxesPanel">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="0.1*" />
                <RowDefinition Height="10" />
                <RowDefinition Height="*" />
                <RowDefinition Height="10" />
                <RowDefinition Height="*" />
                <RowDefinition Height="10" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
        </Grid>
    </ItemsPanelTemplate>
    <Style x:Key="ChartHeaderStyle" TargetType="s:TextAnnotation">
        <Setter Property="FontSize" Value="12" />
        <Setter Property="FontWeight" Value="Thin" />
        <Setter Property="Foreground" Value="Black" />
    </Style>
</UserControl.Resources>
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="32" />
    </Grid.RowDefinitions>

    <s:SciChartSurface x:Name="sciChart" Grid.Row="0" s:ThemeManager.Theme="Chrome" LeftAxesPanelTemplate="{StaticResource YAxesPanel}"
                       RightAxesPanelTemplate="{StaticResource YAxesPanel}"
                       s:RenderSurfaceBase.RenderSurfaceType="Abt.Controls.SciChart.Rendering.HighQualityRasterizer.HighQualityRenderSurface">

        <s:SciChartSurface.RenderableSeries>
            <s:FastLineRenderableSeries SeriesColor="#FFFF1919" YAxisId="Ch0" />
            <s:FastLineRenderableSeries SeriesColor="#FFFC9C29" YAxisId="Ch1" DataSeries="{Binding DataCH1}" />
            <s:FastLineRenderableSeries SeriesColor="#FFFF1919" YAxisId="Ch2" DataSeries="{Binding DataCH2}" />
            <s:FastLineRenderableSeries SeriesColor="#FFFC9C29" YAxisId="Ch3" DataSeries="{Binding DataCH3}" />
        </s:SciChartSurface.RenderableSeries>

        <s:SciChartSurface.YAxes>
            <s:NumericAxis x:Name="Ch0" Style="{StaticResource YAxisStyle}" Id="Ch0" Grid.Row="0" DrawMajorTicks="False" DrawLabels="False" />
            <s:NumericAxis x:Name="Ch1" Style="{StaticResource YAxisStyle}" Id="Ch1" Grid.Row="2" />
            <s:NumericAxis x:Name="Ch2" Style="{StaticResource YAxisStyle}" Id="Ch2" Grid.Row="4" />
            <s:NumericAxis x:Name="Ch3" Style="{StaticResource YAxisStyle}" Id="Ch3" Grid.Row="6" />
        </s:SciChartSurface.YAxes>

        <s:SciChartSurface.XAxis>
            <s:NumericAxis Name="xAxis" VisibleRange="{Binding ChartXRange, Mode=TwoWay}" />
        </s:SciChartSurface.XAxis>

        <s:SciChartSurface.ChartModifier>
            <s:ModifierGroup>
                <!--<s:RubberBandXyZoomModifier x:Name="rubberBandZoomModifier" IsEnabled="True" IsXAxisOnly="True" ZoomExtentsY="False" IsAnimated="True" />-->
                <s:MouseWheelZoomModifier x:Name="mouseWheelZoomModifier" XyDirection="XDirection" />
                <!--<Nominal:CustomZoomExtentsModifier ExecuteOn="MouseDoubleClick" />-->
            </s:ModifierGroup>
        </s:SciChartSurface.ChartModifier>

        <s:SciChartSurface.Annotations>
            <!-- Draws Bands behind each axis -->
            <s:BoxAnnotation YAxisId="Ch0" CoordinateMode="RelativeX" X1="0" X2="1" Y1="{Binding VisibleRange.Min, ElementName=Ch0}" Y2="{Binding VisibleRange.Max, ElementName=Ch0}" Background="#11000000" AnnotationCanvas="BelowChart" />
            <s:BoxAnnotation YAxisId="Ch1" CoordinateMode="RelativeX" X1="0" X2="1" Y1="{Binding VisibleRange.Min, ElementName=Ch1}" Y2="{Binding VisibleRange.Max, ElementName=Ch1}" Background="#44B0C4DE" AnnotationCanvas="BelowChart" />
            <s:BoxAnnotation YAxisId="Ch2" CoordinateMode="RelativeX" X1="0" X2="1" Y1="{Binding VisibleRange.Min, ElementName=Ch2}" Y2="{Binding VisibleRange.Max, ElementName=Ch2}" Background="#11000000" AnnotationCanvas="BelowChart" />
            <s:BoxAnnotation YAxisId="Ch3" CoordinateMode="RelativeX" X1="0" X2="1" Y1="{Binding VisibleRange.Min, ElementName=Ch3}" Y2="{Binding VisibleRange.Max, ElementName=Ch3}" Background="#44B0C4DE" AnnotationCanvas="BelowChart" />

            <s:BoxAnnotation YAxisId="Ch1" Name="boxAnnotationCh1" Background="#33FF6600" BorderBrush="#77FF6600" BorderThickness="1" CornerRadius="3" IsEditable="true"
                             X1="{Binding X1_CH1}"  X2="{Binding X2_CH1}"  Y1="{Binding Y1_CH1}"  Y2="{Binding Y2_CH1}" />
            <s:BoxAnnotation YAxisId="Ch2" Name="boxAnnotationCh2"  Background="#33FF6600" BorderBrush="#77FF6600" BorderThickness="1" CornerRadius="3" IsEditable="true"
                             X1="{Binding X1_CH2}"  X2="{Binding X2_CH2}"  Y1="{Binding Y1_CH2}"  Y2="{Binding Y2_CH2}" />
            <s:BoxAnnotation YAxisId="Ch3" Name="boxAnnotationCh3"  Background="#33FF6600" BorderBrush="#77FF6600" BorderThickness="1" CornerRadius="3" IsEditable="true"
                              X1="{Binding X1_CH3}"  X2="{Binding X2_CH3}"  Y1="{Binding Y1_CH3}"  Y2="{Binding Y2_CH3}" />
            <!-- Draws the zero lines for each axis -->
            <s:HorizontalLineAnnotation Y1="0" YAxisId="Ch1" HorizontalAlignment="Stretch" StrokeThickness="1" AnnotationCanvas="BelowChart" />
            <s:HorizontalLineAnnotation Y1="0" YAxisId="Ch2" HorizontalAlignment="Stretch" StrokeThickness="1" AnnotationCanvas="BelowChart" />
            <s:HorizontalLineAnnotation Y1="0" YAxisId="Ch3" HorizontalAlignment="Stretch" StrokeThickness="1" AnnotationCanvas="BelowChart" />

            <!-- Draws a Header line into each chart -->
            <s:TextAnnotation Text="{lex:Loc NominalGeometryInput:Resources:AxisDirection}" YAxisId="Ch1" CoordinateMode="RelativeX" X1="0" X2="1" Y1="{Binding VisibleRange.Min, ElementName=Ch1}" Y2="{Binding VisibleRange.Max, ElementName=Ch1}" Style="{StaticResource ChartHeaderStyle}" />
            <s:TextAnnotation Text="{lex:Loc NominalGeometryInput:Resources:AxisSuperelevation}" YAxisId="Ch2" CoordinateMode="RelativeX" X1="0" X2="1" Y1="{Binding VisibleRange.Min, ElementName=Ch2}" Y2="{Binding VisibleRange.Max, ElementName=Ch2}" Style="{StaticResource ChartHeaderStyle}" />
            <s:TextAnnotation Text="{lex:Loc NominalGeometryInput:Resources:AxisElevation}" YAxisId="Ch3" CoordinateMode="RelativeX" X1="0" X2="1" Y1="{Binding VisibleRange.Min, ElementName=Ch3}" Y2="{Binding VisibleRange.Max, ElementName=Ch3}" Style="{StaticResource ChartHeaderStyle}" />
        </s:SciChartSurface.Annotations>
    </s:SciChartSurface>
    <s:SciChartScrollbar Grid.Row="1" Margin="6,5,4,5" Axis="{Binding ElementName=xAxis}" />
</Grid>

Hello Andrew,
above you can see the complete xaml Code of my example.
Everything still works, but I’m not able to drag the boxannotations(boxAnnotationCh1,….) via mouse?

  • Andrew Burnett-Thompson
    Thank you for providing the extra code. This is important, as issues are often subtle. You have AnnotationCanvas.BelowChart. Unfortunately, it is not possible to drag an annotation below the chart. Why? Because the other layers above it intercept the mouse events. I suggest placing the annotation above the chart to enable dragging and using more transparency so you can see the chart below it. Best regards, Andrew
  • You must to post comments
0
0

Hi Daniel,

I was unable to reproduce this issue. I used your code (without YAxesPanel template, without YAxisStyle) and with Version v3.2.0.5333 of SciChart. Please see the animated gif below.

enter image description here

Can you help us reproduce the issue?

Best regards,
Andrew

  • You must to post comments
Showing 4 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