Page 2 of 2

Re: impresión de gráfica

Posted: Mon Nov 24, 2014 12:28 pm
by Pablo César
Renegado, si quieres imprimir de tamaño menor, en HMG tendrás que alterar el tamaño del GRAPH cuando lo defines. De lo contrário tu solucion es válida tambien.

Fijate este ejemplo en HMG:

Code: Select all

#include <hmg.ch>

Function Main
Define window m at 0,0 width 800 height 600 main On Init ShowPie() backcolor { 255,255,255}

	define button x
		row 10
		col 10
		caption "Draw"
		action showpie()
	end button

	Define Button Button_1
		Row	10
		Col	150
		Caption	'Print'
		Action PRINT GRAPH OF m PREVIEW
	End Button

End window
m.center
m.activate
Return Nil

Function ShowPie
ERASE WINDOW m
DRAW GRAPH IN WINDOW m AT 100,100;
      TO 300,400 ;
      TITLE "Sales" ;
      TYPE PIE;
      SERIES {1500,1800,200,500,800};
		DEPTH 25;
		SERIENAMES {"Product 1","Product 2","Product 3","Product 4","Product 5"};
		COLORS {{255,0,0},{0,0,255},{255,255,0},{0,255,0},{255,128,64},{128,0,128}};
		3DVIEW;
		SHOWXVALUES; 
		SHOWLEGENDS NOBORDER

Return Nil
Vá a imprimir de acuerdo el GRAPH DEFINE.

impresión de gráfica

Posted: Mon Nov 24, 2014 1:20 pm
by Pablo César
Como habia dicho en mi primer mensaje de este tópico. Si hubiera como cambiar las coordenadas del gráfico.
Y fué lo que encontré !
Es decir podemos alterar-los antes del comando PRINT GRAPH

Code: Select all

#include <hmg.ch>

Function Main
Define window m at 0,0 width 800 height 600 main On Init ShowPie() backcolor { 255,255,255}

	define button x
		row 10
		col 10
		caption "Draw"
		action showpie()
	end button

	Define Button Button_1
		Row	10
		Col	150
		Caption	'Print'
		Action MyGraphPrint()
	End Button

End window
m.center
m.activate
Return Nil

Function ShowPie
ERASE WINDOW m
DRAW GRAPH IN WINDOW m AT 100,100;
      TO 400,500 ;
      TITLE "Sales" ;
      TYPE PIE;
      SERIES {1500,1800,200,500,800};
		DEPTH 25;
		SERIENAMES {"Product 1","Product 2","Product 3","Product 4","Product 5"};
		COLORS {{255,0,0},{0,0,255},{255,255,0},{0,255,0},{255,128,64},{128,0,128}};
		3DVIEW;
		SHOWXVALUES; 
		SHOWLEGENDS NOBORDER

Return Nil

Function MyGraphPrint()
_HMG_SYSDATA [ 108 ] [ GetFormIndex ( "m" ) ] := {80,100,800,1000}
PRINT GRAPH OF m PREVIEW
Return Nil
De esta forma podemos tener el gráfico de un tamaño y la impresion de otro. ;)

Re: impresión de gráfica

Posted: Mon Nov 24, 2014 4:34 pm
by Javier Tovar
Gracias Pablo César por compartir!

Saludos

Re: impresión de gráfica

Posted: Mon Nov 24, 2014 5:41 pm
by andyglezl
Gracias Pablo Cesar ! lo probaremos.

Re: impresión de gráfica

Posted: Wed Nov 26, 2014 1:37 am
by Renegado
Gracias Pablo Cesar. Cada día aprendo mas.