diff --git a/ferramentas/graficointerativo1/dicionario.js b/ferramentas/graficointerativo1/dicionario.js index 2d6342e..3d439ac 100755 --- a/ferramentas/graficointerativo1/dicionario.js +++ b/ferramentas/graficointerativo1/dicionario.js @@ -1,316 +1,430 @@ //+$trad(1,i3GEOF.graficointerativo1.dicionario)+ -i3GEOF.graficointerativo1.dicionario = { - 1: [{ - pt:"Tipo", - en:"", - es:"", - it:"" - }], - 2: [{ - pt:"Dados", - en:"", - es:"", - it:"" - }], - 3: [{ - pt:"Gráfico", - en:"", - es:"", - it:"" - }], - 4: [{ - pt:"Escolha o tipo de gráfico", - en:"", - es:"", - it:"" - }], - 5: [{ - pt:"pizza 2d", - en:"", - es:"", - it:"" - }], - 6: [{ - pt:"área simples", - en:"", - es:"", - it:"" - }], - 7: [{ - pt:"distribuição de pontos", - en:"", - es:"", - it:"" - }], - 8: [{ - pt:"linhas simples", - en:"", - es:"", - it:"" - }], - 9: [{ - pt:"Árvore", - en:"", - es:"", - it:"" - }], - 10: [{ - pt:"barras verticais", - en:"", - es:"", - it:"" - }], - 11: [{ - pt:"barras horizontais", - en:"", - es:"", - it:"" - }], - 12: [{ - pt:"Configuração do gráfico", - en:"", - es:"", - it:"" - }], - 13: [{ - pt:"Tema", - en:"", - es:"", - it:"" - }], - 14: [{ - pt:"Item com as classes ou eixo X", - en:"", - es:"", - it:"" - }], - 15: [{ - pt:"Item(ns) com os valores ou eixo Y", - en:"", - es:"", - it:"" - }], - 16: [{ - pt:"Excluir o seguinte valor", - en:"", - es:"", - it:"" - }], - 17: [{ - pt:"gera cores aleatórias", - en:"", - es:"", - it:"" - }], - 18: [{ - pt:"Obter dados", - en:"", - es:"", - it:"" - }], - 19: [{ - pt:"Se vc escolher para X e Y o mesmo item, será considerada a frequência das ocorrências para compor cada parte da pizza. Caso contrário, será feita a soma dos valores existentes em Y para cada ocorrência existente em X.", - en:"", - es:"", - it:"" - }], - 20: [{ - pt:"Inclina os textos do eixo X", - en:"", - es:"", - it:"" - }], - 21: [{ - pt:"Adiciona as linhas em gráficos de barras", - en:"", - es:"", - it:"" - }], - 22: [{ - pt:"Utiliza valores acumulados", - en:"",titleFont: 'bold 14px sans-serif', - titlePosition: "top", - es:"", - it:"" - }], - 23: [{ - pt:"Utiliza valores relativos", - en:"", - es:"", - it:"" - }], - 24: [{ - pt:"Ordena o eixo X", - en:"", - es:"", - it:"" - }], - 25: [{ - pt:"Não processa os valores ao obter os dados (mantém os dados como estão na tabela de atributos) - essa opção é útil nos gráficos de distribuição de pontos", - en:"", - es:"", - it:"" - }], - 26: [{ - pt:"Soma", - en:"", - es:"", - it:"" - }], - 27: [{ - pt:"Média", - en:"", - es:"", - it:"" - }], - 28: [{ - pt:"Tipo de agregação dos valores do eixo Y", - en:"", - es:"", - it:"" - }], - 29: [{ - pt:"Fator de cálculo da largura do gráfico. O número de ocorrências será multiplicado por esse fator para calcular o tamanho final do gráfico em pixels. Deixe como 0 para usar o cálculo automático.", - en:"", - es:"", - it:"" - }], - 30: [{ - pt:"abrir em uma janela separada", - en:"", - es:"", - it:"" - }], - 31: [{ - pt:"Escolha um tipo de grafico", - en:"", - es:"", - it:"" - }], - 32: [{ - pt:"erro ao ler os itens do tema de origem", - en:"", - es:"", - it:"" - }], - 33: [{ - pt:"Digite o título para legenda", - en:"", - es:"", - it:"" - }], - 34: [{ - pt:"Escolha um tema", - en:"", - es:"", - it:"" - }], - 35: [{ - pt:"Escolha um item para X", - en:"", - es:"", - it:"" - }], - 36: [{ - pt:"Escolha um item para Y", - en:"", - es:"", - it:"" - }], - 37: [{ - pt:"Os dados utilizados referem-se apenas à região atual mostrada no mapa", - en:"", - es:"", - it:"" - }], - 38: [{ - pt:"Tabela de dados para o gráfico. Os valores podem ser editados", - en:"", - es:"", - it:"" - }], - 39: [{ - pt:"nome", - en:"", - es:"", - it:"" - }], - 40: [{ - pt:"valor", - en:"", - es:"", - it:"" - }], - 41: [{ - pt:"cor", - en:"", - es:"", - it:"" - }], - 42: [{ - pt:"excluir", - en:"", - es:"", - it:"" - }], - 43: [{ - pt:"digite o novo nome", - en:"", - es:"", - it:"" - }], - 44: [{ - pt:"digite o novo valor", - en:"", - es:"", - it:"" - }], - 45: [{ - pt:"casos", - en:"", - es:"", - it:"" - }], - 46: [{ - pt:"n. de casos", - en:"", - es:"", - it:"" - }], - 47: [{ - pt:"Atualiza o gráfico ao navegar pelo mapa", - en:"", - es:"", - it:"" - }], - 48: [{ - pt:"Utiliza barras divididas entre os valores (stacked)", - en:"", - es:"", - it:"" - }], - 49: [{ - pt:"As linhas de dados ficam nas colunas", - en:"", - es:"", - it:"" - }], - 50: [{ - pt:"Título", - en:"", - es:"", - it:"" - }], - 51: [{ - pt:"Título do eixo X", - en:"", - es:"", - it:"" - }], - 52: [{ - pt:"Título do eixo Y", - en:"", - es:"", - it:"" - }] -}; \ No newline at end of file +i3GEOF.graficointerativo1.dicionario = + { + 1 : [ + { + pt : "Tipo", + en : "", + es : "", + it : "" + } + ], + 2 : [ + { + pt : "Dados", + en : "", + es : "", + it : "" + } + ], + 3 : [ + { + pt : "Gráfico", + en : "", + es : "", + it : "" + } + ], + 4 : [ + { + pt : "Escolha o tipo de gráfico", + en : "", + es : "", + it : "" + } + ], + 5 : [ + { + pt : "pizza 2d", + en : "", + es : "", + it : "" + } + ], + 6 : [ + { + pt : "área simples", + en : "", + es : "", + it : "" + } + ], + 7 : [ + { + pt : "distribuição de pontos", + en : "", + es : "", + it : "" + } + ], + 8 : [ + { + pt : "linhas simples", + en : "", + es : "", + it : "" + } + ], + 9 : [ + { + pt : "Árvore", + en : "", + es : "", + it : "" + } + ], + 10 : [ + { + pt : "barras verticais", + en : "", + es : "", + it : "" + } + ], + 11 : [ + { + pt : "barras horizontais", + en : "", + es : "", + it : "" + } + ], + 12 : [ + { + pt : "Configuração do gráfico", + en : "", + es : "", + it : "" + } + ], + 13 : [ + { + pt : "Tema", + en : "", + es : "", + it : "" + } + ], + 14 : [ + { + pt : "Item com as classes ou eixo X", + en : "", + es : "", + it : "" + } + ], + 15 : [ + { + pt : "Item(ns) com os valores ou eixo Y", + en : "", + es : "", + it : "" + } + ], + 16 : [ + { + pt : "Excluir o seguinte valor", + en : "", + es : "", + it : "" + } + ], + 17 : [ + { + pt : "gera cores aleatórias", + en : "", + es : "", + it : "" + } + ], + 18 : [ + { + pt : "Obter dados", + en : "", + es : "", + it : "" + } + ], + 19 : [ + { + pt : "Se vc escolher para X e Y o mesmo item, será considerada a frequência das ocorrências para compor cada parte da pizza. Caso contrário, será feita a soma dos valores existentes em Y para cada ocorrência existente em X.", + en : "", + es : "", + it : "" + } + ], + 20 : [ + { + pt : "Inclina os textos do eixo X", + en : "", + es : "", + it : "" + } + ], + 21 : [ + { + pt : "Adiciona as linhas em gráficos de barras", + en : "", + es : "", + it : "" + } + ], + 22 : [ + { + pt : "Utiliza valores acumulados", + en : "", + titleFont : 'bold 14px sans-serif', + titlePosition : "top", + es : "", + it : "" + } + ], + 23 : [ + { + pt : "Utiliza valores relativos", + en : "", + es : "", + it : "" + } + ], + 24 : [ + { + pt : "Ordena o eixo X", + en : "", + es : "", + it : "" + } + ], + 25 : [ + { + pt : "Não processa os valores ao obter os dados (mantém os dados como estão na tabela de atributos) - essa opção é útil nos gráficos de distribuição de pontos", + en : "", + es : "", + it : "" + } + ], + 26 : [ + { + pt : "Soma", + en : "", + es : "", + it : "" + } + ], + 27 : [ + { + pt : "Média", + en : "", + es : "", + it : "" + } + ], + 28 : [ + { + pt : "Tipo de agregação dos valores do eixo Y", + en : "", + es : "", + it : "" + } + ], + 29 : [ + { + pt : "Fator de cálculo da largura do gráfico. O número de ocorrências será multiplicado por esse fator para calcular o tamanho final do gráfico em pixels. Deixe como 0 para usar o cálculo automático.", + en : "", + es : "", + it : "" + } + ], + 30 : [ + { + pt : "abrir em uma janela separada", + en : "", + es : "", + it : "" + } + ], + 31 : [ + { + pt : "Escolha um tipo de grafico", + en : "", + es : "", + it : "" + } + ], + 32 : [ + { + pt : "erro ao ler os itens do tema de origem", + en : "", + es : "", + it : "" + } + ], + 33 : [ + { + pt : "Digite o título para legenda", + en : "", + es : "", + it : "" + } + ], + 34 : [ + { + pt : "Escolha um tema", + en : "", + es : "", + it : "" + } + ], + 35 : [ + { + pt : "Escolha um item para X", + en : "", + es : "", + it : "" + } + ], + 36 : [ + { + pt : "Escolha um item para Y", + en : "", + es : "", + it : "" + } + ], + 37 : [ + { + pt : "Os dados utilizados referem-se apenas à região atual mostrada no mapa", + en : "", + es : "", + it : "" + } + ], + 38 : [ + { + pt : "Tabela de dados para o gráfico. Os valores podem ser editados", + en : "", + es : "", + it : "" + } + ], + 39 : [ + { + pt : "nome", + en : "", + es : "", + it : "" + } + ], + 40 : [ + { + pt : "valor", + en : "", + es : "", + it : "" + } + ], + 41 : [ + { + pt : "cor", + en : "", + es : "", + it : "" + } + ], + 42 : [ + { + pt : "excluir", + en : "", + es : "", + it : "" + } + ], + 43 : [ + { + pt : "digite o novo nome", + en : "", + es : "", + it : "" + } + ], + 44 : [ + { + pt : "digite o novo valor", + en : "", + es : "", + it : "" + } + ], + 45 : [ + { + pt : "casos", + en : "", + es : "", + it : "" + } + ], + 46 : [ + { + pt : "n. de casos", + en : "", + es : "", + it : "" + } + ], + 47 : [ + { + pt : "Atualiza o gráfico ao navegar pelo mapa", + en : "", + es : "", + it : "" + } + ], + 48 : [ + { + pt : "Utiliza barras divididas entre os valores (stacked)", + en : "", + es : "", + it : "" + } + ], + 49 : [ + { + pt : "As linhas de dados ficam nas colunas", + en : "", + es : "", + it : "" + } + ], + 50 : [ + { + pt : "Título", + en : "", + es : "", + it : "" + } + ], + 51 : [ + { + pt : "Título do eixo X", + en : "", + es : "", + it : "" + } + ], + 52 : [ + { + pt : "Título do eixo Y", + en : "", + es : "", + it : "" + } + ], + 53 : [ + { + pt : "Atualiza ao navegar", + en : "", + es : "", + it : "" + } + ] + }; \ No newline at end of file diff --git a/ferramentas/graficointerativo1/index.js b/ferramentas/graficointerativo1/index.js index 113a0d8..1be9637 100755 --- a/ferramentas/graficointerativo1/index.js +++ b/ferramentas/graficointerativo1/index.js @@ -1,123 +1,115 @@ -/* -Title: Gráfico interativo 1 - -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. +/** + * Title: Gráfico interativo 1 + * + * 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. +i3GEOF.graficointerativo1 = + { + /** + * Array com os ids das janelas ja criadas */ - aguarde : "", - /* + janelas : [], + propJanelas : {}, + /** * 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 + * + * 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 - * + * + * 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 - * + * + * 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 + /** + * Para efeitos de compatibilidade antes da versão 4.7 que não tinha dicionário */ criaJanelaFlutuante : function(dados) { if (dados) { @@ -125,636 +117,628 @@ i3GEOF.graficointerativo1 = { } 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 + * + * 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; } + var temp = function() { + i3GEOF.graficointerativo1.ativaNavegacao(); + i3GEOF.graficointerativo1.iniciaJanelaFlutuante(dados); + }; if (typeof (i3GEOF.graficointerativo1.dicionario) === 'undefined') { - i3GEO.util.scriptTag(i3GEO.configura.locaplic - + "/ferramentas/graficointerativo1/dependencias.php", - "i3GEOF.graficointerativo1.iniciaJanelaFlutuante()", - "i3GEOF.graficointerativo1.dicionario_script"); + i3GEO.util.scriptTag( + i3GEO.configura.locaplic + "/ferramentas/graficointerativo1/dependencias.php", + temp, + "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 - * + * + * 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) { + inicia : function(iddiv, idjanela) { // 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 - - //tipos de graficos - $i("i3GEOgraficointerativo1guia1").onclick = function() { - i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia1", - "i3GEOgraficointerativo1guia"); - $i("i3GEOgraficointerativo1Grafico").style.display = "none"; + $i(iddiv).innerHTML += i3GEOF.graficointerativo1.html(idjanela); + $i(idjanela + "i3GEOgraficointerativo1Acumula").checked = i3GEOF.graficointerativo1.propJanelas[idjanela].acumula; + $i(idjanela + "i3GEOgraficointerativo1Relativa").checked = i3GEOF.graficointerativo1.propJanelas[idjanela].relativa; + $i(idjanela + "i3GEOgraficointerativo1DadosPuros").checked = i3GEOF.graficointerativo1.propJanelas[idjanela].dadospuros; + // tipos de graficos + $i(idjanela + "i3GEOgraficointerativo1guia1").onclick = function() { + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOgraficointerativo1guia1", idjanela + "i3GEOgraficointerativo1guia"); + $i(idjanela + "i3GEOgraficointerativo1Grafico").style.display = "none"; }; - //dados para o grafico - $i("i3GEOgraficointerativo1guia2").onclick = function() { - if(i3GEOF.graficointerativo1.tipo === ""){ + // dados para o grafico + $i(idjanela + "i3GEOgraficointerativo1guia2").onclick = function() { + if (i3GEOF.graficointerativo1.propJanelas[idjanela].tipo === "") { alert($trad(4, i3GEOF.graficointerativo1.dicionario)); return; } - i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia2","i3GEOgraficointerativo1guia"); - i3GEOF.graficointerativo1.configuraDados(); - $i("i3GEOgraficointerativo1Grafico").style.display = "none"; + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOgraficointerativo1guia2", idjanela + "i3GEOgraficointerativo1guia"); + i3GEOF.graficointerativo1.configuraDados(idjanela); + $i(idjanela + "i3GEOgraficointerativo1Grafico").style.display = "none"; }; - //propriedades adicionais - $i("i3GEOgraficointerativo1guia3").onclick = function() { - i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia3", - "i3GEOgraficointerativo1guia"); - $i("i3GEOgraficointerativo1Grafico").style.display = "none"; + // propriedades adicionais + $i(idjanela + "i3GEOgraficointerativo1guia3").onclick = function() { + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOgraficointerativo1guia3", idjanela + "i3GEOgraficointerativo1guia"); + $i(idjanela + "i3GEOgraficointerativo1Grafico").style.display = "none"; }; - //mostra o grafico - $i("i3GEOgraficointerativo1guia4").onclick = function() { - if(i3GEOF.graficointerativo1.tipo === ""){ + // mostra o grafico + $i(idjanela + "i3GEOgraficointerativo1guia4").onclick = function() { + if (i3GEOF.graficointerativo1.propJanelas[idjanela].tipo === "") { alert($trad(4, i3GEOF.graficointerativo1.dicionario)); return; } - if($i("i3GEOgraficointerativo1Dados").innerHTML === ""){ + if ($i(idjanela + "i3GEOgraficointerativo1Dados").innerHTML === "") { return; } - i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia4","i3GEOgraficointerativo1guia"); - var t = $i("i3GEOgraficointerativo1Grafico"); + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOgraficointerativo1guia4", idjanela + "i3GEOgraficointerativo1guia"); + var t = $i(idjanela + "i3GEOgraficointerativo1Grafico"); t.style.display = "block"; t.style.position = "relative"; t.style.top = "-5px"; t.visibility = "visible"; - i3GEOF.graficointerativo1.tabela2dados(); - }; - $i("i3GEOgraficointerativo1guia5").onclick = function() { - if(i3GEOF.graficointerativo1.tipo === ""){ - alert($trad(4, i3GEOF.graficointerativo1.dicionario)); - return; - } - if($i("i3GEOgraficointerativo1Dados").innerHTML === ""){ - return; - } - i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia5","i3GEOgraficointerativo1guia"); - $i("i3GEOgraficointerativo1Grafico").style.display = "none"; - $i("i3GEOgraficointerativo1guia5obj").innerHTML = ""; - }; - $i("i3GEOgraficointerativo1guia6").onclick = function() { - if(i3GEOF.graficointerativo1.tipo === ""){ - alert($trad(4, i3GEOF.graficointerativo1.dicionario)); - return; - } - if($i("i3GEOgraficointerativo1Dados").innerHTML === ""){ - return; - } - var w,h,form = $i("i3GEOgraficointerativo1PNG"), - isvg = form.getElementsByTagName("input")[0], - svg = $i("i3GEOgraficointerativo1guia4objCanvas").firstChild; - h = svg.getAttributeNS(null, 'height'); - w = svg.getAttributeNS(null, 'width'); - if (typeof XMLSerializer != "undefined"){ - svg = (new XMLSerializer()).serializeToString(svg); - } else { - svg = svg.html(); - } - isvg.value = svg; - form.action = form.action+"?"+"w="+w+"&h="+h; - form.submit(); + i3GEOF.graficointerativo1.tabela2dados(idjanela); }; - i3GEOF.graficointerativo1.ativaFoco(); - i3GEOF.graficointerativo1.comboTemas(); - new YAHOO.widget.Button("i3GEOgraficointerativo1botao1", { + $i(idjanela + "i3GEOgraficointerativo1guia5").onclick = + function() { + if (i3GEOF.graficointerativo1.tipo === "") { + alert($trad(4, i3GEOF.graficointerativo1.dicionario)); + return; + } + if ($i(idjanela + "i3GEOgraficointerativo1Dados").innerHTML === "") { + return; + } + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOgraficointerativo1guia5", idjanela + "i3GEOgraficointerativo1guia"); + $i(idjanela + "i3GEOgraficointerativo1Grafico").style.display = "none"; + $i(idjanela + "i3GEOgraficointerativo1guia5obj").innerHTML = + ""; + }; + $i(idjanela + "i3GEOgraficointerativo1guia6").onclick = + function() { + if (i3GEOF.graficointerativo1.tipo === "") { + alert($trad(4, i3GEOF.graficointerativo1.dicionario)); + return; + } + if ($i(idjanela + "i3GEOgraficointerativo1Dados").innerHTML === "") { + return; + } + var w, h, form = $i(idjanela + "i3GEOgraficointerativo1PNG"), isvg = form.getElementsByTagName("input")[0], svg = + $i(idjanela + "i3GEOgraficointerativo1guia4objCanvas").firstChild; + h = svg.getAttributeNS(null, 'height'); + w = svg.getAttributeNS(null, 'width'); + if (typeof XMLSerializer != "undefined") { + svg = (new XMLSerializer()).serializeToString(svg); + } else { + svg = svg.html(); + } + isvg.value = svg; + form.action = form.action + "?" + "w=" + w + "&h=" + h; + form.submit(); + }; + i3GEOF.graficointerativo1.ativaFoco(idjanela); + i3GEOF.graficointerativo1.comboTemas(idjanela); + new YAHOO.widget.Button(idjanela + "i3GEOgraficointerativo1botao1", { onclick : { - fn : i3GEOF.graficointerativo1.obterDados + fn : function() { + i3GEOF.graficointerativo1.obterDados(idjanela); + } } }); - if (i3GEOF.graficointerativo1.dados && i3GEOF.graficointerativo1.dados != "undefined") { - i3GEOF.graficointerativo1.montaTabelaDados(i3GEOF.graficointerativo1.dados); - $i("i3GEOgraficointerativo1guia4").onclick.call(); - } - else{ - i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia1","i3GEOgraficointerativo1guia"); + if (i3GEOF.graficointerativo1.propJanelas[idjanela].dados + && i3GEOF.graficointerativo1.propJanelas[idjanela].dados != "undefined") { + i3GEOF.graficointerativo1.montaTabelaDados(idjanela, i3GEOF.graficointerativo1.propJanelas[idjanela].dados); + $i(idjanela + "i3GEOgraficointerativo1guia4").onclick.call(); + } else { + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOgraficointerativo1guia1", idjanela + "i3GEOgraficointerativo1guia"); } }, - /* + /** * Function: html - * - * Gera o código html para apresentação das - * opções da ferramenta - * + * + * 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 = '' - + '
' - //tipos de grafico - + ' ' - //obtencao dos dados e parametros - + '' + // aqui vai o grafico + + '' + // csv + + '' + // png + + '' + ''; return ins; }, - /* + /** * Function: iniciaJanelaFlutuante - * + * * Cria a janela flutuante para controle da ferramenta. - * + * * Parametro - * + * * dados {JSON} - dados para o gráfico */ iniciaJanelaFlutuante : function(dados) { + // id utilizado para diferenciar cada janela e seus respectivos + // componentes + idjanela = "graficoi" + parseInt(Math.random() * 1000000, 10); + i3GEOF.graficointerativo1.janelas.push(idjanela); + i3GEOF.graficointerativo1.propJanelas[idjanela] = {}; + i3GEOF.graficointerativo1.propJanelas[idjanela].tema = i3GEO.temaAtivo; + i3GEOF.graficointerativo1.propJanelas[idjanela].atualiza = false; + i3GEOF.graficointerativo1.propJanelas[idjanela].dados = dados; + // guarda para esse grafico alguns valores default obtidos dos + // parametros gerais da ferramenta + i3GEOF.graficointerativo1.propJanelas[idjanela].acumula = i3GEOF.graficointerativo1.acumula; + i3GEOF.graficointerativo1.propJanelas[idjanela].relativa = i3GEOF.graficointerativo1.relativa; + i3GEOF.graficointerativo1.propJanelas[idjanela].dadospuros = i3GEOF.graficointerativo1.dadospuros; + if (dados) { - i3GEOF.graficointerativo1.dados = dados; + i3GEOF.graficointerativo1.propJanelas[idjanela].dados = dados; } var minimiza, cabecalho, janela, divid, temp, titulo; // cria a janela flutuante cabecalho = function() { - i3GEOF.graficointerativo1.ativaFoco(); + i3GEOF.graficointerativo1.ativaFoco(idjanela); }; minimiza = function() { - i3GEO.janela.minimiza("i3GEOF.graficointerativo1"); + i3GEO.janela.minimiza(idjanela); }; - mudaTamanhoGrafico = function(){ - var t = $i("i3GEOgraficointerativo1Grafico"); - if(t.style.display === "block"){ - i3GEOF.graficointerativo1.tabela2dados(); + mudaTamanhoGrafico = function() { + var t = $i(idjanela + "i3GEOgraficointerativo1Grafico"); + if (t.style.display === "block") { + i3GEOF.graficointerativo1.tabela2dados(idjanela); } }; - titulo = "   " - + $trad("t37b") - + "    "; - janela = i3GEO.janela.cria( + duplica = function() { + i3GEOF.graficointerativo1.iniciaJanelaFlutuante(); + }; + titulo = + "   " + $trad("t37b") + "    "; + janela = + i3GEO.janela.cria( "480px", - "450px", - "", - "", - "", + "450px", + "", + "", + "", titulo, - "i3GEOF.graficointerativo1", - false, - "hd", - cabecalho, - minimiza, + idjanela, + false, + "hd", + cabecalho, + minimiza, mudaTamanhoGrafico, true, - i3GEO.configura.locaplic+"/imagens/oxygen/16x16/view-statistics.png" - ); + i3GEO.configura.locaplic + "/imagens/oxygen/16x16/view-statistics.png", + duplica); 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); + i3GEOF.graficointerativo1.aguarde = $i(idjanela + "_imagemCabecalho").style; + $i(idjanela + "_corpo").style.backgroundColor = "white"; + $i(idjanela + "_corpo").style.overflow = "auto"; + + i3GEOF.graficointerativo1.propJanelas[idjanela].aguarde = $i(idjanela + "_imagemCabecalho").style; + i3GEOF.graficointerativo1.propJanelas[idjanela].atualiza = true; + // indica se a janela sera atualizada na navegacao + temp = 'i3GEOF.graficointerativo1.propJanelas["' + idjanela + '"].atualiza = this.checked'; + janela[0] + .setFooter("
 " + $trad(53, i3GEOF.graficointerativo1.dicionario) + " (" + idjanela + ")
