Oxyplot Plotview调整窗口以获得良好的径向图

时间:2016-05-30 21:41:32

标签: wpf plot oxyplot radial

我不知道如何描述我的问题所以我试着告诉你:

These ellipses are actually circles

这些椭圆实际上是圆圈。当我调整窗口大小时,我可以得到它:

enter image description here

就像你看到的,现在我有一个圆圈,但有时尽管窗口调整大小,我也无法得到它。如果有人知道我需要改变什么,我不需要再调整大小了吗?

这是我的情节窗口:

<Window x:Class="View.Views.PlotWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:oxy="http://oxyplot.org/wpf"
    Title="PlotWindow" MinHeight="600" MinWidth="800" WindowStartupLocation="CenterScreen">

    <oxy:PlotView Model="{Binding PlotModel}" />

</Window>

和创建情节模型的方法。

public override PlotModel DrawPlot(Data data)
        {
            ObservableCollection<Radial> radials = ((RdData)data).Radials;
            if (data.Records[0].Items.Count > 2)
                return null;
            PlotModel model = new PlotModel();
            int i = 0;
            foreach (var r in radials)
            {
                var rad = generateRadialFunc(r);
                var series = new FunctionSeries();
                foreach (var p in rad)
                {
                    series.Points.Add(new DataPoint(p[0], p[1]));
                }
                series.MarkerSize = 2;
                series.MarkerStrokeThickness = 1;
                series.Title = "Radial (" + string.Format("{0:N2}", r.centerCoordinates.Items[0].Value) + ';' + string.Format("{0:N2}", r.centerCoordinates.Items[1].Value) + ')';
                i++;
                model.Series.Add(series);
            }
            scatterAndAxis(model, data);

            return model;
        }

        protected double[][] generateRadialFunc(Radial radial)
        {
            double[][] rad = new double[3600][];
            int j = 0;
            for (double i = 0.0; i <= 360.0; i+=0.1)
            {
                rad[j] = new double[2];
                double angle = i * Math.PI / 180;
                rad[j][0] = radial.centerCoordinates.Items[0].Value + radial.R * Math.Cos(angle);
                rad[j][1] = radial.centerCoordinates.Items[1].Value + radial.R * Math.Sin(angle);
                j++;
            }
            return rad;
        }

0 个答案:

没有答案