jdskty
jdskty

Reputation: 91

OxyPlot Odd Marker Placement With LineSeries

I am coding a basic Cumulative Moving Average LineSeries with the MarkerType = MarkerType.Circle. For some reason my Marker is ending up not on the line. Pan and Zoom are disabled on my Y axis. I have included a picture of it. Anyone know of a reason why it would be doing this?enter image description here

This is how I'm adding the Series to the plot

   <Grid x:Name="GridChart" Column="2">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <TextBlock Grid.Row="0" Background="Yellow" Padding="4" FontWeight="Normal" FontSize="12" Visibility="Collapsed"/>
    <oxy:Plot Grid.Row="1" x:Name="PlotStrikeTheoBasis" MouseDoubleClick="PlotStrikeTheoBasisOnMouseDoubleClick" Margin="5" LegendPlacement="Inside" MouseWheel="PlotStrikeTheoBasisOnMouseWheel">
        <oxy:Plot.Annotations>
            <oxy:LineAnnotation Type="Horizontal" Y="0"/>
        </oxy:Plot.Annotations>
        <oxy:Plot.Axes>
            <oxy:LinearAxis Position="Left" x:Name="AxisQty" Title="Qty" IsZoomEnabled="False" IsPanEnabled="False" MinorTickSize="0"/>
            <oxy:LinearAxis Position="Bottom" x:Name="AxixBasisPoints" Title="Basis Points" MinorTickSize="0" Maximum="{Binding Max, Mode=TwoWay}" Minimum="{Binding Min, Mode=TwoWay}" AbsoluteMaximum="200" AbsoluteMinimum="-200"/>
        </oxy:Plot.Axes>
        <oxy:LineSeries x:Name="LineSeriesMovingAverage" Visibility="{Binding MovingAverageQtyChecked, Converter={StaticResource BooleanVisibilityConverter}}" ItemsSource="{Binding MovingAverageDataSeriesSet}" DataFieldX="BasisPoints" DataFieldY="Quantity" Title="CMA" MarkerType="Cross" MarkerStroke="HotPink"/>
    </oxy:Plot>
</Grid>

public partial class TheoBasisStrikeChartWindow : Window
{
    private static readonly ILog Log = LogManager.Create();

    private TheoBasisHistogramViewModel _viewModel;

    internal TheoBasisHistogramViewModel TheoBasisHistogramViewModel
    {
        get { return _viewModel; }
        set
        {
            _viewModel = value;
            GridChart.DataContext = value;
        }
    }        

    public TheoBasisStrikeChartWindow()
    {
        InitializeComponent();

        TheoBasisHistogramViewModel = new TheoBasisHistogramViewModel();
    }

    private void Refresh()
    {
        try
        {
            _viewModel.Refresh();
        }
        catch (Exception ex)
        {
            Log.Error(ex);
            MessageWindow.Show(
                "Error occurred loading Window. Please report to IT Staff",
                "Error", MessageWindowImage.Error,
                MessageWindowStartupLocation.CreateCenteredOn(this, this), MessageWindowButton.OK);
        }
    }
}


public class BasisPointsQty
{
    public double BasisPoints { get; set; }
    public double Quantity { get; set; }
    public BasisPointsQty(double basisPoints, int quantity)
    {             
        BasisPoints = basisPoints;
        Quantity = quantity;
    }
}

public class TheoBasisHistogramViewModel : PropertyChangedNotifier
{
    public ObservableCollectionEx<BasisPointsQty> MovingAverageDataSeriesSet { get;}

    public TheoBasisHistogramViewModel()
    {
        MovingAverageDataSeriesSet = new ObservableCollectionEx<BasisPointsQty>();
    }

    public void Refresh() 
    {
        // Update MovingAverageDataSeriesSet here
    }
}

Upvotes: 1

Views: 466

Answers (0)

Related Questions