O máximo que consegui pra facilitar.
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.
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