English 中文(简体)
当某些价值缺失时,如何提取谷歌线图?
原标题:How to draw Google Line Charts when some of the values are missing?
最佳回答

If it s possible for you to use the javascript version of this chart, then you can achieve something like what you want by using the interpolateNulls option available through the line chart options.

这里是一个例子。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load( visualization ,  1.1 , {packages: [ corechart ,  imagelinechart ]});
    </script>
    <script type="text/javascript">
    function drawVisualization() {
        var data = new google.visualization.DataTable();
        data.addColumn( string ,  Year );
        data.addColumn( number ,  Sales );
        data.addColumn( number ,  Expenses );
        data.addRows(4);
        data.setValue(0, 0,  2004 );
        data.setValue(0, 1, 1000);
        data.setValue(0, 2, 400);
        data.setValue(1, 0,  2005 );
        //data.setValue(1, 1, 1170); // sales for 2005
        data.setValue(1, 2, 460);
        data.setValue(2, 0,  2006 );
        data.setValue(2, 1, 860);
        data.setValue(2, 2, 580);
        data.setValue(3, 0,  2007 );
        data.setValue(3, 1, 1030);
        data.setValue(3, 2, 540);

        var chart = new google.visualization.LineChart(document.getElementById( visualization ));
        chart.draw(data, {width: 500, height: 250, min: 0, interpolateNulls: true});
      }
      google.setOnLoadCallback(drawVisualization);
    </script>
  </head>
  <body>
    <div id="visualization" style="width: 600px; height: 400px;"></div>
  </body>
</html>
问题回答

暂无回答




相关问题
Editing legend name on an excel chart using C#

I want to edit the name of the legends given on my excel chart. Right now I have 5 Series on a chart and the legend displays the names "Series 1", "Series 2", "Series 3", "Series 4", "Series 5". I ...

Flash charts that can map/dither the data on X axis

I looked at different flash chart software (free and commercial) and could find only one that supports the feature I want: map my dataset on the predefined X axis. Let me give an example. Let s say ...

Grid Chart using GWT

Is there any library in gwt that will create grid chart, something similar to this : http://www.eyescience.com/images/vision/amsler_grid.gif. Thank you.

Microsoft .Net Chart Control not showing markers

I m using the Microsoft Chart Controls for Microsoft .NET Framework 3.5 and am having a spot of trouble getting Data Markers to show on the image. I m generating the chart at run-time, so can t just ...

Drawing 3D bar graphs using PHP?

I m looking to draw a 3d bar graph similar to the one below alt text http://techportal.co.za/article_images/image004.png My problem is that I can t seem to find any useful library that can do this ...