Página 8 de 23

RMChart

Enviado: 11 Mai 2016 19:46
por JoséQuintas
E tem aquele projeto usando DLL....
Serve até pra ajudar a fazer no Harbour

declarações
vb6dll.png
Manual conforme digita
vb6dll-2.png
Manual conforme digita mesmo, passo a passo
vb6dll-3.png
Depois é só digitar no Harbour.
Recomendo a todos ter o VB6 instalado pra facilitar no Harbour.... rs

Vai ver é por isso que quando o Harbour entra na parte gráfica ou IDE, eu não gosto.
Isso há 20 anos atrás....

RMChart

Enviado: 11 Mai 2016 19:57
por JoséQuintas
Faltou dizer:
a única coisa que fiz foi instalar a OCX do RMChart pra usar no Harbour, que já ficou válida para o VB6.
E vários dias brigando com isso no Harbour.

Pena que a Microsoft complicou tudo no VB.NET.

RMChart

Enviado: 11 Mai 2016 20:08
por asimoes
Nos exemplos que eu vi na pasta do rmchart, a função precisa deste tipo de dado para a função AddBarSeries
Fonte: rmctest.prg

oData:nDouble[1] := 60.0 // Your data goes into these 5 slots
oData:nDouble[2] := 70.0
oData:nDouble[3] := 40.0
oData:nDouble[4] := 60.0
oData:nDouble[5] := 30.0

Só que não funciona com o harbour, acredito que esse é o x da questão para montar as barras dos 12 meses usando a dll

oChart:AddBarSeries(ID_CHART, 1, oData, 5, RMC_BARGROUP, RMC_BAR_FLAT_GRADIENT2, .F., 0, .F., 1, RMC_VLABEL_NONE, 1, RMC_HATCHBRUSH_ONPRINTING )

Quintas, parece só eu e você estamos tentando resolver, será que ninguém se interessa?

O que eu não queria é fazer isso:

Código: Selecionar todos

      sData += "00003700|00004500|000054|000061|000071|00008-984833|00009412|00011Tahoma|100011|"
       sData += "100032|100042|10005348|10006248|1000910|100101|100111|100181|100200|10021100|100"
       sData += "2211|100238|100331|100341|100355|100378|100481|100491|10051-984833|10052-1677721"
       sData += "6|10053-657956|100541|100558|10056-16777216|10057-16777216|10060-16777216|10061-"
       sData += "16777216|10187Label 1*Label 2*Label 3*Label 4*Label 5|110011|110021|110031|11004"
       sData += "6|110056|11006-1|110091|110131|11014-1|110171|1102111|110221|110235|1105330*40*7"
       sData += "0*60*20|200011|20003352|200042|20005-2|20006248|2000910|200101|200111|200181|200"
       sData += "200|20021100|2002211|200238|200331|200341|200355|200378|200484|200491|20051-9848"
       sData += "33|20052-16777216|20053-657956|200544|200555|20056-16777216|20057-16777216|20060"
       sData += "-16777216|20061-16777216|20187Label 1*Label 2*Label 3*Label 4*Label 5|210011|210"
       sData += "023|210033|210045|210055|21006-1|210091|210101|210131|21014-1|210171|2102111|210"
       sData += "221|210235|2105320*10*15*25*30|220011|220023|220033|220045|220055|22006-1|220091"
       sData += "|220101|220131|22014-1|220171|2202111|220221|220235|2205325*30*10*20*15|230011|2"
       sData += "30023|230033|230045|230055|23006-1|230091|230101|230131|23014-1|230171|2302111|2"
       sData += "30221|230235|2305310*20*40*20*30|240011|240023|240033|240045|240055|24006-1|2400"
       sData += "91|240101|240131|24014-1|240171|2402111|240221|240235|2405340*30*20*30*20|300011"
       sData += "|300032|30004252|30005348|30006-2|3000910|300101|300181|300481|300491|30051-9848"
       sData += "33|30052-16777216|30053-657956|310011|3100251|310031|3100454|310054|310071|31009"
       sData += "1|310121|310151|310161|310171|310182|310211|310221|310235|3105330*50*20*40*60|40"
       sData += "0011|40003352|40004252|40005-2|40006-2|4000910|400101|400111|400131|400181|40020"
       sData += "100|40021250|4002211|400238|400281|400292|400300|400310|400322|400331|400341|400"
       sData += "3510|400378|400482|400492|40051-984833|40052-16777216|40053-984833|400541|400558"
       sData += "|40056-16776961|40057-16777216|400592|40060-16777216|40061-16777216|40183$ |4018"
       sData += "5 %|410011|410021|410031|410043|410053|41006-1|4100950|410131|41014-1|410171|410"
       sData += "19-10496|4102111|410221|4102310|41053240*230*220*180*170*160*145*130*125*115|420"
       sData += "011|4200221|420035|4200422|420052|420061|420071|4200963|420111|420121|420131|420"
       sData += "171|42019-16744448|4202115|420221|4202310|420261|420538.1*6.2*4.3*2.2*1.2*3.1*5."
       sData += "2*11.4*7.3*4.2"
