简体   繁体   English

在Google可视化中表示数组中的“无价值”

[英]Representing “No value” in array in Google visualization

For the below array i get a smooth curve. 对于下面的数组,我得到一条平滑的曲线。

  data.addColumn('string', 'x');
  data.addColumn('number', 'Cats');
  data.addColumn('number', 'Blanket 1');
  data.addColumn('number', 'Blanket 2');
  data.addRow(["A", 1, 1, 0.5]);
  data.addRow(["B", 2, 0.5, 1]);
  data.addRow(["C", 4, 1, 0.5]);
  data.addRow(["D", 8, 7 , 1]);
  data.addRow(["E", 7, 1, 0.5]);
  data.addRow(["F", 7, 0.5, 1]);
  data.addRow(["G", 8, 1, 0.5]);
  data.addRow(["H", 4, 0.5, 1]);
  data.addRow(["I", 2, 1, 0.5]);
  data.addRow(["J", 3.5, 0.5, 1]);
  data.addRow(["K", 3, 1, 0.5]);
  data.addRow(["L", 3.5, 0.5, 1]);
  data.addRow(["M", 1, 1, 0.5]);
  data.addRow(["N", 1, 0.5, 1]);

在此输入图像描述

Now assume that I don't have the Blanket1 value for row D, how do I represent it so that there is coninuity in the graph? 现在假设我没有D行的Blanket1值,我该如何表示它以便图中有连续性?

If I make it like data.addRow(["D", 8, , 1]); 如果我把它变成data.addRow(["D", 8, , 1]); the graph becomes discontinuous at the D for Blankets. 对于毯子,图表在D处变得不连续。

在此输入图像描述

I want google to make a guess at that value and keep the curve smooth. 我想谷歌猜测一下这个值并保持曲线平滑。 Even if the guess is not smart that is fine but the curve should be continuous and smooth. 即使猜测不聪明也不错,但曲线应该是连续和平滑的。

What you are looking for is the option: 您正在寻找的是选项:

interpolateNulls = true;

And then you just put a 'null' into the value array at the point where data is missing. 然后你只需在数据缺失的位置将'null'放入值数组中。

Check the API reference: http://code.google.com/apis/chart/interactive/docs/gallery/linechart.html#Configuration_Options 查看API参考: http//code.google.com/apis/chart/interactive/docs/gallery/linechart.html#Configuration_Options

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM