Revize d5a88af0
Přidáno uživatelem Tomáš Ballák před asi 4 roky(ů)
website/public/js/zcu-heatmap.js | ||
---|---|---|
22 | 22 |
var datasetSelected = [] |
23 | 23 |
|
24 | 24 |
const globalMarkersHolder = {} |
25 |
const datasetColorDict = {} |
|
25 |
// all marker from which popup was removed |
|
26 |
// contains: {key:[L.circle,L.pupup]} |
|
27 |
// key: x and y, x + '' + y string |
|
28 |
let globalMarkersChanged = {} |
|
26 | 29 |
|
27 |
/* const genColor = (datasetNames) => { |
|
28 |
datasetNames.forEach((name) => { |
|
29 |
datasetColorDict[name] = |
|
30 |
}) |
|
31 |
} */ |
|
32 | 30 |
const fetchByNameDate = async (baseRoute, name, date, currentTime) => { |
33 | 31 |
const headers = new Headers() |
34 | 32 |
const myRequest = new Request(baseRoute + '/' + name + '/' + date + '/' + currentTime, { |
... | ... | |
47 | 45 |
const beforeJson = await fetch(myRequest) |
48 | 46 |
return beforeJson.json() |
49 | 47 |
} |
50 |
// all marker from which popup was removed |
|
51 |
// contains: {key:[L.circle,L.pupup]} |
|
52 |
// key: x and y, x + '' + y string |
|
53 |
let globalMarkersChanged = {} |
|
54 | 48 |
|
55 | 49 |
const genPopUpControlButtons = (currentPage, numPages, onNextClick, onPreviousClick) => ({ |
56 | 50 |
previousButton: '<button id="previous-info-btn" class="circle-button" onclick="previousInfo()"></button>', |
... | ... | |
172 | 166 |
|
173 | 167 |
const numDatasets = Object.keys(datasetsInRadius).length |
174 | 168 |
|
175 |
if (!numDatasets) { return } |
|
169 |
if (!numDatasets) { |
|
170 |
return |
|
171 |
} |
|
176 | 172 |
|
177 | 173 |
if (numDatasets === 1) { |
178 | 174 |
const infoDict = getElFromObjectInfo(0) |
... | ... | |
361 | 357 |
const dataDict = dataRaw |
362 | 358 |
const mergedPoints = [] |
363 | 359 |
let max = 0 |
360 |
if (Object.keys(globalMarkersChanged).length) { |
|
361 |
Object.keys(globalMarkersChanged).forEach(function (key) { |
|
362 |
globalMarkersChanged[key][0].bindPopup(globalMarkersChanged[key][1]) |
|
363 |
}) |
|
364 |
globalMarkersChanged = {} |
|
365 |
} |
|
364 | 366 |
Object.keys(dataDict).forEach((key) => { |
365 | 367 |
const data = dataDict[key] |
366 | 368 |
max = Math.max(max, data.max) |
367 | 369 |
if (data != null) { |
368 | 370 |
// Bind back popups for markers (we dont know if there is any data for this marker or not) |
369 |
if (Object.keys(globalMarkersChanged).length) { |
|
370 |
Object.keys(globalMarkersChanged).forEach(function (key) { |
|
371 |
globalMarkersChanged[key][0].bindPopup(globalMarkersChanged[key][1]) |
|
372 |
}) |
|
373 |
globalMarkersChanged = {} |
|
374 |
} |
|
375 | 371 |
const points = data.items.map((point) => { |
376 | 372 |
const { x, y, number } = point |
377 | 373 |
const key = x + '' + y |
Také k dispozici: Unified diff
done