Clipper On Line • Ver Tópico - Image / handle de image

Image / handle de image

Projeto MiniGui - Biblioteca visual para Harbour/xHarbour

Moderador: Moderadores

 

Image / handle de image

Mensagempor JoséQuintas » 22 Abr 2017 10:15

Estou tentando usar o imagem pro gráfico do rmchart, mas não dá certo obter o handle.
É obrigatório ter imagem no controle imagem?
Ou não dá pra acessar o handle do controle imagem?

MEMVAR Button1, Button2, Button3, Button4, Button5, Button6, Button7, Button8, Button9, image1

PROCEDURE Main

   LOCAL oElement, cNumButton
   LOCAL oButtonList := { ;
      { "Chart1", { || Chart1( ThisWindow.Handle ) } }, ;
      { "Print",  { || PrintChart( Image1.Handle ) } }, ; /// <== aqui erro na compilação GetProperty( "image1", "handle" ) não deu certo
      { "Close",  { || EndWindow() } } }

   PRIVATE image1, button1, button2, button3, button4, button5, button6, button7, button8, button9, image1

   oRMChart := RMChart():New()

   SET FONT TO "Times New Roman" , 10

   DEFINE WINDOW Win_1 ;
      AT 0,0 ;
      WIDTH 680 ;
      HEIGHT 550 ;
      TITLE APP_TITLE ;
      ICON "demo.ico" ;
      MAIN ;
      NOMAXIMIZE NOSIZE ;
      ON INTERACTIVECLOSE iif( MsgYesNo( "Really want to quit ?", "Exit" ), EndWindow( .F. ), .F. )

      FOR EACH oElement IN oButtonList
         cButtonName := "button" + Str( oElement:__EnumIndex, 1 )
         @ oElement:__EnumIndex * 50, 10 BUTTON &cButtonName ;
            CAPTION oElement[ 1 ] ;
            ACTION  Eval( oElement[ 2 ] ) ;
            WIDTH 150 HEIGHT 30 DEFAULT
      NEXT

      @ 5, 200 IMAGE Image1 ;
         PICTURE NIL ;
         WIDTH 470 ;
         HEIGHT 540

   END WINDOW
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18157
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1215 vezes

Image / handle de image

Mensagempor JoséQuintas » 22 Abr 2017 10:19

Ou usar outro controle, ou até mesmo uma janela dentro da outra através de SetParent(), o que vai necessitar ajustar coordenadas.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18157
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1215 vezes

Image / handle de image

Mensagempor Claudio Soto » 22 Abr 2017 11:16

José, los habdles Gui son iguales a los de los archivos sólo son válidos después de abiertos, en el caso de las imágenes los habdles se crean cuando se carga la imagen, y si en un mismo control se cargan X cantidad de imágenes van a existir X cantidad de habdles.
Por ejemplo.
Form_1.Image_1.Picture := "foto1"
Handle1 := Form_1.Image_1.Handle

Form_1.Image_1.Picture := "foto2"
Handle2 := Form_1.Image_1.Handle

Acá Handle1 ya no es válido porque fue cerrado antes de cargar foto2

Form_1.Image_1.Picture:= ""
Acá ni Handle1 ni Handle2 son válidos y Form_1.Image_1.Handle es 0 porque no hay ninguna imagen cargada.
Saludos.
Dr. Claudio Soto
(Uruguay)
http://srvet.blogspot.com
Avatar de usuário

Claudio Soto
Colaborador

Colaborador
 
Mensagens: 555
Data de registro: 27 Ago 2012 12:31
Cidade/Estado: Uruguay
Curtiu: 35 vezes
Mens.Curtidas: 166 vezes

Image / handle de image

Mensagempor JoséQuintas » 22 Abr 2017 11:30

E além disso, na declaração de variáveis, ainda não existem as variáveis pra construir o codeblock.
Movi oButtonList pra depois da criação das variáveis, senão nem a referência de main funcionava..

Resolvi com o mesmo quebra galho dos exemplos, colocando os botões embaixo.
E descobri que o exemplo 2 dá erro, mas como o teste era outro, não verifiquei qual é o problema dele.

Juntei todos os exemplos de RMChart.
Não é problema juntar exemplos, porque cada gráfico tem sua própria rotina.
É bom pra já descobrir o GPF que ocorre, caso faça errado, e talvez por isso não juntaram antes.
Só usar RMChart:Reset() no final dos gráficos.

Facilitei os botões usando a mesma técnica que uso na GTWVG, que também usei na HWGUI, e deu certo na HMG mas exigiu um Eval() a mais.

Os exemplos estão em samples\advanced\rmchart_dll_2 (HMG Extended)

Nessa pasta tem este fonte, Não tinha visto antes.... rs
* RmChart Class
* Author: Jose M. C. Quintas


Agora tudo junto:

/*
* MINIGUI - Harbour Win32 GUI library Demo
*
* Copyright 2016 Grigory Filatov <gfilatov@inbox.ru>
*
*/

ANNOUNCE RDDSYS

#include "minigui.ch"
#include "rmchart.ch"

