Make your own free website on Tripod.com

 

Home Creations

Great Palm OS™ software. Everything else is irrelevant.


Example code snippet that creates the bar graph below.


	//code snippet shows how a  color bar graph is created

	grLibSetGraphParams(br,10,15,140,100,BAR,col);

        //specify the scales (max and min X and Y) - these are the data ranges
        grLibSetMaxMinScales(br,0,1999,100,2004);

        //draw an outer frame for the graph. This routine will use the frame
        //parameters set in grLibSetGraphParams
        grLibDrawGraphFrame(br,SIMPLE_FRAME);

        //start inputting data!
        if( grLibInputGraphData(br,25,2002,0,"Yahoo") != grLibNone) 
            return grLibInvData;
        if( grLibInputGraphData(br,50,2003,1,"Lycos") != grLibNone) 
            return grLibInvData;
        if( grLibInputGraphData(br,75,2001,2,"MSN") !=grLibNone) 
            return grLibInvData;
        if( grLibInputGraphData(br,90,2002,3,"Redif") !=grLibNone) 
            return grLibInvData;
	
    //draw the legends first, print them in rows of 3 columns each.
    grLibDrawGraphLegends(&appgr,3);

    //draw the gray line vertical grids originating from X axis. Also print 
    //the scale values on the Y axis. '5' specifies how many grids to draw
    grLibDrawGraphGrids(&appgr,YGRID,XTEXT,5); 

    //draw the gray line horizontal grids originating from Y axis. Also print 
    //the scale values on the X axis. '5' specifies how many grids to draw
    //You can specify variables to print grids and text in variety of 
    //combinations (No grid, X text or no grids,no text, only X grid and so on)
    //see the grid_t typedefs
    grLibDrawGraphGrids(&appgr,NO_GRID,YTEXT,5); 

    //this will draw the graph for all the data points. You can choose to print
    //only some if you wish to - using the for loop. The numDataPts is an 
    //internal value calculated when the data was loaded to the graph
    for(idx = 0;idx < appgr.numDataPts ;idx++)
        grLibDrawGraph(&appgr,idx);

    grLibDrawGraphTitle(&appgr,"ISP Turnover");
	

Of course, using some of the code above in different ways - you choose some of the below formats as well

  • Black and White
  • No title
  • No legends
  • No grids
  • More grids (Y or X or both XY axis)
  • so on...

Creating other graphs is equally simple.

(c) homecreations, 2001-2002. All sample downloads and final products are sold on the condition that at no circumstance shall homecreations be held responsible for any kind of damage or harm caused by the software. There are no implied warranties and you are wholly responsible for all eventualities. God, what legal crap do we have to print to save ourselves.

homepalm@hotmail.com