ASP.net c#帮助进行图表控制

本文关键字:控制 net 帮助 ASP | 更新日期: 2023-09-27 17:59:30

我有以下数据集

NAME | GP   | ORD_GP | EXP   | TOTAL GP | TARGET
a      206     48      -239     15         1600
b      0       27       0        27        1520

iv设法使用代码在图表上显示TOTAL GP

    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");

请有人告诉我如何在同一张图表上画出目标?

更新

此外,我如何让图表显示每列的值?

ASP.net c#帮助进行图表控制

您只需要将第二列数据绑定到一些源数据

Chart1.Series[1].Points.DataBindXY(dataView, "NAME", dataView, "TARGET");

http://code.google.com/intl/tr-TR/apis/chart/