2009-06-11 50 views
1

因此,我基於我通過CodeSharp AOP庫收集的使用數據制定了一些代碼度量指標報告。(GoogleChartSharp)爲什麼這個Google Charts散點圖都搞砸了?

這裏的餅圖數據的樣子: alt text http://tinyurl.com/lg6bnl

然而,這裏就是我得到的scatterchart: alt text http://tinyurl.com/m2vayw

下面的代碼,修改,從而改變數據集成文字陣列和減標籤:

using System; 
    using System.Data; 
    using System.Configuration; 
    using System.Collections; 
    using System.Collections.Generic; 
    using System.Web; 
    using System.Web.Security; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.WebControls.WebParts; 
    using System.Web.UI.HtmlControls; 
    using GoogleChartSharp; 

int[] totalCalls={161,35,15,100,94,87,84,84,76,76,76,74,74,71,71,69,69,23,66,61};   
int[] totalCPU ={ 180, 100, 94, 55, 52, 48, 47, 47, 42, 42, 42, 41, 41, 39, 39, 38, 38, 38, 37, 34 }; 

     int[] averageRunningTime={18,45,100,9,9,9,9,9,9,9,9,9,9,9,9,9,9,27,9,9}; 

     List<int[]> dataList = new List<int[]>(); 
     dataList.Add(totalCalls); 
     dataList.Add(averageRunningTime); 
     dataList.Add(totalCPU); 


     ScatterPlot sp = new ScatterPlot(600, 300); 

     ChartAxis totalCallsAxis = new ChartAxis(ChartAxisType.Left); 
     totalCallsAxis.SetRange(15, 161); 

     ChartAxis averageRunningTimeAxis = new ChartAxis(ChartAxisType.Bottom); 
     totalCallsAxis.SetRange(9, 100); 

     sp.SetData(dataList); 



     Image1.ImageUrl = sp.GetUrl(); 

可能是什麼問題?

萬一有人已經開始關注此問題,這裏有最新版本的scatterchart的: alt text http://tinyurl.com/lvbrgw

回答

0

基本上,CodeSharp庫會對Google Charts堅持使用的數字進行一些欺騙,這會導致這些奇怪的顯示問題。我稍微修改了數據規範化程序並取得了我期待的結果。

0

兩個可能的解決方案:

  1. 你從來沒有明確添加ChartAxis類型的散點圖。檢查the Scatter Plots example我從哪裏得到這些信息。
  2. this page上的海報表示他的散點圖不起作用,因爲他試圖添加大於100的浮點值。我注意到你(可能,不確定,因爲我之前沒有使用此API)正在做同樣的事情。

希望這有助於!

+0

謝謝,這是有幫助的,特別是> 100小費 – 2009-06-11 21:35:24