Skip to content
Snippets Groups Projects
Commit 42fbbeca authored by zdenko.vuk@ijs.si's avatar zdenko.vuk@ijs.si
Browse files

This is a combination of 6 commits.

looks to be working

 deleted getColorHighToLow

 made some cleanup, more too follow

 now passing one argument less to reset

also removed getNewColor

done some furhter cleanup
parent fe8e2569
No related branches found
No related tags found
No related merge requests found
......@@ -15,47 +15,10 @@ const color_5 = "#35b499";
const color_capacity_equal_9999 = "#ffffff00";
const color_value_undefined = "#9efcff33";
export function getNewColor(
bioSection,
properties: any,
pro: any,
isCapacityEqual9999: boolean
): string {
if (isCapacityEqual9999 == true) {
return color_capacity_equal_9999;
}
let value = undefined;
if (pro == "pedestrianTravelTime") {
value = properties;
} else {
for (let key in properties) {
if (key == pro) {
value = properties[key];
}
}
}
if (value == undefined) return color_value_undefined;
return value > bioSection.get("legend_4").value
? color_0
: value > bioSection.get("legend_3").value
? color_1
: value > bioSection.get("legend_2").value
? color_2
: value > bioSection.get("legend_1").value
? color_3
: value > bioSection.get("legend_0").value
? color_4
: color_5;
}
export function getColor(
properties: any,
pro: any,
max: number,
ratiosBetweenGrades: number[],
ograjice: number[],
isCapacityEqual9999: boolean
): string {
if (isCapacityEqual9999 == true) {
......@@ -63,7 +26,11 @@ export function getColor(
}
let value = undefined;
if (pro == "pedestrianTravelTime") {
if (
pro == "pedestrianTravelTime" ||
pro == "dailyInternalBikeTravels" ||
pro == "capacity"
) {
value = properties;
} else {
for (let key in properties) {
......@@ -75,24 +42,23 @@ export function getColor(
if (value == undefined) return color_value_undefined;
return value > max / ratiosBetweenGrades[4]
return value > ograjice[4]
? color_0
: value > max / ratiosBetweenGrades[3]
: value > ograjice[3]
? color_1
: value > max / ratiosBetweenGrades[2]
: value > ograjice[2]
? color_2
: value > max / ratiosBetweenGrades[1]
: value > ograjice[1]
? color_3
: value > max / ratiosBetweenGrades[0]
: value > ograjice[0]
? color_4
: color_5;
}
export function getColorHighToLow(
export function getColorOgrajiceHighToLow(
properties: any,
pro: any,
max: number,
ratiosBetweenGrades: number[],
ograjice: number[],
isCapacityEqual9999: boolean
): string {
if (isCapacityEqual9999 == true) {
......@@ -100,9 +66,11 @@ export function getColorHighToLow(
}
let value = undefined;
if (pro == "dailyInternalBikeTravels") {
value = properties;
} else if (pro == "capacity") {
if (
pro == "pedestrianTravelTime" ||
pro == "dailyInternalBikeTravels" ||
pro == "capacity"
) {
value = properties;
} else {
for (let key in properties) {
......@@ -114,15 +82,15 @@ export function getColorHighToLow(
if (value == undefined) return color_value_undefined;
return value > max / ratiosBetweenGrades[4]
return value > ograjice[4]
? color_5
: value > max / ratiosBetweenGrades[3]
: value > ograjice[3]
? color_4
: value > max / ratiosBetweenGrades[2]
: value > ograjice[2]
? color_3
: value > max / ratiosBetweenGrades[1]
: value > ograjice[1]
? color_2
: value > max / ratiosBetweenGrades[0]
: value > ograjice[0]
? color_1
: color_0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment