在(3d)条形图中排除xvalue

时间:2014-07-31 05:31:53

标签: c# asp.net web charts

我有下面的三维条形图: enter image description here

想知道是否有一种方法可以排除图表中的“已关闭”和“总计”行?

这是我生成的代码:

chtOverview.DataSource = dt;

var headercountries = new List<string>();
foreach (DataColumn dc in dt.Columns)
{
     if (!(dc.ColumnName.ToLower().Contains("total") || dc.ColumnName.ToLower().Contains("status")))
     {
        headercountries.Add(dc.ColumnName);
        chtOverview.Series.Add(new Series(dc.ColumnName));
     }
}

chtOverview.Legends.Add(new Legend("Legend1"));

for (int i = 0; i < headercountries.Count; i++)
{
        chtOverview.Series[i].ChartArea = "ChartArea1";
        chtOverview.Series[i].ChartType = SeriesChartType.Column;
        chtOverview.Series[i].IsValueShownAsLabel = true;
        chtOverview.Series[i].Legend = "Legend1";
        chtOverview.Series[i].XValueMember = "Case Status";
        chtOverview.Series[i].YAxisType = AxisType.Primary;
        chtOverview.Series[i].YValueMembers = headercountries[i];
}


chtOverview.DataBind();

感谢您的帮助。 :)

1 个答案:

答案 0 :(得分:1)

在您声明数据源的行中:

chtOverview.DataSource = dt.Select("[Case Status] NOT IN ('Closed', 'TOTALS')");