From 41679f3b50d5ebc7c3590ad89f48d0d2d3356d63 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Mon, 15 Apr 2013 12:56:06 +0000 Subject: [PATCH] --- ferramentas/graficointerativo1/dicionario.js | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ferramentas/graficointerativo1/exec.php | 34 ++++++++++++++++++++++++++++++++++ ferramentas/graficointerativo1/index.js | 1209 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1306 insertions(+), 0 deletions(-) create mode 100755 ferramentas/graficointerativo1/dicionario.js create mode 100755 ferramentas/graficointerativo1/exec.php create mode 100755 ferramentas/graficointerativo1/index.js diff --git a/ferramentas/graficointerativo1/dicionario.js b/ferramentas/graficointerativo1/dicionario.js new file mode 100755 index 0000000..1752c78 --- /dev/null +++ b/ferramentas/graficointerativo1/dicionario.js @@ -0,0 +1,63 @@ +//+$trad(1,i3GEOF.graficointerativo.dicionario)+ +i3GEOF.graficointerativo.dicionario = { +1: [{ +pt:"", +en:"", +es:"", +it:"" +}], +2: [{ +pt:"", +en:"", +es:"", +it:"" +}], +3: [{ +pt:"", +en:"", +es:"", +it:"" +}], +4: [{ +pt:"", +en:"", +es:"", +it:"" +}], +5: [{ +pt:"", +en:"", +es:"", +it:"" +}], +6: [{ +pt:"", +en:"", +es:"", +it:"" +}], +7: [{ +pt:"", +en:"", +es:"", +it:"" +}], +8: [{ +pt:"", +en:"", +es:"", +it:"" +}], +9: [{ +pt:"", +en:"", +es:"", +it:"" +}], +10: [{ +pt:"", +en:"", +es:"", +it:"" +}] +}; \ No newline at end of file diff --git a/ferramentas/graficointerativo1/exec.php b/ferramentas/graficointerativo1/exec.php new file mode 100755 index 0000000..745afe1 --- /dev/null +++ b/ferramentas/graficointerativo1/exec.php @@ -0,0 +1,34 @@ + +*/ + case "GRAFICOSELECAO": + include(dirname(__FILE__)."/../../classesphp/graficos.php"); + if(!isset($exclui)) + {$exclui = "";} + if(!isset($tipo)) + {$tipo = "nenhum";} + if(!isset($ordenax)) + {$ordenax = "nao";} + $retorno = iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$tipo,false,$ext,true,$ordenax); + break; +} +if (!connection_aborted()){ + if(isset($map_file) && isset($postgis_mapa) && $map_file != "") + restauraCon($map_file,$postgis_mapa); + cpjson($retorno); +} +else +{exit();} +?> \ No newline at end of file diff --git a/ferramentas/graficointerativo1/index.js b/ferramentas/graficointerativo1/index.js new file mode 100755 index 0000000..989295c --- /dev/null +++ b/ferramentas/graficointerativo1/index.js @@ -0,0 +1,1209 @@ + +/*jslint plusplus:false,white:false,undef: false, rhino: true, onevar: true, evil: true */ +/* +Title: Gráfico interativo + +Representação gráfica de dados. O gráfico é construído tendo como base os atributos de um tema e é modificado +conforme o usuário navega pelo mapa. A renderização do gráfico é feito pelo navegador por meio do aplicativo openflashchart. +Os dados que serão utilizados no gráfico são baseados em um elemento TABLE. Esse elemento pode ser montado com base na tabela +de atributos e editada pelo usuário. Os dados podem também ser inseridos como parâmetros na inicialização da ferramenta, +permitindo que o gráfico seja utilizado por outras ferramentas. + +Veja: + + + +Arquivo: + +i3geo/ferramentas/graficointerativo1/index.js.php + +Licenca: + +GPL2 + +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet + +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com + +Este programa é software livre; você pode redistribuí-lo +e/ou modificá-lo sob os termos da Licença Pública Geral +GNU conforme publicada pela Free Software Foundation; + +Este programa é distribuído na expectativa de que seja útil, +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. +Consulte a Licença Pública Geral do GNU para mais detalhes. +Você deve ter recebido uma cópia da Licença Pública Geral do +GNU junto com este programa; se não, escreva para a +Free Software Foundation, Inc., no endereço +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. +*/ +if(typeof(i3GEOF) === 'undefined'){ + var i3GEOF = {}; +} +/* +Classe: i3GEOF.graficointerativo1 + +*/ +i3GEOF.graficointerativo1 = { + /* + Variavel: aguarde + + Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. + */ + aguarde: "", + /* + Propriedade: dados + + Dados que serao utilizados. Pode ser passado como parametro. + + Default: + {false} + */ + dados:false, + /* + Propriedade: titulo + + Título do gráfico. Se for vazio, será obtido do nome do tema selecionado + */ + titulo: "", + /* + Propriedade: tipo + + Tipo de gráfico escolhido pelo usuário. + */ + tipo: "", + /* + Propriedade: acumula + + Acumula os valores ao gerar o gráfico + + Type: + {boolean} + + Default: + {false} + */ + acumula: false, + /* + Propriedade: relativa + + Utiliza valores relativos ao criar o gráfico + + Type: + {boolean} + + Default: + {false} + */ + relativa: false, + /* + Propriedade: dadospuros + + Não faz nenhum tipo de processamento nos dados antes de gerar o gráfico + + Type: + {boolean} + + Default: + {false} + */ + dadospuros: false, + /* + Propriedade: navegacao + + Ativa ou não a navegação dinâmica do mapa + + Type: + {boolean} + + Default: + {false} + */ + navegacao:false, + + /* + Para efeitos de compatibilidade antes da versão 4.7 que não tinha dicionário + */ + criaJanelaFlutuante: function(dados){ + if(dados){ + i3GEOF.graficointerativo1.dados = dados; + } + i3GEOF.graficointerativo1.iniciaDicionario(); + }, + /* + Function: iniciaDicionario + + Carrega o dicionário e chama a função que inicia a ferramenta + + O Javascript é carregado com o id i3GEOF.nomedaferramenta.dicionario_script + */ + iniciaDicionario: function(dados){ + if(dados){ + i3GEOF.graficointerativo1.dados = dados; + } + if(typeof(i3GEOF.graficointerativo1.dicionario) === 'undefined'){ + i3GEO.util.scriptTag( + i3GEO.configura.locaplic+"/ferramentas/graficointerativo1/dicionario.js", + "i3GEOF.graficointerativo1.iniciaJanelaFlutuante()", + "i3GEOF.graficointerativo1.dicionario_script" + ); + } + else{ + i3GEOF.graficointerativo1.iniciaJanelaFlutuante(dados); + } + }, + /* + Function: inicia + + Inicia a ferramenta. É chamado por criaJanelaFlutuante + + Parametros: + + iddiv {String} - id do div que receberá o conteudo HTML da ferramenta + + dados {JSON} - dados para o gráfico (opcional) exemplo ["n;x","'Argentina';33796870","'Paraguay';4773464","'Brazil';151525400","'Chile';13772710"] + */ + inicia: function(iddiv){ + //try{ + $i(iddiv).innerHTML += i3GEOF.graficointerativo1.html(); + $i("i3GEOgraficointerativo1Acumula").checked = i3GEOF.graficointerativo1.acumula; + $i("i3GEOgraficointerativo1Relativa").checked = i3GEOF.graficointerativo1.relativa; + $i("i3GEOgraficointerativo1DadosPuros").checked = i3GEOF.graficointerativo1.dadospuros; + if(i3GEOF.graficointerativo1.navegacao === true) + {i3GEOF.graficointerativo1.ativaNavegacao(true);} + //eventos das guias + $i("i3GEOgraficointerativo1guia1").onclick = function(){ + i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia1","i3GEOgraficointerativo1guia"); + $i("i3GEOgraficointerativo1Grafico").style.display = "none"; + }; + $i("i3GEOgraficointerativo1guia2").onclick = function(){ + i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia2","i3GEOgraficointerativo1guia"); + i3GEOF.graficointerativo1.configuraDados(); + $i("i3GEOgraficointerativo1Grafico").style.display = "none"; + }; + $i("i3GEOgraficointerativo1guia3").onclick = function(){ + i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia3","i3GEOgraficointerativo1guia"); + $i("i3GEOgraficointerativo1Grafico").style.display = "none"; + }; + $i("i3GEOgraficointerativo1guia4").onclick = function(){ + i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia4","i3GEOgraficointerativo1guia"); + function outputStatus(e) { + //alert("oi"); + } + swfobject.embedSWF( + i3GEO.configura.locaplic+"/pacotes/openflashchart/open-flash-chart.swf", + "i3GEOgraficointerativo1Grafico", + "95%", + "88%", + "9.0.0", + "expressInstall.swf", + { + "get-data":"i3GEOF.graficointerativo1.tabela2dados", + "loading":"Criando grafico..." + }, + false, + false, + outputStatus + ); + var t = $i("i3GEOgraficointerativo1Grafico"); + t.style.display = "block"; + t.style.position = "relative"; + t.style.top = "-5px"; + t.visibility = "visible"; + }; + $i("i3GEOgraficointerativo1guia5").onclick = function(){ + i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia5","i3GEOgraficointerativo1guia"); + $i("i3GEOgraficointerativo1Grafico").style.display = "none"; + $i("i3GEOgraficointerativo1guia5obj").innerHTML = ""; + }; + + i3GEOF.graficointerativo1.ativaFoco(); + i3GEOF.graficointerativo1.comboTemas(); + new YAHOO.widget.Button( + "i3GEOgraficointerativo1botao1", + {onclick:{fn: i3GEOF.graficointerativo1.obterDados}} + ); + if(i3GEOF.graficointerativo1.dados && i3GEOF.graficointerativo1.dados != "undefined"){ + //i3GEOF.graficointerativo1.tipo = "pizza2d"; + //var retorno = {"attributes":{"id":""},"data":{"dados":["n;x","'4';3839572","'8';81710320","'7';24631314","'2';10967753","'1';24496400","'3';18752482","'5';13574480","'6';216507515"]}}; + i3GEOF.graficointerativo1.montaTabelaDados(i3GEOF.graficointerativo1.dados); + $i("i3GEOgraficointerativo1guia4").onclick.call(); + } + i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia1","i3GEOgraficointerativo1guia"); + //} + //catch(erro){i3GEO.janela.tempoMsg(erro);} + }, + /* + Function: html + + Gera o código html para apresentação das opções da ferramenta + + Retorno: + + String com o código html + */ + html:function(){ + var locaplic = i3GEO.configura.locaplic, + ins = '' + + '
' + + ' ' + + '

' + + ' ' + + '' + + ''+ + '' + + '' + + ''; + return ins; + }, + /* + Function: iniciaJanelaFlutuante + + Cria a janela flutuante para controle da ferramenta. + + Parametro + + dados {JSON} - dados para o gráfico + */ + iniciaJanelaFlutuante: function(dados){ + if(dados){ + i3GEOF.graficointerativo1.dados = dados; + } + var minimiza,cabecalho,janela,divid,temp,titulo; + //cria a janela flutuante + cabecalho = function(){ + i3GEOF.graficointerativo1.ativaFoco(); + }; + minimiza = function(){ + i3GEO.janela.minimiza("i3GEOF.graficointerativo1"); + }; + titulo = "   "+$trad("t37b")+"    "; + janela = i3GEO.janela.cria( + "380px", + "310px", + "", + "", + "", + titulo, + "i3GEOF.graficointerativo1", + false, + "hd", + cabecalho, + minimiza + ); + divid = janela[2].id; + i3GEOF.graficointerativo1.aguarde = $i("i3GEOF.graficointerativo1_imagemCabecalho").style; + $i("i3GEOF.graficointerativo1_corpo").style.backgroundColor = "white"; + $i("i3GEOF.graficointerativo1_corpo").style.overflow = "auto"; + i3GEOF.graficointerativo1.inicia(divid); + if(i3GEO.Interface){ + temp = function(){ + if(i3GEO.Interface.ATUAL !== "googlemaps" && i3GEO.Interface.ATUAL !== "googleearth"){ + i3GEO.eventos.NAVEGAMAPA.remove("i3GEOF.graficointerativo1.obterDados()"); + } + if(i3GEO.Interface.ATUAL == "googlemaps"){ + google.maps.event.removeListener(graficointerativo1Dragend); + google.maps.event.removeListener(graficointerativo1Zoomend); + } + if(i3GEO.Interface.ATUAL === "googleearth"){ + google.earth.removeEventListener(graficointerativo1Dragend); + } + if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEOF.graficointerativo1.comboTemas()") > 0) + {i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEOF.graficointerativo1.comboTemas()");} + }; + YAHOO.util.Event.addListener(janela[0].close, "click", temp); + if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEOF.graficointerativo1.comboTemas()") < 0) + {i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEOF.graficointerativo1.comboTemas()");} + } + }, + /* + Function: ativaFoco + + Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado + */ + ativaFoco: function(){ + if(i3GEO.Interface){ + i3GEO.barraDeBotoes.ativaIcone("graficointerativo1"); + } + var i = $i("i3GEOF.graficointerativo1_c").style; + i3GEO.janela.ULTIMOZINDEX++; + i.zIndex = i3GEO.janela.ULTIMOZINDEX; + }, + novaJanela: function(){ + var janela = "", + divid, + g = $i("i3GEOgraficointerativo1Grafico"), + v = g.cloneNode(true), + cabecalho = function(){}, + id = YAHOO.util.Dom.generateId(), + minimiza = function(){ + i3GEO.janela.minimiza(id); + }, + titulo = "   "+i3GEOF.graficointerativo1.titulo; + janela = i3GEO.janela.cria( + "380px", + "280px", + "", + "", + "", + titulo, + id, + false, + "hd", + cabecalho, + minimiza + ); + divid = janela[2].id; + $i(divid).style.marginTop = "0px"; + v = g.cloneNode(true); + v.id = id+"ngrafico"; + v.style.marginTop = "0px"; + $i(divid).appendChild(v); + }, + /* + Function: comboTemas + + Monta o combo para escolha do tema que será utilizado no gráfico + */ + comboTemas: function(){ + if(!i3GEO.Interface){return;} + i3GEO.util.comboTemas( + "i3GEOgraficointerativo1ComboTemasId", + function(retorno){ + $i("i3GEOgraficointerativo1ComboTemas").innerHTML = retorno.dados; + $i("i3GEOgraficointerativo1ComboTemas").style.display = "block"; + if ($i("i3GEOgraficointerativo1ComboTemasId")){ + $i("i3GEOgraficointerativo1ComboTemasId").onchange = function(){ + i3GEO.mapa.ativaTema($i("i3GEOgraficointerativo1ComboTemasId").value); + i3GEOF.graficointerativo1.comboItensSel(); + }; + } + if(i3GEO.temaAtivo !== ""){ + $i("i3GEOgraficointerativo1ComboTemasId").value = i3GEO.temaAtivo; + $i("i3GEOgraficointerativo1ComboTemasId").onchange.call(); + } + }, + "i3GEOgraficointerativo1ComboTemas", + "", + false, + "ligados", + "font-size:12px;width:350px" + ); + }, + /* + Function: ativaTipo + + Define a variável com o tipo de gráfico e mostra a guia 2 + */ + ativaTipo: function(obj){ + i3GEOF.graficointerativo1.tipo = obj.value; + if($i("i3GEOgraficointerativo1Grafico").innerHTML === "" || $i("i3GEOgraficointerativo1tabeladados").innerHTML == "") + {$i("i3GEOgraficointerativo1guia2").onclick.call();} + else + {$i("i3GEOgraficointerativo1guia4").onclick.call();} + }, + /* + Function: configuraDados + + Configura o formulário para obtenção dos dados para cada tipo de gráfico + */ + configuraDados: function(){ + var ativa = function(comboxlinha,comboylinha,ajudapizza){ + try{ + $i("i3GEOgraficointerativo1ComboXlinha").style.display = comboxlinha; + $i("i3GEOgraficointerativo1ComboYlinha").style.display = comboylinha; + $i("i3GEOgraficointerativo1AjudaPizza").style.display = ajudapizza; + }catch(e){} + }; + if (i3GEOF.graficointerativo1.tipo === ""){ + i3GEO.janela.tempoMsg("Escolha um tipo de grafico"); + i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia1","i3GEOgraficointerativo1guia"); + return; + } + if(i3GEOF.graficointerativo1.tipo === "pizza2d"){ + ativa.call("block","block","block"); + } + }, + /* + Function: comboItensSel + + Cria um combo para selecionar os itens do tema escolhido + + Veja: + + + */ + comboItensSel: function(){ + var tema = $i("i3GEOgraficointerativo1ComboTemasId").value; + i3GEO.util.comboItens( + "i3GEOgraficointerativo1ComboXid", + tema, + function(retorno){ + if(retorno.tipo === "erro"){ + $i("i3GEOgraficointerativo1ComboX").innerHTML = "

erro ao ler os itens do tema de origem

"; + $i("i3GEOgraficointerativo1ComboY").innerHTML = "

erro ao ler os itens do tema de origem

"; + } + else{ + $i("i3GEOgraficointerativo1ComboY").innerHTML = retorno.dados + " "; + $i("i3GEOgraficointerativo1ComboXid").id = "i3GEOgraficointerativo1ComboYid"; + $i("i3GEOgraficointerativo1ComboX").innerHTML = retorno.dados + " "; + $i("i3GEOgraficointerativo1ComboXid").style.width = "160px"; + $i("i3GEOgraficointerativo1ComboYid").style.width = "160px"; + $i("i3GEOgraficointerativo1ComboXid").onchange = function(){ + var combo = $i("i3GEOgraficointerativo1ComboXid"); + $i("i3GEOgraficointerativo1ComboXidTitulo").value = combo.options[combo.selectedIndex].label; + }; + $i("i3GEOgraficointerativo1ComboYid").onchange = function(){ + var combo = $i("i3GEOgraficointerativo1ComboYid"); + $i("i3GEOgraficointerativo1ComboYidTitulo").value = combo.options[combo.selectedIndex].label; + }; + } + }, + "i3GEOgraficointerativo1ComboX", + "" + ); + }, + /* + Function: obterDados + + Obtém os dados que serão utilizados no gráfico + + Veja: + + + */ + obterDados: function(){ + if(!i3GEO.Interface){ + return; + } + if(i3GEOF.graficointerativo1.aguarde.visibility === "visible") + {return;} + var tema = $i("i3GEOgraficointerativo1ComboTemasId").value, + x = $i("i3GEOgraficointerativo1ComboXid").value, + y = $i("i3GEOgraficointerativo1ComboYid").value, + excluir = $i("i3GEOgraficointerativo1excluir").value, + p = i3GEO.configura.locaplic+"/ferramentas/graficointerativo1/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=graficoSelecao&tema="+tema+"&itemclasses="+x+"&itemvalores="+y+"&exclui="+excluir+"&ext="+i3GEO.parametros.mapexten, + cp = new cpaint(), + tipo = $i("i3GEOgraficointerativo1TipoAgregacao").value, + ordenax = "sim", + monta; + + if($i("i3GEOgraficointerativo1DadosPuros").checked) + {tipo = "nenhum";} + else{ + if(x === y) + {tipo = "conta";} + } + if(!$i("i3GEOgraficointerativo1OrdenaX").checked) + {ordenax = "nao";} + + if(tema === "") + {i3GEO.janela.tempoMsg("Escolha um tema");return;} + if(x === "") + {i3GEO.janela.tempoMsg("Escolha um item para X");return;} + if(y === "") + {i3GEO.janela.tempoMsg("Escolha um item para Y");return;} + monta = function(retorno){ + i3GEOF.graficointerativo1.aguarde.visibility = "hidden"; + i3GEOF.graficointerativo1.montaTabelaDados(retorno); + $i("i3GEOgraficointerativo1guia4").onclick.call(); + i3GEO.janela.tempoMsg("Os dados utilizados referem-se apenas à região atual mostrada no mapa"); + }; + i3GEOF.graficointerativo1.aguarde.visibility = "visible"; + cp.set_response_type("JSON"); + cp.call(p+"&tipo="+tipo+"&ordenax="+ordenax,"graficoSelecao",monta); + }, + /* + Function: montaTabelaDados + + Monta a tabela com os dados que serão utilizados no gráfico + + Parametro: + + retorno {JSON} - dados no formato JSON + */ + montaTabelaDados: function(retorno){ + var dados, + n, + v, + ins = [], + i, + id, + cor = "#C11515"; + if(!retorno.dados && retorno.data != undefined) + {dados = retorno.data.dados;} + else + {dados = retorno;} + n = dados.length; + ins.push("

