chg: [dashboard] world map scale parameterised

pull/5705/head
iglocska 2020-03-09 11:15:56 +01:00
parent 0e2babfa04
commit b83a238a80
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 11 additions and 3 deletions

View File

@ -12,11 +12,18 @@
'meta' => 'icon'
));
$randomNumber = rand();
if (empty($data['colour_scale'])) {
$data['colour_scale'] = json_encode(array(
'#003FBF','#0063BF','#0087BF','#00ACBF','#00BFAD','#00BF89','#00BF64',
'#00BF40','#00BF1C','#08BF00','#2CBF00','#51BF00','#75BF00','#99BF00',
'#BEBF00','#BF9B00','#BF7700','#BF5200','#BF2E00','#BF0900'
), true);
}
?>
<div id="world-map-<?= $randomNumber ?>" style="width: 600px; height: 400px"></div>
<script>
(function() { // variables and functions have their own scope (no override)
(function() { // variables and functions have their own scope (no override)
'use strict';
var randomNumber = "<?= $randomNumber ?>";
var scope = "<?= h($data['scope']) ?>";
@ -29,7 +36,8 @@
series: {
regions: [{
values: mapData,
scale: ['#003FBF','#0063BF','#0087BF','#00ACBF','#00BFAD','#00BF89','#00BF64','#00BF40','#00BF1C','#08BF00','#2CBF00','#51BF00','#75BF00','#99BF00','#BEBF00','#BF9B00','#BF7700','#BF5200','#BF2E00','#BF0900'], // gradient blue->green->yellow->red
scale:
<?= $data['colour_scale'] ?>, // gradient blue->green->yellow->red
normalizeFunction: 'polynomial'
}]
},
@ -57,4 +65,4 @@
});
});
}());
</script>
</script>