graphics.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
ANALYZE.C
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
/* ANALYZE.C illustrates presentation graphics analyze functions.
* The example uses function:
* _pg_analyzechartms
*
* The same principles apply for:
* _pg_analyzepie _pg_analyzechart
* _pg_analyzescatter _pg_analyzescatterms
*/
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <graph.h>
#include <pgchart.h>
#define FALSE 0
#define TRUE 1
/* Note that data are declared as a single-dimension array. The multiseries
* chart functions expect only one dimension. See the _pg_chartms example
* for an alternate method using multidimension array.
*/
#define TEAMS 4
#define MONTHS 3
float _far values[TEAMS * MONTHS] = { .435F, .522F, .671F,
.533F, .431F, .590F,
.723F, .624F, .488F,
.329F, .226F, .401F };
char _far *months[MONTHS] = { "May", "June", "July" };
char _far *teams[TEAMS] = { "Reds", "Sox", "Cubs", "Mets" };
void main()
{
chartenv env;
if( !_setvideomode( _MAXRESMODE ) )
exit( 1 );
_pg_initchart(); /* Initialize chart system */
/* Default multiseries bar chart */
_pg_defaultchart( &env, _PG_BARCHART, _PG_PLAINBARS );
strcpy( env.maintitle.title, "Little League Records - Default" );
_pg_chartms( &env, months, values, TEAMS, MONTHS, MONTHS, teams );
getch();
_clearscreen( _GCLEARSCREEN );
/* Analyze multiseries bar chart with autoscale. This sets all
* default scale values. We want some x values to be automatic,
* including scalemin and scalefactor.
*/
_pg_defaultchart( &env, _PG_BARCHART, _PG_PLAINBARS );
strcpy( env.maintitle.title, "Little League Records - Customized" );
env.xaxis.autoscale = TRUE;
_pg_analyzechartms( &env, months, values,
TEAMS, MONTHS, MONTHS, teams );
/* Now customize some of the x axis values. Then draw the chart. */
env.xaxis.autoscale = FALSE;
env.xaxis.scalemax = 1.0F; /* Make scale show 0.0 to 1.0 */
env.xaxis.ticinterval = 0.2F; /* Don't make scale too crowded */
env.xaxis.ticdecimals = 3; /* Show three decimals */
strcpy( env.xaxis.scaletitle.title, "Win/Loss Percentage" );
_pg_chartms( &env, months, values, TEAMS, MONTHS, MONTHS, teams );
getch();
_setvideomode( _DEFAULTMODE );
}