RMChart

Projeto [x]Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

Avatar do usuário
asimoes
Colaborador
Colaborador
Mensagens: 4919
Registrado em: 26 Abr 2007 16:48
Localização: RIO DE JANEIRO-RJ

RMChart

Mensagem por asimoes »

Janio,

Dll pura a rmchart.dll
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Avatar do usuário
asimoes
Colaborador
Colaborador
Mensagens: 4919
Registrado em: 26 Abr 2007 16:48
Localização: RIO DE JANEIRO-RJ

RMChart

Mensagem por asimoes »

Quintas,

Tem esse método da rmchart RMC_Draw2File

Explicação:

Draws a chart into a *.jpg, *.png or *.emf file
Syntax
nResult (LONG) = RMC_Draw2File(
ByVal nCtrlId (LONG),
ByRef sFileName (ASCIIZ),
Optional ByVal nWidth (LONG),
Optional ByVal nHeight (LONG),
Optional ByVal nJPGQualityLevel (LONG)
)

Parameter
nCtrlId (LONG)
Unique ID of the chart control, which shall be saved.
sFileName (ASCIIZ)
Path and name of the file, which shall be created. The extension of sFileName can be: png, jpg, emf or emf+. If you want to save the chart as a bitmap, you should use png, because the file size is smaller than with jpg. No rule without exception: I made the experience, that with pies and donuts as well as with thumbnails jpg is smaller then png.
emf is compatible with the GDI's EMF-files (but up to 25 times bigger than emf+), while emf+ works only with GDI+. When saved to disk, both types have the extension *.emf.
nWidth (LONG)
Width of the bitmap, which shall be drawn into the file, in pixel. See Remarks
nHeight (LONG)
Height of the bitmap, which shall be drawn into the file, in pixel. See Remarks
nJPGQualityLevel (LONG)
Compression ratio (and therefore the quality) of the bitmap, if you save it as JPG/JPEG. Valid values are between 1 (highest compression, lowest quality) to 100 (lowest compression, highest quality). If omitted or 0: the standard compression ratio of GDI+ is used, which is something around 75 (I guess).
Não consegui sucesso na chamada, aborta
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Avatar do usuário
asimoes
Colaborador
Colaborador
Mensagens: 4919
Registrado em: 26 Abr 2007 16:48
Localização: RIO DE JANEIRO-RJ

RMChart

Mensagem por asimoes »

Quintas,

Consegui.

Pode ser um png, bmp e jpg, o png é o de menor tamanho
oGrafico:Draw( nIdChart )

Inkey( 0 )
oGrafico:Draw2File(nIdChart, hb_DirBase()+"teste.png", 770, 400, 100)
oCrt:destroy()
oGrafico:Destroy()

METHOD Draw2File( ... ) INLINE ::CallDllStd( "RMC_DRAW2FILE", ... )
Arquivo gerado pela função RMC_Draw2File
Arquivo gerado pela função RMC_Draw2File
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

RMChart

Mensagem por JoséQuintas »

Legal.
Devagarzinho vamos recheando de mais opções.
Ainda não sei o que aconteceu com o manual do RMChart aqui.
Só mostra índice, mas sem texto nenhum.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"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 do usuário
asimoes
Colaborador
Colaborador
Mensagens: 4919
Registrado em: 26 Abr 2007 16:48
Localização: RIO DE JANEIRO-RJ

RMChart

Mensagem por asimoes »

Quintas,

Tenta usar este no anexo.
Anexos
rmchart.zip
Descompactar
(596.77 KiB) Baixado 311 vezes
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

RMChart

Mensagem por JoséQuintas »

Cliquei em propriedades do arquivo, e encontrei o motivo.
Por ser conteúdo html....
helprmchart.png
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"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 do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

RMChart

Mensagem por JoséQuintas »

Olhando o manual...
Me chamou a atenção esta parte:
New features in version 4.12 (January 2008)
...
RMCDesigner supports now source code creation for Xailer, a development environment for Xbase
E depois dei de cara com este fonte, que parece mas não é.... rs

Código: Selecionar todos

