Loading ...
Sorry, an error occurred while loading the content.
 

proc bars: bug + fix

Expand Messages
  • Tsafrir Dan
    hi -the attached script produces an erroneous graph (the command line I used was: pl 2.pcus -cm -eps). -the problem is in `select ing the rows: pl displays
    Message 1 of 1 , Aug 14, 2001
      hi

      -the attached script produces an erroneous graph (the
      command line I used was: pl 2.pcus -cm -eps).

      -the problem is in `select'ing the rows: pl displays values
      that are not selected.

      -this code - bars.c[401]:
      for( i = 0; i < Nrecords[Dsel]; i++ ) {
      if( strlen( selectex ) > 0 ) {
      /* process against selection condition if any.. */
      stat = do_select( selectex, i, &result );
      if( stat != 0 ) {
      Eerr( stat, "Select error", selectex ); continue;
      }
      if( result == 0 ) continue; /* reject */
      }
      indeed ignores the correct lines.

      -however, this code - bars.c[565]:
      if( showvals || labelfld >= 0 ) {
      /* print values.. a lot of code replicated from above loop.. */
      textdet( "labeldetails", labeldetails, &align, &adjx, &adjy, -3, "R" );
      if( adjy == 0.0 ) adjy = 0.02;
      if( align == '?' ) align = 'C';
      for( i = 0; i < Nrecords[Dsel]; i++ ) {
      // do it ...
      does not.

      ---------------------------------------------------------

      -my fix was:

      // a global var:
      static int dont_include[MAXDSEL];

      // ...

      // bars.c[401]:
      for( i = 0; i < Nrecords[Dsel]; i++ ) {
      if( strlen( selectex ) > 0 ) {
      stat = do_select( selectex, i, &result );
      if( stat != 0 ) {
      Eerr( stat, "Select error", selectex ); continue;
      }
      dont_include[i] = ( result == 0 ); // THE CHANGE
      if( dont_include[i] ) continue;
      }

      // ...

      // bars.c[565]:
      if( showvals || labelfld >= 0 ) {
      textdet( "labeldetails", labeldetails, &align, &adjx, &adjy, -3, "R" );
      if( adjy == 0.0 ) adjy = 0.02;
      if( align == '?' ) align = 'C';
      for( i = 0; i < Nrecords[Dsel]; i++ ) {
      if( dont_include[i] ) // THE CHANGE
      continue;


      it wroked for me.
      best regards,

      --dan
    Your message has been successfully submitted and would be delivered to recipients shortly.