设置OXYPLOT C#的位置和尺寸

时间:2016-01-31 00:20:08

标签: c# plot oxyplot

我试着学习oxyplot的用法。当我在表格上显示情节时,情节将涵盖所有表格区域(如下所示)。我想把它放在具有维度的特定坐标上。

我该怎么做?

我的代码:

 private void Plot()
{

    PlotView pv = new PlotView();
    pv.Dock = DockStyle.Fill;
    this.Controls.Add(pv);

    LinearAxis XAxis = new LinearAxis { Position = OxyPlot.Axes.AxisPosition.Bottom };
    LinearAxis YAxis = new LinearAxis();
    PlotModel pm = new PlotModel();
    pm.Axes.Add(XAxis);
    pm.Axes.Add(YAxis);
    pm.Background = OxyColor.FromRgb(0, 0, 255);
    pv.Model = pm;
    pv.Model.Series.Add(GetFunction());
}

private FunctionSeries GetFunction()
    {
        FunctionSeries fs = new FunctionSeries();
        for(int x=-10;x<=10;x++)
            for(int y=-10;y<10;y++)
            {
                DataPoint data = new DataPoint(x, y);
                fs.Points.Add(data);
            }
        return fs;
    }

结果:

enter image description here

1 个答案:

答案 0 :(得分:1)

您应该在xaml上创建PlotView,将PlotView Model属性绑定到后面的代码上的PlotModel,然后将其视为正常的框架元素:

rows = cur.fetchall()

for row in rows:
    print  row
    print type(row)

    for rowitems in row:

            print rowitems
            print type(rowitems)
相关问题