#define RMC_USERWM         ""               // Your watermark
#define RMC_USERWMCOLOR    COLOR_BLACK      // Color for the watermark
#define RMC_USERWMLUCENT   30               // Lucent factor between 1(=not visible) and 255(=opaque)
#define RMC_USERWMALIGN    RMC_TEXTCENTER   // Alignment for the watermark
#define RMC_USERFONTSIZE   0                // Fontsize; if 0: maximal size is used

#define APP_TITLE "Example 9 RMCHART"

#define ID_CHART   1001
#define ID_CHART_2 1002

STATIC oRMChart, lDraw := .F.
MEMVAR Button1, Button2, Button3, Button4, Button5, Button6, Button7, Button8, Button9, Button10, Button11, image1, Win1, nNumChart

SET PROCEDURE TO rmchart.prg

PROCEDURE Main

   LOCAL oElement, cNumButton
   LOCAL oButtonList
   PRIVATE image1, button1, button2, button3, button4, button5, button6, button7, button8, button9, button10, button11, image1, Win1, nNumChart := 0

   oButtonList := { ;
      { "Chart1", { || nNumChart := 1, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart2", { || nNumChart := 2, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart3", { || nNumChart := 3, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart4", { || nNumChart := 4, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart5", { || nNumChart := 5, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart6", { || nNumChart := 6, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart7", { || nNumChart := 7, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart8", { || nNumChart := 8, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart9", { || nNumChart := 9, DrawChart( ThisWindow.Handle ) } }, ;
      { "Print",  { || PrintChart( ThisWindow.Handle ) } }, ;
      { "Close",  { || EndWindow() } } }
   oRMChart := RMChart():New()

   SET FONT TO "Times New Roman" , 10

   DEFINE WINDOW Win1 ;
      AT 0,0 ;
      WIDTH 680 ;
      HEIGHT 550 ;
      TITLE APP_TITLE ;
      ICON "demo.ico" ;
      MAIN ;
      NOMAXIMIZE NOSIZE ;
      ON INTERACTIVECLOSE iif( MsgYesNo( "Really want to quit ?", "Exit" ), EndWindow( .F. ), .F. )

      FOR EACH oElement IN oButtonList
         cButtonName := "button" + Ltrim( Str( oElement:__EnumIndex, 2 ) )
         @ 470, 62 * ( oElement:__EnumIndex - 1 ) + 5 BUTTON &cButtonName ;
            CAPTION oElement[ 1 ] ;
            ACTION  Eval( oElement[ 2 ] ) ;
            WIDTH 60 HEIGHT 30 DEFAULT
      NEXT

      @ 5, 200 IMAGE Image1 ;
         PICTURE NIL ;
         WIDTH 470 ;
         HEIGHT 540

   END WINDOW

   CENTER WINDOW Win1
   ACTIVATE WINDOW Win1

   RETURN

#define RMC_PORTRAIT  1
#define RMC_LANDSCAPE 2

PROCEDURE PrintChart( hWnd )

   IF nNumChart < 1
      RETURN
   ENDIF
   DrawChart( hWnd, .T. )

   IF CallDll( "RMC_DRAW2PRINTER", "RMCHART.DLL", ID_CHART, RMC_LANDSCAPE, 10, 10, 220, 150, RMC_EMFPLUS ) < 0

      MsgStop( "Print error!" )

   ENDIF
   oRMChart:Reset( ID_CHART )
   RETURN

PROCEDURE endwindow( lClose )

   hb_Default( @lClose, .T. )

   IF lClose
       Win1.Release
       oRMChart:Destroy()
   ENDIF

   RETURN

PROCEDURE DrawChart( hWnd, lExportOnly )

   hb_Default( @lExportOnly, .F. )
   DO CASE
   CASE nNumChart == 1 ; Graphic1( hWnd, oRMChart, iif( lExportOnly, ID_CHAR_2, ID_CHART ), lExportOnly )
   CASE nNumChart == 2 ; Graphic2( hWnd, oRMChart, iif( lExportOnly, ID_CHAR_2, ID_CHART ), lExportOnly )
   CASE nNumChart == 3 ; Graphic3( hWnd, oRMChart, iif( lExportOnly, ID_CHAR_2, ID_CHART ), lExportOnly )
   CASE nNumChart == 4 ; Graphic4( hWnd, oRMChart, iif( lExportOnly, ID_CHAR_2, ID_CHART ), lExportOnly )
   CASE nNumChart == 5 ; Graphic5( hWnd, oRMChart, iif( lExportOnly, ID_CHAR_2, ID_CHART ), lExportOnly )
   CASE nNumChart == 6 ; Graphic6( hWnd, oRMChart, iif( lExportOnly, ID_CHAR_2, ID_CHART ), lExportOnly )
   CASE nNumChart == 7 ; Graphic7( hWnd, oRMChart, iif( lExportOnly, ID_CHAR_2, ID_CHART ), lExportOnly )
   CASE nNumChart == 8 ; Graphic8( hWnd, oRMChart, iif( lExportOnly, ID_CHAR_2, ID_CHART ), lExportOnly )
   CASE nNumChart == 9 ; Graphic9( hWnd, oRMChart, iif( lExportOnly, ID_CHAR_2, ID_CHART ), lExportOnly )
   ENDCASE
   oRMChart:Draw( ID_CHART )
   oRMChart:Reset( ID_CHART )

   RETURN

FUNCTION Graphic1( hWnd, oRMChart, nIdChart, nExportOnly, nW, nH )

   LOCAL cLegenda, cLabels, cTitulo, aDados, cUnidade, cTextoVert, nMax, oElement, nCont

   DEFAULT nExportOnly TO 0, nW TO 650, nH TO 450

   cLegenda   := "Entradas*Saidas*Mais Um"
   cLabels    := "Janeiro*Fevereiro*Março*Abril*Maio*Junho*Julho*Agosto*Setembro*Outubro*Novembro*Dezembro"
   cTitulo    := "Gráfico de Teste"
   aDados     := { ;
                 { 225.25, 100.00, 100.00, 150.00, 250.00, 300.00, 25.00, 75.00, 300.00, 200.00, 325.00, 300.00 }, ;
                 { 220.00, 100.00, 125.00, 300.00, 150.00, 125.00, 85.00, 50.00, 285.00, 275.00, 295.00, 280.00 }, ;
                 { 125.25, 100.00, 100.00, 150.00, 250.00, 300.00, 25.00, 75.00, 300.00, 200.00, 325.00, 300.00 } }
   cUnidade   := "R$ "
   cTextoVert := ""
   nMax       := 0

   FOR EACH oElement IN aDados
      nMax := Max( nMax, aMax( oElement ) )
   NEXT

   nMax := Round( ( Int( nMax / 10 ) * 10 ) + 10, 2 )

   oRMChart:CreateChart( hWnd, nIdChart, 10, 10, nW, nH, COLOR_AZURE, RMC_CTRLSTYLE3DLIGHT, nExportOnly, "", "", 0, 0 )
   oRMChart:AddRegion( nIdChart, 0, 0, nW, nH, "RmChart", .F. )
   oRMChart:AddCaption( nIdChart, 1, cTitulo, COLOR_TRANSPARENT, COLOR_RED, 9, .T. )
   oRMChart:AddGrid( nIdChart, 1, COLOR_LIGHT_BLUE, .F., 20, 20, nW - 100, nH - 100, RMC_BICOLOR_LABELAXIS )
   oRMChart:AddLabelAxis( nIdChart, 1, cLabels, 1, Len( aDados[ 1 ] ), RMC_LABELAXISBOTTOM, 8, COLOR_BLACK, RMC_TEXTCENTER, COLOR_BLACK, RMC_LINESTYLENONE, "" )
   oRMChart:AddDataAxis( nIdChart, 1, RMC_DATAAXISRIGHT, 0.0, nMax, Len( aDados[ 1 ] ), 8, COLOR_BLACK, COLOR_BLACK, RMC_LINESTYLESOLID, 1, cUnidade, cTextoVert, "", RMC_TEXTCENTER )
   oRMChart:AddLegend( nIdChart, 1, cLegenda, RMC_LEGEND_BOTTOM, COLOR_TRANSPARENT, RMC_LEGENDNORECT, COLOR_RED, 8, .T. )

   FOR nCont = 1 TO Len( aDados )
      oRMChart:AddBarSeries( nIdChart, 1, aDados[ nCont ], 12, RMC_BARGROUP, RMC_BAR_FLAT_GRADIENT2, .F., 0, .F., 1, RMC_VLABEL_NONE, nCont, RMC_HATCHBRUSH_ONPRINTING )
   NEXT

   RETURN NIL

FUNCTION Graphic2( hWnd, oRMChart, nIdChart, nExportOnly, nW, nH )

   LOCAL sTemp, aData

   DEFAULT nExportOnly TO 0, nW TO 700, nH TO 500

   IF .T. // Need solve a problem before to use
      RETURN NIL
   ENDIF
   //************** Create the chart **********************
   oRMChart:CreateChart(hWnd, nIdChart, 10, 10, nW, nH, COLOR_ALICE_BLUE, RMC_CTRLSTYLEFLATSHADOW, nExportOnly, "", "Tahoma", 0, COLOR_DEFAULT)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Region 1 *****************************
   oRMChart:AddRegion(nIdChart,2,2,348,248,"",FALSE)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add grid to region 1 *****************************
   oRMChart:AddGrid(nIdChart,1,COLOR_BEIGE,FALSE,0,0,0,0,RMC_BICOLOR_NONE)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add data axis to region 1 *****************************
   oRMChart:AddDataAxis(nIdChart,1,RMC_DATAAXISLEFT,0,100,11,8,COLOR_BLACK,COLOR_BLACK,RMC_LINESTYLESOLID,0,"","","",RMC_TEXTCENTER)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add label axis to region 1 *****************************
   sTemp := "Label 1*Label 2*Label 3*Label 4*Label 5"
   oRMChart:AddLabelAxis(nIdChart,1, sTemp,1,5,RMC_LABELAXISBOTTOM,8,COLOR_BLACK,RMC_TEXTCENTER,COLOR_BLACK,RMC_LINESTYLESOLID,"")
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Series 1 to region 1 *******************************
   //****** Read data values ******
   aData := Array(5)
   aData[1] := 30 ; aData[2] := 40 ; aData[3] := 70 ; aData[4] = 60 ; aData[5] := 20
   oRMChart:AddBarSeries(nIdChart,1,aData, 5,RMC_BARSINGLE,RMC_BAR_3D,FALSE,COLOR_DEFAULT,FALSE,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Region 2 *****************************
   oRMChart:AddRegion(nIdChart,352,2,-2,248,"",FALSE)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add grid to region 2 *****************************
   oRMChart:AddGrid(nIdChart,2,COLOR_BEIGE,FALSE,0,0,0,0,RMC_BICOLOR_NONE)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add data axis to region 2 *****************************
   oRMChart:AddDataAxis(nIdChart,2,RMC_DATAAXISBOTTOM,0,100,11,8,COLOR_BLACK,COLOR_BLACK,RMC_LINESTYLESOLID,0,"","","",RMC_TEXTCENTER)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add label axis to region 2 *****************************
   sTemp := "Label 1*Label 2*Label 3*Label 4*Label 5"
   oRMChart:AddLabelAxis(nIdChart,2, sTemp,1,5,RMC_LABELAXISLEFT,8,COLOR_BLACK,RMC_TEXTCENTER,COLOR_BLACK,RMC_LINESTYLESOLID,"")
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Series 1 to region 2 *******************************
   //****** Read data values ******
   aData[1] := 20 ; aData[2] := 10 ; aData[3] := 15 ; aData[4] := 25 ; aData[5] := 30
   oRMChart:AddBarSeries(nIdChart,2,aData, 5,RMC_BARSTACKED,RMC_COLUMN_FLAT,FALSE,COLOR_DEFAULT,TRUE,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Series 2 to region 2 *******************************
   //****** Read data values ******
   aData[1] := 25 ; aData[2] := 30 ; aData[3] := 10 ; aData[4] := 20 ; aData[5] := 15
   oRMChart:AddBarSeries(nIdChart,2,aData, 5,RMC_BARSTACKED,RMC_COLUMN_FLAT,FALSE,COLOR_DEFAULT,TRUE,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Series 3 to region 2 *******************************
   //****** Read data values ******
   aData[1] := 10 ; aData[2] := 20 ; aData[3] := 40 ; aData[4] := 20 ; aData[5] := 30
   oRMChart:AddBarSeries(nIdChart,2,aData, 5,RMC_BARSTACKED,RMC_COLUMN_FLAT,FALSE,COLOR_DEFAULT,TRUE,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Series 4 to region 2 *******************************
   //****** Read data values ******
   aData[1] := 40 ; aData[2] := 30 ; aData[3] := 20 ; aData[4] := 30 ; aData[5] := 20
   oRMChart:AddBarSeries(nIdChart,2,aData, 5,RMC_BARSTACKED,RMC_COLUMN_FLAT,FALSE,COLOR_DEFAULT,TRUE,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Region 3 *****************************
   oRMChart:AddRegion(nIdChart,2,252,348,-2,"",FALSE)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Series 1 to region 3 *******************************
   //****** Read data values ******
   aData[1] := 30 ; aData[2] := 50 ; aData[3] := 20 ; aData[4] := 40 ; aData[5] := 60
   oRMChart:AddGridlessSeries(nIdChart,3, aData, 5,0,0,RMC_PIE_3D_GRADIENT,RMC_FULL,2,FALSE,RMC_VLABEL_DEFAULT,RMC_HATCHBRUSH_OFF, 0)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Region 4 *****************************
   oRMChart:AddRegion(nIdChart,352,252,-2,-2,"",FALSE)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add grid to region 4 *****************************
   oRMChart:AddGrid(nIdChart,4,COLOR_ALICE_BLUE,TRUE,0,0,0,0,RMC_BICOLOR_NONE)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add data axis to region 4 *****************************
   oRMChart:AddDataAxis(nIdChart,4,RMC_DATAAXISLEFT,100,250,11,8,COLOR_BLUE,COLOR_BLACK,RMC_LINESTYLESOLID,0,"$ ","","",RMC_TEXTCENTER)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add second data axis to region 4 *****************************
   oRMChart:AddDataAxis(nIdChart,4,RMC_DATAAXISRIGHT,0,0,0,0,0,0,0,2," %","")
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add label axis to region 4 *****************************
   sTemp := ""
   oRMChart:AddLabelAxis(nIdChart,4, sTemp,1,10,RMC_LABELAXISBOTTOM,8,COLOR_BLACK,RMC_TEXTCENTER,COLOR_BLACK,RMC_LINESTYLESOLID,"")
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Series 1 to region 4 *******************************
   //****** Read data values ******
   aData := Array(10)
   aData[1] := 240 ; aData[2] := 230 ; aData[3] := 220 ; aData[4] := 180 ; aData[5] := 170
   aData[6] := 160 ; aData[7] := 145 ; aData[8] := 130 ; aData[9] := 125 ; aData[10]:= 115
   oRMChart:AddBarSeries(nIdChart,4,aData, 10,RMC_BARSINGLE,RMC_BAR_FLAT_GRADIENT2,FALSE,COLOR_GOLD,FALSE,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF
   //************** Add Series 2 to region 4 *******************************
   //****** Read data values ******
   aData[1] := 8.1 ; aData[2] := 6.2 ; aData[3] := 4.3  ; aData[4] := 2.2 ; aData[5] := 1.2
   aData[6] := 3.1 ; aData[7] := 5.2 ; aData[8] := 11.4 ; aData[9] := 7.3 ; aData[10]:= 4.2
   oRMChart:AddLineSeries(nIdChart,4, aData, 10,0,0,RMC_LINE,RMC_LINE_CABLE,RMC_LSTYLE_LINE,FALSE, ;
                                COLOR_GREEN,RMC_SYMBOL_NONE,2,RMC_VLABEL_DEFAULT,RMC_HATCHBRUSH_OFF)
   IF oRMChart:nError < 0 ; MsgStop("Error!") ; RETURN NIL ; ENDIF

   oRMChart:SetWatermark( RMC_USERWM, RMC_USERWMCOLOR, RMC_USERWMLUCENT, RMC_USERWMALIGN, RMC_USERFONTSIZE )

   RETURN NIL

FUNCTION Graphic3( hWnd, oRMChart, nIdChart, nExportOnly, MAX_SIZE_ONE, MAX_SIZE_TWO )

   LOCAL sTemp := "Apples*Bananas*Pears*Cherries"
   LOCAL aData := { 30.25, 26.75, 15.89, 46.23 }

   DEFAULT nExportOnly TO .F., MAX_SIZE_ONE TO 650, MAX_SIZE_TWO TO 450

   oRMChart:CreateChart( hWnd, nIdChart, 10, 10, MAX_SIZE_ONE, MAX_SIZE_TWO, COLOR_DEFAULT, RMC_CTRLSTYLEFLAT, nExportOnly, "", "Tahoma", 0, COLOR_DEFAULT )
   oRMChart:AddRegion( nIdChart, 5, 5, MAX_SIZE_ONE - 5, MAX_SIZE_TWO - 5, "", .F. )
   oRMChart:AddLegend( nIdChart, 1, sTemp, RMC_LEGEND_CUSTOM_UL, COLOR_DEFAULT, RMC_LEGENDRECTSHADOW, COLOR_DEFAULT, 8, .F. )
   oRMChart:AddGridlessSeries( nIdChart, 1, aData, 4, 0, 0, RMC_PYRAMIDE3, RMC_FULL, 0, .F., RMC_VLABEL_DEFAULT, RMC_HATCHBRUSH_OFF, 0 )
   oRMChart:SetWatermark( RMC_USERWM, RMC_USERWMCOLOR, RMC_USERWMLUCENT, RMC_USERWMALIGN, RMC_USERFONTSIZE )

   RETURN NIL

FUNCTION Graphic4( hWnd, oRMChart, nIdChart, nExportOnly, MAX_SIZE_ONE, MAX_SIZE_TWO )

   DEFAULT nExportOnly TO .F., MAX_SIZE_ONE TO 650, MAX_SIZE_TWO TO 450

   oRMChart:CreateChart(hWnd,nIdChart,10,10,MAX_SIZE_ONE,MAX_SIZE_TWO,COLOR_TRANSPARENT,RMC_CTRLSTYLEIMAGE,nExportOnly,"seasky.jpg","Tahoma", 0, COLOR_DEFAULT)
   oRMChart:AddRegion(nIdChart,5,5,-15,-15,"",.F.)
   oRMChart:AddGrid(nIdChart,1,COLOR_TRANSPARENT,.F.,0,0,0,0,RMC_BICOLOR_NONE)
   oRMChart:AddDataAxis(nIdChart,1,RMC_DATAAXISLEFT,0,100,11,8,COLOR_CHALK,COLOR_CHALK,RMC_LINESTYLEDOT,0,"","","",RMC_TEXTCENTER)
   oRMChart:AddLabelAxis(nIdChart,1, "Label 1*Label 2*Label 3*Label 4*Label 5",1,5,RMC_LABELAXISBOTTOM,8,COLOR_YELLOW,RMC_TEXTCENTER,COLOR_CHALK,RMC_LINESTYLENONE,"")
   oRMChart:AddBarSeries(nIdChart,1,{ 50, 70, 40, 60, 30 }, 5,RMC_BARSINGLE,RMC_BAR_FLAT_GRADIENT2,.T.,COLOR_TRANSPARENT,.F.,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)
   oRMChart:SetWatermark(RMC_USERWM,RMC_USERWMCOLOR,RMC_USERWMLUCENT,RMC_USERWMALIGN,RMC_USERFONTSIZE)

   RETURN NIL

FUNCTION Graphic5( hWnd, oRMChart, nIdChart, nExportOnly, MAX_SIZE_ONE, MAX_SIZE_TWO )

   LOCAL aColors := { COLOR_LIGHT_GREEN, COLOR_YELLOW, COLOR_GOLDENROD, COLOR_CRIMSON }
   LOCAL aData   := { 40, 30, 60, 20 }

   DEFAULT nExportOnly TO .F., MAX_SIZE_ONE TO 650, MAX_SIZE_TWO TO 450

   oRmChart:CreateChart( hWnd,nIdChart,10,10,MAX_SIZE_ONE,MAX_SIZE_TWO,COLOR_MIDNIGHT_BLUE,RMC_CTRLSTYLEIMAGE,nExportOnly,"seasky.jpg","Tahoma", 0, COLOR_DEFAULT )
   oRMChart:AddRegion(nIdChart,5,5,-5,-5,"",.F.)
   oRMChart:AddLegend(nIdChart,1,"Apples*Citrons*Bananas*Cherries",RMC_LEGEND_CUSTOM_CENTER,COLOR_DEFAULT,RMC_LEGENDNORECT,COLOR_WHITE,8,.F.)
   oRmChart:AddGridlessSeries(nIdChart,1, aData, 4, aColors, 4,RMC_DONUT_GRADIENT,RMC_FULL,0,.F.,RMC_VLABEL_TWIN,RMC_HATCHBRUSH_OFF, 0)
   oRmChart:SetWatermark(RMC_USERWM,RMC_USERWMCOLOR,RMC_USERWMLUCENT,RMC_USERWMALIGN,RMC_USERFONTSIZE)

   RETURN NIL

FUNCTION Graphic6( hWnd, oRMChart, nIdChart, nExportOnly, MAX_SIZE_ONE, MAX_SIZE_TWO )

   LOCAL aData, sTemp

   DEFAULT nExportOnly TO .F., MAX_SIZE_ONE TO 650, MAX_SIZE_TWO TO 450

   oRMChart:CreateChart( hWnd, nIdChart, 10, 10, MAX_SIZE_ONE, MAX_SIZE_TWO, COLOR_BISQUE, RMC_CTRLSTYLE3DLIGHT, nExportOnly, "", "Tahoma", 0, COLOR_DEFAULT )
   oRMChart:AddRegion( nIdChart, 5, 5, -5, -5, "this is the footer", .F. )
   oRMChart:AddCaption( nIdChart, 1, "Example of stacked bars", COLOR_BISQUE, COLOR_BLACK, 11, .F. )
   oRMChart:AddGrid( nIdChart, 1, COLOR_CORN_SILK, .F., 0, 0, 0, 0, RMC_BICOLOR_NONE )
   oRMChart:AddDataAxis( nIdChart, 1, RMC_DATAAXISLEFT, 0, 50000, 11, 8, COLOR_BLACK, COLOR_BLACK, RMC_LINESTYLESOLID, 0, " $","optional axis text, 9 points bold\9b", "", RMC_TEXTCENTER )
   sTemp := "Label Nr. 1*Label Nr. 2*Label Nr. 3*Label Nr. 4*Label Nr. 5*Label Nr. 6"
   oRMChart:AddLabelAxis( nIdChart, 1, sTemp, 1, 6, RMC_LABELAXISBOTTOM, 8, COLOR_BLACK, RMC_TEXTCENTER, COLOR_BLACK, RMC_LINESTYLESOLID, "optional label axis text" )
   sTemp := "Apples*Pears*Cherries*Strawberries"
   oRMChart:AddLegend( nIdChart, 1, sTemp, RMC_LEGEND_CUSTOM_UL, COLOR_LIGHT_YELLOW, RMC_LEGENDRECT, COLOR_BLUE, 8, .F. )
   aData := { 10000, 10000, 16000, 12000, 20000, 10000 }
   oRMChart:AddBarSeries( nIdChart, 1, aData, 6, RMC_BARSTACKED, RMC_COLUMN_FLAT, .F., COLOR_DARK_BLUE, .F., 1, RMC_VLABEL_NONE, 1, RMC_HATCHBRUSH_OFF )
   aData := { 5000, 7000, 4000, 15000, 10000, 10000 }
   oRMChart:AddBarSeries( nIdChart, 1, aData, 6, RMC_BARSTACKED, RMC_COLUMN_FLAT, .F., COLOR_DARK_GREEN, .F., 1, RMC_VLABEL_NONE, 1, RMC_HATCHBRUSH_OFF )
   aData := { 10000, 3000, 12000, 10000, 5000, 20000 }
   oRMChart:AddBarSeries(nIdChart,1,aData, 6,RMC_BARSTACKED,RMC_COLUMN_FLAT,.F.,COLOR_MAROON,.F.,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)
   aData := { 5000, 9000, 12000, 6000, 10000, 5000 }
   oRMChart:AddBarSeries( nIdChart, 1, aData, 6, RMC_BARSTACKED, RMC_COLUMN_FLAT, .F., COLOR_DARK_GOLDENROD, .F., 1, RMC_VLABEL_NONE, 1, RMC_HATCHBRUSH_OFF )
   oRMChart:SetWatermark( RMC_USERWM, RMC_USERWMCOLOR, RMC_USERWMLUCENT, RMC_USERWMALIGN, RMC_USERFONTSIZE )

   RETURN NIL

FUNCTION Graphic7( hWnd, oRMChart, nIdChart, nExportOnly, MAX_SIZE_ONE, MAX_SIZE_TWO )

   LOCAL aData, sTemp

   DEFAULT nExportOnly TO .F., MAX_SIZE_ONE TO 640, MAX_SIZE_TWO TO 450

   oRmChart:CreateChart( hWnd, nIdChart, 15, 10, MAX_SIZE_ONE,MAX_SIZE_TWO, COLOR_TRANSPARENT, RMC_CTRLSTYLEIMAGETILED, nExportOnly, "seasky.jpg", "Tahoma", 0, COLOR_DEFAULT )
   oRmChart:AddRegion( nIdChart, 5, 5, -15, -15, "", .F. )
   oRmChart:AddGrid( nIdChart, 1, COLOR_TRANSPARENT, .F., 0, 0, 0, 0, RMC_BICOLOR_NONE )
   oRmChart:AddDataAxis( nIdChart, 1, RMC_DATAAXISLEFT, 0, 100, 11, 8, COLOR_DEFAULT, COLOR_DEFAULT, RMC_LINESTYLESOLID, 0, "", "", "", RMC_TEXTCENTER )
   sTemp := "2000*2001*2002*2003*2004"
   oRmChart:AddLabelAxis( nIdChart, 1, sTemp, 1,5, RMC_LABELAXISBOTTOM, 8, COLOR_DEFAULT, RMC_TEXTCENTER, COLOR_DEFAULT, RMC_LINESTYLESOLID, "" )
   sTemp := "First quarter*Second quarter*Third quarter*Fourth quarter"
   oRmChart:AddLegend( nIdChart, 1, sTemp, RMC_LEGEND_TOP, COLOR_DEFAULT, RMC_LEGENDNORECT, COLOR_DEFAULT, 8, .F. )
   aData := { 30, 20, 40, 60, 10 }
   oRmChart:AddBarSeries( nIdChart, 1, aData, 5, RMC_BARGROUP, RMC_BAR_HOVER, .F., COLOR_DEFAULT, .F., 1, RMC_VLABEL_NONE, 1, RMC_HATCHBRUSH_OFF )
   aData := { 30, 20, 50, 70, 60 }
   oRmChart:AddBarSeries( nIdChart, 1, aData, 5, RMC_BARGROUP, RMC_BAR_HOVER, .F., COLOR_DEFAULT, .F., 1, RMC_VLABEL_NONE, 1, RMC_HATCHBRUSH_OFF )
   aData := { 40, 10, 30, 20, 80 }
   oRmChart:AddBarSeries( nIdChart, 1, aData, 5, RMC_BARGROUP, RMC_BAR_HOVER, .F., COLOR_DEFAULT, .F., 1, RMC_VLABEL_NONE, 1, RMC_HATCHBRUSH_OFF )
   aData := { 70, 50, 80, 40, 30 }
   oRmChart:AddBarSeries( nIdChart, 1, aData, 5, RMC_BARGROUP, RMC_BAR_HOVER, .F., COLOR_DEFAULT, .F., 1, RMC_VLABEL_NONE, 1, RMC_HATCHBRUSH_OFF )
   oRmChart:SetWatermark( RMC_USERWM, RMC_USERWMCOLOR, RMC_USERWMLUCENT, RMC_USERWMALIGN, RMC_USERFONTSIZE )

   RETURN NIL

FUNCTION Graphic8( hWnd, oRMChart, nIdChart, nExportOnly, nW, nH )

   LOCAL cLabels, cTitle, aData, cUnidade, cTextoVert, nMin, nMax

   DEFAULT nExportOnly TO .F., nW TO 650, nH TO 450

   cLabels    := "Label A*Label B*Label C*Label D*Label E"
   cTitle     := "This is our chart's caption"
   aData      := { 55.0, 70.0, 40.0, 60.0, 30.0 }
   cUnidade   := "%"
   cTextoVert := "Axis Text"
   nMin       := 0.0
   nMax       := 100.0

   oRMChart:CreateChart( hWnd, nIdChart, 10, 10, nW, nH, COLOR_AZURE, RMC_CTRLSTYLEFLAT, nExportOnly, "", "", 0, 0 )
   oRMChart:AddRegion( nIdChart, 5, 5, -5, -5, "", .F. )
   oRMChart:AddCaption( nIdChart, 1, cTitle, COLOR_TRANSPARENT, COLOR_BLUE, 11, .T. )
   oRMChart:AddGrid( nIdChart, 1, COLOR_BEIGE, .F., 0, 0, 0, 0, RMC_BICOLOR_LABELAXIS )
   oRMChart:AddDataAxis( nIdChart, 1, RMC_DATAAXISLEFT, nMin, nMax, 11, 8, COLOR_BLACK, COLOR_BLACK, RMC_LINESTYLEDOT, 0, cUnidade, cTextoVert, "", RMC_TEXTCENTER )
   oRMChart:AddLabelAxis( nIdChart, 1, cLabels, 1, 5, RMC_LABELAXISBOTTOM, 8, COLOR_BLACK, RMC_TEXTCENTER, COLOR_BLACK, RMC_LINESTYLENONE, "" )

   oRMChart:AddBarSeries( nIdChart, 1, aData, 5, RMC_BARSINGLE, RMC_BAR_FLAT_GRADIENT2, .F., COLOR_CORN_FLOWER_BLUE, .F., 1, RMC_VLABEL_NONE, 1, RMC_HATCHBRUSH_OFF )

   RETURN NIL

FUNCTION Graphic9( hWnd, oRMChart, nIdChart, nExportOnly, nW, nH )

   LOCAL aColor, aData, sTemp

   hb_Default( @nExportOnly, .F. )
   hb_Default( @nW, 650 )
   hb_Default( @nH, 450 )

   oRMChart:CreateChart( hWnd, nIdChart, 10, 10, nW, nH, COLOR_TRANSPARENT, RMC_CTRLSTYLEFLAT, nExportOnly, "", "Tahoma", 0, COLOR_DEFAULT )
   ORMChart:AddRegion( nIdChart, 10, -5, -5, -5, "", .F. )
   aColor := { COLOR_MAROON, COLOR_MEDIUM_BLUE, COLOR_CRIMSON, COLOR_DEFAULT }
   aData := { 80, 50, 60, 30 }
   oRMChart:AddGridlessSeries(nIdChart, 1, aData, 4, aColor, 4, RMC_PIE_3D_GRADIENT, RMC_HALF_TOP, 0, .F., RMC_VLABEL_NONE, RMC_HATCHBRUSH_OFF, 0 )
   sTemp := "This is a 3D pie with semicircle alignment, tooltips, a custom text" + Chr(13) + Chr(10) + "and a discreet watermark."
   oRMChart:COText( nIdChart, 1, sTemp, 100, 270, 400, 50, RMC_BOX_3D_SHADOW, COLOR_MOCCASIN, COLOR_DEFAULT, 0, RMC_LINE_HORIZONTAL, COLOR_MAROON, "09C" )
   oRMChart:SetWatermark( "RMChart", COLOR_AUTUMN_ORANGE, 25, 1, RMC_USERFONTSIZE )

   RETURN NIL

FUNCTION AMax( x )

   LOCAL nVal, oElement

   nVal := x[ 1 ]
   FOR EACH oElement IN x
      IF oElement > nVal
         nVal := oElement
      ENDIF
   NEXT

   RETURN nVal


rmchart.png
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18157
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1215 vezes

Image / handle de image

Mensagempor JoséQuintas » 22 Abr 2017 11:36

Esqueci de apagar o controle image, que tinha usado pra teste.
Tá no fonte mas não é usado.

@ 5, 200 IMAGE Image1 ;
         PICTURE NIL ;
         WIDTH 470 ;
         HEIGHT 540
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18157
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1215 vezes

Image / handle de image

Mensagempor JoséQuintas » 22 Abr 2017 11:41

Além do RMChart, acho interessante mostrar esta construçào de botões, que pode facilitar criar alguma coisa sem recorrer à IDE, principalmente se forem muitos botões.
Ponto pro Harbour, porque FOR/NEXT não serve.

   PRIVATE image1, button1, button2, button3, button4, button5, button6, button7, button8, button9, button10, button11, image1, Win1, nNumChart := 0

   oButtonList := { ;
      { "Chart1", { || nNumChart := 1, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart2", { || nNumChart := 2, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart3", { || nNumChart := 3, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart4", { || nNumChart := 4, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart5", { || nNumChart := 5, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart6", { || nNumChart := 6, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart7", { || nNumChart := 7, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart8", { || nNumChart := 8, DrawChart( ThisWindow.Handle ) } }, ;
      { "Chart9", { || nNumChart := 9, DrawChart( ThisWindow.Handle ) } }, ;
      { "Print",  { || PrintChart( ThisWindow.Handle ) } }, ;
      { "Close",  { || EndWindow() } } }
      FOR EACH oElement IN oButtonList
         cButtonName := "button" + Ltrim( Str( oElement:__EnumIndex, 2 ) )
         @ 470, 62 * ( oElement:__EnumIndex - 1 ) + 5 BUTTON &cButtonName ;
            CAPTION oElement[ 1 ] ;
            ACTION  Eval( oElement[ 2 ] ) ;
            WIDTH 60 HEIGHT 30 DEFAULT
      NEXT
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18157
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1215 vezes

Image / handle de image

Mensagempor JoséQuintas » 22 Abr 2017 19:24

O que eu queria fazer pra RMChart era usar um controle "hospedeiro", e não o form direto.
No caso da GTWVG criei um controle que chamei de retangle pra coisas desse tipo.
É só um controle de uma janela e nada demais, acaba tendo 1001 utilidades.
Serve pra RMChart, imagem, texto, etc. como se fosse um controle de usuário, basta alterar o Style.

Um controle desses com eventos click, resize, etc. poderia até substituir outros.
E se permitir controles desses dentro de outro controle desses, possibilidades infinitas.
Um gerador de controles.... rs
José M. C. Quintas
Harbour 3.2, mingw, gtwvg, multithread, dbfcdx, ADO+MySql, PNotepad
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18157
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1215 vezes




Retornar para MiniGui

Quem está online

Usuários vendo este fórum: Nenhum usuário registrado online e 7 visitantes


Ola Amigo, espero que meu site e forum tem lhe beneficiado, com exemplos e dicas de programacao.
Entao divulgue o link da Doacao abaixo para seus amigos e redes sociais ou faça uma doacao para o site forum...
MUITO OBRIGADO PELA SUA DOACAO!
Faça uma doação para o forum
cron
v
Olá visitante, seja bem-vindo ao Fórum Clipper On Line!
Efetue o seu login ou faça o seu Registro