ASP.net c# help with chart control
i have the following 开发者_如何学Pythondataset
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 ?
You just need to databind the second column to some source data
Chart1.Series[1].Points.DataBindXY(dataView, "NAME", dataView, "TARGET");
http://code.google.com/intl/tr-TR/apis/chart/
精彩评论