0

我想使用 asp.net 图表控件,在代码隐藏中有这段代码:

chIstatistik.DataSource =
                SqliteDatabase.ExecuteDataTable("SELECT COUNT(*) as sayi, kategoriNo FROM kisi WHERE kategoriNo = " +
                                                drpCategories.SelectedItem.Value);


            chIstatistik.Series["Series1"].XValueMember = "sayi";
            chIstatistik.Series["Series1"].YValueMembers = "kategoriNo";
            chIstatistik.DataBind();

我想要做的是,显示给定“kategoriNo”的行数。代码中是否有任何错误?图表为空,但我可以看到数据源中的数据。

谢谢

4

1 回答 1

0

试试下面的代码

DataTable dt = SqliteDatabase.ExecuteDataTable("SELECT COUNT(*) as Yaxis, kategoriNo as Xaxis FROM kisi WHERE kategoriNo = " + drpCategories.SelectedItem.Value);
DataView dv = dt.DefaultView;
// Populate series data
chIstatistik.Series["Series1"].Points.DataBindXY(dv, "Xaxis", dv, "Yaxis");

CategoriNo 应该是一些将显示在 Xaxis 上的名称。希望能帮助到你

于 2012-04-19T13:38:15.457 回答