impresión de gráfica

HMG en Español

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: impresión de gráfica

Post 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.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

impresión de gráfica

Post 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. ;)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: impresión de gráfica

Post by Javier Tovar »

Gracias Pablo César por compartir!

Saludos
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: impresión de gráfica

Post by andyglezl »

Gracias Pablo Cesar ! lo probaremos.
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
Renegado
Posts: 88
Joined: Tue Mar 11, 2014 11:59 pm

Re: impresión de gráfica

Post by Renegado »

Gracias Pablo Cesar. Cada día aprendo mas.
Post Reply