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 )