winform怎样绘制折线图?
将下面几个坐标点在坐标系中显示出来,然后用折线连接起来,用chart感觉完全没有思路?1,-4.812,-4.763,-4.504,-4.655,-4.926,-4.56...
将下面几个坐标点在坐标系中显示出来,然后用折线连接起来,用chart感觉完全没有思路?
1,-4.81
2,-4.76
3,-4.50
4,-4.65
5,-4.92
6,-4.56
7,-4.01
8,-4.61
9,-5.02
10,-4.79
求大神帮忙~ 展开
1,-4.81
2,-4.76
3,-4.50
4,-4.65
5,-4.92
6,-4.56
7,-4.01
8,-4.61
9,-5.02
10,-4.79
求大神帮忙~ 展开
1个回答
展开全部
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
// 图标类型:线
chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
// 线的颜色为红色
chart1.Series[0].Color = Color.Red;
// 添加数据
chart1.Series[0].Points.AddXY(1, -4.81);
chart1.Series[0].Points.AddXY(2, -4.76);
chart1.Series[0].Points.AddXY(3, -4.50);
chart1.Series[0].Points.AddXY(4, -4.65);
chart1.Series[0].Points.AddXY(5, -4.92);
chart1.Series[0].Points.AddXY(6, -4.81);
chart1.Series[0].Points.AddXY(7, -4.56);
chart1.Series[0].Points.AddXY(8, -4.01);
chart1.Series[0].Points.AddXY(9, -5.02);
chart1.Series[0].Points.AddXY(10, -4.79);
// Y的最大值
chart1.ChartAreas[0].AxisY.Maximum = -4;
// 隐藏图示
chart1.Legends[0].Enabled = false;
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询