gdc_samp2.c File Reference

#include <stdio.h>
#include <values.h>
#include "gdc.h"
#include "gdchart.h"

Go to the source code of this file.

Functions

 main ()


Function Documentation

main ( void   ) 

Definition at line 22 of file gdc_samp2.c.

References GDC_ANNOTATION_T::color, FALSE, GDC_COMBO_HLC_AREA, GDC_HLC_CLOSE_CONNECTED, GDC_HLC_I_CAP, GDC_NOVALUE, GDC_SMALL, GDC_TINY, GDC_title, GDC_ytitle, GDC_ytitle2, MAX_NOTE_LEN, GDC_ANNOTATION_T::note, out_graph(), and GDC_ANNOTATION_T::point.

00023 {
00024         /* set some sample data points */
00025         float   h[12]  = {      17.8,  17.1,  17.3,  GDC_NOVALUE,  17.2,  17.1,
00026                                                 17.3,  17.3,  17.3,  17.1,         17.5,  17.4 };
00027 
00028         float   c[12]  =  { 17.0,  16.8,  16.9,  GDC_NOVALUE,  16.9,  16.8,
00029                                             17.2,  16.8,  17.0,  16.9,         16.4,  16.1 };
00030 
00031         float   l[12]  = {  16.8,  16.8,  16.7,  GDC_NOVALUE,  16.5,  16.0,
00032                                                 16.1,  16.8,  16.5,  16.9,         16.2,  16.0 };
00033 
00034         float   v[12]  = {  150.0, 100.0, 340.0,  GDC_NOVALUE, 999.0, 390.0,
00035                                                 420.0, 150.0, 100.0,  340.0,       1590.0, 700.0 };
00036         char    *t[12] = {      "May", "Jun", "Jul",  "Aug",       "Sep",  "Oct",
00037                                                 "Nov", "Dec", "Jan", "Feb",        "Mar",  "Apr" };
00038 
00039 //      /* set color RGB as ulong array */
00040 //      unsigned long   setcolor[3]    = { 0xC0C0FF, 0xFF4040, 0xFFFFFF };
00041 
00042         GDC_ANNOTATION_T        anno;
00043 
00044         /* need an open FILE pointer  - can be stdout */
00045         FILE                            *outgif1 = fopen( "g2.gif", "wb" );     /* rem: test open() fail */
00046 
00047 
00048         anno.color = 0x00FF00;
00049         strncpy( anno.note, "Did Not\nTrade", MAX_NOTE_LEN );   /* don't exceed MAX_NOTE_LEN */
00050         anno.point = 3;                                                                                 /* first is 0 */
00051         GDC_annotation_font = GDC_TINY;
00052         GDC_annotation = &anno;                                                                 /* set annote option */
00053 
00054         GDC_HLC_style = GDC_HLC_I_CAP | GDC_HLC_CLOSE_CONNECTED;
00055         GDC_HLC_cap_width = 45;
00056 
00057         GDC_bar_width     = 75;                                                                 /* % */
00058 
00059 //      GDC_BGImage = "W.gif";
00060 
00061         GDC_title = "Widget Corp.";
00062         GDC_ytitle = "Price ($)";
00063         GDC_ytitle2 = "Volume (K)";
00064         GDC_ytitle_size = GDC_SMALL;
00065         GDC_VolColor = 0x4040FFL;                                                               /* aka combo */
00066         GDC_3d_depth  = 4.0;                                                                    /* % entire gif */
00067 
00068 //      GDC_SetColor  = setcolor;                                                               /* see README */
00069         GDC_PlotColor = 0xFFFFFF;
00070         GDC_grid = FALSE;
00071 
00072 //      GDC_xtitle="fy.1998";
00073 
00074 //      fprintf( stdout, "Content-Type: image/gif\n\n" );               /* rem: for web use */
00075                                                                                                                         /* finally: make the call */
00076         out_graph( 200, 175,                                                                    // overall width, height
00077                            outgif1,                                                                             // open FILE pointer
00078                            GDC_COMBO_HLC_AREA,                                                  // chart type
00079                            12,                                                                                  // number of points
00080                            t,                                                                                   // X axis label array
00081                            1,                                                                                   // number of sets (see README)
00082                            h,                                                                                   // set 1 (high)
00083                            l,                                                                                   // low
00084                            c,                                                                                   // close
00085                            v );                                                                                 // combo/volume
00086 
00087         fclose( outgif1 );
00088         exit(0);
00089 }


Generated on Sat Dec 15 00:01:27 2007 for BulmaGes by  doxygen 1.5.1