1
I’m making a query to plot the data in the chart Highchart, with interval of up to 1h the query is ok, but of 1h is already slow to generate the chart.
[WebMethod]
public static string SENSORES()
{
aqui eu retorno a consulta do banco de dados
}
//Código usado no javascript
Dados = <%=SENSORES()%>;
//Informação de 20 registro
Dados = [[1611309619,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76],[1611309618,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76],[1611309617,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76],[1611309616,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76],[1611309615,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76],[1611309614,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76,41.76],[1611309613,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8],[1611309612,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8],[1611309611,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8],[1611309610,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8],[1611309609,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8],[1611309608,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8],[1611309607,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8],[1611309606,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8],[1611309605,55.68,55.68,55.68,55.68,55.68,55.68,55.68,55.68,55.68],[1611309604,55.68,55.68,55.68,55.68,55.68,55.68,55.68,55.68,55.68],[1611309603,55.68,55.68,55.68,55.68,55.68,55.68,55.68,55.68,55.68],[1611309602,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8],[1611309601,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8,34.8],[1611309600,27.84,27.84,27.84,27.84,27.84,27.84,27.84,27.84,27.84]];
//AQUI ELE GERAR O GRAFICO
series: [{
type: 'line',
name: 'PSI',
data: (function () {
var data = [];
Dados.forEach(function (val) {
data.push([(val[0] * 1000), val[3]]);
});
return data;
})()
}]
The problem is when I do a 12h consultation, as will come too much record. It ends up taking too long. How to solve this challenge?
how to resolve? if you have many records you can group, if you can’t, you can try paging the results
– Ricardo Pontual
how to do this procedure?
– user3788328
Is the delay due to the query or even the data volume traffic? It is with compression enabled and cache for this data?
– Leandro Angelo
The SQL query inside the public Static string SENSORES() is fast. The Delay is being in the variable Data that is on the client side. A query with a 1h interval does not take long to generate the chart, since a 12h query takes more than 2 minutes to generate the chart
– user3788328