FWChartFactory(): New ( [ ] ) →
Observação
A instância de gráfico gerada pela FWChartFactory teve seu método SaveToPng depreciado.
FwChartFactory(): setLegend ( < nAlign> ) -->
Nome | Tipo | Descrição | Obrigatório | Referência |
nAlign | Numérico | Define onde será criado a legenda na tela. Ex: CONTROL_ALIGN_NONE, CONTROL_ALIGN_LEFT, CONTROL_ALIGN_TOP, CONTROL_ALIGN_RIGHT, CONTROL_ALIGN_BOTTOM | X |
SetOwner
FwChartFactory(): SetOwner ( < oPanel> ) -->
Nome | Tipo | Descrição | Obrigatório | Referência |
---|---|---|---|---|
oPanel | Objeto | painel onde sera criado o gráfico | X |
SetXaxis
FwChartFactory(): SetXaxis ( < aXAxis> ) -->
Nome | Tipo | Descrição | Obrigatório | Referência |
---|---|---|---|---|
aXAxis | Array | Descrição das séries dos gráficos | X |
AddSerie
FwChartFactory(): AddSerie ( < cTitle>,< uValue> ) -->
Nome | Tipo | Descrição | Obrigatório | Referência |
---|---|---|---|---|
cTitle | Caracter | Título | X | |
uValue | Numeric/Array | Valor ou valores da série | X |
Obs:
Variável uValue
Se a série for unica o tipo de variável deve ser NUMÉRICO Ex.: (cTitle, 10)
Se for multi série o tipo de variável deve ser Array de numéricos Ex.: (cTitle, {10,20,30} )
Os gráficos NEWLINECHART e RADARCHART funcionam apenas em multi série
A partir da lib 20250224, é possível enviar valores nulos para multi série
FwChartFactory(): SetAlignSerieLabel ( < nAlign> ) -->
Nome | Tipo | Descrição | Obrigatório | Referência |
---|---|---|---|---|
nAlign | Numérico | posição de alinhamento do Label | X |
SetChartDefault
FwChartFactory(): SetChartDefault ( < nChartDefault> ) -->
Nome | Tipo | Descrição | Obrigatório | Referência |
---|---|---|---|---|
nChartDefault | Numérico | tipo de grafico a ser apresentado | X |
Opções disponíveis : RADARCHART FUNNELCHART COLUMNCHART NEWPIECHART NEWLINECHART
FwChartFactory(): setMask ( [ cMask] ) -->
Nome | Tipo | Descrição | Obrigatório | Referência |
cMask | Caracter | Máscara do tooltip. Ex: "R$ *@*", será exibido por exemplo R$ 10,00 | X |
FwChartFactory(): setPicture ( < cPicture> ) -->
Nome | Tipo | Descrição | Obrigatório | Referência |
cPicture | Caracter | Picture que será utilizada nos valores do gráfico. Ex: @E 99.99 | X |
FwChartFactory(): EnableMenu( < lEnable> ) -->
Nome | Tipo | Descrição | Obrigatório | Referência |
lEnable | Lógico | .T. Ativa e .F. Desativa o menu de troca de painel | X |
FwChartFactory(): setTitle ( [ cTitle], [ nAlign] ) -->
Nome | Tipo | Descrição | Obrigatório | Referência |
cTitle | Caracter | Título do gráfico. | X | |
nAlign | Numérico | Alinhamento do título. Ex: CONTROL_ALIGN_LEFT,CONTROL_ALIGN_CENTER,CONTROL_ALIGN_RIGHT |
FwChartFactory(): Activate( ) -->
Para instanciar objetos do tipo FWChart, existe a classe FWChartFactory, responsável em instanciar o objeto gráfico, conforme parâmetro passado, criando assim gráficos em pizza, barras, funil ou linhas.
#include 'Protheus.ch' User Function tstFactory() Local oDlg as object Local oChart as object Local oPanel as object Local oPanel2 as object DEFINE DIALOG oDlg TITLE "Teste novos graficos" SIZE 800,800 PIXEL oPanel:= TPanel():New( , ,,oDlg,,,,,, 0, 50) oPanel:Align := CONTROL_ALIGN_TOP oPanel2:= TPanel():New( , ,,oDlg,,,,,, 0, 0) oPanel2:Align := CONTROL_ALIGN_ALLCLIENT TButton():New( 10, 10, "Refresh",oPanel,{||BtnClick(oChart)},45,15,,,.F.,.T.,.F.,,.F.,,,.F. ) oChart := FWChartFactory():New() oChart:SetOwner(oPanel2) //Para graficos multi serie, definir a descricao pelo SetxAxis e passar array no addSerie /* oChart:SetXAxis( {"periodo um", "periodo dois", "periodo tres"} ) oChart:addSerie('Apresentação teste', { 96, 33, 10 } ) oChart:addSerie('Qualificação teste', { 100, 33, 10 } ) oChart:addSerie('Fechamento teste', { 99, 36, 10 } ) oChart:addSerie('Pós Venda', { 80, 100, 10 } ) */ //Para graficos de serie unica utilizar conforme abaixo oChart:addSerie('Apresentação teste', 96 ) oChart:addSerie('Qualificação teste', 100 ) oChart:addSerie('Fechamento teste', 99 ) oChart:addSerie('Pós Venda', 80 ) //---------------------------------------------- //Picture //---------------------------------------------- oChart:setPicture("@E 999,999,999.99") //---------------------------------------------- //Mascara //---------------------------------------------- oChart:setMask("R$ *@*") //---------------------------------------------- //Adiciona Legenda //opções de alinhamento da legenda: //CONTROL_ALIGN_RIGHT | CONTROL_ALIGN_LEFT | //CONTROL_ALIGN_TOP | CONTROL_ALIGN_BOTTOM //---------------------------------------------- oChart:SetLegend(CONTROL_ALIGN_LEFT) //---------------------------------------------- //Titulo //opções de alinhamento do titulo: //CONTROL_ALIGN_RIGHT | CONTROL_ALIGN_LEFT | CONTROL_ALIGN_CENTER //---------------------------------------------- oChart:setTitle("Titulo do Grafico", CONTROL_ALIGN_CENTER) //"Oportunidades por fase" //---------------------------------------------- //Opções de alinhamento dos labels(disponível somente no gráfico de funil): //CONTROL_ALIGN_RIGHT | CONTROL_ALIGN_LEFT | CONTROL_ALIGN_CENTER //---------------------------------------------- oChart:SetAlignSerieLabel(CONTROL_ALIGN_RIGHT) //Desativa menu que permite troca do tipo de gráfico pelo usuário oChart:EnableMenu(.F.) //Define o tipo do gráfico oChart:SetChartDefault(FUNNELCHART) //----------------------------------------- // Opções disponiveis // RADARCHART // FUNNELCHART // COLUMNCHART // NEWPIECHART // NEWLINECHART //----------------------------------------- oChart:Activate() ACTIVATE DIALOG oDlg CENTERED Return Static function BtnClick(oChart) oChart:DeActivate() //Para graficos multi serie, definir a descricao pelo SetxAxis e passar array no addSerie /* oChart:SetXAxis( {"periodo um", "periodo dois", "periodo tres"} ) oChart:addSerie('WApresentação teste', { Randomize(1,20), Randomize(1,20), Randomize(1,20) } ) oChart:addSerie('AQualificação teste', { Randomize(1,20), Randomize(1,20), Randomize(1,20) } ) oChart:addSerie('EFechamento teste', { Randomize(1,20), Randomize(1,20), Randomize(1,20) } ) oChart:addSerie('BPós Venda', { Randomize(1,20), Randomize(1,20), Randomize(1,20) } ) */ //Para graficos de serie unica utilizar conforme abaixo oChart:addSerie('Apresentação teste', Randomize(1,20) ) oChart:addSerie('Qualificação teste', Randomize(1,20) ) oChart:addSerie('Fechamento teste', Randomize(1,20) ) oChart:addSerie('Pós Venda', Randomize(1,20) ) oChart:Activate() Return |