在 ASP.net 图中使用数组

Using an Array in ASP.net Graph

我不得不对从数据库中提取的数据进行一些计算。我现在有一个包含 24 个数据点的双精度数组。有没有办法将这些信息绘制到我网站上的现有图表上?

using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.DataVisualization.Charting;
using System.Web.UI.WebControls;

public partial class _Default : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Get data for limits
        DataView avgLim = avgLimits.Select(DataSourceSelectArguments.Empty) as DataView;
        DataTable averageLim = avgLim.ToTable();

        //Add data for single fill parts
        DataView dv = noDamper.Select(DataSourceSelectArguments.Empty) as DataView;
        DataTable singleDT = dv.ToTable();


        //Add data for Dampered Parts
        DataView dv1 = Damper.Select(DataSourceSelectArguments.Empty) as DataView;
        DataTable damperDT = dv1.ToTable();
        damperData.Series.Add("damperData");

        //Moving Average starts here
        //Calc moving data
        Double[] singleMovData = new Double[24];
        Double[] damperMovData = new Double[24];

        //GET DATA TO Column
        Double[] tempSingle = new Double[25];
        Double[] tempDamper = new Double[25];

        int j =0;
        foreach (DataRow row in singleDT.Rows)
            tempSingle[j++] = Convert.ToInt32(row[2]);//Convert.ToDouble(row[3]);
        j =0;
        foreach(DataRow row in damperDT.Rows)
            tempDamper[j++] = Convert.ToInt32(row[2]);

        for (int i = 0; i <= 23; i++)
        {
            singleMovData[i] = Math.Abs(Convert.ToDouble(tempSingle[i]) - Convert.ToDouble(tempSingle[i+1]));
            damperMovData[i] = Math.Abs(Convert.ToDouble(tempDamper[i]) - Convert.ToDouble(tempDamper[i + 1]));

        }

        //singleFillMoving.Series.Add("singleMov");
        //singleFillMoving.Series["singleMov"].ChartType = SeriesChartType.Line;
        singleFillMoving.DataSource = singleMovData;
        //singleFillMoving.Series.Add(singleMovData);
        singleFillMoving.DataBind();

        damperFillMoving.Series.Add("damperData");
        damperFillMoving.Series["damperData"].ChartType = SeriesChartType.Line;
        //damperFillMoving.Series["damperData"].XValueMember = "CONTAINER_ID";
        //damperFillMoving.Series["damperData"].YValueMembers = "DIFFERENCE";
        damperFillMoving.DataSource = damperMovData;
        damperFillMoving.DataBind();  

    }
}
singleFillMoving.Series["singleMov"].Points.DataBindY(singleMovData);

这就是我需要的代码行。只需要挖掘得足够深。