Para isso tem usar o RMCDESIGNER, e depois trocar os valores desta string maluca

RMChart

Enviado: 11 Mai 2016 21:19
por JoséQuintas
Ainda ajustando esse exemplo.

Código: Selecionar todos

d:\temp\rmchart3>hbmk2 test.hbp
hbmk2: Processing environment options: -comp=msvc
Harbour 3.4.0dev (645d608) (2016-04-28 20:49)
Copyright (c) 1999-2016, https://github.com/vszakats/harbour-core/
Compiling 'test.prg'...
test.prg(62) Warning W0001  Ambiguous reference 'COLORAZURE'
test.prg(64) Warning W0001  Ambiguous reference 'COLORTRANSPARENT'
test.prg(64) Warning W0001  Ambiguous reference 'COLORRED'
test.prg(65) Warning W0001  Ambiguous reference 'COLORLIGHTBLUE'
test.prg(66) Warning W0001  Ambiguous reference 'COLORBLACK'
test.prg(66) Warning W0001  Ambiguous reference 'COLORBLACK'
test.prg(67) Warning W0001  Ambiguous reference 'COLORBLACK'
test.prg(67) Warning W0001  Ambiguous reference 'COLORBLACK'
test.prg(73) Warning W0001  Ambiguous reference 'COLORTRANSPARENT'
test.prg(73) Warning W0001  Ambiguous reference 'COLORRED'
test.prg(88) Warning W0032  Variable 'NRETVAL' is assigned but not used in function 'MAIN(20)'
test.prg(93) Error E0030  Syntax error "syntax error at 'NELEM'"
test.prg(118) Error E0030  Syntax error "syntax error at 'NELEM'"
test.prg(119) Error E0030  Syntax error "syntax error at 'CORDEM'"
test.prg(127) Warning W0003  Variable 'X' declared but not used in function 'AASORT(116)'
test.prg(127) Warning W0003  Variable 'Y' declared but not used in function 'AASORT(116)'
3 errors

RMChart

Enviado: 11 Mai 2016 21:20
por JoséQuintas
Ele está usando um outro rmchart.ch
Só se percebe usando -w3 -es2

RMChart

Enviado: 11 Mai 2016 21:30
por JoséQuintas
E esse do fivewin, depois do ajuste, simplesmente deu GPF... rs

RMChart

Enviado: 11 Mai 2016 21:37
por JoséQuintas
O que entendi do fivewin é:

declaração do array de 12 elementos double

Código: Selecionar todos

typedef struct { CTYPE_DOUBLE nDouble[12] } DataStructD12
declaração da variável no Harbour

Código: Selecionar todos

   LOCAL oCompara1 IS DataStructD12
   LOCAL oCompara2 IS DataStructD12
   LOCAL oCompara3 IS DataStructD12
Colocando os elementos no array

Código: Selecionar todos

   FOR nCont = 1 TO 12
      oCompara1:nDouble[ nCont ] := aDados[ 1, nCont ]
      oCompara2:nDouble[ nCont ] := aDados[ 2, nCont ]
      oCompara3:nDouble[ nCont ] := aDados[ 3, nCont ]
   NEXT
e o uso do array, único que não dá GPF

