1

我正在使用 MarkerType = MarkerType.Circle 编写一个基本的累积移动平均线系列。由于某种原因,我的标记最终没有上线。在我的 Y 轴上禁用了平移和缩放。我已经附上了它的图片。任何人都知道它会这样做的原因吗?在此处输入图像描述

这就是我将系列添加到情节中的方式

   <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
    }
}
4

0 回答 0