Tabela de dados para o gráfico. Os valores podem ser editados

"); + ins.push(""); + ins.push(""); + ins.push(""); + for (i=1;i"); + ins.push(""); + } + ins.push("
  nome  valorcor
"); + ins.push(""); + ins.push($inputText("","",id+"_nome","digite o novo nome",20,v[0],"nome")); + ins.push(""); + ins.push($inputText("","",id+"_valor","digite o novo valor",12,v[1],"valor")); + ins.push(""); + if($i("i3GEOgraficointerativo1CoresA").checked){ + cor = i3GEO.util.rgb2hex(i3GEO.util.randomRGB()); + } + //verifica se no objeto com os dados existe um terceiro valor com as cores + if(v[2]){ + cor = i3GEO.util.rgb2hex(v[2]); + } + ins.push($inputText("","",id+"_cor","",12,cor,"cor")); + ins.push(""); + ins.push("aquarela.gif"); + ins.push("

"); + $i("i3GEOgraficointerativo1Dados").innerHTML = ins.join(""); + }, + /* + Function: tabela2csv + + Obtém os dados da tabela em CSV + */ + tabela2csv: function(){ + var inputs = $i("i3GEOgraficointerativo1Dados").getElementsByTagName("input"), + ninputs = inputs.length, + i, + legendaX = "", + legendaY = "", + csv = []; + if($i("i3GEOgraficointerativo1ComboXid")) + {legendaX = $i("i3GEOgraficointerativo1ComboXid").value;} + if($i("i3GEOgraficointerativo1ComboYid")) + {legendaY = $i("i3GEOgraficointerativo1ComboYid").value;} + csv.push(legendaX+";"+legendaY); + for(i=0;i maior) + {maior = temp;} + if(temp < menor) + {menor = temp;} + temp = inputs[i].value * 1; + if(temp > maiorNome) + {maiorNome = temp;} + if(temp < menorNome) + {menorNome = temp;} + par.push({"value":inputs[i+1].value * 1,"label":inputs[i].value+" "}); + + temp = inputs[i+1].value * 1; + if($i("i3GEOgraficointerativo1Acumula").checked) + {temp = acum;} + if($i("i3GEOgraficointerativo1Relativa").checked) + {temp = (temp * 100) / total;} + parcor.push({"colour":inputs[i+2].value,"value":temp,"label":inputs[i].value+" "}); + } + if($i("i3GEOgraficointerativo1Acumula").checked){ + valores = acumulado; + maior = soma; + } + if(legendaX == legendaY){ + menor = 0; + legendaX += " (casos)"; + legendaY += " (n. de casos)"; + } + if($i("i3GEOgraficointerativo1Relativa").checked){ + n = valores.length; + for(i=0;i#percent# de 100%", + "gradient-fill": gradient + }], + "title":{ + "text": titulo, + "style": "{font-size: "+tituloSize+"; color:"+tituloCor+"; text-align: "+tituloAlinhamento+";}" + }, + "num_decimals": 2, + "is_fixed_num_decimals_forced": true, + "is_decimal_separator_comma": true, + "is_thousand_separator_disabled": true, + "x_axis": null + }; + } + if(i3GEOF.graficointerativo1.tipo === "line" || i3GEOF.graficointerativo1.tipo === "scatter" || i3GEOF.graficointerativo1.tipo === "hbar" || i3GEOF.graficointerativo1.tipo === "area" || i3GEOF.graficointerativo1.tipo === "bar_round" || i3GEOF.graficointerativo1.tipo === "bar_round_glass" || i3GEOF.graficointerativo1.tipo === "bar_filled" || i3GEOF.graficointerativo1.tipo === "bar_glass" || i3GEOF.graficointerativo1.tipo === "bar_3d" || i3GEOF.graficointerativo1.tipo === "bar_sketch" || i3GEOF.graficointerativo1.tipo === "bar_cylinder" || i3GEOF.graficointerativo1.tipo === "bar_cylinder_outline"){ + temp = valores; + if(i3GEOF.graficointerativo1.tipo === "line" || i3GEOF.graficointerativo1.tipo === "scatter" || i3GEOF.graficointerativo1.tipo === "area") + {temp = parcor;} + parametros = { + "elements":[ + { + "type": i3GEOF.graficointerativo1.tipo, + "start-angle": 180, + "colour": corunica, + "outlinecolor": outlinecolor, + "alpha": alpha, + "stroke": stroke, + "animate": 1, + "values" : temp, + "tip": "#val#", + "gradient-fill": gradient, + "fill": fill, + "fill-alpha": alpha, + "dot-style": { "type": "solid-dot", "colour": "#9C0E57", "dot-size": pointSize } + } + ], + "x_axis": { + "colour": "#A2ACBA", + "grid-colour": corGrid, + "offset": true, + "steps": 1, + "labels": { + "steps": 1, + "rotate": rotacaoX, + "colour": "#000000", + "labels": nomes + } + }, + "y_axis": { + "min": menor, + "max": maior, + "steps": parseInt((parseInt(maior - menor,10) / divisoesY),10) + }, + "x_legend": { + "text": legendaX, + "style": "{font-size: 12px; color: #778877}" + }, + "y_legend": { + "text": legendaY, + "style": "{font-size: 12px; color: #778877}" + }, + "title":{ + "text": titulo, + "style": "{font-size: "+tituloSize+"; color:"+tituloCor+"; text-align: "+tituloAlinhamento+";}" + } + }; + if($i("i3GEOgraficointerativo1AdLinhas").checked){ + parametros.elements.push({ + "type": "line", + "colour": "#FFFFFF", + "start-angle": 180, + "alpha": 0, + "stroke": 0, + "width": 0, + "animate": 1, + "values" : parcor, + "dot-style": { "type": "solid-dot", "colour": "#9C0E57", "dot-size": pointSize } + }); + } + if(i3GEOF.graficointerativo1.tipo === "hbar"){ + n = valores.length; + temp = []; + for(i=0;i 0); + p.parentNode.removeChild(p); + }, + /* + Function: corj + + Abre a janela para o usuário selecionar uma cor interativamente + */ + corj: function(obj) + {i3GEO.util.abreCor("",obj,"hex");}, + /* + Function: ordenaColuna + + Ordena uma coluna da tabela + */ + ordenaColuna: function(coluna,cid){ + try{ + var tabela = $i("i3GEOgraficointerativo1Dados").getElementsByTagName("table")[0], + trs = tabela.getElementsByTagName("tr"), + ntrs = trs.length, + psort = [], + t, + psortfim, + npsortfim, + ins, + p, + e, + temp, + chaves = [], + numero = false; + + function sortNumber(a,b) + {return a - b;} + for (t=1;t"; + npsortfim = psortfim.length; + for (p=0;p";} + } + tabela.innerHTML = ins; + } + catch(e){} + }, + /* + Function: ativaNavegacao + + Ativa ou desativa a atualização automática ao navegar no mapa + */ + ativaNavegacao: function(obj){ + if(!i3GEO.Interface){ + return; + } + if(obj === true){ + if(i3GEO.Interface.ATUAL !== "googlemaps" && i3GEO.Interface.ATUAL !== "googleearth"){ + i3GEO.eventos.NAVEGAMAPA.push("i3GEOF.graficointerativo1.obterDados()"); + } + if(i3GEO.Interface.ATUAL === "googlemaps"){ + graficointerativo1Dragend = GEvent.addListener(i3GeoMap, "dragend", function() {i3GEOF.graficointerativo1.obterDados();}); + graficointerativo1Zoomend = GEvent.addListener(i3GeoMap, "zoomend", function() {i3GEOF.graficointerativo1.obterDados();}); + } + if(i3GEO.Interface.ATUAL === "googleearth"){ + graficointerativo1Dragend = google.earth.addEventListener(i3GeoMap.getView(), "viewchangeend", function() {i3GEOF.graficointerativo1.obterDados();}); + } + } + else{ + if(i3GEO.Interface.ATUAL !== "googlemaps" && i3GEO.Interface.ATUAL !== "googleearth"){ + i3GEO.eventos.NAVEGAMAPA.remove("i3GEOF.graficointerativo1.obterDados()"); + } + if(i3GEO.Interface.ATUAL === "googlemaps"){ + GEvent.removeListener(graficointerativo1Dragend); + GEvent.removeListener(graficointerativo1Zoomend); + } + if(i3GEO.Interface.ATUAL === "googleearth"){ + google.earth.removeEventListener(graficointerativo1Dragend); + } + } + } +}; +//pacotes/openflashchart/json2.js +if (!this.JSON1) { + JSON1 = function () { + + function f(n) { // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + Date.prototype.toJSON = function () { + return this.getUTCFullYear() + '-' + + f(this.getUTCMonth() + 1) + '-' + + f(this.getUTCDate()) + 'T' + + f(this.getUTCHours()) + ':' + + f(this.getUTCMinutes()) + ':' + + f(this.getUTCSeconds()) + 'Z'; + }; + var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + function quote(string) { + return escapeable.test(string) ? + '"' + string.replace(escapeable, function (a) { + var c = meta[a]; + if (typeof c === 'string') { + return c; + } + c = a.charCodeAt(); + return '\\u00' + Math.floor(c / 16).toString(16) + + (c % 16).toString(16); + }) + '"' : + '"' + string + '"'; + } + function str(key, holder) { + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + if (value && typeof value === 'object' && + typeof value.toJSON === 'function') { + value = value.toJSON(key); + } + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + return String(value); + case 'object': + if (!value) { + return 'null'; + } + gap += indent; + partial = []; + if (typeof value.length === 'number' && + !(value.propertyIsEnumerable('length'))) { + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + v = partial.length === 0 ? '[]' : + gap ? '[\n' + gap + partial.join(',\n' + gap) + + '\n' + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + if (typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + k = rep[i]; + if (typeof k === 'string') { + v = str(k, value, rep); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + for (k in value) { + v = str(k, value, rep); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + v = partial.length === 0 ? '{}' : + gap ? '{\n' + gap + partial.join(',\n' + gap) + + '\n' + mind + '}' : + '{' + partial.join(',') + '}'; + gap = mind; + return v; + } + } + return { + stringify: function (value, replacer, space) { + var i; + gap = ''; + indent = ''; + if (space) { + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + } else if (typeof space === 'string') { + indent = space; + } + } + if (!replacer) { + rep = function (key, value) { + if (!Object.hasOwnProperty.call(this, key)) { + return undefined; + } + return value; + }; + } else if (typeof replacer === 'function' || + (typeof replacer === 'object' && + typeof replacer.length === 'number')) { + rep = replacer; + } else { + throw new Error('JSON.stringify'); + } + return str('', {'': value}); + }, + parse: function (text, reviver) { + var j; + + function walk(holder, key) { + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@'). +replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). +replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + j = eval('(' + text + ')'); + return typeof reviver === 'function' ? + walk({'': j}, '') : j; + } + throw new SyntaxError('JSON.parse'); + }, + quote: quote + }; + }(); +} + + + + +/* SWFObject v2.2 + is released under the MIT License +*/ +swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab