Home
/* sample gdchart usage */
/* this will produce a 3D BAR chart */
/* this is suitable for use as a CGI */
#include <stdio.h>
#include <values.h>
#include "gdc.h"
#include "gdchart.h"
main()
{
float a[6] = { 0.5, 0.09, 0.3, 0.75, 0.0, 0.90 }, /* sample data */
b[6] = { 1.9, 1.3, 1.2, 0.75, 0.1, 2.0 };
/* X labels */
char *t[6] = { "Chicago", "New York", "L.A.", "Atlanta", "Paris, MD\n(USA) ", "London" };
unsigned long sc[2] = { 0xFF8080, 0x8080FF }; /* data set colors (RGB) */
GDC_BGColor = 0xFFFFFFL; /* backgound color (white) */
GDC_SetColor = sc; /* assign set colors */
printf( "Content-Type: image/gif\n\n" ); /* http mime header (CGIs only) */
/* ----- call the lib ----- */
out_graph( 250, 200, /* short width, height */
stdout, /* FILE* open FILE pointer */
GDC_3DBAR, /* GDC_CHART_T chart type */
6, /* int number of points per data set */
t, /* char*[] array of X labels */
2, /* int number of data sets */
a, /* float[] data set 1 */
b ); /* ... data set n */
exit(0);
}