CALLBACK FUNCTION ShowDialogRMCCallback
  LOCAL TINFO AS tRMC_INFO POINTER
  STATIC z&

  SELECT CASE CBMSG
    CASE %WM_RBUTTONDOWN  ' right mouse button was clicked
      ' CBLPARAM holds always the X/Y-position within the dialog,
      ' even you've clicked onto the chart
      MSGBOX "X-Pos in the dialog:"+STR$(LOWRD(CBLPARAM))+$CRLF+ _
             "Y-Pos in the dialog:"+STR$(HIWRD(CBLPARAM))
    CASE %WM_COMMAND
      SELECT CASE CBCTL
        CASE %ID_CLOSE
          DIALOG END CBHNDL
        CASE %ID_RMC1                 'message from the chart control
          SELECT CASE CBCTLMSG        'identify the message
            CASE %RMC_LBUTTONDOWN     'left mouse button
              z = 1                   'set flag for left mouse button pressed
            CASE %RMC_LBUTTONUP
              z = 0                   'reset the flag for left mouse button pressed
            CASE %RMC_CTRLRBUTTONDOWN 'Ctrl and right mouse button
              TINFO = CBLPARAM        'CBLPARAM holds a pointer to a tRMC_INFO structure
              MSGBOX "X-Pos in the chart:"+STR$(@TINFO.nXPos)+$CRLF+ _
                     "Y-Pos in the chart:"+STR$(@TINFO.nYPos)
            CASE %RMC_MOUSEMOVE       'mouse was moved in the chart control
              TINFO = CBLPARAM        'CBLPARAM holds a pointer to a tRMC_INFO structure
              IF z THEN               'if the left mouse button is pressed
                'move the chart control within your dialog
                RMC_SetCtrlpos %ID_RMC1,@TINFO.nXMove,@TINFO.nYMove,1
              END IF
          END SELECT
      END SELECT
  END SELECT
END FUNCTION
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"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 do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

RMChart

Mensagem por JoséQuintas »

Agora tentei este, mas dá erro logo na primeira linha, que nem sequer tem algo diferente.
Usei o gerador de fonte do RMDesigner, mas parece que ele é incompatível com o próprio RMChart dele... rs

O que reparei é que o RMChart não verifica nada, até se definir o quadro maior que a janela, é GPF.
rmchart.png
Dá pra identificar fácil quem é quem, porque tem o gráfico anterior no fonte.
Só alterar o primeiro gráfico pra .F. e o segundo pra .T.
E dentro do case, usei um case .T. como forma de testar um bloco por vez.

Código: Selecionar todos

#include "hbclass.ch"
#include "rmchart.ch"
#include "hbgtinfo.ch"
#include "hbdyn.ch"
#define RMC_USERWM         ""               // Your watermark
#define RMC_USERWMCOLOR    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