Código: Selecionar todos

   oGrafico:AddBarSeries( ID_CHART, 1, @oCompara1:nDouble[ 1 ], 12, RMC_BARGROUP, RMC_BAR_FLAT_GRADIENT2, .F., 0, .F., 1, RMC_VLABEL_NONE, 1, RMC_HATCHBRUSH_ONPRINTING )
   oGrafico:AddBarSeries( ID_CHART, 1, @oCompara2:nDouble[ 1 ],  12, RMC_BARGROUP, RMC_BAR_FLAT_GRADIENT2, .F., 0, .F., 1, RMC_VLABEL_NONE, 2, RMC_HATCHBRUSH_ONPRINTING )
   oGrafico:AddBarSeries( ID_CHART, 1, @oCompara3:nDouble[ 1 ], 12, RMC_BARGROUP, RMC_BAR_FLAT_GRADIENT2, .F., 0, .F., 1, RMC_VLABEL_NONE, 3, RMC_HATCHBRUSH_ONPRINTING )

RMChart

Enviado: 11 Mai 2016 21:52
por JoséQuintas
Lembrei que o VB é base no array, então tentei passando 11 na quantidade ao invés de 12, mas também não resolveu.
O problema é nesse array de double.

RMChart

Enviado: 11 Mai 2016 22:23
por JoséQuintas
Achei algo interessante nesta página, mas não achei nenhum método aonde usar.

http://kb.elipse.com.br/pt-br/questions ... art+in+E3.
At RMChart, each series (data set) displays the Datastring property, which contains the values to be drawn. This property requires that the values be separated by asterisks ("15*39*21*17"). So, when you have a bar chart, each value represents a bar. Following our example above, we would have:
É até esquisito pelo activex ser por string, e pela DLL ser double, mas não encontrei nada na DLL.

RMChart

Enviado: 11 Mai 2016 22:26
por JoséQuintas
Esquece... isso é pra colocar texto nas colunas.

RMChart

Enviado: 11 Mai 2016 22:35
por JoséQuintas
Resta uma saída, cria a configuração no designer, e no programa só troca os valores da string.
Ou... ir configurando uma coisa de cada vez pra identificar qual a parte da string que representa aquilo.
Pode chegar a uma classe que resolve tudo.

RMChart

Enviado: 11 Mai 2016 22:50
por asimoes
Quintas,

Ou voltar para o activex, tentar resolver os problemas de janela, porque por dll, só funciona 100% usando aquela string maluca

Usando a string maluca:

Código: Selecionar todos

       sData += "00003600|00004450|000051|000061|000071|00008-984833|00009412|00011Tahoma|100011|"
       sData += "100021|100035|100045|10005-5|10006-5|1000910|100101|100111|100131|100181|1002010|"
       sData += "10021100|1002211|100238|100331|100341|1003520|100378|100482|100491|10051-8388652|"
       sData += "10052-16777216|10053-657956|100541|100558|10056-16777216|10057-16777216|10060-"
       sData += "16777216|10061-16777216|10063-1|100651|10181 *** Gráfico Teste ***|10184Em Milhões de Reais|102010.00*10."
       sData += "00*20.00*30.00*40.00*50.00*60.00*70.00*80.00*90.00*100.00|110011|1100221|110035|"
       sData += "1100424|110051|110062|110071|110091|110121|110131|1101421|110152|110171|11019-16"
       sData += "776961|1102115|110221|110235|110261|11053"
       sData += "15*25*30*22*75"
       sData += "|120011|1200221|1200424|120062|120121|1201421|12019-65536|1202115|120221|120235|120261|12053"
       sData += "10*15*40*20*31"
       nWidth :=770
       nHeight:=450 

nRetVal:=hb_dynCall( { "RMC_CREATECHARTFROMFILE", nHandleDLL, hb_bitOr( HB_DYN_CTYPE_LONG , HB_DYN_CALLCONV_STDCALL ) }, hb_gtInfo( HB_GTI_WINHANDLE ), ID_CHART, 10, 10, 0, sData)
nRetVal:=hb_dynCall( { "RMC_DRAW", nHandleDLL, hb_bitOr( HB_DYN_CTYPE_LONG , HB_DYN_CALLCONV_STDCALL ) }, ID_CHART)
nRetVal:=hb_dynCall( { "RMC_DRAW2CLIPBOARD", nHandleDLL, hb_bitOr( HB_DYN_CTYPE_LONG , HB_DYN_CALLCONV_STDCALL ) }, ID_CHART, RMC_BMP )

