2009-06-11 51 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