Google/Google Chart API

[Google Chart API] 2. URL foramt

자수씨 2008. 4. 9. 13:15

URL format

Google Chart API URLs must be in the following format:

http://chart.apis.google.com/chart?<parameter 1>&<parameter 2>&<parameter n>

Note: Each URL must be all on one line.

Parameters are separated with the ampersand (&) character. You can specify as many parameters as you like, in any order. For example, the Chart API returns the following chart in response to the URL below:

Yellow pie chart

http://chart.apis.google.com/chart?
chs=250x100
&chd=t:60,40
&cht=p3
&chl=Hello|World

Where:

  • http://chart.apis.google.com/chart? is the Chart API's location.
  • & separates parameters.
  • chs=250x100 is the chart's size in pixels.
  • chd=t:60,40 is the chart's data.
  • cht=p3 is the chart's type.
  • chl=Hello|World is the chart's label.

You can include a Chart API image in an HTML document by embedding a URL within an <img> tag. For example, the following <img> tag results in the same image as above:

<img src="http://chart.apis.google.com/chart?
chs=250x100
&amp;chd=t:60,40
&amp;cht=p3
&amp;chl=Hello|World
"
alt="Sample chart" />



기본 URL: http://chart.apis.google.com/chart
  chs: 차트 사이즈. [width]x[height] ex) chs=200x100
  chd: 차트 데이터
  cht: 차트 타입
  chl: 차트 레이블

PNG 타입의 이미지기 때문에 크기는 6 KB 정도밖에 안되네요

출처: Google Chart API