|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using OxyPlot;
using OxyPlot.Series;
using OxyPlot.Annotations;
using OxyPlot.Axes;
using OxyPlot.Reporting;
using OxyPlot.WindowsForms;
using OxyPlot.Xamarin;
//using OxyPlot.Wpf;
namespace SPC
{
public partial class KZTForm : Form
{
public KZTForm()
{
this.InitializeComponent();
var myModel = new PlotModel { Title = "X" };
myModel.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.1, "cos(x)"));
this.plot1.Model = myModel;
var myModel1 = new PlotModel { Title = "Xbar" };
myModel1.Series.Add(new FunctionSeries(Math.Sin, 0, 10, 0.1, "sin(x)"));
this.plot2.Model = myModel1;
var model1 = new PlotModel { Title = "图的标题" };
var scatterSeries = new ScatterSeries { MarkerType = MarkerType.Diamond, Title = "散点系列点的名称" };//散点图
var lineSeries1 = new LineSeries("线系列点的名称"); //线图
model1.Axes.Add(new LinearAxis(AxisPosition.Bottom, "X坐标的名称"));
model1.Axes.Add(new LinearAxis(AxisPosition.Left, "Y坐标的名称"));
model1.Axes.Add(new LinearAxis(AxisPosition.Right, "右边Y坐标的名称"));
model1.Axes.Add(new LinearAxis(AxisPosition.Right, "右边Y坐标的名称"));//正常坐标
int[] p = { 1, 2, 3, 5, 8, 9,10,12,23,22,33,44,55,66};
for (int i = 0; i < 10; i++)
{
var x = i;
var y = p;
scatterSeries.Points.Add(new ScatterPoint(x, y));
lineSeries1.Points.Add(new DataPoint(x, y + 10));
}
model1.Series.Add(scatterSeries);//添加散点图到控件
model1.Series.Add(lineSeries1);
this.plot2.Model = model1;
}
private void KZTForm_Load(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
}
}
}
//附件是相关文件
|
|