[英]Help with ASP.Net C# chart control
Im using the following code to display a column chart 我使用以下代码显示柱形图
Chart1.BackColor = Color.Gray;
Chart1.BackSecondaryColor = Color.WhiteSmoke;
Chart1.BackGradientStyle = GradientStyle.DiagonalRight;
Chart1.BorderlineDashStyle = ChartDashStyle.Solid;
Chart1.BorderlineColor = Color.Gray;
Chart1.BorderSkin.SkinStyle = BorderSkinStyle.Emboss;
// format the chart area
Chart1.ChartAreas[0].BackColor = Color.Wheat;
// add and format the title
Chart1.Titles.Add("TOTAL GP Against TARGET ");
Chart1.Titles[0].Font = new Font("Utopia", 16);
Chart1.Series.Add(new Series("total")
{
ChartType = SeriesChartType.Column,
});
Chart1.Series.Add(new Series("perc")
{
ChartType = SeriesChartType.Column,
});
Chart1.Series[0].ChartType = SeriesChartType.Column;
// clear the chart series and bind to the table
DataView dataView = new DataView(dt);
Chart1.Series[0].Points.DataBindXY(dataView, "NAME", dataView, "total");
Chart1.Series[1].Points.DataBindXY(dataView, "NAME", dataView, "perc");
this works fine, however i want to create a another chart which just display the data from on the rows, and im doing something like 这工作正常,但是我想创建另一个图表,该图表仅显示行中的数据,并且即时通讯类似
Chart2.Series[0].Points.DataBindXY(dataView.RowFilter = "NAME = 'John' ", "NAME", dataView, "perc");
but it doesn't seem to work, can any one suggest how I may be able to do this? 但它似乎没有用,有人可以建议我如何做到这一点吗?
Try this: 尝试这个:
DataView dataView = new DataView(dt);
dataView.RowFilter = "NAME = 'John'";
Chart1.Series[0].Points.DataBindXY(dataView, "NAME", dataView, "perc");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.