RMChart

Enviado: 11 Mai 2016 23:44
por JoséQuintas
E essa string maluca não é a mesma sequência dos comandos?

O máximo que consegui pra facilitar.
Quando descobrir, é alterar o método AddBarSeries()
E mais uma complicação no meio: a quantidade de argumentos não bateu com o exemplo do VB que está junto com o RMChart - o exemplo que vém junto com o RMChart.
Acabei acrescentando "..." em tudo, senão dava GPF.

Código: Selecionar todos

#include "hbclass.ch"
#include "rmchart.ch"
#include "hbgtinfo.ch"
#include "hbdyn.ch"

FUNCTION Main

 LOCAL oCrt, cLegenda, cLabels, cTitulo, aDados, cImagem, cUnidade, cTextoVert, nMax, id_Chart, ctrgra1
 LOCAL oElemento, oGrafico := RMChart():New()

 oCrt := WvgCrt():New( , , { -1, -1 }, { 25, 85 }, , .T. )
 oCrt:lModal := .T.
 oCrt:icon := "demo.ico"
 oCrt:create()
 oCrt:resizable := .F.
 hb_gtInfo( HB_GTI_WINTITLE, "Grafico com RmChart - Dll" )
 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
 id_Chart := 1

 FOR cTrGra1 := 1 TO Len( aDados )
   nMax := Max( nMax, aMax( aDados[ cTrGra1 ] ) )
 NEXT

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

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

 FOR EACH oElemento IN aDados
   oGrafico:AddBarSeries( ID_CHART, 1, oElemento, 12, RMC_BARGROUP, RMC_BAR_FLAT_GRADIENT2, .F., 0, .F., 1, RMC_VLABEL_NONE, 12, RMC_HATCHBRUSH_ONPRINTING )
 NEXT

 oGrafico:Draw( ID_CHART )

 Inkey( 0 )
 oCrt:destroy()
 oGrafico:Destroy()

 RETURN NIL

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( nCtrlId, nX, nY, nWidth, nHeight, nBackColor, nCtrlStyle, nExportOnly, sBgImage, sFontName, nBitmapBKColor, ... )
 METHOD AddRegion( nCtrlId, nLeft, nTop, nWidth, nHeight, sFooter, nShowBorder, ... )
   METHOD AddCaption( nCtrlId, nRegion, sCaption, nTitelBackColor, nTitelTextColor, nTitelFontSize, nTitelIsBold, ... )
   METHOD AddGrid( nCtrlId, nRegion, nBackColor, nAsGradient, nLeft, nTop, nWidth, nHeight, nBiColor, ... )
   METHOD AddLabelAxis( nCtrlId, nRegion, sLabels, nCont, nTickCount, nAlignment, nFontSize, nTextColor, nTextAlignment, nLineColor, nLineStyle, sText, ... )
   METHOD AddDataAxis( nCtrlId, nRegion, nAligment, nMinValue, nMaxValue, nTickCount, nFontSize, nTextColor, nLineColor, nLineStyle, nDecimalDigits, ;
      sUnit, sText, sLabels, nLabelAlignment, ... )
   METHOD AddLegend( nCtrlId, nRegion, sLegend, nLegendAlign, nLegendBackColor, nLegendStyle, nLegendTextColor, nLegendFontSize, nLegendIsBold, ... )
   METHOD AddBarSeries( nCtrlId, nRegion, nFirstDataValue, nDataValuesCount, nType, nStyle, ;
      nIsLucent, nColor, nIsHorizontal, nWhichDataAxis, nValueLabelOn, nPointsPerColumn, nHatchMode, ... )
   METHOD Draw( nCtrlId )

ENDCLASS

METHOD RMChart:CreateChart( nCtrlId, nX, nY, nWidth, nHeight, nBackColor, nCtrlStyle, nExportOnly, sBgImage, sFontName, nBitmapBKColor, ... )

   RETURN ::CallDllStd( "RMC_CREATECHART", nCtrlId, nX, nY, nWidth, nHeight, nBackColor, nCtrlStyle, nExportOnly, sBgImage, sFontName, nBitmapBKColor, ... )