FUNCTION Main

   LOCAL oCrt, cLegenda, cLabels, cTitulo, aDados, cImagem, cUnidade, cTextoVert, nMax, nIdChart
   LOCAL oGrafico := RMChart():New(), nCont, oElement
   LOCAL sTemp1, aData1, sTemp2, aData2, aData3, aData4, aData5, aData6, aData7, aData8, sTemp3 := "", ID_RMC1 := 1

   oCrt           := WvgCrt():New( , , { -1, -1 }, { 25, 85 }, , .T. )
   oCrt:lModal    := .T.
   oCrt:icon      := "demo.ico"
   oCrt:resizable := .T.
   oCrt:create()
   hb_gtInfo( HB_GTI_WINTITLE, "Grafico com RmChart - Dll" )
   IF .T.
      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 } }
      cImagem    := ""
      cUnidade   := "R$ "
      cTextoVert := ""
      nMax       := 0
      nIdChart   := 1

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

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

      oGrafico:CreateChart( hb_gtInfo( HB_GTI_WINHANDLE ), nIdChart, 0, 0, 770, 400, Azure, RMC_CTRLSTYLE3DLIGHT, .F., cImagem, "", 0, 0 )
      oGrafico:AddRegion( nIdChart, 0, 0, 760, 400, "RmChart", .F. )
      oGrafico:AddCaption( nIdChart, 1, cTitulo, Transparent, Red, 9, .T. )
      oGrafico:AddGrid( nIdChart, 1, LightBlue, .F., 20, 20, 685, 330, RMC_BICOLOR_LABELAXIS )
      oGrafico:AddLabelAxis( nIdChart, 1, cLabels, 1, Len( aDados[ 1 ] ), RMC_LABELAXISBOTTOM, 8, Black, RMC_TEXTCENTER, Black, RMC_LINESTYLENONE, "" )
      oGrafico:AddDataAxis( nIdChart, 1, RMC_DATAAXISRIGHT, 0.0, nMax, Len( aDados[ 1 ] ), 8, Black, Black, RMC_LINESTYLESOLID, 1, cUnidade, cTextoVert, "", RMC_TEXTCENTER )
      oGrafico:AddLegend( nIdChart, 1, cLegenda, RMC_LEGEND_BOTTOM, Transparent, RMC_LEGENDNORECT, Red, 8, .T. )

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

      oGrafico:Draw( nIdChart )

   ENDIF
   IF .F.
      sTemp1 := "Label 1*Label 2*Label 3*Label 4*Label 5"
      aData1 := { 30,40,70,60,20 }
      sTemp2 := "Label 1*Label 2*Label 3*Label 4*Label 5"
      aData2 := { 20, 10, 15, 25, 30 }
      aData3 := { 25, 30, 10, 20, 15 }
      aData4 := { 10, 20, 40, 20, 30 }
      aData5 := { 40, 30, 20, 30, 20 }
      aData6 := { 30, 50, 20, 40, 60 }
      aData7 := { 240, 230, 220, 180, 170, 160, 145, 130, 125, 115 }
      aData8 := { 8,1, 6.2, 4.3, 2.2, 1.2, 3.1, 5.2, 11.4, 7.3, 4.2 }
      DO CASE
      CASE oGrafico:CreateChart( hb_gtInfo( HB_GTI_WINHANDLE ),ID_RMC1,0,0,700,400,AliceBlue,RMC_CTRLSTYLEFLATSHADOW,.F.,"","", 0, 0 ) < 0
      CASE .T.
      CASE oGrafico:AddRegion(ID_RMC1,2,2,348,248,"",.F.)  < 0
      CASE oGrafico:AddGrid(ID_RMC1,1,Beige,.F.,0,0,0,0,RMC_BICOLOR_NONE) < 0
      CASE oGrafico:AddDataAxis(ID_RMC1,1,RMC_DATAAXISLEFT,0,100,11,8,Black,Black,RMC_LINESTYLESOLID,0,"","","",RMC_TEXTCENTER)  < 0
      CASE oGrafico:AddLabelAxis(ID_RMC1,1, sTemp1,1,5,RMC_LABELAXISBOTTOM,8,Black,RMC_TEXTCENTER,Black,RMC_LINESTYLESOLID,"")
      CASE oGrafico:AddBarSeries(ID_RMC1,1,aData1, 5,RMC_BARSINGLE,RMC_BAR_3D,.F.,Default,.F.,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)  < 0
      CASE oGrafico:AddRegion(ID_RMC1,352,2,-2,248,"",.F.) < 0
      CASE oGrafico:AddGrid(ID_RMC1,2,Beige,.F.,0,0,0,0,RMC_BICOLOR_NONE) < 0
      CASE oGrafico:AddDataAxis(ID_RMC1,2,RMC_DATAAXISBOTTOM,0,100,11,8,Black,Black,RMC_LINESTYLESOLID,0,"","","",RMC_TEXTCENTER) < 0
      CASE oGrafico:AddLabelAxis(ID_RMC1,2, sTemp2,1,5,RMC_LABELAXISLEFT,8,Black,RMC_TEXTCENTER,Black,RMC_LINESTYLESOLID,"") < 0
      CASE oGrafico:AddBarSeries(ID_RMC1,2,aData2, 5,RMC_BARSTACKED,RMC_COLUMN_FLAT,.F.,Default,.T.,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF) < 0
      CASE oGrafico:AddBarSeries(ID_RMC1,2,aData3, 5,RMC_BARSTACKED,RMC_COLUMN_FLAT,.F.,Default,.T.,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF) < 0
      CASE oGrafico:AddBarSeries(ID_RMC1,2,aData4, 5,RMC_BARSTACKED,RMC_COLUMN_FLAT,.F.,Default,.T.,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF) < 0
      CASE oGrafico:AddBarSeries(ID_RMC1,2,aData5, 5,RMC_BARSTACKED,RMC_COLUMN_FLAT,.F.,Default,.T.,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)  < 0
      CASE oGrafico:AddRegion(ID_RMC1,2,252,348,-2,"",.F.) < 0
      CASE oGrafico:AddGridlessSeries(ID_RMC1,3, aData6, 5,0,0,RMC_PIE_3D_GRADIENT,RMC_FULL,2,.F.,RMC_VLABEL_DEFAULT,RMC_HATCHBRUSH_OFF, 0) < 0
      CASE oGrafico:AddRegion(ID_RMC1,352,252,-2,-2,"",.F.) < 0
      CASE oGrafico:AddGrid(ID_RMC1,4,AliceBlue,.T.,0,0,0,0,RMC_BICOLOR_NONE) < 0
      CASE oGrafico:AddDataAxis(ID_RMC1,4,RMC_DATAAXISLEFT,100,250,11,8,Blue,Black,RMC_LINESTYLESOLID,0,"$ ","","",RMC_TEXTCENTER)  < 0
      CASE oGrafico:AddDataAxis(ID_RMC1,4,RMC_DATAAXISRIGHT,0,0,0,0,0,0,0,2," %","") < 0
      CASE oGrafico:AddLabelAxis(ID_RMC1,4, sTemp3,1,10,RMC_LABELAXISBOTTOM,8,Black,RMC_TEXTCENTER,Black,RMC_LINESTYLESOLID,"") < 0
      CASE oGrafico:AddBarSeries(ID_RMC1,4,aData7, 10,RMC_BARSINGLE,RMC_BAR_FLAT_GRADIENT2,.F.,Gold,.F.,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF)  < 0
      CASE oGrafico:AddLineSeries(ID_RMC1,4, aData8, 10,0,0,RMC_LINE,RMC_LINE_CABLE,RMC_LSTYLE_LINE,.F., Green,RMC_SYMBOL_NONE,2,RMC_VLABEL_DEFAULT,RMC_HATCHBRUSH_OFF) < 0
      CASE oGrafico:SetWatermark(RMC_USERWM,RMC_USERWMCOLOR,RMC_USERWMLUCENT,RMC_USERWMALIGN,RMC_USERFONTSIZE) < 0
      CASE oGrafico:Draw(ID_RMC1) < 0
      ENDCASE
   ENDIF
   Inkey( 0 )
   oCrt:destroy()
   oGrafico:Destroy()

   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

CREATE CLASS RmChart

   VAR    nHandle

   METHOD New()                        INLINE ::nHandle := hb_libLoad( "RMChart.dll" ), SELF
   METHOD Destroy()                    INLINE hb_libFree( ::nHandle )
   METHOD CallDllStd( cName, ... )     INLINE hb_DynCall( { cName, ::nHandle, HB_DYN_CALLCONV_STDCALL }, ... )
   METHOD CreateChart( ... )           INLINE ::CallDllStd( "RMC_CREATECHART", ... )
   METHOD AddRegion( ... )             INLINE ::CallDllStd( "RMC_ADDREGION", ... )
   METHOD AddCaption( ... )            INLINE ::CallDllStd( "RMC_ADDCAPTION", ... )
   METHOD AddGrid( ... )               INLINE ::CallDllStd( "RMC_ADDGRID", ... )
   METHOD AddLabelAxis( ... )          INLINE ::CallDllStd( "RMC_ADDLABELAXIS", ... )
   METHOD AddDataAxis( ... )           INLINE ::CallDllStd( "RMC_ADDDATAAXIS", ... )
   METHOD AddLegend( ... )             INLINE ::CallDllStd( "RMC_ADDLEGEND", ... )
   METHOD AddBarSeries( a, b, c, ... ) INLINE ::CallDllStd( "RMC_ADDBARSERIES", a, b, ::ToDouble( c ), ... )
   METHOD Draw( ... )                  INLINE ::CallDllStd( "RMC_DRAW", ... )
   METHOD Draw2Clipboard( ... )        INLINE ::CallDllStd( "RMC_DRAW2CLIPBOARD", ... )
   METHOD Draw2Printer( ... )          INLINE ::CallDllStd( "RMC_DRAW2PRINTER", ... )
   METHOD Draw2File( ... )             INLINE ::CallDllStd( "RMC_DRAW2FILE", ... )
   METHOD ToDouble( c )

