Hola amigos necesito un poco de ayuda, tengo que hacer un grafico de barras o pie, para mostrarlo en asp, y no tengo idea, me podrian ayudar
Trabajo con Oracle y Asp
| |||
Hola, mira este código, no recuerdo de qué pagina lo saqué, haber si te sirve, solo recuerdo que la página era portuguesa o brasileña, no sé Un saludo
Código:
'Este Script é uma função que cria um gráfico de barras, a partir de arrays. <%@ Language=VBScript %> <% function makechart(title, numarray, labelarray, imagename, maxheight, maxwidth, addvalues) 'title: Título do Grafico 'numarray: Uma Array de valores para montar o Gráfico 'labelarray: Uma Array com os títulos dos valores passados pela Array numarray 'imagename: Nome da imagem a ser utilizada para construir o gráfico. Utilize um Gif de 1 pixel da cor que você preferir... 'maxheight: Altura do Gráfico, sem contar os títulos dos valores 'maxwidth: Largura de cada coluna 'addvalues: True ou False. Se vc quer que os valores apareçam ou não no gráfico 'para usar esta função: response.write makechart(parameters) dim tablestring dim max dim tempnumarray dim templabelarray dim heightarray dim tempnum if maxheight > 0 and maxwidth > 0 and ubound(labelarray) = ubound(numarray) then templabelarray = labelarray tempnumarray = numarray heightarray = array() max = 0 maxlength = 0 tablestring = "<TABLE>" & vbCrLf for each stuff in tempnumarray if stuff > max then max = stuff end if next tempnum = maxheight/max for counter = 0 to ubound(tempnumarray) if tempnumarray(counter) = max then redim preserve heightarray(counter) heightarray(counter) = maxheight else redim preserve heightarray(counter) heightarray(counter) = tempnumarray(counter) * tempnum end if next tablestring = tablestring & "<TR><TH colspan='" & ubound(tempnumarray)+1 & "'>" & title & "</TH></TR>" & _ vbCrLf & "<TR>" & vbCrLf for counter = 0 to ubound(tempnumarray) tablestring = tablestring & vbTab & "<TD valign='bottom' align='center'><img src='" & imagename & "' width='" & maxwidth & "' height='" & _ heightarray(counter) & "'>" if addvalues then tablestring = tablestring & "<BR>" & tempnumarray(counter) end if tablestring = tablestring & "</TD>" & vbCrLf next tablestring = tablestring & "</TR>" & vbCrLf for each stuff in labelarray tablestring = tablestring & vbTab & "<TD align='center'><B> " & stuff & " </TD>" & vbCrLf next tablestring = tablestring & "</TABLE>" & vbCrLf makechart = tablestring else Response.Write "Erro! A altura e a largura devem ser maiores que zero (0), ou o número de títulos não é igual ao número de valores passados..." end if end function %> <HTML> <HEAD> <TITLE>CHART</TITLE> </HEAD> <BODY> <% dim stuff stuff = Array(200,100,50,74,23.3) labelstuff = Array("Campo1","Campo2","fff","ggg","gggg") Response.Write makechart("Meu Gráfico", stuff, labelstuff, "chart.gif", 50, 10, true) %> </BODY> </HTML> |