在.net (C#)的代碼如下
  DataTable dt = LoadDataTable();
        ChartSpace mychartSpace = new ChartSpace();        ChChart mychart = mychartSpace.Charts.Add(0);
        mychart.Type = ChartChartTypeEnum.chChartTypeColumnClustered;
        mychart.HasLegend = true;
        //主題
        mychart.HasTitle = true;
        mychart.Title.Caption = "Testing";
        mychart.Axes[0].HasTitle = true;
        mychart.Axes[0].Title.Caption = "星期";        mychart.Axes[1].HasTitle = true;
        mychart.Axes[1].Title.Caption = "降雨量";        //mychart.SeriesCollection.Add(0);
        //mychart.SeriesCollection.Add(0);
        //mychart.SeriesCollection.Add(0);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            mychart.SeriesCollection.Add(i);
            mychart.SeriesCollection[i].Caption = dt.Rows[i][0].ToString();            mychart.SeriesCollection[i].SetData(ChartDimensionsEnum.chDimCategories,
                (int)ChartSpecialDataSourcesEnum.chDataLiteral, dt.Rows[i][0].ToString());            mychart.SeriesCollection[i].SetData(ChartDimensionsEnum.chDimValues,
                (int)ChartSpecialDataSourcesEnum.chDataLiteral, dt.Rows[i][1].ToString());
            mychart.SeriesCollection[i].DataLabelsCollection.Add();
            mychart.SeriesCollection[i].DataLabelsCollection[0].HasPercentage = false;
            mychart.SeriesCollection[i].DataLabelsCollection[0].HasCategoryName = false;
            mychart.SeriesCollection[i].DataLabelsCollection[0].HasValue = true;
            mychart.SeriesCollection[i].DataLabelsCollection[0].Interior.Color = "white";
            mychart.SeriesCollection[i].DataLabelsCollection[0].Font.Name = "Verdana";          }
        string fileName = "nihao" + ".jpg";
        string ImagePath=this.Request.PhysicalApplicationPath+"Image\\"+fileName;
        string ImageUrlPath=this.Request.PhysicalApplicationPath+"Image/"+fileName;
        mychartSpace.ExportPicture(ImagePath,"JPG",500,300);
                Imagel.ImageUrl=ImageUrlPath;
        Imagel.Visible = true;
在指定的文件夾中我看到了,我想要的圖表!但是在頁面中卻不顯示該圖片,請問給為高手,這是怎麼了

解决方案 »

  1.   

    WEB的?
    可能要在配置文件中指定虚拟目录什么的吧!
      

  2.   

    点击右键查看图片路径
    Page.ResolveUrl
      

  3.   

    Imagel.ImageUrl=ImageUrlPath;这是你指定imge的URL.
     Imagel.Visible = true;
    可见读为真。 代码是没有问题的。 在你显示的页面上在imge位置上点属性。有个图片的相对路径。你看是否与你生成的图片路径相同就是了。百分百是路径的问题。
      

  4.   

    点击右键查看图片路径
    Page.ResolveUrl
    Imagel.ImageUrl=ImageUrlPath;这是你指定imge的URL.
     Imagel.Visible = true;
    可见读为真。 代码是没有问题的。 在你显示的页面上在imge位置上点属性。有个图片的相对路径。你看是否与你生成的图片路径相同就是了。百分百是路径的问题。