ENDCLASS

METHOD ToDouble( c )

   LOCAL cDouble := "", oElement

   FOR EACH oElement IN c
      cDouble += FToC( oElement )
   NEXT

   RETURN cDouble
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"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 do usuário
asimoes
Colaborador
Colaborador
Mensagens: 4919
Registrado em: 26 Abr 2007 16:48
Localização: RIO DE JANEIRO-RJ

RMChart

Mensagem por asimoes »

Quintas,

Tenta definir um id para cada um, acho que não pode ser o mesmo para os 2 gráficos

ID_RMC1 := 1
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Avatar do usuário
asimoes
Colaborador
Colaborador
Mensagens: 4919
Registrado em: 26 Abr 2007 16:48
Localização: RIO DE JANEIRO-RJ

RMChart

Mensagem por asimoes »

Outras coisa que eu vi

RMC_Reset function.
Reset an existing chart

This function deletes all internal data structures and memory allocated by an existing chart without destroying the chart control itself. Due to the new RMC_Set... functions, which allow a simple way to alter properties of an existing chart without the need to reset the chart, this function is actually obsolete.

Ou

RMC_DeleteChart

In case you called RMC_Draw() to show the chart on the screen you normally must not delete the chart. Because of it's nature as a control it will be destroyed when the dialog, which ownes the control, is destroyed (closed). If you did not show the chart calling RMC_Draw() but called instead RMC_Draw2Printer() or RMC_Draw2File() you must destroy the chart after saving or printing.
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Avatar do usuário
asimoes
Colaborador
Colaborador
Mensagens: 4919
Registrado em: 26 Abr 2007 16:48
Localização: RIO DE JANEIRO-RJ

RMChart

Mensagem por asimoes »

Sobre RMC_CreateChart function.

nCtrlId (LONG)
Unique ID of the control.
►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

RMChart

Mensagem por JoséQuintas »

Sim, por isso o .T. ou .F., pra mostrar ou um ou o outro.

Já tá saindo alguma coisa, dos 4 gráficos em um.
grafico.png
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"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 do usuário
asimoes
Colaborador
Colaborador
Mensagens: 4919
Registrado em: 26 Abr 2007 16:48
Localização: RIO DE JANEIRO-RJ

RMChart

Mensagem por asimoes »

Quintas,

Maravilha!, ninguém se manifestou, estou satisfeito com os resultados.

Todas aquelas funções podem virar métodos das classes.

Na verdade o designer vai servir de guia para montar os gráficos sem precisar exportar a string sData.

O RMCDesigner serve de guia e tem a opção de exportar em VB6-Dll, opção file conforme imagem:
Screen Shot 05-19-16 at 08.06 AM.PNG

