Commit eb5760604d15f895a768fc4a6b60790d32f18d9e

Authored by Edmar Moretti
1 parent 8d1ff075

Inclusão de gráfico de pizza

Showing 1 changed file with 28 additions and 0 deletions   Show diff stats
ferramentas/legenda/index.js.php
... ... @@ -42,6 +42,12 @@ i3GEOF.legenda = {
42 42 */
43 43 tema: i3GEO.temaAtivo,
44 44 /*
  45 + Variavel: dadosGrafico
  46 +
  47 + Dados utilizados no gráfico no formato da ferramenta graficointerativo
  48 + */
  49 + dadosGrafico: "",
  50 + /*
45 51 Variavel: aguarde
46 52  
47 53 Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela.
... ... @@ -889,7 +895,10 @@ i3GEOF.legenda = {
889 895 if (retorno.data[0].proc == "") //o layer nao deve ser raster
890 896 {
891 897 var ins = [],i,id,re,exp,t;
  898 + ins.push("<p class='paragrafo' ><input type=button value='Gráfico de pizza' id=i3GEOlegendaGraficoPizza /></p>");
  899 + ins.push("<p class='paragrafo' >Número de ocorrências em cada classe (n)</p>");
892 900 ins.push("<table width=100% >")
  901 + i3GEOF.legenda.dadosGrafico = ["n;x"];
893 902 for (i=0;i<retorno.data.length;i++){
894 903 id = retorno.data[i].tema+"-"+retorno.data[i].idclasse; //layer+indice da classe
895 904 re = new RegExp("'", "g");
... ... @@ -897,6 +906,7 @@ i3GEOF.legenda = {
897 906 ins.push("<tr><td style='text-align:left;border-bottom:0 none white' >"+retorno.data[i].nomeclasse+"</td></tr>");
898 907 t = (retorno.data[i].nreg * 100)/retorno.data[i].totalreg;
899 908 ins.push("<tr><td style=text-align:left ><img height=15px width="+t+"% src='"+retorno.data[i].imagem+"' /></td></tr>");
  909 + i3GEOF.legenda.dadosGrafico.push(retorno.data[i].nomeclasse+";"+retorno.data[i].nreg);
900 910 }
901 911 ins.push("</table><br>");
902 912 $i("i3GEOlegendaguia4obj").innerHTML = ins.join("");
... ... @@ -904,6 +914,14 @@ i3GEOF.legenda = {
904 914 else
905 915 {$i("i3GEOlegendaguia4obj").innerHTML = "<p style=color:red >Ocorreu um erro<br>"}
906 916 i3GEOF.legenda.aguarde.visibility = "hidden";
  917 + new YAHOO.widget.Button(
  918 + "i3GEOlegendaGraficoPizza",
  919 + {onclick:{fn: function(){
  920 + var js = i3GEO.configura.locaplic+"/ferramentas/graficointerativo/index.js.php";
  921 + i3GEO.util.scriptTag(js,"i3GEOF.legenda.iniciaGraficoPizza()","i3GEOF.graficointerativo_script");
  922 + }
  923 + }}
  924 + );
907 925 },
908 926 p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=contagemclasse&tema="+i3GEOF.legenda.tema,
909 927 cp = new cpaint();
... ... @@ -913,6 +931,16 @@ i3GEOF.legenda = {
913 931 }
914 932 catch(e){alert("Erro: "+ e);i3GEOF.legenda.aguarde.visibility = "hidden";}
915 933 },
  934 + iniciaGraficoPizza: function(){
  935 + var dados = {
  936 + "attributes":{"id":""},
  937 + "data":{
  938 + "dados":i3GEOF.legenda.dadosGrafico
  939 + }
  940 + };
  941 + i3GEOF.graficointerativo.tipo = "pizza2d";
  942 + i3GEOF.graficointerativo.criaJanelaFlutuante(dados);
  943 + },
916 944 /*
917 945 Function: aplicaProcessos
918 946  
... ...