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

also added high to low colors for inputsLegendContainer

parent 6b9406b3
No related branches found
No related tags found
No related merge requests found
...@@ -57,21 +57,6 @@ export class ResultsMapComponent implements OnChanges { ...@@ -57,21 +57,6 @@ export class ResultsMapComponent implements OnChanges {
this.map = map; this.map = map;
this.grayscaleChange(); this.grayscaleChange();
const legendLabels = document.querySelectorAll(
"#inputsLegendContainer > form > div > div > label"
);
for (let i = 0; i < legendLabels.length; i++) {
(legendLabels[i] as HTMLElement).style.backgroundColor =
MapColors.colorsAll[legendLabels.length - i - 1];
}
const inputsLegend = document.querySelectorAll(
"#inputsLegendContainer > form > div > div > input"
);
for (let i = 0; i < inputsLegend.length; i++) {
(inputsLegend[i] as HTMLElement).style.backgroundColor =
MapColors.colorsAll[inputsLegend.length - i];
}
setTimeout(() => { setTimeout(() => {
this.map.invalidateSize(); this.map.invalidateSize();
this.networkService.getMapInfo().subscribe((res) => { this.networkService.getMapInfo().subscribe((res) => {
...@@ -97,7 +82,7 @@ export class ResultsMapComponent implements OnChanges { ...@@ -97,7 +82,7 @@ export class ResultsMapComponent implements OnChanges {
setTimeout(() => { setTimeout(() => {
const celkomplet2: HTMLElement = document.querySelectorAll( const celkomplet2: HTMLElement = document.querySelectorAll(
"#loadGeojsonButtonsContainer button" "#loadGeojsonButtonsContainer button"
)[3] as HTMLElement; )[1] as HTMLElement;
celkomplet2.click(); celkomplet2.click();
}, 1050); }, 1050);
// setTimeout(() => { // setTimeout(() => {
...@@ -291,6 +276,8 @@ export class ResultsMapComponent implements OnChanges { ...@@ -291,6 +276,8 @@ export class ResultsMapComponent implements OnChanges {
]; ];
} }
this.setInputsLegendContainerColors(direction);
if (direction == "lowToHigh") { if (direction == "lowToHigh") {
div.innerHTML += div.innerHTML +=
"<p style='background:white; display: inline; font-size:17px'> <span style='color:" + "<p style='background:white; display: inline; font-size:17px'> <span style='color:" +
...@@ -314,6 +301,7 @@ export class ResultsMapComponent implements OnChanges { ...@@ -314,6 +301,7 @@ export class ResultsMapComponent implements OnChanges {
"'>&#9632</span> <" + "'>&#9632</span> <" +
grades[1] + grades[1] +
"</p>"; "</p>";
for (let i = 1; i < 6; i++) { for (let i = 1; i < 6; i++) {
div.innerHTML += div.innerHTML +=
"<p style='background:white; display: inline; font-size:17px'> <span style='color:" + "<p style='background:white; display: inline; font-size:17px'> <span style='color:" +
...@@ -321,6 +309,7 @@ export class ResultsMapComponent implements OnChanges { ...@@ -321,6 +309,7 @@ export class ResultsMapComponent implements OnChanges {
"'>&#9632</span> " + "'>&#9632</span> " +
grades[i] + grades[i] +
(grades[i + 1] ? "&ndash;" + grades[i + 1] + "</p>" : "+</p>"); (grades[i + 1] ? "&ndash;" + grades[i + 1] + "</p>" : "+</p>");
this.newBrinkValues.get(`legend_${i - 1}`).setValue(`${grades[i]}`); this.newBrinkValues.get(`legend_${i - 1}`).setValue(`${grades[i]}`);
} }
} }
...@@ -335,7 +324,6 @@ export class ResultsMapComponent implements OnChanges { ...@@ -335,7 +324,6 @@ export class ResultsMapComponent implements OnChanges {
let text = ""; let text = "";
if (feature["cityWide"]) { if (feature["cityWide"]) {
console.log(" we have cityWide");
for (let p in feature["cityWide"]["pollution"]) { for (let p in feature["cityWide"]["pollution"]) {
const tmp = this.limitMyDigits(feature["cityWide"]["pollution"][p]); const tmp = this.limitMyDigits(feature["cityWide"]["pollution"][p]);
if (p == this.checkedRadioButton) { if (p == this.checkedRadioButton) {
...@@ -670,6 +658,7 @@ export class ResultsMapComponent implements OnChanges { ...@@ -670,6 +658,7 @@ export class ResultsMapComponent implements OnChanges {
public addListenerToRadioButtonLayersControlAndSetLegend() { public addListenerToRadioButtonLayersControlAndSetLegend() {
this.map.on("baselayerchange", (e) => { this.map.on("baselayerchange", (e) => {
console.log(" I ho pauroa d i te");
this.setLegend(e["name"]); this.setLegend(e["name"]);
this.checkedRadioButton = e["name"]; this.checkedRadioButton = e["name"];
}); });
...@@ -923,4 +912,38 @@ export class ResultsMapComponent implements OnChanges { ...@@ -923,4 +912,38 @@ export class ResultsMapComponent implements OnChanges {
res["zoom"] res["zoom"]
); );
} }
setInputsLegendContainerColors(direction: string): void {
if (direction == "lowToHigh") {
const legendLabels = document.querySelectorAll(
"#inputsLegendContainer > form > div > div > label"
);
for (let i = 0; i < legendLabels.length; i++) {
(legendLabels[i] as HTMLElement).style.backgroundColor =
MapColors.colorsAll[legendLabels.length - i - 1];
}
const inputsLegend = document.querySelectorAll(
"#inputsLegendContainer > form > div > div > input"
);
for (let i = 0; i < inputsLegend.length; i++) {
(inputsLegend[i] as HTMLElement).style.backgroundColor =
MapColors.colorsAll[inputsLegend.length - i];
}
} else {
const legendLabels = document.querySelectorAll(
"#inputsLegendContainer > form > div > div > label"
);
for (let i = 0; i < legendLabels.length; i++) {
(legendLabels[i] as HTMLElement).style.backgroundColor =
MapColors.colorsAll[i];
}
const inputsLegend = document.querySelectorAll(
"#inputsLegendContainer > form > div > div > input"
);
for (let i = 0; i < inputsLegend.length; i++) {
(inputsLegend[i] as HTMLElement).style.backgroundColor =
MapColors.colorsAll[i];
}
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment