~ubuntu-branches/ubuntu/dapper/ploticus/dapper

« back to all changes in this revision

Viewing changes to src/proc_axis.c

  • Committer: Bazaar Package Importer
  • Author(s): James W. Penny
  • Date: 2004-04-04 22:12:00 UTC
  • mfrom: (0.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040404221200-822i126bwkfgsfx6
Tags: 2.20-3
* Add "late fix" for errbarfields.  Fix found in
  http://groups.yahoo.com/group/ploticus/message/691.
  Solves a problem with asymetric error bands.
* Add "late fix" for proc_axis.c.  Fix found in
  http://groups.yahoo.com/group/ploticus/message/722
  This solves a problem with cumulative rounding of 
  days in graphs with days stubs.
* Add  "late fix" version of chunk_area.  Fix from
  http://ploticus.sourceforge.net/download/chunk_area
  This solves a problem with dates with no day number,
  as mm/yyyy.
* Add "late fix" version of heatarea.pl.  Fix from
  http://ploticus.sourceforge.net/download/heatmap.pl
* Add "late fix" version of proc_getdata.c.  Fix found at
  http://ploticus.sourceforge.net/download/proc_getdata.c
  This permits comma delimited files with more than 255 characters
  per row to be processed.
* Add "late fix" version of proc_lineplot.c.  This is from
  http://ploticus.sourceforge.net/download/proc_lineplot.c
  It clips labels, and handles the degenerate case of no points
  in the range properly.
* Add pltestsuite to debian package as 
  /usr/share/doc/ploticus/examples
* Remove recommends of libming-fonts-openoffice. The package has been
  removed from debian.                         closes: Bug#240560
  

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
int irow;
63
63
double ofsx, ofsy;
64
64
char stubomit[256];
65
 
int axslot;
66
65
int mon, day, yr;
67
66
 
68
67
int stubdf1, stubdf2, nstubdf;
101
100
double cmylast, cmemin, cmemax;
102
101
char cmemins[40], cmemaxs[40];
103
102
char cmvalfmt[80], cmtxt[100];
 
103
int logx, logy, stubexp;
 
104
int stublen;
 
105
char autodays[40], automonths[40];
 
106
char labelurl[256], labelinfo[256];
 
107
double stubmult;
 
108
double stubmininc;
 
109
char firststub[80], laststub[80];
 
110
char stubsubpat[80], stubsubnew[80];
104
111
 
105
112
TDH_errprog( "pl proc axis" );
106
113
 
125
132
mticin = 0;
126
133
mticout = 0.03;
127
134
strcpy( stubformat, "" );
128
 
strcpy( Bigbuf, "" );
 
135
strcpy( PL_bigbuf, "" );
129
136
strcpy( stubdetails, "" );
130
137
strcpy( axislabel, "" );
131
138
strcpy( axislabeldet, "" );
157
164
clickmap = 0;
158
165
strcpy( cmemins, "min" ); strcpy( cmemaxs, "max" );
159
166
strcpy( cmvalfmt, "" );
 
167
stubexp = 0; stublen = 0;
 
168
strcpy( autodays, "" ); strcpy( automonths, "" );
 
169
strcpy( labelurl, "" ); strcpy( labelinfo, "" );
 
170
stubmult = 1.0; stubmininc = 0.0;
 
171
strcpy( firststub, "" ); strcpy( laststub, "" );
 
172
strcpy( stubsubpat, "" ); strcpy( stubsubnew, "" );
160
173
 
161
174
 
162
175
/* get attributes.. */
176
189
                strcpy( axislabel, lineval );
177
190
                convertnl( axislabel );
178
191
                }
179
 
 
 
192
        else if( stricmp( &attr[astart], "labelurl" )==0 ) strcpy( labelurl, val );
 
193
        else if( stricmp( &attr[astart], "labelinfo" )==0 ) strcpy( labelinfo, lineval );
180
194
 
181
195
        else if( stricmp( &attr[astart], "stubs" )==0 || 
182
196
                 stricmp( &attr[astart], "selflocatingstubs" )==0 ) {
224
238
                        i = 0;
225
239
                        GL_getchunk( buf, lineval, &i, " \t" );
226
240
                        while( GL_member( lineval[i], " \t" ) ) i++;
227
 
                        strcpy( Bigbuf, &lineval[i] );
228
 
                        convertnl( Bigbuf );
 
241
                        strcpy( PL_bigbuf, &lineval[i] );
 
242
                        convertnl( PL_bigbuf );
229
243
                        }
230
244
                else if( stricmp( val, "none" )==0 ) isrc = 0;
231
245
                else    {
232
246
                        isrc = HERE;
233
247
                        if( stricmp( val, "text" ) == 0 ) {
234
 
                                getmultiline( "stubs", "", MAXBIGBUF, Bigbuf );
 
248
                                getmultiline( "stubs", "", MAXBIGBUF, PL_bigbuf );
235
249
                                }
236
250
                        else    {
237
 
                                fprintf( Errfp, 
 
251
                                fprintf( PLS.errfp, 
238
252
                                  "warning: proc axis assuming multiline stub text even though 'text' keyword not given\n" );
239
 
                                getmultiline( "stubs", lineval, MAXBIGBUF, Bigbuf );
 
253
                                getmultiline( "stubs", lineval, MAXBIGBUF, PL_bigbuf );
240
254
                                }
241
255
                        }
242
256
                }
264
278
 
265
279
        else if( stricmp( &attr[astart], "stubomit" )==0 ) strcpy( stubomit, lineval );
266
280
 
267
 
        else if( stricmp( &attr[astart], "stubslide" )==0 )  Elenex( val, xory, &stubslide );
268
 
                
 
281
        else if( stricmp( &attr[astart], "stubslide" )==0 ) Elenex( val, xory, &stubslide );
 
282
 
 
283
        else if( stricmp( &attr[astart], "stubexp" )==0 ) {
 
284
                if( strnicmp( val, YESANS, 1 )==0 ) stubexp = 1;
 
285
                else if( stricmp( val, "exp-1" )==0 ) stubexp = 2;
 
286
                else stubexp = 0;
 
287
                }
 
288
 
 
289
        else if( stricmp( &attr[astart], "stublen" )==0 ) stublen = atoi( val );
 
290
 
 
291
        else if( stricmp( &attr[astart], "stubmult" )==0 ) stubmult = atof( val );
 
292
 
 
293
        else if( stricmp( &attr[astart], "stubmininc" )==0 ) stubmininc = atof( val );
 
294
 
269
295
        else if( stricmp( &attr[astart], "ticslide" )==0 )  Elenex( val, xory, &ticslide );
270
296
 
271
297
        else if( stricmp( &attr[astart], "labeldetails" )==0 ) strcpy( axislabeldet, lineval );
272
298
 
273
299
        else if( stricmp( &attr[astart], "labeldistance" )==0 ) {
274
300
                axislabelofs = atof( val );
275
 
                if( Using_cm ) axislabelofs /= 2.54;
 
301
                if( PLS.usingcm ) axislabelofs /= 2.54;
276
302
                }
277
303
 
278
304
        else if( stricmp( &attr[astart], "location" )==0 ) {
303
329
 
304
330
        else if( stricmp( &attr[astart], "ticlen" )==0  ) {
305
331
                sscanf( lineval, "%lf %lf", &ticout, &ticin );
306
 
                if( Using_cm ) { ticout /= 2.54; ticin /= 2.54; }
 
332
                if( PLS.usingcm ) { ticout /= 2.54; ticin /= 2.54; }
307
333
                }
308
334
 
309
335
        else if( stricmp( &attr[astart], "minortics" )==0 ) {
318
344
        else if( stricmp( &attr[astart], "minorticlen" )==0 ||
319
345
                stricmp( attr, "minorticlen" )==0 ) {
320
346
                sscanf( lineval, "%lf %lf", &mticout, &mticin );
321
 
                if( Using_cm ) { mticout /= 2.54; mticin /= 2.54; }
 
347
                if( PLS.usingcm ) { mticout /= 2.54; mticin /= 2.54; }
322
348
                }
323
349
 
324
350
        else if( stricmp( &attr[astart], "grid" )==0 ) {
341
367
                else stubcull = 0.0;
342
368
                }
343
369
 
344
 
        else if( stricmp( &attr[astart], "autoyears" )==0 ) strcpy( autoyears, val );
 
370
        else if( stricmp( &attr[astart], "autoyears" )==0 ) {
 
371
                strcpy( autoyears, val );
 
372
                if( stricmp( autoyears, "yes" )==0 || stricmp( autoyears, "y" )==0 ) strcpy( autoyears, "'yy" );
 
373
                else if( stricmp( autoyears, "no" )==0 ) strcpy( autoyears, "" );
 
374
                }
 
375
 
 
376
        else if( stricmp( &attr[astart], "autodays" )==0 ) {
 
377
                strcpy( autodays, val );
 
378
                if( stricmp( autodays, "yes" )==0 || stricmp( autodays, "y" )==0 ) strcpy( autodays, "Mmmdd" );
 
379
                else if( stricmp( autodays, "no" )==0 ) strcpy( autodays, "" );
 
380
                }
 
381
 
 
382
        else if( stricmp( &attr[astart], "automonths" )==0 ) {
 
383
                strcpy( automonths, val );
 
384
                if( stricmp( automonths, "yes" )==0 || stricmp( automonths, "y" )==0 ) strcpy( automonths, "Mmm" );
 
385
                else if( stricmp( automonths, "no" )==0 ) strcpy( automonths, "" );
 
386
                }
 
387
 
 
388
 
345
389
        else if( stricmp( &attr[astart], "signreverse" )==0 ) {
346
390
                if( strnicmp( val, YESANS, 1 )==0 )revsign = 1;
347
391
                else revsign = 0;
348
392
                }
 
393
 
349
394
        else if( stricmp( &attr[astart], "stubevery" )==0 ) stubevery = atoi( val );
 
395
 
 
396
        else if( stricmp( &attr[astart], "firststub" )==0 ) {
 
397
                strcpy( firststub, lineval );
 
398
                if( strcmp( firststub, "\"\"" )==0 ) strcpy( firststub, " " );
 
399
                }
 
400
        else if( stricmp( &attr[astart], "laststub" )==0 ) {
 
401
                strcpy( laststub, lineval );
 
402
                if( strcmp( laststub, "\"\"" )==0 ) strcpy( laststub, " " );
 
403
                }
 
404
        else if( stricmp( &attr[astart], "stubsubpat" )==0 ) strcpy( stubsubpat, lineval );
 
405
        else if( stricmp( &attr[astart], "stubsubnew" )==0 ) {
 
406
                strcpy( stubsubnew, lineval );
 
407
                if( strcmp( stubsubnew, "\"\"" )==0 ) strcpy( stubsubnew, " " );
 
408
                }
 
409
 
350
410
        else if( stricmp( &attr[astart], "clickmap" )==0 ) {
351
411
                if( strnicmp( val, "xy", 2 )==0 ) {
352
412
                        if( xory == 'x' ) clickmap = 3;
377
437
if( stubevery == 0 ) stubevery = 1;
378
438
 
379
439
 
 
440
 
 
441
 
 
442
/* -------------------------- */
380
443
/* now do the plotting work.. */
381
444
/* -------------------------- */
 
445
 
382
446
Egetunits( xory, scaleunits );
383
447
 
384
448
/* do the label.. easier if we do it before the Eflip below.. */
385
449
if( axislabel[0] != '\0' ) {
386
 
        double labelofs;
 
450
        double xpos, ypos, txtsize;
387
451
        textdet( "labeldetails", axislabeldet, &align, &adjx, &adjy, 0, "R" );
 
452
        txtsize = (double)(strlen( axislabel )) * Ecurtextwidth;
388
453
 
389
454
        if( xory == 'x' ) {
390
 
                Emov( (EXlo+ (( EXhi - EXlo ) / 2.0 )) + adjx, (pos - axislabelofs) + adjy );
 
455
                xpos =  ( EXlo+ (( EXhi - EXlo ) / 2.0 )) + adjx;
 
456
                ypos = (pos - axislabelofs) + adjy;
 
457
                Emov( xpos, ypos );
391
458
                Ecentext( axislabel );
 
459
                if( PLS.clickmap && ( labelurl[0] != '\0' || labelinfo[0] != '\0' ) )
 
460
                        clickmap_entry( 'r', labelurl, 0, xpos - (txtsize/2.0), ypos, 
 
461
                                xpos + (txtsize/2.0), ypos+Ecurtextheight, 1, 0, labelinfo );
392
462
                }
393
463
        else if( xory == 'y' ) {
394
 
                labelofs = 0.4;
395
 
                Emov( (pos - axislabelofs) + adjx, (EYlo + (( EYhi-EYlo ) / 2.0 )) + adjy );
 
464
                xpos = (pos - axislabelofs) + adjx;
 
465
                ypos = (EYlo + (( EYhi-EYlo ) / 2.0 )) + adjy;
 
466
                Emov( xpos, ypos );
396
467
                Etextdir( 90 );
397
468
                Ecentext( axislabel );
398
469
                Etextdir( 0 );
 
470
                if( PLS.clickmap && ( labelurl[0] != '\0' || labelinfo[0] != '\0' ) )
 
471
                        clickmap_entry( 'r', labelurl, 0, xpos-Ecurtextheight, ypos - (txtsize*0.6), 
 
472
                                xpos, ypos + (txtsize*0.6), 0, 0, labelinfo );
399
473
                }
400
474
        }
401
475
 
404
478
 
405
479
 
406
480
 
 
481
/* --------------------- */
407
482
/* tics and axis preliminaries.. */
408
483
/* --------------------- */
409
484
 
412
487
specialunits = 0;
413
488
 
414
489
 
 
490
 
 
491
/* ----------------- */
415
492
/* helpful overrides */
416
493
/* ----------------- */
417
494
 
424
501
/* if doing Y axis with text stubs, and user didn't specify stubreverse: no, 
425
502
        reverse the stubs */
426
503
if( xory == 'y' && !stubreverse_given && stubreverse == 0 &&
427
 
        ( isrc == HERE || isrc == FROMFILE || isrc == FROMDATA ) ) {
 
504
        ( isrc == HERE || isrc == FROMFILE || isrc == FROMDATA ) && !selfloc ) {  /* && !selfloc added scg 3/19/03 */
428
505
        stubreverse = 1;
429
506
        if( !stubrangegiven ) stubstop = max - 1.0;
430
507
        }
431
508
 
 
509
 
432
510
if( stubformat[0] != '\0' && isrc == 0 )
433
511
        Eerr( 2749, "warning, stubformat but no stubs specification", "" );
434
512
 
445
523
        gbstate = 0;
446
524
        } 
447
525
 
448
 
if( Clickmap && clickmap ) {
 
526
if( PLS.clickmap && clickmap ) {
449
527
        Eposex( cmemins, opax, &cmemin ); 
450
528
        Eposex( cmemaxs, opax, &cmemax );
451
529
        Eposex( "min", xory, &cmylast );
460
538
                strcpy( minorticunits, "" );
461
539
                minorticinc = minorticinc * 60;
462
540
                }
463
 
        else if( stricmp( scaleunits, "datetime" )==0 && strnicmp( minorticunits, "hour", 4 ) ==0 ) {
 
541
        else if( stricmp( scaleunits, "datetime" )==0 && 
 
542
                (strnicmp( minorticunits, "hour", 4 ) ==0 || strnicmp( minorticunits, "minute", 3 )==0 )) {
 
543
                double winsize; /* window size in hours */
 
544
                DT_getwin( &winsize );
464
545
                strcpy( minorticunits, "" );
465
 
                minorticinc = minorticinc / 24.0;
 
546
                minorticinc = minorticinc / winsize;
 
547
                if( strnicmp( minorticunits, "minute", 3 )==0 ) minorticinc = minorticinc / 60.0;
466
548
                }
467
 
        else if( stricmp( scaleunits, "time" )==0 && strnicmp( minorticunits, "second", 4 ) ==0 ) {
 
549
        else if( stricmp( scaleunits, "time" )==0 && strnicmp( minorticunits, "second", 3 ) ==0 ) {
468
550
                strcpy( minorticunits, "" );
469
551
                minorticinc = minorticinc / 60.0;
470
552
                }
493
575
 
494
576
        
495
577
 
 
578
 
 
579
/* --------------------------------- */
496
580
/* preliminaries based on stubs type */
497
581
/* --------------------------------- */
498
582
 
499
 
if( isrc == HERE ) bigbuflen = strlen( Bigbuf );
 
583
if( isrc == HERE ) bigbuflen = strlen( PL_bigbuf );
500
584
 
501
 
if( isrc == FROMFILE ) {  /* if taking from file, read the file into Bigbuf */
 
585
if( isrc == FROMFILE ) {  /* if taking from file, read the file into PL_bigbuf */
502
586
        stubfp = fopen( filename, "r" );
503
587
        if( stubfp == NULL ) {
504
588
                Eerr( 303, "Cannot open specified stub file", filename );
507
591
        else    {
508
592
                i = 0;
509
593
                while( fgets( buf, 128, stubfp ) != NULL ) {
510
 
                        strcpy( &Bigbuf[i], buf );
 
594
                        strcpy( &PL_bigbuf[i], buf );
511
595
                        i += strlen( buf );
512
596
                        }
513
597
                fclose( stubfp );
523
607
                }
524
608
        }
525
609
 
526
 
if( isrc == FROMCATS ) {
527
 
        if( xory == 'x' ) axslot = 0;
528
 
        else axslot = 1;
529
 
        selfloc = 0;    /* for rendering purposes don't treat category stubs as self locating */
530
 
        }
 
610
if( isrc == FROMCATS ) selfloc = 0;     /* for rendering purposes don't treat category stubs as self locating */
531
611
 
532
612
 
533
613
if( isrc == 0 && (doingtics || doinggrid) ) {   /* no stubs but doing tics or doing grid */
540
620
        strcpy( incunits, "" );
541
621
        incamount = incamount * 60.0;
542
622
        }
543
 
else if( stricmp( scaleunits, "datetime" )==0 && strnicmp( incunits, "hour", 4 ) ==0 ) {
544
 
        strcpy( incunits, "" );
545
 
        incamount = incamount / 24.0;
546
 
        }
547
 
else if( stricmp( scaleunits, "time" )==0 && strnicmp( incunits, "second", 4 ) ==0 ) {
 
623
else if( stricmp( scaleunits, "datetime" )==0 && 
 
624
        ( strnicmp( incunits, "hour", 4 ) ==0 || strnicmp( incunits, "minute", 3 )==0 )) {
 
625
        double winsize; /* window size in hours */
 
626
        /* must be relative to window size.. */
 
627
        DT_getwin( &winsize );
 
628
        incamount = incamount / winsize;
 
629
        if( strnicmp( incunits, "minute", 3 )==0 ) incamount = incamount / 60.0;
 
630
        strcpy( incunits, "" );
 
631
        /* incamount = incamount / 24.0; */
 
632
        }
 
633
else if( stricmp( scaleunits, "datetime" )==0 && strnicmp( incunits, "minute", 3 ) ==0 ) {
 
634
        strcpy( incunits, "" );
 
635
        incamount = (incamount / 24.0) / 60.0;
 
636
        }
 
637
else if( stricmp( scaleunits, "time" )==0 && strnicmp( incunits, "second", 3 ) ==0 ) {
548
638
        strcpy( incunits, "" );
549
639
        incamount = incamount / 60.0;
550
640
        }
572
662
        if( strnicmp( incunits, "month", 5 )==0 ) {
573
663
                long l;
574
664
                if( ! GL_smember( scaleunits, "date" )) 
575
 
                        Eerr( 2476, "month increment only valid with date scale type", "" );
 
665
                        return( Eerr( 2476, "month increment only valid with date scale type", "" ) );
576
666
                specialunits = MONTHS;
577
667
                selfloc = 0; /* for rendering purposes don't treat month stubs as self locating.. */
578
668
                /* do the following to get starting m, d, y.. */
602
692
                        }
603
693
                else    {
604
694
                        /* try to be smart about choosing default inc */
605
 
                        defaultinc( min, max, &inc );
 
695
                        PL_defaultinc( min, max, &inc );
 
696
                        if( stubevery > 1 ) inc = inc * (double)stubevery;
 
697
                        if( inc < stubmininc ) inc = stubmininc;
606
698
                        }
607
699
                overrun = inc / 10.0;
608
700
                }
611
703
if( xory == 'x' ) setfloatvar( "XINC", inc );
612
704
else if( xory == 'y' ) setfloatvar( "YINC", inc );
613
705
 
 
706
/* log mode */
 
707
logx = logy = 0;
 
708
if( Escaletype_x == E_LOG || Escaletype_x == E_LOGPLUS1 ) logx = 1;
 
709
if( Escaletype_y == E_LOG || Escaletype_y == E_LOGPLUS1 ) logy = 1;
 
710
 
614
711
/* sanity check.. added scg 8/7/00 */
615
712
if( inc <= 0.0 ) return( Eerr( 2705, "axis increment is zero or negative", "" ));
616
713
 
 
714
 
 
715
 
 
716
 
 
717
 
 
718
/* ---------------------------------------------- */
617
719
/* render the stubs and/or tics and/or grid lines.. */
618
720
/* ---------------------------------------------- */
619
721
 
634
736
        if( isrc == INCREMENTAL ) {
635
737
 
636
738
                /* exception for log 0.0 */
637
 
                if( y <= 0.0 && ((xory == 'x' && (Escaletype_x == E_LOG || Escaletype_x == E_LOGPLUS1 ) ) ||
638
 
                                 (xory == 'y' && (Escaletype_y == E_LOG || Escaletype_y == E_LOGPLUS1 ) ) ) ) goto NEXTSTUB;
 
739
                if( y <= 0.0 && ((xory == 'x' && logx ) || (xory == 'y' && logy ) ) ) goto NEXTSTUB;
639
740
                 
640
741
                }
641
742
 
642
743
        if( isrc == INCREMENTAL ) {
643
 
                double yy, fabs(), ftest;
 
744
                double yy, fabs(), ftest, exp();
644
745
                if( revsign && fabs(y) > 0.0001 ) yy = y * -1;
645
746
                else yy = y;
 
747
                if( stubexp == 1 ) yy = exp( yy );
 
748
                else if( stubexp == 2 ) yy = exp( yy ) - 1;
 
749
 
 
750
                /* when generating incremental axes moving from negative to positive, for zero sprintf sometimes
 
751
                gives -0.00 or very tiny values like -5.5579e-17.  The following is a workaround.. scg 7/5/01 */
 
752
                /* moved here from Euprint() scg 10/1/03 */
 
753
                if( stubstart < 0.0 && stubstop > 0.0 && yy < 0.0000000000001 && yy > -0.0000000000001 ) yy = 0.0; 
 
754
 
 
755
                if( stubmult != 1.0 ) yy = yy * stubmult; /* added scg 10/2/03 */
 
756
 
646
757
                nt = sscanf( incunits, "%lf", &ftest );
647
758
                if( nt > 0 ) Euprint( txt, xory, yy/ftest, stubformat );
648
759
                else Euprint( txt, xory, yy, stubformat );
649
 
                if( Clickmap && clickmap ) Euprint( cmtxt, xory, yy, cmvalfmt );
 
760
                if( PLS.clickmap && clickmap ) Euprint( cmtxt, xory, yy, cmvalfmt );
650
761
                }
651
762
 
652
763
        if( isrc == HERE || isrc == FROMFILE ) {
653
764
                if( ibb >= bigbuflen ) break;
654
 
                GL_getseg( txt, Bigbuf, &ibb, "\n" );
655
 
                if( Clickmap && clickmap ) strcpy( cmtxt, txt );
 
765
                GL_getseg( txt, PL_bigbuf, &ibb, "\n" );
 
766
                if( PLS.clickmap && clickmap ) strcpy( cmtxt, txt );
656
767
                }
657
768
                
658
769
        if( isrc == FROMDATA ) {
659
 
                if( irow >= Nrecords[Dsel] ) break;
 
770
                if( irow >= Nrecords ) break;
660
771
                if( ( irow % stubevery ) != 0 ) { irow++; goto NEXTSTUB; }
661
772
                if( nstubdf == 1 )
662
773
                        sprintf( txt, "%s", da( irow, stubdf1 ) );
663
774
                else if( nstubdf == 2 ) 
664
775
                        sprintf( txt, "%s %s", da( irow, stubdf1 ), da( irow, stubdf2 ) );
665
 
                if( Clickmap && clickmap ) strcpy( cmtxt, txt );
 
776
                if( PLS.clickmap && clickmap ) strcpy( cmtxt, txt );
666
777
                irow++;
667
778
                }
668
779
 
669
780
        if( isrc == FROMCATS ) {
670
 
                if( irow >= Ncats[axslot] ) break;
 
781
                char *catp, *PL_getcat();
 
782
                catp = PL_getcat( xory, irow );
 
783
                if( catp == NULL ) break;  /* reached end of cat list */
671
784
                if( ( irow % stubevery ) != 0 ) { irow++; goto NEXTSTUB; }
672
 
                y = Econv( xory, Cats[axslot][irow] ); /* error checking not needed */
673
 
                strcpy( txt, Cats[axslot][irow] );
674
 
                if( Clickmap && clickmap ) strcpy( cmtxt, txt );
 
785
                y = Econv( xory, catp ); /* error checking not needed */
 
786
                strcpy( txt, catp );
 
787
                if( PLS.clickmap && clickmap ) strcpy( cmtxt, txt );
675
788
                irow++;
676
789
                }
677
790
 
682
795
                y = Econv( xory, buf );
683
796
                if( Econv_error() ) { 
684
797
                        Eerr( 9675, "warning, error on date conversion", buf );
685
 
                        goto NEXTSTUB;
 
798
                        break; /* goto NEXTSTUB; changed to avoid inf loop - scg 2/12/03 */
686
799
                        }
687
800
                if( day != 1 ) goto NEXTSTUB; /* added scg 9/12/01 */
688
801
                if( ( y - stubstop ) > overrun ) break;
689
802
                DT_formatdate( buf, stubformat, txt ); /* buf holds date string made above */
690
 
                if( Clickmap && clickmap ) DT_formatdate( buf, cmvalfmt, cmtxt ); /* buf holds date string made above */
 
803
                if( PLS.clickmap && clickmap ) DT_formatdate( buf, cmvalfmt, cmtxt ); /* buf holds date string made above */
 
804
                /* autoyears */
691
805
                if( autoyears[0] != '\0' && ( (firsttime && mon < 11) || mon == 1) ) { /* mon<11 added scg 9/12/01 */
692
 
                        firsttime = 0;
693
806
                        if( strlen( autoyears ) == 2 ) sprintf( buf, "%s\n%02d", txt, yr % 100 );
694
807
                        else if( strlen( autoyears ) == 3 ) sprintf( buf, "%s\n'%02d", txt, yr % 100 );
695
808
                        else    {
701
814
                        }
702
815
                }
703
816
 
 
817
        /* autodays */
 
818
        if( autodays[0] != '\0' ) {
 
819
                if( stricmp( scaleunits, "datetime" )!=0 ) Eerr( 9677, "warning, autodays is only valid with datetime scaling", "" );
 
820
                else    {
 
821
                        double datepart, timepart;
 
822
                        char dt[40];
 
823
                        datepart = floor( y );
 
824
                        timepart = y - datepart;
 
825
                        if( firsttime || fabs(timepart) < 0.000001 ) { /* render date  */
 
826
                                DT_fromjul( (long)datepart, dt );
 
827
                                DT_formatdate( dt, autodays, buf );
 
828
                                strcat( txt, "\n" );
 
829
                                strcat( txt, buf );
 
830
                                }
 
831
                        }
 
832
                }
 
833
 
 
834
        /* automonths - can be used w/ date or datetime.. */
 
835
        if( automonths[0] != '\0' ) {
 
836
                char dt[40];
 
837
                long foo;
 
838
                int imon, iday, iyr;
 
839
                DT_fromjul( (long) y, dt );
 
840
                DT_jdate( dt, &foo ); /* to get m d y */
 
841
                DT_getmdy( &imon, &iday, &iyr );
 
842
                if( firsttime || iday == 1 ) {
 
843
                        DT_formatdate( dt, automonths, buf );
 
844
                        strcat( txt, "\n" );
 
845
                        strcat( txt, buf );
 
846
                        }
 
847
                }
 
848
        
 
849
 
 
850
        /* last minute stub content overrides.. */
 
851
        if( stubsubpat[0] != '\0' && GL_wildcmp( txt, stubsubpat, strlen(stubsubpat), 0 )==0 ) strcpy( txt, stubsubnew );
 
852
        if( firststub[0] != '\0' && firsttime ) strcpy( txt, firststub );
 
853
        if( laststub[0] != '\0' && y+inc > stubstop ) strcpy( txt, laststub );
 
854
 
 
855
        firsttime = 0;
 
856
                
 
857
 
704
858
 
705
859
 
706
860
 
760
914
                        }
761
915
                }
762
916
 
763
 
        if( Clickmap && clickmap ) {    /* save region.. */
 
917
        if( PLS.clickmap && clickmap ) {    /* save region.. */
764
918
                double halfdown, halfup;
765
919
                if( specialunits == MONTHS ) { halfdown = halfup = ( Ea( Y, y ) - cmylast ) / 2.0; }
766
920
                else    {
771
925
                        }
772
926
 
773
927
                if( Eflip ) {
774
 
                        mapentry( 'r', cmtxt, clickmap, (Ea(Y,y)-halfdown)+stubslide, cmemin, 
775
 
                                Ea(Y,y)+halfup+stubslide, cmemax, 0, 1 );
 
928
                        clickmap_entry( 'r', cmtxt, clickmap, (Ea(Y,y)-halfdown)+stubslide, cmemin, 
 
929
                                Ea(Y,y)+halfup+stubslide, cmemax, 0, 1, "" );
776
930
                        }
777
931
                else    {
778
 
                        mapentry( 'r', cmtxt, clickmap, cmemin, (Ea(Y,y)-halfdown)+stubslide, 
779
 
                                cmemax, Ea(Y,y)+halfup+stubslide, 0, 2 );
 
932
                        clickmap_entry( 'r', cmtxt, clickmap, cmemin, (Ea(Y,y)-halfdown)+stubslide, 
 
933
                                cmemax, Ea(Y,y)+halfup+stubslide, 0, 2, "" );
780
934
                        }
781
935
                cmylast = Ea( Y, y );
782
936
                }
807
961
                /* render text..   but don't do last stub if it is past range.. */
808
962
                if( ( (Ea(Y, y)+ofsy)  - Ea(Y, stubstop ) <= overrun ) || stubreverse ) {  
809
963
                        Emov( pos+ofsx, Ea( Y, y)+ofsy ); 
 
964
                        if( stublen && txt[stublen] != '\0' ) { txt[stublen] = '.'; txt[stublen+1] = '.'; txt[stublen+2] = '\0'; }
810
965
                        Edotext( txt, align );
811
966
                        }
812
967
                }
813
968
 
814
969
 
 
970
 
815
971
        /* render major tic mark  */
816
972
        if( doingtics ) {
817
973
                linedet( "tics", tics, 0.5 );