是的,可以在 Chart 控件中使用 'DataGrid' 来显示标点数据的表格形式。可以通过将 Chart 控件和 DataGrid 控件放置在同一个容器中,并根据需要设置它们的位置和大小。

以下是一个示例代码,演示如何在 Chart 控件中显示标点数据的表格形式:

// 创建一个DataTable来存储标点数据
DataTable dataPointsTable = new DataTable();
dataPointsTable.Columns.Add('周期', typeof(string));
dataPointsTable.Columns.Add('合格率', typeof(double));

// 添加标点数据到DataTable中
foreach (DataPoint dataPoint in chart2.Series['合格率'].Points)
{
    string period = dataPoint.AxisLabel;
    double passRate = dataPoint.YValues[0];
    dataPointsTable.Rows.Add(period, passRate);
}

// 创建一个DataGrid控件
DataGrid dataGrid = new DataGrid();
dataGrid.DataSource = dataPointsTable;
dataGrid.Dock = DockStyle.Fill;

// 将DataGrid控件添加到Chart控件的父容器中
chart2.Parent.Controls.Add(dataGrid);

在上述代码中,首先创建一个 DataTable 来存储标点数据,然后遍历 Chart 控件中的标点数据,将数据添加到 DataTable 中。接下来,创建一个 DataGrid 控件,并将 DataTable 设置为其数据源。最后,将 DataGrid 控件添加到 Chart 控件的父容器中。

请根据您的实际需求,将代码中的 'chart2' 和 'dataPointsTable' 替换为您的 Chart 控件和标点数据的 DataTable。

在 Chart 控件中显示标点数据的表格形式

原文地址: https://www.cveoy.top/t/topic/lLz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录