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.
BARCOL.C
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
/* BARCOL.C illustrates presentation graphics support routines and
* single-series chart routines including:
* _pg_initchart _pg_chart _pg_chartpie _pg_defaultchart
*/
#include <conio.h>
#include <stdlib.h>
#include <graph.h>
#include <string.h>
#include <pgchart.h>
#define COUNTRIES 5
float _far value[COUNTRIES] = { 42.5F, 14.3F, 35.2F, 21.3F, 32.6F };
char _far *category[COUNTRIES] = { "USSR", "GDR", "USA", "UK", "Other" };
short _far explode[COUNTRIES] = { 0, 1, 0, 1, 0 };
void main()
{
chartenv env;
if( !_setvideomode( _MAXRESMODE ) )
exit( 1 );
_pg_initchart(); /* Initialize chart system */
/* Single-series bar chart */
_pg_defaultchart( &env, _PG_BARCHART, _PG_PLAINBARS );
strcpy( env.maintitle.title, "Widget Production" );
_pg_chart( &env, category, value, COUNTRIES );
getch();
_clearscreen( _GCLEARSCREEN );
/* Single-series column chart */
_pg_defaultchart( &env, _PG_COLUMNCHART, _PG_PLAINBARS );
strcpy( env.maintitle.title, "Widget Production" );
_pg_chart( &env, category, value, COUNTRIES );
getch();
_clearscreen( _GCLEARSCREEN );
/* Pie chart */
_pg_defaultchart( &env, _PG_PIECHART, _PG_PERCENT );
strcpy( env.maintitle.title, "Widget Production" );
_pg_chartpie( &env, category, value, explode, COUNTRIES );
getch();
_setvideomode( _DEFAULTMODE );
}