2010-06-08 38 views
0

我在這裏有一個大問題..我在我的asp.net mvc應用程序中使用微軟圖表控件..pie圖表在我的Mozilla Firefox中完美工作,當我打開嘗試在IE中運行應用程序圖表不顯示。當我刷新頁面幾次它顯示在那裏的圖表?微軟圖表控件IE6使用asp.net mvc不工作

有沒有什麼做錯的?

請任何人可以幫助我走出

感謝

回答

0

我也使用Microsoft圖表控制在我的ASP.NET MVC應用程序。你所描述的問題不能出現在我的案例中。我可以解釋爲什麼。我有一個使用方法GetChart的MVC控制器,它可以將純PNG文件作爲流返回。所以我在HTML頁面上定義了一個<img>元素,其src屬性如"<%= Url.Content ("~/Home/GetChart")%>"。因此,Web瀏覽器僅加載並顯示PNG圖形。這種實現在所有瀏覽器中都很完美。它也經過測試並與IE6一起使用。

GetChart方法看起來像以下:

public FileStreamResult GetChart (/*some additional parameters*/) { 
    MyChartModel model = new MyChartModel(); 

    System.Web.UI.DataVisualization.Charting.Chart chart = 
     model.CreateChart (/*some parameters*/); 

    // Save the chart in a MemoryStream 
    MemoryStream imageStream = new MemoryStream(); 
    chart.SaveImage (imageStream, ChartImageFormat.Png); 

    // Reset the stream’s pointer back to the start of the stream. 
    imageStream.Seek (0, SeekOrigin.Begin); 

    return new FileStreamResult (imageStream, "image/png"); 
} 

模型MyChartModel的代碼是長一點,但如果你已經Microsoft圖表的實現,你已經全部所需。