KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q49063: Changing Default Character in QC 2.00 Presentation Graphics

Article: Q49063
Product(s): See article
Version(s): 2.00
Operating System(s): MS-DOS
Keyword(s): ENDUSER | S_QuickAsm | mspl13_c
Last Modified: 10-OCT-1989

You can change the default characters used by QuickC Version 2.00's
presentation graphics library routines to any other character. To
change the default character, insert the following lines of code
before you display the graphic:

charmap  chartemp1;

/* '*' is default character */
/* change '*' to ASCII character '+' */

_pg_getchardef ('+', chartemp1);
_pg_setchardef ('*', chartemp1);

The first line gets the new character that you want to use. The second
line sets the new character to the character that you want to replace.

You cannot display each point in a data series as a different
character, but you can change the default characters for each data
series.

The following code is the _pg_chartscatter() example from the QuickC
2.00 on-line help. The lines of code mentioned above have been added
to the code example to demonstrate this feature.

Code Example
------------

#include <conio.h>
#include <graph.h>
#include <string.h>
#include <stdlib.h>
#include <pgchart.h>

#define ITEMS  5
#define SERIES 2
float far employees[SERIES][ITEMS] = {{235., 423., 596., 729., 963.},
                                      {285., 392., 634., 801., 895.}};
float far profits[SERIES][ITEMS] =   {{0.9,  2.3,  5.4,  8.0,  9.3},
                                      {4.2,  3.4,  3.6,  2.9,  2.7}};
char far *companies[SERIES] = { "Goodstuff, Inc.", "Badjunk & Co."};

charmap  chartemp1;

main()
{
    chartenv env;
    short mode = _VRES16COLOR;

    while( !_setvideomode( mode ) )
        mode--;
    if (mode == _TEXTMONO )
        exit( 1 );

    _pg_initchart();

    /* Change '*' to '+' */

    _pg_getchardef ('+', chartemp1);
    _pg_setchardef ('*', chartemp1);

    /* Single-series scatter chart */

    _pg_defaultchart (&env, _PG_SCATTERCHART, _PG_POINTONLY );
    strcpy( env.maintitle.title, "Goodstuff, Inc." );
    strcpy( env.xaxis.axistitle.title, "Employees" );
    strcpy( env.yaxis.axistitle.title, "Profitability" );
    _pg_chartscatter( &env, employees[0], profits[0], ITEMS );
    getch();
    _clearscreen( _GCLEARSCREEN );

    /* Multi-series scatter chart */

    _pg_defaultchart (&env, _PG_SCATTERCHART, _PG_POINTONLY );
    strcpy( env.xaxis.axistitle.title, "Employees" );
    strcpy( env.yaxis.axistitle.title, "Profitability" );
    _pg_chartscatterms( &env, (float far *)employees,
                        (float far *)profits, SERIES, ITEMS, ITEMS,
                        companies );
    getch();

    exit( !_setvideomode( _DEFAULTMODE ) );
}

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.