Alex
Alex

Reputation: 38529

Google Chart - Bar chart with label underneath

I'm trying to create something close to this using Google Chart API:

what i'm trying to do

So far, I've got this:

<img src="//chart.googleapis.com/chart?
chbh=a
&chs=461x337
&cht=bvg
&chco=323232,7bc247&c
&chd=e:zM,Mz" width="461" height="337" alt="" />

Which generates this

http://jsfiddle.net/alexjamesbrown/c2VAP/

Which is almost there, but I can't figure out how / if I can add a label underneath the bars?

Upvotes: 0

Views: 629

Answers (1)

asgallant
asgallant

Reputation: 26340

If you want to get labels like that, you have to make a few changes. Set the following chart parameters:

cht=bvs                // create a stacked chart
chd=zM__,__Mz          // insert null values for the opposite data points
chxt=x                 // create an x-axis
hxl=0:|Label+1|Label+2 // set the labels on the x-axis ("+" translates to a space)

see example: http://jsfiddle.net/asgallant/c2VAP/2/

Upvotes: 1

Related Questions