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.
MSERIES.C
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
/* MSERIES.C illustrates presentation graphics multiseries chart
 * routines using:
 *    _pg_chartms
 */
 
#include <conio.h>
#include <graph.h>
#include <string.h>
#include <pgchart.h>
#include <stdlib.h>
 
/* Note that data are declared as a multidimension array. Since multiseries
 * chart functions expect single-series data, this array must be cast in
 * the function call. See the _pg_analyzechartms example for an alternate
 * method using a single-dimension array.
 */
#define TEAMS  4
#define MONTHS 3
float _far values[TEAMS][MONTHS] = { { .435F,   .522F,   .671F  },
                                     { .533F,   .431F,   .590F  },
                                     { .723F,   .624F,   .488F  },
                                     { .329F,   .446F,   .401F  } };
char _far *months[MONTHS] =          { "May",   "June",  "July"  };
char _far *teams[TEAMS] = { "Reds", "Sox",  "Cubs", "Mets" };
 
void main()
{
    chartenv env;
 
    if( !_setvideomode( _MAXRESMODE ) ) /* Find a valid graphics mode */
        exit( 1 );
    _pg_initchart();                    /* Initialize chart system    */
 
    /* Multiseries bar chart */
    _pg_defaultchart( &env, _PG_BARCHART, _PG_PLAINBARS );
    strcpy( env.maintitle.title, "Little League Records" );
    _pg_chartms( &env, months, (float _far *)values,
                 TEAMS, MONTHS, MONTHS, teams );
    getch();
    _clearscreen( _GCLEARSCREEN );
 
    /* Multiseries column chart */
    _pg_defaultchart( &env, _PG_COLUMNCHART, _PG_PLAINBARS );
    strcpy( env.maintitle.title, "Little League Records" );
    _pg_chartms( &env, months, (float _far *)values,
                 TEAMS, MONTHS, MONTHS, teams );
    getch();
    _clearscreen( _GCLEARSCREEN );
 
    /* Multiseries line chart */
    _pg_defaultchart( &env, _PG_LINECHART, _PG_POINTANDLINE );
    strcpy( env.maintitle.title, "Little League Records" );
    _pg_chartms( &env, months, (float _far *)values,
                 TEAMS, MONTHS, MONTHS, teams );
    getch();
    _clearscreen( _GCLEARSCREEN );
 
    /* Multiseries line chart showing only two columns out of three
     * and three series out of four.
     */
    _pg_defaultchart( &env, _PG_LINECHART, _PG_POINTANDLINE );
    strcpy( env.maintitle.title, "Partial Little League Records" );
    _pg_chartms( &env, &months[1], &values[1][1],
                 TEAMS - 1, MONTHS - 1, MONTHS, &teams[1] );
    getch();
    _setvideomode( _DEFAULTMODE );
}