mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-11-22 06:23:01 +00:00
Create GenerateCSSGradient function, but it's not used yet.
This commit is contained in:
parent
9194a1f372
commit
a91c2283af
3 changed files with 22 additions and 14 deletions
21
client_src/js/Helpers/GradientHelpers.mjs
Normal file
21
client_src/js/Helpers/GradientHelpers.mjs
Normal file
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
function RenderGradient(stops, max) {
|
||||
let result = {};
|
||||
|
||||
for(let value in stops) {
|
||||
result[value / max] = stops[value];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function GenerateCSSGradient(stops, max) {
|
||||
let stops_processed = [];
|
||||
for(let value in stops) {
|
||||
stops_processed = `${stops[value]} ${(value/max).toFixed(3)}%`
|
||||
}
|
||||
return `linear-gradient(to bottom, ${stops_processed.join(", ")})`;
|
||||
}
|
||||
|
||||
export { RenderGradient };
|
|
@ -1,13 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
function RenderGradient(stops, max) {
|
||||
let result = {};
|
||||
|
||||
for(let value in stops) {
|
||||
result[value / max] = stops[value];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export default RenderGradient;
|
|
@ -5,7 +5,7 @@ import HeatmapOverlay from 'leaflet-heatmap';
|
|||
import Config from './Config.mjs';
|
||||
|
||||
import GetFromUrl from './Helpers/GetFromUrl.mjs';
|
||||
import RenderGradient from './Helpers/RenderGradient.mjs';
|
||||
import { RenderGradient } from './Helpers/GradientHelpers.mjs';
|
||||
|
||||
|
||||
class LayerHeatmap {
|
||||
|
|
Loading…
Reference in a new issue