i have the following dataset
NAME | GP | ORD_GP | EXP | TOTAL GP | TARGET
a 206 48 -239 15 1600
b 0 27 0 27 1520
iv managed to display the TOTAL GP on the chart using the code
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("TotalGP")
{
ChartType = SeriesChartType.Column,
});
Chart1.Series.Add(new Series("Target")
{
ChartType = SeriesChartType.Column,
});
Chart1.Series[0].ChartType = SeriesChartType.Column;
DataView dataView = new DataView(ds.Tables[0]);
Chart1.Series[0].Points.DataBindXY(dataView, "NAME", dataView, "TOTAL_GP");
please can some one tell me how i can plot the target on the same chart ?
UPDATE
also how do i get the chart to show the values for each column ?
您只需要将第二列与某些源数据绑定
Chart1.Series[1].Points.DataBindXY(dataView, "NAME", dataView, "TARGET");
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.