Annotations with Reversed X Axis Direction

Oystein Bjorke il y a 10 ans 0
This discussion was imported from CodePlex

seveland12 wrote at 2012-04-23 19:57:


I want to add vertical and horizontal "limit lines" to my graph, so I decided to use Annotations. The problem I'm having is that I occasionally need to reverse the direction of the X axis, thus the binding on StartPosition and EndPosition. The annotations work correctly when the axis is in the normal increasing direction, but they disappear when the direction is reversed. Is this a known problem, or did I do something incorrect?


Thanks in advance.

<oxy:Plot Name="mainPlot" Title="Try This"  HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
<oxy:Plot.Axes>
                <oxy:LinearAxis Name="yAxis" AbsoluteMinimum="0.0" Position="Left"  MajorGridlineStyle="Solid" MinorGridlineStyle="Solid" />
                <oxy:LinearAxis Name="xAxis" StartPosition="{Binding Path=reverseXAxisDirection, Mode=OneWay, Converter={StaticResource BooleanToAxisStartPositionConverter}, UpdateSourceTrigger=PropertyChanged}" EndPosition="{Binding Path=reverseXAxisDirection, Mode=OneWay, Converter={StaticResource BooleanToAxisEndPositionConverter}, UpdateSourceTrigger=PropertyChanged}" Position="Bottom" MajorGridlineStyle="Solid" MinorGridlineStyle="Solid" />
            </oxy:Plot.Axes>
            <oxy:Plot.Annotations>
                <oxy:LineAnnotation LineStyle="Dot" Slope="0.1" Intercept="1" Text="First" />
                <oxy:LineAnnotation Slope="0.3" Intercept="2" MaximumX="40" Color="Red" Text="Second" />
                <oxy:LineAnnotation Type="Vertical" X="50" Color="Green" Text="Vertical" />
                <oxy:LineAnnotation Type="Horizontal" Y="2" MinimumX="0" Color="Gold" Text="Horizontal" />
            </oxy:Plot.Annotations>
            <oxy:Plot.Series>
                <oxy:LineSeries Title="Basis" Name="basisSeries" Color="MediumBlue" StrokeThickness="2" MarkerType="Circle" MarkerSize="3" MarkerFill="MediumBlue" DataFieldX="x" DataFieldY="y" ItemsSource="{Binding Path=plots.basisPlot, UpdateSourceTrigger=PropertyChanged}"/>
                <oxy:LineSeries Title="Comparison" Name="comparisonSeries" Color="Maroon" StrokeThickness="2" MarkerType="Circle" MarkerSize="3" MarkerFill="Maroon" DataFieldX="x" DataFieldY="y" ItemsSource="{Binding Path=plots.comparisonPlot, UpdateSourceTrigger=PropertyChanged}"/>

 
            </oxy:Plot.Series>
        </oxy:Plot>

objo wrote at 2012-04-23 21:17:

thanks for the notice! this was a bug - should be corrected now!