Gokul N K
Gokul N K

Reputation: 2458

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

enter image description here

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?

If I make it like data.addRow(["D", 8, , 1]); the graph becomes discontinuous at the D for Blankets.

enter image description here

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.

Upvotes: 15

Views: 12349

Answers (1)

Tys
Tys

Reputation: 3610

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.

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

Upvotes: 25

Related Questions