Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 541
Gokul N K Avatar asked Mar 05 '11 10:03

Gokul N K


People also ask

How do you show no data available on Google chart?

Use noData() method to enable "No data" label: chart. noData().

How do you show a value in a Google pie chart?

How to display both Percentage and Values in Google Pie Chart ? You can't display both on the slice labels, but if you set the pieSliceText option to 'label' and the legend. position option to 'labeled' , you will see the value on the slice and the percent on the legend label.

What is arrayToDataTable?

arrayToDataTable()This helper function creates and populates a DataTable using a single call. Advantages: Very simple and readable code executed in the browser. You can either explicitly specify the data type of each column, or let Google Charts infer the type from the data passed in.

How do I change the data in a Google chart?

On your computer, open a spreadsheet in Google Sheets. On the chart, right click the bar or point. Click Format Data Point. Make your changes.


1 Answers

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

like image 168
Tys Avatar answered Oct 02 '22 15:10

Tys