C9111003: Pie Charts Drawn Incorrectly for Large Percentages

ID Number: Q80128

6.00 6.00a 6.00ax

MS-DOS

buglist6.00 buglist6.00a buglist6.00ax fixlist7.00

Summary:

PROBLEM ID: C9111003

SYMPTOMS

When using the Microsoft C Compiler versions 6.0, 6.0a, and 6.0ax, and

the Microsoft QuickC Compiler versions 2.5 and 2.51, pie charts

where one value equals or exceeds 99.91 percent, the chart is drawn

incorrectly. Only a horizontal line is drawn; the circle is not

displayed.

RESOLUTION

If possible, adjust values sent to _pg_chartpie so that the largest

is no more than 99.90 percent. This has the disadvantage that the

percentages printed next to the pie may be incorrect; however, only

one decimal place is printed by default, so in most cases this

should not be a problem.

STATUS

Microsoft has confirmed this to be a problem in Microsoft C

versions 6.0, 6.0a, 6.0ax, QuickC 2.5 and 2.51 (buglist2.50 and

buglist2.51). This problem was corrected in C/C++ version 7.0.

More Information:

In the sample code below, two values are used. When the larger value

exceeds 99.91 percent, only a horizontal line (a radius from the

center of the pie to the 3 o'clock position) is displayed.

Sample Code

-----------

// Compile options needed: none

#include <conio.h>

#include <graph.h>

#include <string.h>

#include <stdlib.h>

#include <pgchart.h>

#define COUNTRIES 2

/* The following line illustrates a bad chart. */

float _far value[COUNTRIES] = { 99.92F, 0.08F };

/* The comment line below works correctly. */

//float _far value[COUNTRIES] = { 99.91F, 0.09F };

char _far *category[COUNTRIES] = { "USSR", "GDR" };

short _far explode[COUNTRIES] = { 0, 0 };

void main()

{

chartenv env;

if( !_setvideomode( _MAXRESMODE ) )

exit( 1 );

_pg_initchart(); /* Initialize chart system */

/* 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 );

}

Additional reference words: 6.00 6.00a 6.00ax 2.50