GRAPHPRN

GRAPHPRN

Postby Marco Augusto » Fri Oct 28, 2022 1:00 am

Saludos

haciendo pruebas con la nueva funcionalidad de impresión directa de graficas

compilo el programa graphprn.prg

si utilizo el tipo de grafica PIE me manda error

Code: Select all  Expand view  RUN
function Main()

   local oGraph, oPrn, aTable, cRegion

   CreateDBF()

   USE GRAFDATA NEW VIA "DBFCDX"
   SET ORDER TO TAG MAIN
   GO TOP

   DEFINE GRAPH oGraph SIZE 250, 200 TYPE GRAPH_TYPE_PIE ;
      YVALUES XGRID YGRID XVALUES LEGENDS

   WITH OBJECT oGraph
      :aSeries = { { "DeskTop", METRO_AMBER  }, ;
                   { "Lap-Top", METRO_OLIVE  }, ;
                   { "Printer", CLR_HMAGENTA } }
      :aYVals = { "Jan", "Feb", "Mar", "Apr", "May" }
      :lViewSRLegend = .T.
      :cTitle := "ABC COMPANY"
   END

   PRINT oPrn PREVIEW

   for each cRegion in { "NORTH", "SOUTH" }

      oGraph:aData   := FW_DbfToArray( "JAN,FEB,MAR,APR,MAY", { || FIELD->REGION = cRegion } )
      oGraph:cTitle  := "ABC COMPANY, " + cRegion + " REGION"

      PAGE

      @ 1, 1   PRINT TO oPrn GRAPH oGraph SIZE 5,4 INCHES
      @ 5, 1   PRINT TO oPrn TABLE oGraph:aTable SIZE 5, 2 INCHES
      @ 7, 1.5 PRINT TO oPrn CHART oGraph:aTable SIZE 4, 3 INCHES

      ENDPAGE

   next

   ENDPRINT

   oGraph:End()
   CLOSE DATA

return nil

//----------------------------------------------------------------------------//

static function CreateDBF()

   field REGION, PRODUCT

   local aData := ;
   {  { "NORTH", "DeskTop", 14280, 20420, 12870, 25347,  7640 } ;
   ,  { "NORTH", "Lap-Top",  8350, 10315, 15870,  5347, 12340 } ;
   ,  { "NORTH", "Printer", 12345,  8945, 10560, 15600, 17610 } ;
   ,  { "SOUTH", "DeskTop", 12345,  8945, 10560, 15600, 17610 } ;
   ,  { "SOUTH", "Lap-Top", 14280, 20420, 12870, 25347,  7640 } ;
   ,  { "SOUTH", "Printer",  8350, 10315, 15870,  5347, 12340 } ;
   }

   DBCREATE( "GRAFDATA", { { "REGION", "C", 5, 0 }, { "PRODUCT", "C", 7, 0 }, ;
      { "JAN", "N", 5, 0 }, { "FEB", "N", 5, 0 }, { "MAR", "N", 5, 0 }, ;
      { "APR", "N", 5, 0 }, { "MAY", "N", 5, 0 } }, "DBFCDX", .T., "DATA" )

  FW_ArrayToDBF( aData )

  GO TOP
  INDEX ON REGION+PRODUCT TAG MAIN
  CLOSE DATA

return nil

//----------------------------------------------------------------------------//
 


Error description: Error BASE/1004 Class: 'NIL' has no exported method: GETDC
Args:
[ 1] = U

Stack Calls
===========
Called from: => GETDC( 0 )
Called from: .\source\classes\TGRAPH.PRG => TGRAPH:DRAWPIE( 2194 )
Called from: .\source\classes\TGRAPH.PRG => TGRAPH:PAINT( 970 )
Called from: .\source\classes\TGRAPH.PRG => TGRAPH:PRINT( 2355 )
Called from: .\source\classes\PRINTER.PRG => TPRINTER:PRINTGRAPH( 1286 )
Called from: GP3.prg => MAIN( 44 )
Marco Augusto Rodriguez Manzo
FWH January 2020 Xharbour 1.2.3
MySQL 5.0.19 Fastreport

PERZO SOFT
Sistemas Personalizados
User avatar
Marco Augusto
 
Posts: 144
Joined: Wed Oct 12, 2005 1:03 pm
Location: Cuernacava, Morelos Mexico

Re: GRAPHPRN

Postby nageswaragunupudi » Tue Nov 08, 2022 4:45 am

We are sorry. There is a bug in TGraph.prg while printing PIE chart directly to printer. Painting on screen works well.

We suggest the fix here. You may apply this fix to tgraph.prg.

Line 2194 in the Method DrawPie() of TGraph.prg:
Existing code:
Code: Select all  Expand view  RUN
hMemCDC := ::oWnd:GetDC()


Substitute with this revised code:
Code: Select all  Expand view  RUN
hMemCDC := If( ::oWnd == nil, GetDC( 0 ), ::oWnd:GetDC() )


Next, go to line 2198.
Existing code:
Code: Select all  Expand view  RUN
::oWnd:ReleaseDC()


Substitute with this revised code:
Code: Select all  Expand view  RUN
if ::oWnd == nil; ReleaseDC( 0, hMemCDC ); else; ::oWnd:ReleaseDC(); endif


With this change your program works.
We would be glad if you apply the fix and confirm its working.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: GRAPHPRN

Postby Marco Augusto » Tue Nov 08, 2022 8:38 pm

gracias
sí funcionó!
Marco Augusto Rodriguez Manzo
FWH January 2020 Xharbour 1.2.3
MySQL 5.0.19 Fastreport

PERZO SOFT
Sistemas Personalizados
User avatar
Marco Augusto
 
Posts: 144
Joined: Wed Oct 12, 2005 1:03 pm
Location: Cuernacava, Morelos Mexico

Re: GRAPHPRN

Postby nageswaragunupudi » Wed Nov 09, 2022 12:00 am

Thanks for your confirmation.
This fix is included for the next release.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 107 guests