Gráfico XY..
Moderador: Moderadores
Gráfico XY..
Boa noite, pessoal..
Alguém tem um código de gráfico simples pra compartilhar, do tipo que a gente informa o "Título do gráfico", e "nomes" e "valores" da coordenada "X" ?
Pode ser circular ou cartesiano, tanto faz.
Hoje eu andei vendo aqui no fórum e não achei o que aproveitar
Eu uso Hb3.2
Grato
Alguém tem um código de gráfico simples pra compartilhar, do tipo que a gente informa o "Título do gráfico", e "nomes" e "valores" da coordenada "X" ?
Pode ser circular ou cartesiano, tanto faz.
Hoje eu andei vendo aqui no fórum e não achei o que aproveitar
Eu uso Hb3.2
Grato
lugab
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gráfico XY..
Infelizmente o que tenho é dependente da GTWVG do Harbour 3.4.
No 3.2 a GTWVG é limitada em uma coisa simples: tamanhos sempre em linhas/colunas, em números inteiros.
Na LIB JoseQuintas
ze_barchartclass.prg
exemplos de uso
pbancograficomes.prg
pbancografresumo.prg
Um mais complexo só na OOHG, usando bostaurus.
Talvez possa ser adaptado pra GTWVG, se não tiver função dependente da oohg.
No 3.2 a GTWVG é limitada em uma coisa simples: tamanhos sempre em linhas/colunas, em números inteiros.
Na LIB JoseQuintas
ze_barchartclass.prg
exemplos de uso
pbancograficomes.prg
pbancografresumo.prg
Um mais complexo só na OOHG, usando bostaurus.
Talvez possa ser adaptado pra GTWVG, se não tiver função dependente da oohg.
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/
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/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gráfico XY..
Mas só lembrando... pra que simplificar? Vai direto pra RMChart.
mesma lib, ze_rmchartclass.prg
programa teste em tests/rmchart
mesma lib, ze_rmchartclass.prg
programa teste em tests/rmchart
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/
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/
Gráfico XY..
Valeu, Mestre Quintas..
Eu fui na página https://github.com/JoseQuintas procurar
Eu sei q to indo no lugar errado, então, me passe o link aí
Eu fui na página https://github.com/JoseQuintas procurar
e não achei...LIB JoseQuintas
ze_barchartclass.prg
exemplos de uso
pbancograficomes.prg
pbancografresumo.prg
Eu sei q to indo no lugar errado, então, me passe o link aí
lugab
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gráfico XY..
O endereço anterior é de todas as LIBs, JoseQuintas faz parte.
https://github.com/JoseQuintas/JoseQuin ... tclass.prg
https://github.com/JoseQuintas/JoseQuin ... icomes.prg
https://github.com/JoseQuintas/JoseQuin ... resumo.prg
https://github.com/JoseQuintas/JoseQuin ... tclass.prg
https://github.com/JoseQuintas/JoseQuin ... es/rmchart
tudo junto (LIB JoseQuintas)
https://github.com/JoseQuintas/JoseQuintas
https://github.com/JoseQuintas/JoseQuin ... tclass.prg
https://github.com/JoseQuintas/JoseQuin ... icomes.prg
https://github.com/JoseQuintas/JoseQuin ... resumo.prg
https://github.com/JoseQuintas/JoseQuin ... tclass.prg
https://github.com/JoseQuintas/JoseQuin ... es/rmchart
tudo junto (LIB JoseQuintas)
https://github.com/JoseQuintas/JoseQuintas
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/
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/
Gráfico XY..
Obrigado, Quintas,..
E pra terminar: como é q compila, tem um .HBP pronto ?
Grato
E pra terminar: como é q compila, tem um .HBP pronto ?
Grato
lugab
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gráfico XY..
Na prática esse é meu aplicativo, mas não completo.
Pra compilar tudo tá na pasta tests/
Vai abrir os módulos liberados como públicos, muuuitos.
Não criei nada independente, exceto o que está em samples/
Exceto também, por exemplo, o formatador de fontes, em drafts/prgformat.prg
Tudo em sources\ entram no meu aplicativo, então complicado deixar independente.
Mas pode compilar o tests/ e acrescentar/retirar módulos.
Pra compilar tudo tá na pasta tests/
Vai abrir os módulos liberados como públicos, muuuitos.
Não criei nada independente, exceto o que está em samples/
Exceto também, por exemplo, o formatador de fontes, em drafts/prgformat.prg
Tudo em sources\ entram no meu aplicativo, então complicado deixar independente.
Mas pode compilar o tests/ e acrescentar/retirar módulos.
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/
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/
Gráfico XY..
Obrigado, Quintas..
Não consegui testar, Vou ver se encontro algum exemplo de geração de gráficos no excel
Não consegui testar, Vou ver se encontro algum exemplo de geração de gráficos no excel
lugab
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gráfico XY..
Código: Selecionar todos
#include "inkey.ch"
PROCEDURE Main
LOCAL aBarras := { "BARRA-1", "BARRA-2", "BARRA-3" }
LOCAL aMeses := { "JAN", "FEV", "MAR", "ABR", "MAI" }
LOCAL aValor := { ;
{ 1000, 2000, 3000, 4000, 5000 }, ;
{ 3000, 4000, 5000, 6000, 7000 }, ;
{ 5000, 6000, 7000, 5000, 4000 } }
LOCAL oGrafico
SetMode( 40, 100 )
oGrafico := BarChartClass():New()
oGrafico:nTop := 2
oGrafico:nLeft := 0
oGrafico:nBottom := MaxRow() - 3
oGrafico:nRight := MaxCol()
oGrafico:nGradeCount := 5
oGrafico:cTxtTitle := "COMPARATIVO"
oGrafico:aTxtSubList := aBarras
oGrafico:aTxtBarList := aMeses
oGrafico:aValues := aValor
oGrafico:Show()
Inkey(0)
RETURN
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/
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/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gráfico XY..
Com gtwvw
Com não sei qual, talvez console, talvez gtwvt
Com não sei qual, talvez console, talvez gtwvt
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/
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/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gráfico XY..
No primeiro teste indiquei a lib: hbmk2 test josequintas.hbc
Nos demais, só o test.prg e ze_barchartclass.prg
ou sem parâmetro adicional ou com gtwvw.hbc
E correção: não depende de GTWVG, é console mesmo.
Nos demais, só o test.prg e ze_barchartclass.prg
ou sem parâmetro adicional ou com gtwvw.hbc
E correção: não depende de GTWVG, é console mesmo.
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/
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/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gráfico XY..
Uia....
Minha PRIMEIRA classe no FlagShip....
deu um trabalhinho pra descobrir a sintaxe, mas foi...
Compatível Flagship X Harbour
Minha PRIMEIRA classe no FlagShip....
deu um trabalhinho pra descobrir a sintaxe, mas foi...
Compatível Flagship X Harbour
Código: Selecionar todos
#include "inkey.ch"
PROCEDURE Main
LOCAL aBarras := { "BARRA-1", "BARRA-2", "BARRA-3" }
LOCAL aMeses := { "JAN", "FEV", "MAR", "ABR", "MAI" }
LOCAL aValor := { ;
{ 1000, 2000, 3000, 4000, 5000 }, ;
{ 3000, 4000, 5000, 6000, 7000 }, ;
{ 5000, 6000, 7000, 5000, 4000 } }
LOCAL oGrafico
SetMode( 25, 80 )
#ifdef FlagShip
oGrafico := BarChartClass{}
#else
oGrafico := BarChartClass():New()
#endif
? ValType( oGrafico )
Inkey(0)
oGrafico:nTop := 2
oGrafico:nLeft := 0
oGrafico:nBottom := MaxRow() - 3
oGrafico:nRight := MaxCol()
oGrafico:nGradeCount := 5
oGrafico:cTxtTitle := "COMPARATIVO"
oGrafico:aTxtSubList := aBarras
oGrafico:aTxtBarList := aMeses
oGrafico:aValues := aValor
oGrafico:Show()
Inkey(0)
RETURN
Código: Selecionar todos
/*
ZE_CHART - Gráfico de barras simples
2016.05 - José Quintas
*/
#ifndef FlagShip
#include "hbclass.ch"
#else
#define INIT :=
#define VAR EXPORT
#endif
CLASS BarChartClass
VAR cTxtTitle INIT ""
VAR aTxtBarList INIT {}
VAR aTxtSubList INIT {}
VAR aValues INIT {}
VAR nTop INIT 0
VAR nLeft INIT 0
VAR nBottom INIT MaxRow()
VAR nRight INIT MaxCol()
VAR nMaxValue INIT 10
VAR nIncrement INIT 1
VAR nGradeCount INIT 5
#ifndef FlagShip
METHOD Show()
METHOD CalcMaxValue()
METHOD ShowEmpty()
METHOD ShowColBar()
METHOD ShowColSub( nNumBar, nColuna, nLarguraColuna )
METHOD BarColor( nNumColor )
ENDCLASS
#endif
METHOD Show() CLASS BarChartClass
::CalcMaxValue()
Scroll( ::nTop, ::nLeft, ::nBottom, ::nRight, 0 )
::ShowEmpty()
::ShowColBar()
RETURN NIL
METHOD CalcMaxValue() CLASS BarChartClass
LOCAL nCont, nCont2
FOR nCont = 1 TO Len( ::aValues )
FOR nCont2 = 1 TO Len( ::aValues[ nCont ] )
::nMaxValue := Max( ::nMaxValue, ::aValues[ nCont, nCont2 ] )
NEXT
NEXT
DO WHILE .t.
::nIncrement *= 10
IF ::nIncrement * ::nGradeCount > ::nMaxValue
EXIT
ENDIF
ENDDO
IF ( ::nIncrement * ::nGradeCount / 2 ) > ::nMaxValue
::nIncrement := ::nIncrement / 2
ENDIF
IF ( ::nIncrement * ::nGradeCount / 2 ) > ::nMaxValue
::nIncrement := ::nIncrement / 2
ENDIF
::nMaxValue := ::nIncrement * ::nGradeCount
RETURN NIL
METHOD ShowEmpty() CLASS BarChartClass
LOCAL nCont
// Título
@ ::nTop, Int( ( ::nRight - ::nLeft - 1 - Len( ::cTxtTitle ) ) / 2 ) SAY " " + ::cTxtTitle + " " COLOR "N/W"
// Linhas horizontal/vertical
@ ::nTop + 2, ::nLeft + 12 TO ::nBottom - 3, ::nLeft + 12
@ ::nBottom - 3, ::nLeft + 12 TO ::nBottom - 3, ::nRight - 2
// Valores da barra vertical
FOR nCont = 1 TO ::nGradeCount
@ ::nBottom - 3 - ( ( ::nBottom - ::nTop - 6 ) / ::nGradeCount * nCont ), ::nLeft SAY nCont * ::nIncrement PICTURE "9999999999"
@ Row(), ::nLeft + 13 TO Row(), ::nRight - 3
NEXT
// Legenda
@ ::nBottom - 1, ::nLeft SAY ""
FOR nCont = 1 TO Len( ::aTxtSubList )
@ Row(), Col() + 2 SAY Space(2) COLOR ::BarColor( nCont )
@ Row(), Col() + 2 SAY ::aTxtSubList[ nCont ]
NEXT
RETURN NIL
METHOD ShowColBar() CLASS BarChartClass
LOCAL nCont, nLarguraColuna
nLarguraColuna := Int( ( ::nRight - ::nLeft - 11 ) / ( Len( ::aValues[ 1 ] ) + 1 ) )
// cada grupo do gráfico
FOR nCont = 1 TO Len( ::aTxtBarList )
::ShowColSub( nCont, 13 + ( ( nCont - 1 ) * nLarguraColuna ), nLarguraColuna )
NEXT
RETURN NIL
METHOD ShowColSub( nNumBar, nColuna, nLarguraColuna ) CLASS BarChartClass
LOCAL nCont, cColorOld, nRow
cColorOld := SetColor()
// barras de comparação
FOR nCont = 1 TO Len( ::aTxtSubList )
nRow := ::nBottom - ( ( ::nBottom - ::nTop - 2 ) * ::aValues[ nCont, nNumbar ] / ::nMaxValue )
SetColor( ::BarColor( nCont ) )
@ nRow, nColuna + nCont CLEAR TO ::nBottom - 4, nColuna + nCont
NEXT
SetColor( cColorOld )
// legenda de cada coluna do gráfico
@ ::nBottom - 2, nColuna + 1 SAY Pad( ::aTxtBarList[ nNumBar ], nLarguraColuna - 1 )
RETURN NIL
METHOD BarColor( nNumColor ) CLASS BarChartClass
DO CASE
CASE nNumColor == 1 ; RETURN "9/9"
CASE nNumColor == 2 ; RETURN "14/14"
CASE nNumColor == 3 ; RETURN "15/15"
CASE nNumColor == 4 ; RETURN "11/11"
CASE nNumColor == 5 ; RETURN "12/12"
ENDCASE
RETURN "N/W"
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/
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/
Gráfico XY..
Estou começando agora a mexer com modo gráfico, bem iniciante mesmo.
Estou precisando de um gráfico nesse estilo XY, citado inicialmente neste post.
Testei os exemplos deste post, mas não consegui compilar. Talvez porque não tenho gtwvw. Estou usando hwgui.
É possível fazer um gráfico assim em hwgui?
Estou precisando de um gráfico nesse estilo XY, citado inicialmente neste post.
Testei os exemplos deste post, mas não consegui compilar. Talvez porque não tenho gtwvw. Estou usando hwgui.
É possível fazer um gráfico assim em hwgui?
Inacio de Carvalho Neto
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Gráfico XY..
Esses são pra console, HWGUI não é console.
Use RMCHAR ou outro.
Talvez.... apenas talvez.... o do próprio Windows, não sei se fica liberado geral.
Use RMCHAR ou outro.
Talvez.... apenas talvez.... o do próprio Windows, não sei se fica liberado geral.
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/
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/
Gráfico XY..
Pra console? É possível fazer gráfico assim em modo console? No 3.2 também, ou só no 3.4? Precisa de alguma lib especial?
O do windows mencionado acima eu tentei, mas não consegui.
O do windows mencionado acima eu tentei, mas não consegui.
Inacio de Carvalho Neto

