using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); //网格设为透明色,即隐藏网格 chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.Transparent; chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.Transparent; Series series1 = chart1.Series[0];//为图标增加一个序列 series1.IsVisibleInLegend = false;//隐藏该序列的图例 series1.ChartType = SeriesChartType.Point;//该序列为散点类型 series1.BorderWidth = 1;//宽度为1 series1.Color = System.Drawing.Color.Red;//颜色为红色 chart1.ChartAreas[0].AxisX.Title = "时间"; //X轴标题 chart1.ChartAreas[0].AxisY.Title = "值"; //Y轴标题 chart1.ChartAreas[0].AxisY.TextOrientation = TextOrientation.Horizontal;//Y轴标题的方向为水平 //准备数据 int[] x = { 1, 2, 3, 4, 5, 6, 7, 8 }; int[] y = { 10, 11, 12, 13, 14, 15, 16, 17 }; series1.Points.DataBindXY(x, y); //绑定数据 } } }View Code
标签:System,入门,Color,chart,chart1,ChartAreas,series1,Drawing,winform From: https://www.cnblogs.com/lizhiqiang0204/p/17786692.html