METHOD RMChart:AddRegion( nCtrlId, nLeft, nTop, nWidth, nHeight, sFooter, nShowBorder, ... )

   RETURN ::CallDllStd( "RMC_ADDREGION", nCtrlId, nLeft, nTop, nWidth, nHeight, sFooter, nShowBorder, ... )

METHOD RMChart:AddCaption( nCtrlId, nRegion, sCaption, nTitelBackColor, nTitelTextColor, nTitelFontSize, nTitelIsBold, ... )

   RETURN ::CallDllStd( "RMC_ADDCAPTION", nCtrlId, nRegion, sCaption, nTitelBackColor, nTitelTextColor, nTitelFontSize, nTitelIsBold, ... )

METHOD RMChart:AddGrid( nCtrlId, nRegion, nBackColor, nAsGradient, nLeft, nTop, nWidth, nHeight, nBiColor, ... )

   RETURN ::CallDllStd( "RMC_ADDGRID", nCtrlId, nRegion, nBackColor, nAsGradient, nLeft, nTop, nWidth, nHeight, nBiColor, ... )

METHOD RMChart:AddLabelAxis( nCtrlId, nRegion, sLabels, nCont, nTickCount, nAlignment, nFontSize, nTextColor, nTextAlignment, nLineColor, nLineStyle, sText, ... )

   RETURN ::CallDllStd( "RMC_ADDLABELAXIS", nCtrlId, nRegion, sLabels, nCont, nTickCount, nAlignment, nFontSize, nTextColor, nTextAlignment, nLineColor, nLineStyle, sText, ... )

METHOD RMChart:AddDataAxis( nCtrlId, nRegion, nAligment, nMinValue, nMaxValue, nTickCount, nFontSize, nTextColor, nLineColor, nLineStyle, nDecimalDigits, ;
      sUnit, sText, sLabels, nLabelAlignment, ... )

   RETURN ::CallDllStd( "RMC_ADDDATAAXIS",   nCtrlId, nRegion, nAligment, nMinValue, nMaxValue, nTickCount, nFontSize, nTextColor, nLineColor, nLineStyle, nDecimalDigits, ;
      sUnit, sText, sLabels, nLabelAlignment, ... )

METHOD RMChart:AddLegend( nCtrlId, nRegion, sLegend, nLegendAlign, nLegendBackColor, nLegendStyle, nLegendTextColor, nLegendFontSize, nLegendIsBold, ... )

   RETURN ::CallDllStd( "RMC_ADDLEGEND", nCtrlId, nRegion, sLegend, nLegendAlign, nLegendBackColor, nLegendStyle, nLegendTextColor, nLegendFontSize, nLegendIsBold, ... )

METHOD RMChart:Draw( nCtrlId )

   RETURN ::CallDllStd( "RMC_DRAW", nCtrlId )

METHOD RMChart:AddBarSeries( nCtrlId, nRegion, nFirstDataValue, nDataValuesCount, nType, nStyle, ;
      nIsLucent, nColor, nIsHorizontal, nWhichDataAxis, nValueLabelOn, nPointsPerColumn, nHatchMode, ... )

   LOCAL aArray

   aArray := aClone( nFirstDataValue ) // tem que ser double

   RETURN ::CallDllStd( "RMC_ADDBARSERIES", nCtrlId, nRegion, @aArray[ 1 ], nDataValuesCount, nType, nStyle, ;
      nIsLucent, nColor, nIsHorizontal, nWhichDataAxis, nValueLabelOn, nPointsPerColumn, nHatchMode, ... )

FUNCTION AMax( x )

 LOCAL nVal, oElement

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

 RETURN nVal

RMChart

Enviado: 11 Mai 2016 23:48
por JoséQuintas
Nota:
Por padrão o array, no Harbour, nem precisa indicar que o array é por referência.
Mas pra DLL precisou.

RMChart

Enviado: 12 Mai 2016 01:03
por JoséQuintas
Pensando bem, olhando atentamente esses gráficos, tá fácil fazer igual sem precisar do rmchart.