"); + + i3GEOF.graficointerativo1.inicia(divid, idjanela); 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()"); - } - }; + 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('" + idjanela + "')") > 0) { + i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEOF.graficointerativo1.comboTemas('" + idjanela + "')"); + } + }; 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()"); + if (i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEOF.graficointerativo1.comboTemas('" + idjanela + "')") < 0) { + i3GEO.eventos.ATUALIZAARVORECAMADAS.push("i3GEOF.graficointerativo1.comboTemas('" + idjanela + "')"); } } janela[0].bringToTop(); }, - /* + /** * Function: ativaFoco - * - * Refaz a interface da ferramenta quando a janela flutuante tem seu foco - * ativado + * + * Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado */ - ativaFoco : function() { + ativaFoco : function(idjanela) { if (i3GEO.Interface) { i3GEO.barraDeBotoes.ativaIcone("graficointerativo1"); } - var i = $i("i3GEOF.graficointerativo1_c").style; + var i = $i(idjanela + "_c").style; i3GEO.janela.ULTIMOZINDEX++; i.zIndex = i3GEO.janela.ULTIMOZINDEX; }, - novaJanela : function() { - var janela = "", divid, g = $i("i3GEOgraficointerativo1guia4objCanvas"), v = g - .cloneNode(true), cabecalho = function() { - }, id = YAHOO.util.Dom.generateId(), minimiza = function() { + novaJanela : function(idjanela) { + var janela = "", divid, g, v, cabecalho, id, minimiza, titulo; + g = $i(idjanela + "i3GEOgraficointerativo1guia4objCanvas"); + 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); + }; + titulo = "   " + i3GEOF.graficointerativo1.propJanelas[idjanela].titulo; + janela = i3GEO.janela.cria("380px", "280px", "", "", "", titulo, id, false, "hd", cabecalho, minimiza); divid = janela[2].id; $i(divid).style.marginTop = "0px"; 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 + * + * Monta o combo para escolha do tema que será utilizado no gráfico */ - comboTemas : function() { + comboTemas : function(idjanela) { 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"); + i3GEO.util.comboTemas(idjanela + "i3GEOgraficointerativo1ComboTemasId", function(retorno) { + $i(idjanela + "i3GEOgraficointerativo1ComboTemas").innerHTML = retorno.dados; + $i(idjanela + "i3GEOgraficointerativo1ComboTemas").style.display = "block"; + if ($i(idjanela + "i3GEOgraficointerativo1ComboTemasId")) { + $i(idjanela + "i3GEOgraficointerativo1ComboTemasId").onchange = function() { + i3GEO.mapa.ativaTema($i(idjanela + "i3GEOgraficointerativo1ComboTemasId").value); + i3GEOF.graficointerativo1.comboItensSel(idjanela); + }; + } + if (i3GEO.temaAtivo !== "") { + $i(idjanela + "i3GEOgraficointerativo1ComboTemasId").value = i3GEO.temaAtivo; + $i(idjanela + "i3GEOgraficointerativo1ComboTemasId").onchange.call(); + } + }, idjanela + "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 + * + * Define a variável com o tipo de gráfico e mostra a guia2 */ - ativaTipo : function(obj) { - if(obj){ - i3GEOF.graficointerativo1.tipo = obj.value; + ativaTipo : function(obj, idjanela) { + if (obj) { + i3GEOF.graficointerativo1.propJanelas[idjanela].tipo = obj.value; } - if(i3GEOF.graficointerativo1.tipo == "ponto_1"){ - $i("i3GEOgraficointerativo1DadosPuros").checked = true; - } - else{ - $i("i3GEOgraficointerativo1DadosPuros").checked = false; + if (i3GEOF.graficointerativo1.propJanelas[idjanela].tipo == "ponto_1") { + $i(idjanela + "i3GEOgraficointerativo1DadosPuros").checked = true; + } else { + $i(idjanela + "i3GEOgraficointerativo1DadosPuros").checked = false; } - if (!$i("i3GEOgraficointerativo1tabeladados") || $i("i3GEOgraficointerativo1tabeladados").innerHTML == "") { - $i("i3GEOgraficointerativo1guia2").onclick.call(); + if (!$i(idjanela + "i3GEOgraficointerativo1tabeladados") || $i(idjanela + "i3GEOgraficointerativo1tabeladados").innerHTML == "") { + $i(idjanela + "i3GEOgraficointerativo1guia2").onclick.call(); } else { - $i("i3GEOgraficointerativo1guia4").onclick.call(); + $i(idjanela + "i3GEOgraficointerativo1guia4").onclick.call(); } }, - alteraFatorPixel: function(tipo){ - var delta = 20, - temp = $i("i3GEOgraficointerativo1FatorTamanho"), - v = parseInt(temp.value,10); - if(temp.value >= 0){ - if(tipo === "mais"){ + alteraFatorPixel : function(tipo, idjanela) { + var delta = 20, temp = $i(idjanela + "i3GEOgraficointerativo1FatorTamanho"), v = parseInt(temp.value, 10); + if (temp.value >= 0) { + if (tipo === "mais") { temp.value = v + delta; - } - else{ + } else { temp.value = v - delta; } } - if(parseInt(temp.value,10) < 0){ + if (parseInt(temp.value, 10) < 0) { temp.value = 0; } - $i("i3GEOgraficointerativo1guia4").onclick.call(); + $i(idjanela + "i3GEOgraficointerativo1guia4").onclick.call(); }, - /* + /** * Function: configuraDados - * - * Configura o formulário para obtenção dos dados para - * cada tipo de gráfico + * + * Configura o formulário para obtenção dos dados para cada tipo de gráfico */ - configuraDados : function() { + configuraDados : function(idjanela) { var ativa = function(comboxlinha, comboylinha, ajudapizza) { try { - $i("i3GEOgraficointerativo1ComboXlinha").style.display = comboxlinha; - $i("i3GEOgraficointerativo1ComboYlinha").style.display = comboylinha; - $i("i3GEOgraficointerativo1AjudaPizza").style.display = ajudapizza; - } catch (e) {} + $i(idjanela + "i3GEOgraficointerativo1ComboXlinha").style.display = comboxlinha; + $i(idjanela + "i3GEOgraficointerativo1ComboYlinha").style.display = comboylinha; + $i(idjanela + "i3GEOgraficointerativo1AjudaPizza").style.display = ajudapizza; + } catch (e) { + } }; - if (i3GEOF.graficointerativo1.tipo === "") { - i3GEO.janela.tempoMsg($trad(31, - i3GEOF.graficointerativo1.dicionario)); - i3GEO.guias.mostraGuiaFerramenta("i3GEOgraficointerativo1guia1", - "i3GEOgraficointerativo1guia"); + if (i3GEOF.graficointerativo1.propJanelas[idjanela].tipo === "") { + i3GEO.janela.tempoMsg($trad(31, i3GEOF.graficointerativo1.dicionario)); + i3GEO.guias.mostraGuiaFerramenta(idjanela + "i3GEOgraficointerativo1guia1", idjanela + "i3GEOgraficointerativo1guia"); return; } - if (i3GEOF.graficointerativo1.tipo === "pizza2d") { + if (i3GEOF.graficointerativo1.propJanelas[idjanela].tipo === "pizza2d") { ativa.call("block", "block", "block"); } }, - /* + /** * Function: comboItensSel - * + * * Cria um combo para selecionar os itens do tema escolhido - * + * * Veja: - * + * * */ - comboItensSel : function() { - var adicionaFilho = function(){}, - tema = $i("i3GEOgraficointerativo1ComboTemasId").value; - i3GEO.util - .comboItens( - "i3GEOgraficointerativo1ComboXid", - tema, - function(retorno) { - if (retorno.tipo === "erro") { - $i("i3GEOgraficointerativo1ComboX").innerHTML = "

" - + $trad( - 32, - i3GEOF.graficointerativo1.dicionario) - + "

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

" - + $trad( - 32, - i3GEOF.graficointerativo1.dicionario) - + "

"; - } else { - $i("i3GEOgraficointerativo1ComboY").innerHTML = "
" - + retorno.dados - + " " - + " " - + "aquarela.gif
"; + comboItensSel : function(idjanela) { + var adicionaFilho = function() { + }, tema = $i(idjanela + "i3GEOgraficointerativo1ComboTemasId").value; + i3GEO.util.comboItens(idjanela + "i3GEOgraficointerativo1ComboXid", tema, function(retorno) { + if (retorno.tipo === "erro") { + $i(idjanela + "i3GEOgraficointerativo1ComboX").innerHTML = + "

" + $trad(32, i3GEOF.graficointerativo1.dicionario) + "

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

" + $trad(32, i3GEOF.graficointerativo1.dicionario) + "

"; + } else { + $i(idjanela + "i3GEOgraficointerativo1ComboY").innerHTML = + "
" + retorno.dados + " " + + " " + + "aquarela.gif
"; - $i("i3GEOgraficointerativo1ComboXid").id = "i3GEOgraficointerativo1ComboYid"; - $i("i3GEOgraficointerativo1ComboX").innerHTML = "
" - + retorno.dados - + " 
"; - $i("i3GEOgraficointerativo1ComboXid").style.width = "160px"; - $i("i3GEOgraficointerativo1ComboYid").style.width = "160px"; + $i(idjanela + "i3GEOgraficointerativo1ComboXid").id = idjanela + "i3GEOgraficointerativo1ComboYid"; + $i(idjanela + "i3GEOgraficointerativo1ComboX").innerHTML = + "
" + retorno.dados + " 
"; + $i(idjanela + "i3GEOgraficointerativo1ComboXid").style.width = "160px"; + $i(idjanela + "i3GEOgraficointerativo1ComboYid").style.width = "160px"; - adicionaFilho = function() { - var no = document.createElement("div"), - id = "CorG"+parseInt(Math.random()*100000,10), - novoselect; - no.innerHTML = retorno.dados - + " " - + " " - + "aquarela.gif
"; - novoselect = no.getElementsByTagName("select")[0]; - novoselect.id = ""; - novoselect.onchange = adicionaFilho; - novoselect.style.width = "160px"; - $i("i3GEOgraficointerativo1ComboY").appendChild(no); - }; - $i("i3GEOgraficointerativo1ComboYid").onchange = adicionaFilho; - } - }, "i3GEOgraficointerativo1ComboX", ""); + adicionaFilho = + function() { + var no = document.createElement("div"), id = "CorG" + parseInt(Math.random() * 100000, 10), novoselect; + no.innerHTML = + retorno.dados + " " + " " + + "aquarela.gif
"; + novoselect = no.getElementsByTagName("select")[0]; + novoselect.id = ""; + novoselect.onchange = adicionaFilho; + novoselect.style.width = "160px"; + $i(idjanela + "i3GEOgraficointerativo1ComboY").appendChild(no); + }; + $i(idjanela + "i3GEOgraficointerativo1ComboYid").onchange = adicionaFilho; + } + }, idjanela + "i3GEOgraficointerativo1ComboX", ""); + }, + /** + * Atualiza as janelas obtendo os dados conforme a navegacao ocorre + */ + atualizaListaDeRegistros : function() { + var i, janelas = i3GEOF.graficointerativo1.janelas, propJanelas = i3GEOF.graficointerativo1.propJanelas, n = janelas.length; + for (i = 0; i < n; i++) { + if (propJanelas[janelas[i]].atualiza === true) { + i3GEOF.graficointerativo1.obterDados(janelas[i]); + } + } }, - /* + /** * Function: obterDados - * + * * Obtém os dados que serão utilizados no gráfico - * + * * Veja: - * + * * */ - obterDados : function() { + obterDados : function(idjanela) { + // TODO if (!i3GEO.Interface) { return; } - if (i3GEOF.graficointerativo1.aguarde.visibility === "visible") { + if (i3GEOF.graficointerativo1.propJanelas[idjanela].aguarde.visibility === "visible") { return; } - var tema = $i("i3GEOgraficointerativo1ComboTemasId").value, excluir = $i("i3GEOgraficointerativo1excluir").value, cp = new cpaint(), tipo = $i("i3GEOgraficointerativo1TipoAgregacao").value, ordenax = "sim", monta, p, x, y, i, n, temp; + var tema, excluir, cp, tipo, ordenax, monta, p, x, y, i, n, temp; + + tema = $i(idjanela + "i3GEOgraficointerativo1ComboTemasId").value; + excluir = $i(idjanela + "i3GEOgraficointerativo1excluir").value; + cp = new cpaint(); + tipo = $i(idjanela + "i3GEOgraficointerativo1TipoAgregacao").value; + ordenax = "sim"; // pega os itens - temp = $i("i3GEOgraficointerativo1ComboX"); + temp = $i(idjanela + "i3GEOgraficointerativo1ComboX"); x = temp.getElementsByTagName("select")[0].value; - temp = $i("i3GEOgraficointerativo1ComboY"); + temp = $i(idjanela + "i3GEOgraficointerativo1ComboY"); temp = temp.getElementsByTagName("select"); n = temp.length; if (n === 1) { @@ -768,243 +752,209 @@ i3GEOF.graficointerativo1 = { } y = y.join(","); } - 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.util.extOSM2Geo(i3GEO.parametros.mapexten); + 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.util.extOSM2Geo(i3GEO.parametros.mapexten); - if ($i("i3GEOgraficointerativo1DadosPuros").checked) { + if ($i(idjanela + "i3GEOgraficointerativo1DadosPuros").checked) { tipo = "nenhum"; } else { if (x === y) { tipo = "conta"; } } - if (!$i("i3GEOgraficointerativo1OrdenaX").checked) { + if (!$i(idjanela + "i3GEOgraficointerativo1OrdenaX").checked) { ordenax = "nao"; } if (tema === "") { - i3GEO.janela.tempoMsg($trad(34, - i3GEOF.graficointerativo1.dicionario)); + i3GEO.janela.tempoMsg($trad(34, i3GEOF.graficointerativo1.dicionario)); return; } if (x === "") { - i3GEO.janela.tempoMsg($trad(35, - i3GEOF.graficointerativo1.dicionario)); + i3GEO.janela.tempoMsg($trad(35, i3GEOF.graficointerativo1.dicionario)); return; } if (y === "") { - i3GEO.janela.tempoMsg($trad(36, - i3GEOF.graficointerativo1.dicionario)); + i3GEO.janela.tempoMsg($trad(36, i3GEOF.graficointerativo1.dicionario)); return; } monta = function(retorno) { - i3GEOF.graficointerativo1.aguarde.visibility = "hidden"; - i3GEOF.graficointerativo1.montaTabelaDados(retorno); - $i("i3GEOgraficointerativo1guia4").onclick.call(); - // verifica para nao ficar mostrando a janela toda vez que redesenha - // o mapa - if ($i("i3GEOFgraficointerativo1ativaNavegacao").checked == false) { - i3GEO.janela.tempoMsg($trad(37, - i3GEOF.graficointerativo1.dicionario)); - } + i3GEOF.graficointerativo1.propJanelas[idjanela].aguarde.visibility = "hidden"; + i3GEOF.graficointerativo1.montaTabelaDados(idjanela, retorno); + $i(idjanela + "i3GEOgraficointerativo1guia4").onclick.call(); }; - i3GEOF.graficointerativo1.aguarde.visibility = "visible"; + i3GEOF.graficointerativo1.propJanelas[idjanela].aguarde.visibility = "visible"; cp.set_response_type("JSON"); - cp.call(p + "&tipo=" + tipo + "&ordenax=" + ordenax, "graficoSelecao", - monta); + cp.call(p + "&tipo=" + tipo + "&ordenax=" + ordenax, "graficoSelecao", monta); }, - /* + /** * Pega os nomes das colunas */ - nomesColunas: function(){ - //pega os nomes das clunas - var i,n,p, - temp = $i("i3GEOgraficointerativo1ComboX"), - colunas, - cores, - alias; - if(temp.getElementsByTagName("select")[0]){ + nomesColunas : function(idjanela) { + // pega os nomes das clunas + var i, n, p, temp = $i(idjanela + "i3GEOgraficointerativo1ComboX"), colunas, cores, alias; + if (temp.getElementsByTagName("select")[0]) { cores = []; - colunas = [temp.getElementsByTagName("select")[0].value]; - alias = [temp.getElementsByTagName("input")[0].value]; - } - else{ - //caso os dados tenham sido definidos como parametros - colunas = ["-","-"]; + colunas = [ + temp.getElementsByTagName("select")[0].value + ]; + alias = [ + temp.getElementsByTagName("input")[0].value + ]; + } else { + // caso os dados tenham sido definidos como parametros + colunas = [ + "-", + "-" + ]; alias = colunas; - cores = ["#29C152","#29C152"]; + cores = [ + "#29C152", + "#29C152" + ]; } - temp = $i("i3GEOgraficointerativo1ComboY"); + temp = $i(idjanela + "i3GEOgraficointerativo1ComboY"); temp = temp.getElementsByTagName("select"); n = temp.length; - for(i=0;i" - + $trad(38, i3GEOF.graficointerativo1.dicionario) - + "

"); - //pega os nomes das clunas - colunas = i3GEOF.graficointerativo1.nomesColunas()[0]; + ins.push("

" + $trad(38, i3GEOF.graficointerativo1.dicionario) + "

"); + // pega os nomes das clunas + colunas = i3GEOF.graficointerativo1.nomesColunas(idjanela)[0]; ncolunas = colunas.length; - for(i=0;i  " - + colunas[i] - + ""); + for (i = 0; i < ncolunas; i++) { + ins + .push(""); } - ins.push(""); + ins.push(""); n = dados.length; for (i = 1; i < n; i++) { v = dados[i].split(";"); // ins += v[0]+" "+v[1]; - id = "i3GEOgraficointerativo1Dados" + i; // layer+indice da classe + id = idjanela + "i3GEOgraficointerativo1Dados" + i; // layer+indice da classe ins.push(""); + + i3GEO.configura.locaplic + "/imagens/x.gif' title='" + $trad(42, i3GEOF.graficointerativo1.dicionario) + "' />"); ins.push(""); - for(j=0;j"); - ins.push($inputText("", "", id + colunas[j], $trad(43, - i3GEOF.graficointerativo1.dicionario), 20, v[j], colunas[j])); + ins.push($inputText("", "", id + colunas[j], $trad(43, i3GEOF.graficointerativo1.dicionario), 20, v[j], colunas[j])); ins.push(""); } ins.push(""); } ins.push("
  " + colunas[i] + "" - + $trad(41, i3GEOF.graficointerativo1.dicionario) - + "
" + $trad(41, i3GEOF.graficointerativo1.dicionario) + "
"); ins.push(""); - if ($i("i3GEOgraficointerativo1CoresA").checked) { + if ($i(idjanela + "i3GEOgraficointerativo1CoresA").checked) { cor = i3GEO.util.rgb2hex(i3GEO.util.randomRGB()); } - // verifica se no objeto com os dados existe um terceiro valor com + // verifica se no objeto com os dados existe um terceiro + // valor com // as cores if (v[ncolunas + 1]) { cor = i3GEO.util.rgb2hex(v[ncolunas + 1]); } - ins.push($inputText("", "", id + "_cor", "", 12, cor, $trad(41, - i3GEOF.graficointerativo1.dicionario))); + ins.push($inputText("", "", id + "_cor", "", 12, cor, $trad(41, i3GEOF.graficointerativo1.dicionario))); ins.push(""); - ins.push("aquarela.gif"); + ins.push("aquarela.gif"); ins.push("

"); - $i("i3GEOgraficointerativo1Dados").innerHTML = ins.join(""); + $i(idjanela + "i3GEOgraficointerativo1Dados").innerHTML = ins.join(""); }, - /* + /** * Function: tabela2csv - * + * * Obtém os dados da tabela em CSV */ - tabela2csv : function() { - var colunas = i3GEOF.graficointerativo1.nomesColunas(), - ncolunas = colunas[0].length, - inputs = $i("i3GEOgraficointerativo1Dados").getElementsByTagName("input"), - ninputs = inputs.length, - i,j, - temp, - csv = []; + tabela2csv : function(idjanela) { + var colunas = i3GEOF.graficointerativo1.nomesColunas(idjanela), ncolunas = colunas[0].length, inputs = + $i(idjanela + "i3GEOgraficointerativo1Dados").getElementsByTagName("input"), ninputs = inputs.length, i, j, temp, csv = []; csv.push(colunas[0].join(";")); - for (i = 0; i < ninputs; i = (i + 1 + ncolunas)){ + for (i = 0; i < ninputs; i = (i + 1 + ncolunas)) { temp = []; - for(j=0;j 0){ + if (ninputs > 0) { menor = inputs[1].value * 1; } - if ($i("i3GEOgraficointerativo1ComboTemasId")) { - titulo = $i("i3GEOgraficointerativo1ComboTemasId").options[$i("i3GEOgraficointerativo1ComboTemasId").options.selectedIndex].text; + if ($i(idjanela + "i3GEOgraficointerativo1ComboTemasId")) { + titulo = + $i(idjanela + "i3GEOgraficointerativo1ComboTemasId").options[$i(idjanela + "i3GEOgraficointerativo1ComboTemasId").options.selectedIndex].text; } if (i3GEOF.graficointerativo1.titulo != "") { titulo = i3GEOF.graficointerativo1.titulo; } - if ($i("i3GEOgraficointerativo1ComboXid")) { - legendaX = $i("i3GEOgraficointerativo1ComboXidTitulo").value; + if ($i(idjanela + "i3GEOgraficointerativo1ComboXid")) { + legendaX = $i(idjanela + "i3GEOgraficointerativo1ComboXidTitulo").value; } - if ($i("i3GEOgraficointerativo1ComboYid")) { - legendaY = $i("i3GEOgraficointerativo1ComboYidTitulo").value; + if ($i(idjanela + "i3GEOgraficointerativo1ComboYid")) { + legendaY = $i(idjanela + "i3GEOgraficointerativo1ComboYidTitulo").value; } - if(ncolunas === 2){ + if (ncolunas === 2) { for (i = 0; i < ninputs; i = i + 3) { temp = inputs[i + 1].value * 1; total += temp; @@ -1022,23 +972,25 @@ i3GEOF.graficointerativo1 = { menor = temp; } temp = inputs[i + 1].value * 1; - if ($i("i3GEOgraficointerativo1Acumula").checked) { + if ($i(idjanela + "i3GEOgraficointerativo1Acumula").checked) { temp = acum; } - if ($i("i3GEOgraficointerativo1Relativa").checked) { + if ($i(idjanela + "i3GEOgraficointerativo1Relativa").checked) { temp = (temp * 100) / total; } - par.push([ inputs[i].value + " ", temp ]); + par.push([ + inputs[i].value + " ", + temp + ]); } - if ($i("i3GEOgraficointerativo1Acumula").checked) { + if ($i(idjanela + "i3GEOgraficointerativo1Acumula").checked) { maior = 0; } - } - else{ + } else { total = 0; - for (i = 0; i < ninputs; i = (i + 1 + ncolunas)){ + for (i = 0; i < ninputs; i = (i + 1 + ncolunas)) { temp = []; - for(j=0;j 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) { - var tabela = $i("i3GEOgraficointerativo1Dados").getElementsByTagName( - "table")[0], trs, ntrs = 0, psort = [], t = 0, ins = "", p = 0, e, temp, chaves = [], numero = false; + var tabela = $i(idjanela + "i3GEOgraficointerativo1Dados").getElementsByTagName("table")[0], trs, ntrs = 0, psort = [], t = 0, ins = + "", p = 0, e, temp, chaves = [], numero = false; trs = tabela.getElementsByTagName("tr"); ntrs = trs.length; @@ -1163,133 +1106,110 @@ i3GEOF.graficointerativo1 = { } tabela.innerHTML = ins; }, - /* + /** * Function: ativaNavegacao - * - * Ativa ou desativa a atualização automática ao - * navegar no mapa + * + * Ativa a atualização automática ao navegar no mapa */ - ativaNavegacao : function(obj) { + ativaNavegacao : function() { 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); - } + i3GEO.janela.tempoMsg($trad(37, i3GEOF.graficointerativo1.dicionario)); + if (i3GEO.Interface.ATUAL !== "googlemaps" && i3GEO.Interface.ATUAL !== "googleearth") { + i3GEO.eventos.NAVEGAMAPA.push("i3GEOF.graficointerativo1.atualizaListaDeRegistros()"); + } + if (i3GEO.Interface.ATUAL === "googlemaps") { + graficointerativo1Dragend = GEvent.addListener(i3GeoMap, "dragend", function() { + i3GEOF.graficointerativo1.atualizaListaDeRegistros(); + }); + graficointerativo1Zoomend = GEvent.addListener(i3GeoMap, "zoomend", function() { + i3GEOF.graficointerativo1.atualizaListaDeRegistros(); + }); } + if (i3GEO.Interface.ATUAL === "googleearth") { + graficointerativo1Dragend = google.earth.addEventListener(i3GeoMap.getView(), "viewchangeend", function() { + i3GEOF.graficointerativo1.atualizaListaDeRegistros(); + }); + } + }, - configDefault : function(dados, maior, cores, legendaY, legendaX) { - var temp,config = { - canvas : "i3GEOgraficointerativo1guia4objCanvas", - height : parseInt($i("i3GEOF.graficointerativo1_corpo").style.height, 10) - 80, - orthoAxisTitle : legendaY, - valuesFont : 'normal 9px sans-serif ', - baseAxisTitle : legendaX, - baseAxisTitleAlign : 'center', - tooltipEnabled : true, - tooltipArrowVisible : true, - tooltipFade : false, - tooltipFollowMouse : false, - tooltipFormat : function(scene) { - var cat = this.scene.datum.atoms['category'].value, val = this.scene.datum.atoms['value'].value; - return "" + cat + "
" - + format("#.###,", val); - }, - baseAxisTitleFont : '9px sans-serif', - yAxisTickFormatter : function(valor) { - valor = valor + ""; - valor = format("#.###,", valor); - return valor; - }, - valueFormat : function(valor) { - valor = valor + ""; - valor = format("#.###,", valor); - return valor; - }, - valuesAnchor : 'top', - valuesVisible : false, - orthoAxisOriginIsZero : false, - titleAlign : 'center', - titleFont: 'bold 14px sans-serif', - baseAxisTitleFont : '12px sans-serif', - orthoAxisTitleFont : '12px sans-serif', - titlePosition: "top", - orientation : 'vertical', - baseAxisTicks : true, - stacked : false, - animate : true, - hoverable : false, - axisGrid : true, - contentMargins : 5, - axisOffset : 0.02, - panelSizeRatio : 0.8, - orthoAxisLabelSpacingMin : 2, - selectable : false, - extensionPoints : { - continuousAxisTicks_strokeStyle : 'gray', - axisGrid_strokeStyle : 'lightgray', - xAxisLabel_textStyle : 'black', - label_textBaseline : "bottom", - xAxisLabel_font : 'normal 10px sans-serif' - } + configDefault : function(idjanela, dados, maior, cores, legendaY, legendaX) { + var temp, config = { + canvas : idjanela + "i3GEOgraficointerativo1guia4objCanvas", + height : parseInt($i(idjanela + "_corpo").style.height, 10) - 80, + orthoAxisTitle : legendaY, + valuesFont : 'normal 9px sans-serif ', + baseAxisTitle : legendaX, + baseAxisTitleAlign : 'center', + tooltipEnabled : true, + tooltipArrowVisible : true, + tooltipFade : false, + tooltipFollowMouse : false, + tooltipFormat : function(scene) { + var cat = this.scene.datum.atoms['category'].value, val = this.scene.datum.atoms['value'].value; + return "" + cat + "
" + format("#.###,", val); + }, + baseAxisTitleFont : '9px sans-serif', + yAxisTickFormatter : function(valor) { + valor = valor + ""; + valor = format("#.###,", valor); + return valor; + }, + valueFormat : function(valor) { + valor = valor + ""; + valor = format("#.###,", valor); + return valor; + }, + valuesAnchor : 'top', + valuesVisible : false, + orthoAxisOriginIsZero : false, + titleAlign : 'center', + titleFont : 'bold 14px sans-serif', + baseAxisTitleFont : '12px sans-serif', + orthoAxisTitleFont : '12px sans-serif', + titlePosition : "top", + orientation : 'vertical', + baseAxisTicks : true, + stacked : false, + animate : true, + hoverable : false, + axisGrid : true, + contentMargins : 5, + axisOffset : 0.02, + panelSizeRatio : 0.8, + orthoAxisLabelSpacingMin : 2, + selectable : false, + extensionPoints : { + continuousAxisTicks_strokeStyle : 'gray', + axisGrid_strokeStyle : 'lightgray', + xAxisLabel_textStyle : 'black', + label_textBaseline : "bottom", + xAxisLabel_font : 'normal 10px sans-serif' + } }; - if(maior > 0){ + if (maior > 0) { config.orthoAxisFixedMax = maior; } - if($i("i3GEOgraficointerativo1Titulo").value != ""){ - config.title = $i("i3GEOgraficointerativo1Titulo").value; + if ($i(idjanela + "i3GEOgraficointerativo1Titulo").value != "") { + config.title = $i(idjanela + "i3GEOgraficointerativo1Titulo").value; } - if($i("i3GEOgraficointerativo1TituloX").value != ""){ - config.baseAxisTitle = $i("i3GEOgraficointerativo1TituloX").value; + if ($i(idjanela + "i3GEOgraficointerativo1TituloX").value != "") { + config.baseAxisTitle = $i(idjanela + "i3GEOgraficointerativo1TituloX").value; } - if($i("i3GEOgraficointerativo1TituloY").value != ""){ - config.orthoAxisTitle = $i("i3GEOgraficointerativo1TituloY").value; + if ($i(idjanela + "i3GEOgraficointerativo1TituloY").value != "") { + config.orthoAxisTitle = $i(idjanela + "i3GEOgraficointerativo1TituloY").value; } - temp = $i("i3GEOgraficointerativo1FatorTamanho"); - if(temp && temp.value > 0){ + temp = $i(idjanela + "i3GEOgraficointerativo1FatorTamanho"); + if (temp && temp.value > 0) { config.width = dados.resultset.length * temp.value; - } - else{ - config.width = parseInt($i("i3GEOF.graficointerativo1").style.width,10) - 20; + } else { + config.width = parseInt($i(idjanela).style.width, 10) - 20; } return config; }, - barras : function(dados, maior, cores, legendaY, legendaX, xInclinado, tipo) { - var ct = true, - sr = false, - config = i3GEOF.graficointerativo1.configDefault(dados, maior, cores,legendaY, legendaX); + barras : function(idjanela, dados, maior, cores, legendaY, legendaX, xInclinado, tipo) { + var ct = true, sr = false, config = i3GEOF.graficointerativo1.configDefault(idjanela, dados, maior, cores, legendaY, legendaX); if (tipo === "horizontal") { config.orientation = 'horizontal'; } @@ -1298,15 +1218,14 @@ i3GEOF.graficointerativo1 = { config.extensionPoints.xAxisLabel_textBaseline = 'top'; config.extensionPoints.xAxisLabel_textAlign = 'right'; } - if(dados.resultset[0].length > 2){ - config.stacked = $i("i3GEOFgraficointerativo1ativaStacked").checked; + if (dados.resultset[0].length > 2) { + config.stacked = $i(idjanela + "i3GEOFgraficointerativo1ativaStacked").checked; config.legend = true; ct = true; - sr = $i("i3GEOFgraficointerativo1ativaRowsInColumns").checked; + sr = $i(idjanela + "i3GEOFgraficointerativo1ativaRowsInColumns").checked; config.colors = cores; - } - else{ - if(cores != ""){ + } else { + if (cores != "") { config.extensionPoints.bar_fillStyle = function(d) { return cores[this.index]; }; @@ -1314,15 +1233,12 @@ i3GEOF.graficointerativo1 = { } new pvc.BarChart(config).setData(dados, { crosstabMode : ct, - seriesInRows: sr + seriesInRows : sr }).render(); - i3GEOF.graficointerativo1.aguarde.visibility = "hidden"; + i3GEOF.graficointerativo1.propJanelas[idjanela].aguarde.visibility = "hidden"; }, - linhas : function(dados, maior, cores, legendaY, legendaX, xInclinado, tipo) { - var ct = false, - sr = false, - config = i3GEOF.graficointerativo1.configDefault(dados, maior, cores, - legendaY, legendaX); + linhas : function(idjanela, dados, maior, cores, legendaY, legendaX, xInclinado, tipo) { + var ct = false, sr = false, config = i3GEOF.graficointerativo1.configDefault(idjanela, dados, maior, cores, legendaY, legendaX); if (xInclinado == true) { config.extensionPoints.xAxisLabel_textAngle = -Math.PI / 3; config.extensionPoints.xAxisLabel_textBaseline = 'top'; @@ -1330,24 +1246,21 @@ i3GEOF.graficointerativo1 = { } config.dotsVisible = true; - if(dados.resultset[0].length > 2){ - config.stacked = $i("i3GEOFgraficointerativo1ativaStacked").checked; + if (dados.resultset[0].length > 2) { + config.stacked = $i(idjanela + "i3GEOFgraficointerativo1ativaStacked").checked; config.legend = true; ct = true; - sr = $i("i3GEOFgraficointerativo1ativaRowsInColumns").checked; + sr = $i(idjanela + "i3GEOFgraficointerativo1ativaRowsInColumns").checked; config.colors = cores; } new pvc.LineChart(config).setData(dados, { crosstabMode : ct, - seriesInRows: sr + seriesInRows : sr }).render(); - i3GEOF.graficointerativo1.aguarde.visibility = "hidden"; + i3GEOF.graficointerativo1.propJanelas[idjanela].aguarde.visibility = "hidden"; }, - areas : function(dados, maior, cores, legendaY, legendaX, xInclinado, tipo) { - var ct = false, - sr = false, - config = i3GEOF.graficointerativo1.configDefault(dados, maior, cores, - legendaY, legendaX); + areas : function(idjanela, dados, maior, cores, legendaY, legendaX, xInclinado, tipo) { + var ct = false, sr = false, config = i3GEOF.graficointerativo1.configDefault(idjanela, dados, maior, cores, legendaY, legendaX); if (xInclinado == true) { config.extensionPoints.xAxisLabel_textAngle = -Math.PI / 3; config.extensionPoints.xAxisLabel_textBaseline = 'top'; @@ -1356,107 +1269,102 @@ i3GEOF.graficointerativo1 = { config.dotsVisible = true; config.areasVisible = true; - if(dados.resultset[0].length > 2){ - config.stacked = $i("i3GEOFgraficointerativo1ativaStacked").checked; + if (dados.resultset[0].length > 2) { + config.stacked = $i(idjanela + "i3GEOFgraficointerativo1ativaStacked").checked; config.legend = true; ct = true; - sr = $i("i3GEOFgraficointerativo1ativaRowsInColumns").checked; + sr = $i(idjanela + "i3GEOFgraficointerativo1ativaRowsInColumns").checked; config.colors = cores; } new pvc.LineChart(config).setData(dados, { crosstabMode : ct, - seriesInRows: sr + seriesInRows : sr }).render(); - i3GEOF.graficointerativo1.aguarde.visibility = "hidden"; + i3GEOF.graficointerativo1.propJanelas[idjanela].aguarde.visibility = "hidden"; }, - arvores : function(dados, maior, cores, legendaY, legendaX, tipo) { + arvores : function(idjanela, dados, maior, cores, legendaY, legendaX, tipo) { config = { - canvas : "i3GEOgraficointerativo1guia4objCanvas", - title : legendaY, - titleFont : 'italic 14px sans-serif', - selectable : true, - hoverable : true, - legend : false, - tooltipEnabled : true, - legendPosition : 'right', - rootCategoryLabel : legendaX, - tooltipFormat : function(scene) { - var cat = this.scene.datum.atoms['category'].value, val = this.scene.datum.atoms.size.value; - return "" + cat + "
" - + format("#.###,", val); - } + canvas : idjanela + "i3GEOgraficointerativo1guia4objCanvas", + title : legendaY, + titleFont : 'italic 14px sans-serif', + selectable : true, + hoverable : true, + legend : false, + tooltipEnabled : true, + legendPosition : 'right', + rootCategoryLabel : legendaX, + tooltipFormat : function(scene) { + var cat = this.scene.datum.atoms['category'].value, val = this.scene.datum.atoms.size.value; + return "" + cat + "
" + format("#.###,", val); + } }; - if(cores != ""){ + if (cores != "") { config.colors = cores; } new pvc.TreemapChart(config).setData(dados, { crosstabMode : false }).render(); - i3GEOF.graficointerativo1.aguarde.visibility = "hidden"; + i3GEOF.graficointerativo1.propJanelas[idjanela].aguarde.visibility = "hidden"; }, - pizzas : function(dados, maior, cores, legendaY, legendaX, tipo) { - config = i3GEOF.graficointerativo1.configDefault(dados, maior, cores, - legendaY, legendaX); + pizzas : function(idjanela, dados, maior, cores, legendaY, legendaX, tipo) { + config = i3GEOF.graficointerativo1.configDefault(idjanela, dados, maior, cores, legendaY, legendaX); var config = { - canvas : "i3GEOgraficointerativo1guia4objCanvas", - animate : true, - selectable : true, - hoverable : true, - valuesVisible : true, - valuesLabelStyle : 'inside', - valuesMask : "{category}", - tooltipFormat : function(scene) { - var cat = this.scene.datum.atoms['category'].value, val = this.scene.datum.atoms['value'].value; - return "" + cat + "
" - + format("#.###,", val); - }, - extensionPoints : { - slice_strokeStyle : 'white' - } + canvas : idjanela + "i3GEOgraficointerativo1guia4objCanvas", + animate : true, + selectable : true, + hoverable : true, + valuesVisible : true, + valuesLabelStyle : 'inside', + valuesMask : "{category}", + tooltipFormat : function(scene) { + var cat = this.scene.datum.atoms['category'].value, val = this.scene.datum.atoms['value'].value; + return "" + cat + "
" + format("#.###,", val); + }, + extensionPoints : { + slice_strokeStyle : 'white' + } }; - if(cores != ""){ + if (cores != "") { config.colors = cores; } new pvc.PieChart(config).setData(dados, { crosstabMode : false }).render(); - i3GEOF.graficointerativo1.aguarde.visibility = "hidden"; + i3GEOF.graficointerativo1.propJanelas[idjanela].aguarde.visibility = "hidden"; }, - pontos: function(dados, maior, cores, legendaY, legendaX, tipo) { - config = i3GEOF.graficointerativo1.configDefault(dados, maior, cores, - legendaY, legendaX); + pontos : function(idjanela, dados, maior, cores, legendaY, legendaX, tipo) { + config = i3GEOF.graficointerativo1.configDefault(idjanela, dados, maior, cores, legendaY, legendaX); var config = { - canvas : "i3GEOgraficointerativo1guia4objCanvas", - animate : true, - selectable : true, - hoverable : true, - valuesVisible : false, - orthoAxisTitle : legendaY, - valuesFont : 'normal 9px sans-serif ', - baseAxisTitle : legendaX, - yAxisTickFormatter : function(valor) { - valor = valor + ""; - valor = format("#.###,", valor); - return valor; - }, - valueFormat : function(valor) { - valor = valor + ""; - valor = format("#.###,", valor); - return valor; - }, - tooltipFormat : function(scene) { - var cat = this.scene.datum.atoms['category'].value, val = this.scene.datum.atoms['value'].value; - return "X: " + cat + "
Y: " - + format("#.###,", val); - } + canvas : idjanela + "i3GEOgraficointerativo1guia4objCanvas", + animate : true, + selectable : true, + hoverable : true, + valuesVisible : false, + orthoAxisTitle : legendaY, + valuesFont : 'normal 9px sans-serif ', + baseAxisTitle : legendaX, + yAxisTickFormatter : function(valor) { + valor = valor + ""; + valor = format("#.###,", valor); + return valor; + }, + valueFormat : function(valor) { + valor = valor + ""; + valor = format("#.###,", valor); + return valor; + }, + tooltipFormat : function(scene) { + var cat = this.scene.datum.atoms['category'].value, val = this.scene.datum.atoms['value'].value; + return "X: " + cat + "
Y: " + format("#.###,", val); + } }; - if(cores != ""){ + if (cores != "") { config.colors = cores; } new pvc.DotChart(config).setData(dados, { crosstabMode : false }).render(); - i3GEOF.graficointerativo1.aguarde.visibility = "hidden"; + i3GEOF.graficointerativo1.propJanelas[idjanela].aguarde.visibility = "hidden"; } -}; + }; diff --git a/ferramentas/tabela/index.js b/ferramentas/tabela/index.js index 8802123..c58617a 100644 --- a/ferramentas/tabela/index.js +++ b/ferramentas/tabela/index.js @@ -1,590 +1,809 @@ -if(typeof(i3GEOF) === 'undefined'){ +if (typeof (i3GEOF) === 'undefined') { var i3GEOF = {}; } /* -Classe: i3GEOF.tabela + * Classe: i3GEOF.tabela */ -i3GEOF.tabela = { +i3GEOF.tabela = + { /** * Array com os ids das janelas ja criadas */ - janelas: [], - propJanelas: {}, + janelas : [], + propJanelas : {}, /* - Para efeitos de compatibilidade antes da versão 4.7 que não tinha dicionário + * Para efeitos de compatibilidade antes da versão 4.7 que não tinha dicionário */ - criaJanelaFlutuante: function(){ + criaJanelaFlutuante : function() { i3GEOF.tabela.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 + * 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(){ - if(typeof(i3GEOF.tabela.dicionario) === 'undefined'){ + iniciaDicionario : function() { + if (typeof (i3GEOF.tabela.dicionario) === 'undefined') { i3GEO.util.scriptTag( - i3GEO.configura.locaplic+"/ferramentas/tabela/dicionario.js", - "i3GEOF.tabela.iniciaJanelaFlutuante()", - "i3GEOF.tabela.dicionario_script" - ); - } - else{ + i3GEO.configura.locaplic + "/ferramentas/tabela/dicionario.js", + "i3GEOF.tabela.iniciaJanelaFlutuante()", + "i3GEOF.tabela.dicionario_script"); + } else { i3GEOF.tabela.iniciaJanelaFlutuante(); } }, /* - Function: inicia - - Inicia a ferramenta. É chamado por criaJanelaFlutuante - - Parametro: - - iddiv {String} - id do div que receberá o conteudo HTML da ferramenta + * Function: inicia + * + * Inicia a ferramenta. É chamado por criaJanelaFlutuante + * + * Parametro: + * + * iddiv {String} - id do div que receberá o conteudo HTML da ferramenta */ - inicia: function(iddiv,idjanela){ - var onButtonClick = function (p_sType, p_aArgs, botao) { + inicia : function(iddiv, idjanela) { + var onButtonClick = function(p_sType, p_aArgs, botao) { var oMenuItem = p_aArgs[1]; if (oMenuItem) { - if(oMenuItem.value != ""){ + if (oMenuItem.value != "") { i3GEO.mapa.ativaTema(oMenuItem.value); - botao.set("label", "" + oMenuItem.cfg.getProperty("text") + "  "); + botao.set( + "label", + "" + oMenuItem.cfg.getProperty("text") + "  "); i3GEOF.tabela.propJanelas[idjanela].tema = oMenuItem.value; - $i(idjanela+"_corpo").innerHTML = ""; - i3GEOF.tabela.inicia(iddiv,idjanela); + $i(idjanela + "_corpo").innerHTML = ""; + i3GEOF.tabela.inicia( + iddiv, + idjanela); } } }; - i3GEO.janela.comboCabecalhoTemas(idjanela+"i3GEOFtabelaComboCabeca",idjanela+"i3GEOFtabelaComboCabecaSel","tabela","ligadosComTabela",onButtonClick); - if(i3GEOF.tabela.propJanelas[idjanela].tema === ""){ - $i(iddiv).innerHTML = "";//'

'+$trad("x33")+'

'; + i3GEO.janela.comboCabecalhoTemas( + idjanela + "i3GEOFtabelaComboCabeca", + idjanela + "i3GEOFtabelaComboCabecaSel", + "tabela", + "ligadosComTabela", + onButtonClick); + if (i3GEOF.tabela.propJanelas[idjanela].tema === "") { + $i(iddiv).innerHTML = "";// '

'+$trad("x33")+'

'; return; } - try{ + try { $i(iddiv).innerHTML = i3GEOF.tabela.html(idjanela); - i3GEO.guias.mostraGuiaFerramenta(idjanela+"i3GEOtabelaguia1",idjanela+"i3GEOtabelaguia"); - //eventos das guias - $i(idjanela+"i3GEOtabelaguia6").onclick = function(){ - i3GEO.guias.mostraGuiaFerramenta(idjanela+"i3GEOtabelaguia6",idjanela+"i3GEOtabelaguia"); + i3GEO.guias.mostraGuiaFerramenta( + idjanela + "i3GEOtabelaguia1", + idjanela + "i3GEOtabelaguia"); + // eventos das guias + $i(idjanela + "i3GEOtabelaguia6").onclick = function() { + i3GEO.guias.mostraGuiaFerramenta( + idjanela + "i3GEOtabelaguia6", + idjanela + "i3GEOtabelaguia"); }; - $i(idjanela+"i3GEOtabelaguia1").onclick = function(){ - i3GEO.guias.mostraGuiaFerramenta(idjanela+"i3GEOtabelaguia1",idjanela+"i3GEOtabelaguia"); + $i(idjanela + "i3GEOtabelaguia1").onclick = function() { + i3GEO.guias.mostraGuiaFerramenta( + idjanela + "i3GEOtabelaguia1", + idjanela + "i3GEOtabelaguia"); }; - $i(idjanela+"i3GEOtabelaguia3").onclick = function(){ - i3GEO.guias.mostraGuiaFerramenta(idjanela+"i3GEOtabelaguia3",idjanela+"i3GEOtabelaguia"); - if(!$i(idjanela+"i3GEOtabelaComboItensGuia3")){ + $i(idjanela + "i3GEOtabelaguia3").onclick = function() { + i3GEO.guias.mostraGuiaFerramenta( + idjanela + "i3GEOtabelaguia3", + idjanela + "i3GEOtabelaguia"); + if (!$i(idjanela + "i3GEOtabelaComboItensGuia3")) { i3GEOF.tabela.comboItensEstat(idjanela); } }; - //relatorio - $i(idjanela+"i3GEOtabelaguia5").onclick = function(){ - i3GEO.guias.mostraGuiaFerramenta(idjanela+"i3GEOtabelaguia5",idjanela+"i3GEOtabelaguia"); + // relatorio + $i(idjanela + "i3GEOtabelaguia5").onclick = function() { + i3GEO.guias.mostraGuiaFerramenta( + idjanela + "i3GEOtabelaguia5", + idjanela + "i3GEOtabelaguia"); i3GEO.util.checkItensEditaveis( - i3GEOF.tabela.propJanelas[idjanela].tema, - function(retorno){ - if (retorno.tipo === "dados"){ - $i(idjanela+"i3GEOtabelaitensrelatorio").innerHTML = retorno.dados; - } - }, - idjanela+"i3GEOtabelaitensrelatorio", - "320px", - "", - "sim" - ); + i3GEOF.tabela.propJanelas[idjanela].tema, + function(retorno) { + if (retorno.tipo === "dados") { + $i(idjanela + "i3GEOtabelaitensrelatorio").innerHTML = retorno.dados; + } + }, + idjanela + "i3GEOtabelaitensrelatorio", + "320px", + "", + "sim"); i3GEO.util.comboItens( - idjanela+"i3GEOtabelaagrupaItem", - i3GEOF.tabela.propJanelas[idjanela].tema, - function(retorno){ - if(retorno.tipo === "erro"){ - $i(idjanela+"i3GEOtabelaagrupamento").innerHTML = "

"+$trad(2,i3GEOF.tabela.dicionario)+"

"; - } - else{ - $i(idjanela+"i3GEOtabelaagrupamento").innerHTML = retorno.dados; - } - }, - idjanela+"i3GEOtabelaagrupamento", - "" - ); + idjanela + "i3GEOtabelaagrupaItem", + i3GEOF.tabela.propJanelas[idjanela].tema, + function(retorno) { + if (retorno.tipo === "erro") { + $i(idjanela + "i3GEOtabelaagrupamento").innerHTML = "

" + $trad( + 2, + i3GEOF.tabela.dicionario) + "

"; + } else { + $i(idjanela + "i3GEOtabelaagrupamento").innerHTML = retorno.dados; + } + }, + idjanela + "i3GEOtabelaagrupamento", + ""); }; new YAHOO.widget.Button( - idjanela+"i3GEOtabelabotao2", - {onclick:{fn: function(){ - i3GEOF.tabela.ativaSelecao(idjanela); - }}} - ); + idjanela + "i3GEOtabelabotao2", + { + onclick : { + fn : function() { + i3GEOF.tabela.ativaSelecao(idjanela); + } + } + }); new YAHOO.widget.Button( - idjanela+"i3GEOtabelabotao3", - {onclick:{fn: function(){ - i3GEOF.tabela.limpaSelecao(idjanela); - }}} - ); + idjanela + "i3GEOtabelabotao3", + { + onclick : { + fn : function() { + i3GEOF.tabela.limpaSelecao(idjanela); + } + } + }); new YAHOO.widget.Button( - idjanela+"i3GEOtabelabotao6", - {onclick:{fn: function(){ - i3GEOF.tabela.criaNovoTema(idjanela); - }}} - ); + idjanela + "i3GEOtabelabotao6", + { + onclick : { + fn : function() { + i3GEOF.tabela.criaNovoTema(idjanela); + } + } + }); new YAHOO.widget.Button( - idjanela+"i3GEOtabelabotaoLista", - {onclick:{fn: function(){ - i3GEOF.tabela.pegaRegistros(idjanela); - }}} - ); + idjanela + "i3GEOtabelabotaoLista", + { + onclick : { + fn : function() { + i3GEOF.tabela.pegaRegistros(idjanela); + } + } + }); new YAHOO.widget.Button( - idjanela+"i3GEOtabelaGraficoI", - {onclick:{fn: function(){ - i3GEO.mapa.ativaTema(i3GEOF.tabela.propJanelas[idjanela].tema); - i3GEO.analise.dialogo.graficoInterativo1(); + idjanela + "i3GEOtabelaGraficoI", + { + onclick : { + fn : function() { + i3GEO.mapa.ativaTema(i3GEOF.tabela.propJanelas[idjanela].tema); + i3GEO.analise.dialogo.graficoInterativo1(); + } } - }} - ); - $i(idjanela+"i3GEOtabelabotaoLista-button").style.minHeight = "1em"; - $i(idjanela+"i3GEOtabelabotaoLista-button").style.padding = "0px 15px"; - $i(idjanela+"i3GEOtabelabotaoLista-button").style.lineHeight = "1.3"; - $i(idjanela+"i3GEOtabelabotaoLista").style.position = "relative"; - $i(idjanela+"i3GEOtabelabotaoLista").style.top = "2px"; + }); + $i(idjanela + "i3GEOtabelabotaoLista-button").style.minHeight = "1em"; + $i(idjanela + "i3GEOtabelabotaoLista-button").style.padding = "0px 15px"; + $i(idjanela + "i3GEOtabelabotaoLista-button").style.lineHeight = "1.3"; + $i(idjanela + "i3GEOtabelabotaoLista").style.position = "relative"; + $i(idjanela + "i3GEOtabelabotaoLista").style.top = "2px"; new YAHOO.widget.Button( - idjanela+"i3GEOtabelabotao4", - {onclick:{fn: function(){ - i3GEOF.tabela.estatistica(idjanela); - }}} - ); + idjanela + "i3GEOtabelabotao4", + { + onclick : { + fn : function() { + i3GEOF.tabela.estatistica(idjanela); + } + } + }); new YAHOO.widget.Button( - idjanela+"i3GEOtabelabotao7", - {onclick:{fn: function(){ - i3GEOF.tabela.relatorioTabela(idjanela); - }}} - ); + idjanela + "i3GEOtabelabotao7", + { + onclick : { + fn : function() { + i3GEOF.tabela.relatorioTabela(idjanela); + } + } + }); new YAHOO.widget.Button( - idjanela+"i3GEOtabelabotao5", - {onclick:{fn: function(){ - i3GEOF.tabela.relatorioTexto(idjanela); - }}} - ); + idjanela + "i3GEOtabelabotao5", + { + onclick : { + fn : function() { + i3GEOF.tabela.relatorioTexto(idjanela); + } + } + }); new YAHOO.widget.Button( - idjanela+"i3GEOtabelabotaoVinculos", - {onclick:{fn: function(){ - i3GEOF.tabela.vinculos.iniciaJanelaFlutuante(); - }}} - ); - i3GEO.util.mensagemAjuda(idjanela+"i3GEOtabelamen1",$i(idjanela+"i3GEOtabelamen1").innerHTML); + idjanela + "i3GEOtabelabotaoVinculos", + { + onclick : { + fn : function() { + i3GEOF.tabela.vinculos.iniciaJanelaFlutuante(); + } + } + }); + i3GEO.util.mensagemAjuda( + idjanela + "i3GEOtabelamen1", + $i(idjanela + "i3GEOtabelamen1").innerHTML); - if (i3GEO.parametros.r.toLowerCase() !== "sim"){ - $i(idjanela+"i3GEOtabelaguia4obj").innerHTML = $trad("x22"); + if (i3GEO.parametros.r.toLowerCase() !== "sim") { + $i(idjanela + "i3GEOtabelaguia4obj").innerHTML = $trad("x22"); } i3GEOF.tabela.pegaRegistros(idjanela); + } catch (erro) { + i3GEO.janela.tempoMsg(erro); } - 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 + * Function: html + * + * Gera o código html para apresentação das opções da ferramenta + * + * Retorno: + * + * String com o código html */ - html:function(idjanela){ - var ins = '';//

- ins += '

'; + html : function(idjanela) { + var ins = '';//

+ ins += '


'; - ins += '
'; - //propriedades - ins += '
'; + ins += + '
'; + // propriedades + ins += '
'; ins += ' '; ins += ' '; - ins += ' '; - ins += ' '; + ins += + ' '; + ins += ' '; ins += ' '; ins += ' '; - ins += ' '; - ins += ' '; + ins += + ' '; + ins += ' '; ins += ' '; ins += '
'+$trad(8,i3GEOF.tabela.dicionario)+'' + $trad( + 8, + i3GEOF.tabela.dicionario) + '
'+$trad(9,i3GEOF.tabela.dicionario)+'' + $trad( + 9, + i3GEOF.tabela.dicionario) + '
'; ins += '
'; - ins += '
'; - ins += '