User Tools

Site Tools


g-language_charts_api

This is an old revision of the document!


G-language Charts API

Overview

The G-language Charts API is a RESTful web service for creating charts by accessing a simple URL. The charts are generated via R programming language through a CGI accessible with both GET and POST methods. Some examples are shown below:

The URL should be specified in the following format:

http://rest.g-language.org/chart?cht=<*chart type*>&chd=<*chart data*>
&chs=<*chart size*>&…*additional parameters*…

which is basically identical to the deprecated Google Charts API.

Making a Chart

A chart can be made by accessing a URL created manually.

Here are some instructions for creating a chart:

  1. Select a chart type available, which can be seen from our [Chart Gallery](). The chart type is specified by the [cht]() parameter.
  2. Prepare your chart data for drawing your chart. The data is specified by the [chd]() parameter. Separate each group of values with "|" characters and each value with "," characters. Be careful as URL length is limited when accessing with a GET request, and if more length is needed pass a POST request.
  3. Specify the chart size. The size is specified by the [chs]() parameter, passed as *number*x*number*. For PDF, values are converted to inch assuming 72 dpi.
  4. Pass additional parameters. The parameters available for each chart are listed in the [parameter]() documentation page.
  5. Build you URL string, according to the format above. The base URL for the API is http://rest.g-language.org/chart, followed with the parameters of your choice. Be sure to sanitize all HTML metacharacters in the URL when embedding into an HTML file.
  6. Get your chart image, by accessing the URL with a GET request via web browser, or by embedding the image into HTML using <img> tags. If the URL is too long, send a POST request instead.

Parameters

Chart Gallery

g-language_charts_api.1377070528.txt.gz · Last modified: 2014/01/18 07:44 (external edit)