Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chart API: Is it possible to have an incomplete chart?

I need to make a chart showing weekly activity for the current week, with each day of the week as a point on the X axis. Example:

enter image description here

This works fine, but the problem I'm having is that, if today were wednesday, there's no data for Thursday-Saturday. Currently the chart depicts this by sending the line back to 0. Is there any way to make Google Charts stop drawing the line at a specific point and leave the other data points empty?

I tried omitting the missing values from the dataset, but that just causes it to stretch Sunday-Wednesday across the entire graph.

like image 348
ChiperSoft Avatar asked Aug 25 '11 16:08

ChiperSoft


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 I add data to a Google chart?

Double-click the chart you want to change. At the right, click Setup. Select the cells you want to include in your chart. Optional: To add more data to the chart, click Add another range.

Is Google Charts API free?

Google chart tools are powerful, simple to use, and free. Try out our rich gallery of interactive charts and data tools.


1 Answers

You have to pass the value null, which is Javascript's way of saying nil. Make sure you don't include quotation marks.

For instance:

["Sat", null, 165, 210]
like image 190
Juan Avatar answered Sep 25 '22 16:09

Juan