Преглед изворни кода

💄 brighter colors (--> more contrast)

jmacura пре 3 година
родитељ
комит
9809e5f11f
1 измењених фајлова са 13 додато и 2 уклоњено
  1. 13 2
      src/app/sdm-dih.service.ts

+ 13 - 2
src/app/sdm-dih.service.ts

@@ -65,6 +65,12 @@ export class SdmDihService {
       });
   }
 
+  /**
+   * For given region, year and scenario calculates its aggregated index,
+   * i.e. the Index of Rural Attractiveness (RAI) by combining its sub-indices
+   * @param regionData - Data for all the factors in a certain region, certain year and certain scenario
+   * @returns Aggregated index for the region, year and scenario
+   */
   calcAggregatedIndex(regionData) {
     let weightedSum = 0;
     let sumWeight = 0;
@@ -90,6 +96,11 @@ export class SdmDihService {
     return weightedSum / sumWeight;
   }
 
+  /**
+   * For given region, given year, given scenario and single factor calculates its index value (a sub-index)
+   * @param factorData - Data for a single factor in a certain region, certain year and certain scenario
+   * @returns Sub-index value (between 0 and 1)
+   */
   calcFactorIndex(factorData) {
     let sumValue = 0;
     let n = 0;
@@ -129,7 +140,7 @@ export class SdmDihService {
     }
     // eslint-disable-next-line @typescript-eslint/no-unused-vars
     const h = r * 0x10000 + g * 0x100 + b * 0x1;
-    return `rgba(${r}, ${g}, ${b}, 0.7)`;
+    return `rgba(${r}, ${g}, ${b}, 1)`;
   }
 
   /**
@@ -153,7 +164,7 @@ export class SdmDihService {
       }
       if (!regionData[factor]) {
         regionData[factor] = {
-          weight: 1,
+          weight: 1, //TODO: Allow to change weight of factors?
           datasets: [],
         };
       }