Ver Mensaje Individual
  #8 (permalink)  
Antiguo 02/06/2011, 11:26
Cambotero
 
Fecha de Ingreso: febrero-2010
Mensajes: 15
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: Problemas varios con JQuery

Hemos encontrado la causa del problema, resulta que tenemos un script en medio del código que se ejecuta siempre y que dibuja una gráfica de google (el código os lo adjunto en la parte inferior) nos hemos dado cuenta de que si quitamos dicho código todo va perfecto.

A ver si hay alguna manera de que se ejecute al final o después de jquery, para que así no nos aparezca este problema de refresco.

<div align="center">Variable <%=salidas.elementAt(i)%> medida en <%=unidades_salidas.elementAt(i) %></div>
<div id="<%=i %>"></div>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Year');
data.addColumn('number', '<%=salidas.elementAt(indice) %>');
var n = <%=valores_graficas.elementAt(indice).size() %>;
data.addRows(n);
<%
for (int j=0;j<valores_graficas.elementAt(indice).size();j+ +){
%>
data.setValue(<%=j %>, 0, '<%=j %>');
data.setValue(<%=j %>, 1, <%=valores_graficas.elementAt(indice).elementAt( j) %>);
<%
}
%>

var chart = new google.visualization.LineChart(document.getElement ById('<%=i %>'));
chart.draw(data, {width: 700, height: 240, backgroundColor: "#FFFFFF"});
}
</script>
<%
}else{
if (representacion.elementAt(i).compareTo("Reloj") == 0){

%>
<%=salidas.elementAt(i) %>
<div id="<%=i %>" align="center">
</div>

<script type='text/javascript'>
google.load('visualization', '1', {packages:['gauge']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Label');
data.addColumn('number', 'Value');
data.addRows(1);
data.setValue(0, 0, '');
data.setValue(0, 1, <%=valores_graficas.elementAt(i).lastElement()%> );

var chart = new google.visualization.Gauge(document.getElementById ('<%=i %>'));
var options = {width: 450, height: 170, redColor: '#FF0000', redFrom: <%=rango_colores.elementAt(i).elementAt(1) %>, redTo: <%=rango_colores.elementAt(i).elementAt(2) %>,
yellowColor: '#FFFF00', yellowFrom: <%=rango_colores.elementAt(i).elementAt(0) %>, yellowTo: <%=rango_colores.elementAt(i).elementAt(1) %>, minorTicks: 5,
greenColor: '#00FF00', greenFrom: <%=minimos.elementAt(i) %>, greenTo: <%=rango_colores.elementAt(i).elementAt(0) %>, min: <%=minimos.elementAt(i) %>, max:<%=maximos.elementAt(i) %>};
chart.draw(data, options);
}
</script>
<%

Saludos