rlemon
rlemon

Reputation: 17666

custom labels for xAxis on Scatter Chart using Google API

I'm new to the google-api, and i'm trying to whip together a quick chart.

What I have

 10 |        .     .
    |      .
  5 |  .         .
    |  .
  0 |_______________
       1    2    3    4 

What I want

 10 |        .     .
    |      .
  5 |  .         .
    |  .
  0 |_______________
       1pm  2pm  3pm  4pm

Doing this is a piece of cake using a Line Chart; All that is required is for you to make the first column of the DataTable a string. However a Scatter Chart forces you to use a 'number' for the first column.

So how can I write custom labels for the xAxis using Google API + Charts

Scatter Chart

Line Chart

Upvotes: 0

Views: 1037

Answers (1)

Incognito
Incognito

Reputation: 20765

You want to use chx1?

cht=s
chd=t:12,87,75,41,23,96,68,71,34,9
    98,60,27,34,56,79,58,74,18,76
    84,23,69,81,47,94,60,93,64,54
chxt=x,y
chs=400x200
chxl=0:|12PM|1PM|2PM|3PM|4PM|5PM|F|G

Documentation here

enter image description here

You could also use tools such as:

http://imagecharteditor.appspot.com/

or even

https://code.google.com/apis/chart/image/docs/chart_playground.html

Upvotes: 2

Related Questions