110,539
社区成员
发帖
与我相关
我的任务
分享
private void DrawLine(ZedGraphControl zgc)
{
GraphPane myPane = zgc.GraphPane;
List<PointPairList> DataSource = new List<PointPairList>();
myPane.Title.Text = "用户访问曲线图";
myPane.XAxis.Title.Text= "月份";
myPane.YAxis.Title.Text = "用户访问数量";
Random rand = new Random();
//for (int i = 0; i < 3; i++)
//{
ZedGraph.PointPairList ppl = new ZedGraph.PointPairList();
for (double x = 0; x < 5; x += 1.0)
{
double y = rand.NextDouble() * 1000;
ppl.Add(x, y);
}
myPane.AddCurve("as" + 1.ToString(), ppl, Color.Red, SymbolType.None);
//}
ZedGraph.PointPairList pp2 = new ZedGraph.PointPairList();
for (double x = 6; x < 10; x += 1.0)
{
double y = rand.NextDouble() * 1000;
pp2.Add(x, y);
}
myPane.AddCurve("as" + 3.ToString(), pp2, Color.Red, SymbolType.None);
zgc.AxisChange();
//重绘控件
Refresh();
}
private void picBox_Paint(object sender, PaintEventArgs e)
{
float[] month = new float[12];
for (int i = 0; i < 12; i++)
{
month[i] = i + 1;
}
float[] d = new float[12] { 20.5f, 60, 10.8f, 15.6f, 30, 70.9f, 50.3f, 30.7f, 70, 50.4f, 30.8f, 20};
picBox.SizeMode = PictureBoxSizeMode.Zoom;
CurvePaint cp = new CurvePaint();
cp.XkeduCount = 10;
cp.YkeduCount = 10;
cp.XvalueStrMoveleft = 15;
picBox.Image = cp.drawCurve(month, d, "某工厂某产品月生产量图表", "月份", "产量(万)");
}