Lesson goal: Make a Google Chart

Previous: Play a chirp | Home | Next: Make an (x,y) plot

Google has an online chart creation facility. There are a variety of professional looking charts that you can use right inside of your programming projects. In this lesson, we'll show you how to use a function called drawchart that calls upon this awesome Google tool, to allow you to create charts yourself.

Since charts are made of rows of data, arrays will be a natural way of holding and presenting your data to the chart drawing function, which is called drawchart as described here:

drawchart(xdata,ydata,type)
Move the mouse over a dotted box for more information.

A chart will always appear at the very bottom of the browser window. You might have to scroll down to see it.

Now you try. Fill the x and y arrays with comma-separated data points, then see your line chart appear.

Type your code here:


See your results here:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.