Hello all,
I’m currently trying to configure a business text plugin to:
- Get boundingbox from leaflet map
- Get timerange from grafana setting
- Request a WMS image for the correct time/area (boundingbox)
- Plot this image on the correct place on the map.
My issue is, the new data seems to be requested and received correctly. I have a table-panel which shows the response (a json containing a Base64 string and a timestamp) and the map on one dashboard.
When i move the map i see the boundingbox variables being updated and the new base64 string is requested.
When i compare the base64 strings before and after a map-movement they are different, so a new request has been done.
However, my leaflet map get the base64 string by calling:
var base64 = context.data[0][0]['result'];
var timestamp = context.data[0][0]['timestamp'];
I have a function to compare the timestamp and the previous timestamp and they seem to be the same.
function waitForDataThenPlot() {
console.log("Starting checking for new data");
showLoading();
let attempts = 0;
const maxAttempts = 5;
var interval = setInterval(() => {
var base64 = context.data[0][0]['result'];
var timestamp = context.data[0][0]['timestamp'];
console.log('Checking...');
console.log('Previous timestamp:', previousTimestamp, 'Current timestamp:', timestamp);
if (base64 && base64 !== "0" && timestamp !== previousTimestamp) {
console.log("start plotWmsOverlay");
plotWmsOverlay(map_grid.getBounds(), base64);
clearInterval(interval);
previousTimestamp = timestamp;
hideLoading();
} else {
attempts++;
base64 = null
if (attempts >= maxAttempts) {
console.log('Max attempts reached. Stopping interval.');
clearInterval(interval);
hideLoading();
}
}
}, 1000); // check every 1 second
}
My question is, when or how-often is the information in context.data refreshed?
The data in this panel is requested by a query which uses the bbox variable:
If anyone has any experience with this please let me know, happy to provide any additional information if needed!
Kind regards,
Teun