Código: Selecionar todos

 Dim i AS LONG
    Dim nC AS LONG
    Dim nDataCount AS LONG
    Dim nRetVal AS LONG
    Dim sTemp AS STRING
    ReDim aData(0) AS DOUBLE
    ReDim aData2(0) AS DOUBLE
    ReDim aPPC(0) AS LONG
    ReDim aColor(0) AS LONG
 
 
    '************** Create the chart ********************** 
    nRetVal = RMC_CreateChartOnDC(Me.hDC,ID_RMC1,10,10,600,450,Transparent,RMC_CTRLSTYLEIMAGE,FALSE,"seasky.jpg","Tahoma", Default)
    IF nRetVal < 0 THEN GOTO IsError
    '************** Add Region 1 ***************************** 
    nRetVal = RMC_AddRegion(ID_RMC1,5,5,-5,-5,"",FALSE) 
    IF nRetVal < 0 THEN GOTO IsError
    '************** Add grid to region 1 ***************************** 
    nRetVal = RMC_AddGrid(ID_RMC1,1,Transparent,FALSE,0,0,0,0,RMC_BICOLOR_NONE) 
    IF nRetVal < 0 THEN GOTO IsError
    '************** Add data axis to region 1 ***************************** 
    nRetVal = RMC_AddDataAxis(ID_RMC1,1,RMC_DATAAXISLEFT,0,100,11,8,Chalk,Chalk,RMC_LINESTYLEDOT,0,"","","",RMC_TEXTCENTER) 
    IF nRetVal < 0 THEN GOTO IsError
    '************** Add label axis to region 1 ***************************** 
    sTemp = "Label 1*Label 2*Label 3*Label 4*Label 5"
    nRetVal = RMC_AddLabelAxis(ID_RMC1,1, sTemp,1,5,RMC_LABELAXISBOTTOM,8,Yellow,RMC_TEXTCENTER,Chalk,RMC_LINESTYLENONE,"") 
    IF nRetVal < 0 THEN GOTO IsError
    '************** Add Series 1 to region 1 ******************************* 
    '****** Read data values ******
    REDIM aData(4)
    aData(0) = 50 : aData(1) = 70 : aData(2) = 40 : aData(3) = 60 : aData(4) = 30
    nRetVal = RMC_AddBarSeries(ID_RMC1,1,aData(0), 5,RMC_BARSINGLE,RMC_BAR_FLAT_GRADIENT2,TRUE,Transparent,FALSE,1,RMC_VLABEL_NONE,1,RMC_HATCHBRUSH_OFF) 
    IF nRetVal < 0 THEN GOTO IsError
 
    nRetVal = RMC_SetWatermark(RMC_USERWM,RMC_USERWMCOLOR,RMC_USERWMLUCENT,RMC_USERWMALIGN,RMC_USERFONTSIZE)
    nRetVal = RMC_Draw(ID_RMC1)
    IF nRetVal < 0 THEN GOTO IsError
    Exit SUB 
 
    IsError: 

►Harbour 3.x | Minigui xx-x | HwGui◄
Pense nas possibilidades abstraia as dificuldades.
Não corrigir nossas falhas é o mesmo que cometer novos erros.
A imaginação é mais importante que o conhecimento. (Albert Einstein)
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

RMChart

Mensagem por JoséQuintas »

Foi isso mesmo que usei.
A opção pra Xailer usa Activex e não serve.

Na verdade são CINCO gráficos, a quarta janela é barras + linhas

- AddDataAxis dá erro, seriam as linhas verticais do gráfico 3, e linhas horizontais nos gráficos 1 e 4
- Não está mantendo barras + linhas no gráfico 4

Atenção a um detalhe: tem valor com decimal, que se deixar valor inteiro dá GPF, e vice-versa.
É porque os valores são convertidos em hb_Dyn() de acordo com o conteúdo. (pra inteiro, ponto flutuante, ponteiro, etc.)
E se o tipo for diferente, é onde ocorre o GPF no RMChart.
Talvez melhor fazer igual o Double, e colocar alguma rotina na classe pra não precisar se preocupar com isto, nem que seja multiplicar por 1.0.
grafico.png
Na imagem as linhas do fonte que causam GPF estão mais escuras, por estarem comentadas (//).
Todas contém AddDataAxis, que funciona no primeiro gráfico que fizemos.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"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 do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

RMChart

Mensagem por JoséQuintas »

Aproveitando:
- A janela inteira recebe o ID de gráfico, que é passado ao enviar informações.
- Cada uma dessas quatro partes são uma região, que é passada ao enviar as informações.
- Aquele RESET seria pra fazer um gráfico limpo, mas tem casos aonde um gráfico é feito SOBRE o anterior, que seria o caso do último gráfico que ainda não deu certo, não sei se por faltarem as tais DataAxis.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Responder