Question

So I'm putting together a little code metrics report based off of usage data I've been collecting via the CodeSharp AOP libraries.

Here's what the piechart data looks like: alt text http://tinyurl.com/lg6bnl

However, here's what I'm getting for the scatterchart: alt text http://tinyurl.com/m2vayw

Here's the code, modified to change the datasets into literal arrays and minus the labels:

    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();

What could be the problem?

Just in case someone has been following this question, here's the latest version of the scatterchart: alt text http://tinyurl.com/lvbrgw

Was it helpful?

Solution 2

Basically, the CodeSharp library is doing some trickery with the numbers encoding Google Charts insists on, which results in these odd display problems. I tinkered with the data normalization procedures a little and achieved the results I was looking for.

OTHER TIPS

Two possible solutions:

  1. You never explicitly added the ChartAxis types to the ScatterPlot. Check the Scatter Plots example for where I drew this info from.
  2. A poster on this page said his scatter plot was not working because he was attempting to add float values greater than 100. I noticed that you (might, not sure as I have not worked with this API before) are doing the same thing.

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top