#include <stdio.h>#include <values.h>#include <math.h>#include "gdc.h"#include "gdcpie.h"Go to the source code of this file.
Functions | |
| main (int argc, char *argv[]) | |
| main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Definition at line 13 of file gdc_pie_samp.c.
References FALSE, GDC_3DPIE, GDC_SMALL, GDCPIE_PCT_RIGHT, pie_gif(), and TRUE.
00014 { 00015 /* labels */ 00016 char *lbl[] = { "CPQ\n(DEC)", 00017 "HP", 00018 "SCO", 00019 "IBM", 00020 "SGI", 00021 "SUN\nSPARC", 00022 "other" }; 00023 /* values to chart */ 00024 float p[] = { 12.5, 00025 20.1, 00026 2.0, 00027 22.0, 00028 5.0, 00029 18.0, 00030 13.0 }; 00031 00032 FILE *fp = fopen( "pie.gif", "wb" ); 00033 00034 /* set which slices to explode, and by how much */ 00035 int expl[] = { 0, 0, 0, 0, 0, 20, 0 }; 00036 00037 /* set missing slices */ 00038 unsigned char missing[] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE }; 00039 00040 /* colors */ 00041 unsigned long clr[] = { 0xFF4040L, 0x80FF80L, 0x8080FFL, 0xFF80FFL, 0xFFFF80L, 0x80FFFFL, 0x0080FFL }; 00042 00043 /* set options */ 00044 /* a lot of options are set here for illustration */ 00045 /* none need be - see gdcpie.h for defaults */ 00046 GDCPIE_title = "Sample\nPIE"; 00047 GDCPIE_label_line = TRUE; 00048 GDCPIE_label_dist = 15; /* dist. labels to slice edge */ 00049 /* can be negative */ 00050 GDCPIE_LineColor = 0x000000L; 00051 GDCPIE_label_size = GDC_SMALL; 00052 /* GDCPIE_3d_depth = 25; */ 00053 /* GDCPIE_3d_angle = 45; 0 - 359 */ 00054 GDCPIE_explode = expl; /* default: NULL - no explosion */ 00055 GDCPIE_Color = clr; 00056 GDCPIE_BGColor = 0xFFFFFFL; 00057 GDCPIE_EdgeColor = 0x000000L; /* default is GDCPIE_NOCOLOR */ 00058 /* for no edging */ 00059 GDCPIE_missing = missing; /* default: NULL - none missing */ 00060 00061 /* add percentage to slice label */ 00062 /* below the slice label */ 00063 GDCPIE_percent_labels = GDCPIE_PCT_RIGHT; 00064 00065 /* call the lib */ 00066 pie_gif( 480, /* width */ 00067 360, /* height */ 00068 fp, /* open file pointer */ 00069 GDC_3DPIE, /* or GDC_2DPIE */ 00070 7, /* number of slices */ 00071 lbl, /* slice labels (unlike out_gif(), can be NULL */ 00072 p ); /* data array */ 00073 00074 fclose( fp ); 00075 exit( 0 ); 00076 }
1.5.1