# OpenChart **Repository Path**: joeyzhao/openchart ## Basic Information - **Project Name**: OpenChart - **Description**: 用C#编写的一个简单的图表控件,运行于winform程序中。可展现的图形包括:曲线图、饼图和对象折线图。 - **Primary Language**: C# - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 47 - **Forks**: 19 - **Created**: 2013-06-23 - **Last Updated**: 2025-05-11 ## Categories & Tags **Categories**: charting-components **Tags**: None ## README ![效果图](http://pic002.cnblogs.com/images/2011/29548/2011012309251471.png)
参见:http://www.cnblogs.com/zzy0471/archive/2011/01/23/1942316.html
### 实例代码 this.chart1.BackColor = Color.Black; this.chart1.ChartArea.ChartType = Enums.ChartType.Line; this.chart1.ChartArea.Data = this.dsTest1.Tables[0]; this.chart1.ChartArea.XValueMember = "F_X"; StringInfo chartTitle = new StringInfo(); chartTitle.Value = "LineChart"; chartTitle.Color = Color.DarkBlue; chartTitle.Size = 15; this.chart1.ChartArea.ChartTitle = chartTitle; this.chart1.ChartArea.AxisLineColor = Color.DarkSeaGreen; this.chart1.ChartArea.AxisLineWidth = 2; PartingLine line = new PartingLine(); line.YValue = 50; line.LineColor = Color.GreenYellow; this.chart1.ChartArea.PartingLines.Add(line); StringInfo axisXLable = new StringInfo(); axisXLable.Size = 12; axisXLable.Color = Color.Silver; axisXLable.Value = "时间"; this.chart1.ChartArea.AxisX.Lable = axisXLable; this.chart1.ChartArea.AxisX.Interval = 1; this.chart1.ChartArea.AxisX.IntervalType = Enums.InervalType.Hours; this.chart1.ChartArea.AxisX.TimeFormat = "MM-dd HH:mm"; this.chart1.ChartArea.AxisX.Grid.LineColor = Color.RosyBrown; this.chart1.ChartArea.AxisX.Grid.LineStyle = Enums.LineStyle.DashDot; this.chart1.ChartArea.AxisX.ShowGrid = true; StringInfo axisYLable = new StringInfo(); axisYLable.Size = 12; axisYLable.Color = Color.Silver; axisYLable.Value = "数据"; this.chart1.ChartArea.AxisY1.Lable = axisYLable; this.chart1.ChartArea.AxisY1.Interval = 10; this.chart1.ChartArea.AxisY1.IntervalType = Enums.InervalType.Number; this.chart1.ChartArea.AxisY1.Grid.LineColor = Color.SaddleBrown; this.chart1.ChartArea.AxisY1.Grid.LineStyle = Enums.LineStyle.DashDot; this.chart1.ChartArea.AxisY1.ShowGrid = true; Series series1 = new Series(); series1.Name = "SeriesOne"; series1.Color = Color.Red; series1.Width = 1; series1.YValueMember = "F_Y1"; this.chart1.ChartArea.Series.Add(series1); Series series2 = new Series(); series2.Name = "SeriesTwo"; series2.Color = Color.RoyalBlue; series2.Width = 1; series2.YValueMember = "F_Y2"; this.chart1.ChartArea.Series.Add(series2); Series series3 = new Series(); series3.Name = "SeriesThree"; series3.Color = Color.SeaShell; series3.Width = 1; series3.YValueMember = "F_Y3"; this.chart1.ChartArea.Series.Add(series3); ###