我在我的 Asp.net 页面上显示一个柱形图表。代码如下:
private DataSet FetchDummyChartData()
{
DataSet ds = new DataSet();
DataTable table = new DataTable();
table.Columns.Add("Product", typeof(string));
table.Columns.Add("Status", typeof(string));
table.Columns.Add("Count", typeof(int));
table.Rows.Add("FRA", "Completed", 20);
table.Rows.Add("FRA", "Exceptions", 10);
table.Rows.Add("Swaption", "Exceptions", 15);
table.Rows.Add("Swaption", "Completed", 50);
table.Rows.Add("Cap/Floor", "Exceptions", 40);
table.Rows.Add("Cap/Floor", "Approval Pending", 10);
table.Rows.Add("Single currency swap", "Completed", 70);
table.Rows.Add("Single currency swap", "Approval Pending", 30);
table.Rows.Add("Cross currency swap", "Completed", 60);
table.Rows.Add("Cross currency swap", "Exceptions", 20);
table.Rows.Add("IRS", "Completed", 40);
table.Rows.Add("IRS", "Approval Pending", 70);
table.Rows.Add("Single currency Option", "Completed", 70);
table.Rows.Add("Single currency Option", "Exceptions", 50);
table.Rows.Add("Some Derivative", "Completed", 40);
table.Rows.Add("Some Derivative", "Exceptions", 10);
table.Rows.Add("Some Derivative", "Approval Pending", 50);
ds.Tables.Add(table);
return ds;
}
Chart2.DataBindCrossTable(new DataView(FetchDummyChartData().Tables[0]), "Status", "Product", "Count", null);
问题是,如果 X 轴上的项目包含大于 3-4 个项目(这里的项目“FRA”、“IRS”等代表 X 轴),则不会显示最后一列。请注意,这是一个多线图。这是非常奇怪的行为。没有 CSS/空间问题,我检查过了。
这是屏幕截图: