小女子初来,属于菜鸟级别的,今天做一个项目中,发现一个问题,就是用OWC11画折线图,从数据库里读得数据,数据都显示正确。横轴:时间,Y轴:水温。可是就是没有连起来的折线啊?急死了,盼望各位指点。不胜感激~~主要代码如下: if (!IsPostBack)
        {
          
             string strSeriesName = "图例1";
            
          
                    string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
         "SERVER=localhost;" +
         "DATABASE=siat;" +
         "UID=root;" +
         "PASSWORD=root;" +
         "OPTION=3";
        //Connect to MySQL using Connector/ODBC
        OdbcConnection MyConnection = new OdbcConnection(MyConString);
        MyConnection.Open();
        OdbcDataAdapter sda = new OdbcDataAdapter("select id ,submit_datetime ,water_level from sensor_information order by id desc limit 20", MyConnection);
      
        
        DataSet ds = new DataSet();
        sda.Fill(ds);        //存放时间
        string[] publish_datetime = new string[20];
        //存放水温
        string[] temp = new string[20];
        //string[] id = new string[1024];
        //为数组赋值
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            publish_datetime [i] = ds.Tables[0].Rows[i][1].ToString();            temp[i] =ds.Tables[0].Rows[i][2].ToString();
                  }
        //创建ChartSpace对象来放置图表
        ChartSpace laySpace = new ChartSpaceClass();        //在ChartSpace对象中添加图表
        ChChart InsertChart = laySpace.Charts.Add(0);        //指定绘制图表的类型。类型可以通过OWC.ChartChartTypeEnum枚举值得到
        InsertChart.Type = ChartChartTypeEnum.chChartTypeLine;//折线图
                //指定图表是否需要图例标注
        InsertChart.HasLegend = false ;
        InsertChart.HasTitle = true;//为图表添加标题
        InsertChart.Title.Caption = "水温随时间变化显示图";//标题名称        //为x,y轴添加图示说明
        InsertChart.Axes[0].HasTitle = true;
        InsertChart.Axes[0].Title.Caption = "时间";//
        InsertChart.Axes[1].HasTitle = true;        InsertChart.Axes[1].Title.Caption = "水位";
        //为x轴指定特定字符串,以便显示数据
        string strXdata = String.Empty;
             string strYdata = String.Empty;
                   
            for(int j=0;j<20;j++)
            {
                strXdata = publish_datetime [j] + "/t";
                strYdata = temp[j] + "/t";
                //添加一个series系列
               InsertChart.SeriesCollection.Add(0);                //给定series系列的名字
                InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, +(int)ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName);                //给定分类
                InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, +(int)ChartSpecialDataSourcesEnum.chDataLiteral, strXdata);                //给定值
                InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strYdata);
                Microsoft .Office .Interop .Owc11.ChDataLabels dl=InsertChart.SeriesCollection[0].DataLabelsCollection.Add();
                
                dl.HasValue = true;
                            
      
            }             
        //输出文件.
        string strAbsolutePath = (Server.MapPath(".")) + "//ShowData.gif";
        laySpace.ExportPicture(strAbsolutePath, "GIF", 800,600);        //创建GIF文件的相对路径.
        string strRelativePath = "./ShowData.gif";        //把图片添加到placeholder中,并在页面上显示
        string strImageTag = "<IMG SRC='" + strRelativePath + "'/>";
        this.PlaceHolder1.Controls.Add(new LiteralControl(strImageTag));
    }
        }