资源简介
1.C#动态生成柏拉图
2.自生成Chart控件,DataGridView控件显示数据。
代码片段和文件信息
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;
using System.Windows.Forms.DataVisualization.Charting;
using System.Reflection;
using System.IO;
using System.Runtime.InteropServices;
namespace Pareto
{
public partial class Form1 : Form
{
System.Data.DataTable PCBA_Pareto = new System.Data.DataTable();
System.Data.DataTable PCBA_Paretof = new System.Data.DataTable();
System.Windows.Forms.DataVisualization.Charting.Chart Chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
public Form1()
{
InitializeComponent();
}
void MakeParetoChart(System.Windows.Forms.DataVisualization.Charting.Chart chart string srcSeriesName string destSeriesName)
{
//MessageBox
// Get the name of the ChartArea of the source series
string strChartArea = chart.Series[srcSeriesName].ChartArea;
//Series se =
// Ensure that the source series is a column chart type
chart.Series[srcSeriesName].ChartType = SeriesChartType.Column;
// Sort the data in the series to be in descending order
chart.DataManipulator.Sort(PointSortOrder.Descending srcSeriesName);
// Find the total of all points in the source series
double total = 0.0;
foreach (DataPoint pt in chart.Series[srcSeriesName].Points)
{
total += pt.YValues[0];
double tt = pt.XValue;
}
//// Set the max. value on the primary axis to the total
chart.ChartAreas[strChartArea].AxisY.Maximum = total;
// Create the destination series and add it to the chart
System.Windows.Forms.DataVisualization.Charting.Series destSeries = new System.Windows.Forms.DataVisualization.Charting.Series(destSeriesName);
chart.Series.Add(destSeries);
// Ensure the destination series is a Line or Spline chart type
destSeries.ChartType = SeriesChartType.Line;
//destSeries.ChartType = SeriesChartType.Point;
//destSeries.BorderWidth = 3;
// Assign the series to the same chart area as the column chart
destSeries.ChartArea = chart.Series[srcSeriesName].ChartArea;
//destChartareas = chart.Series[srcSeriesName].ChartArea;
// Assign this series to use the secondary axis and set its maximum to be 100%
//destSeries.YAxisType = AxisType.Secondary;
destSeries.YAxisType = AxisType.Secondary;
chart.ChartAreas[strChartArea].AxisY2.Maximum = 1;
//chart.ChartAreas[strChartArea].AxisY2.Minimum = 0.5;
//destSeries.Enabled = false;
//destSeries.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 860 2015-09-26 11:39 Pareto\Pareto.sln
文件 29184 2015-10-29 16:46 Pareto\Pareto.suo
目录 0 2015-10-29 16:46 Pareto\Pareto\
文件 117 2015-10-28 19:32 Pareto\Pareto\app.config
目录 0 2015-10-29 16:46 Pareto\Pareto\bin\
目录 0 2015-10-29 16:46 Pareto\Pareto\bin\Debug\
文件 17408 2015-10-29 16:46 Pareto\Pareto\bin\Debug\Pareto.exe
文件 117 2015-10-28 19:32 Pareto\Pareto\bin\Debug\Pareto.exe.config
文件 30208 2015-10-29 16:46 Pareto\Pareto\bin\Debug\Pareto.pdb
文件 11608 2015-10-29 16:46 Pareto\Pareto\bin\Debug\Pareto.vshost.exe
文件 117 2015-10-28 19:32 Pareto\Pareto\bin\Debug\Pareto.vshost.exe.config
文件 618150 2015-10-29 16:46 Pareto\Pareto\bin\Debug\PCBA_Chart.JPEG
文件 17347 2015-10-29 16:46 Pareto\Pareto\Form1.cs
文件 3208 2015-10-29 14:21 Pareto\Pareto\Form1.Designer.cs
文件 5817 2015-10-29 14:21 Pareto\Pareto\Form1.resx
目录 0 2015-09-26 11:39 Pareto\Pareto\obj\
目录 0 2015-09-26 11:39 Pareto\Pareto\obj\x86\
目录 0 2015-10-29 16:46 Pareto\Pareto\obj\x86\Debug\
文件 40881 2015-10-29 14:15 Pareto\Pareto\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6522 2015-10-29 16:46 Pareto\Pareto\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 409600 2015-10-18 19:47 Pareto\Pareto\obj\x86\Debug\Interop.Microsoft.Office.Core.dll
文件 229376 2015-10-26 11:47 Pareto\Pareto\obj\x86\Debug\Interop.MSComctlLib.dll
文件 2896 2015-10-29 16:46 Pareto\Pareto\obj\x86\Debug\Pareto.csproj.FileListAbsolute.txt
文件 975 2015-10-29 16:46 Pareto\Pareto\obj\x86\Debug\Pareto.csproj.GenerateResource.Cache
文件 804 2015-10-29 16:46 Pareto\Pareto\obj\x86\Debug\Pareto.csproj.ResolveComReference.cache
文件 22694 2015-10-29 16:46 Pareto\Pareto\obj\x86\Debug\Pareto.csprojResolveAssemblyReference.cache
文件 17408 2015-10-29 16:46 Pareto\Pareto\obj\x86\Debug\Pareto.exe
文件 180 2015-10-29 16:46 Pareto\Pareto\obj\x86\Debug\Pareto.Form1.resources
文件 30208 2015-10-29 16:46 Pareto\Pareto\obj\x86\Debug\Pareto.pdb
文件 180 2015-10-29 16:46 Pareto\Pareto\obj\x86\Debug\Pareto.Properties.Resources.resources
目录 0 2015-10-28 19:32 Pareto\Pareto\obj\x86\Debug\TempPE\
............此处省略9个文件信息
- 上一篇:C#实现动态的曲线图
- 下一篇:ASP.NET写的简易网上聊天室适于初学者
评论
共有 条评论