ChartAPI.org lets you generate charts for your web site. To illustrate how the API works, please copy and paste the following URL into your browser's address bar:
http://api.chartapi.org/chart?s=200x200&t=pie1&d=30,25,45&l=Yes|No|Not%20sure
The following chart should appear in your browser:
Using the chart API is free, both for commercial and non-commercial use. You must however link back to
chartAPI.org. The link must be placed nearby the generated chart. See the chart to right for an example.
If your service will make more than 25000 API calls per day, please send your estimate to
support@chartapi.org.
ChartAPI.org generates a .png chart image based on a URL. You can specify a number of parameters,
such a the image size, colors and labels.
Each parameter is separated by the & character. For example,
the URL below generates an image that is 200x200 pixels (s=200x200),
it is a pie chart (t=pie1) and the data values
are 30, 25, 45 (d=30,25,45). The URL also specify three
labels, "Yes", "No" and "Not sure" (l=Yes|No|Not%20sure).
http://api.chartapi.org/chart?s=200x200&t=pie1&d=30,25,45&l=Yes|No|Not%20sure
You can embed the chart in a HTML document with the img tag. For example:
<img src="http://api.chartapi.org/chart?s=200x200&t=pie1&d=30,25,45&l=Yes|No|Not%20sure" />
Please note that you should use & to separate the parameters while embedding the chart in a HTML document.
The following table shows the pie chart parameters:
| Parameter | Description | Example |
|---|---|---|
t |
The chart type. Use pie1 for this chart. Required. |
t=pie1 |
s |
Size of the resulting .png image in pixels. Required. | s=200x150 |
d |
The data values separated with commas. Required. | d=30,25,45 |
l |
Labels separated by the | character. | l=Yes|No |
r |
Pie radius in pixels. The default value is 50. |
r=65 |
p |
The pie's center position in pixel. The default value is 100,100. |
p=75,95 |
lc |
Color of the lines that separate the pie sectors. | lc=ffffff |
dc |
Color of the pie sectors. If the number of colors are less than the number of sectors the colors are interpolated. | dc=ff3333,ff9999,ffcccc |
sa |
The initial rotation of the pie chart in degrees. | sa=90 |
jlc |
The color of the join lines that connect labels and sectors. | jlc=808080 |
ll |
The label layout. There are two layouts for the labels. The "circle layout",
specified with ll=1, where sector labels are positioned around the perimeter of the pie. This is the default layout.
The other label layout mode is "side layout", specified with ll=0, where labels are placed only on the left
and right side of the chart to avoid overlapping labels. Since labels with this label layout may be far away for
the sectors, it is recommended to set the join line color to connect them. |
ll=0 |
Just to let you know, I'm currently working on adding more chart types, such as a bar chart, a sparkline chart and a 3D pie chart.
To get notification about the updates, please
subscribe to the updates feed.
ChartAPI.org is developed and developed and maintained by Roger Karlsson. The ChartAPI.org back-end is based in part on the work of the Independent JPEG Group and the FreeType Team. The ChartAPI.org logotype is created by Goce Mitevski.
A new layout mode for pie charts has been added to reduce the risk of overlapping labels. Users can also specify the join line color and set the initial rotation angle of the pie chart.
ChartAPI.org is live!