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");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.