瀏覽代碼

Fix color palette generation

jmacura 5 年之前
父節點
當前提交
3696d7a3ca
共有 1 個文件被更改,包括 3 次插入19 次删除
  1. 3 19
      src/app.js

+ 3 - 19
src/app.js

@@ -52,8 +52,6 @@ function generateRandomColorPalette(colorCount) {
     h *= 360;
     palette.push(hsv2rgb(h, 0.5, 0.95));
   }
-  // eslint-disable-next-line no-unused-vars
-  // const h = r * 0x10000 + g * 0x100 + b * 0x1;
   return palette;
   //return `rgba(${r}, ${g}, ${b}, 0.7)`;
 }
@@ -72,7 +70,7 @@ const styles = function (feature) {
     return [
       new Style({
         fill: new Fill({
-          color: randomColorPalette[feature.get('km25.cluster')],
+          color: randomColorPalette[feature.get('km25.cluster') - 1],
         }),
         //stroke: stroke,
       }),
@@ -93,27 +91,14 @@ const nuts3Layer = new VectorLayer({
   style: styles,
   title: 'NUTS3 regions',
 });
-//TODO: update to new PopUp config & align with new attrs
-nuts3Layer.set('hoveredKeys', [
-  'NUTS_NAME',
-  'totalForHumans',
-  'Social & Human',
-  'Anthropic',
-  'Institutional',
-  'Economical',
-  'Natural',
-  'Cultural',
-]);
-nuts3Layer.set('hoveredKeysTranslations', {
-  NUTS_NAME: 'Name',
-  totalForHumans: 'Calculated score',
+nuts3Layer.set('popUp', {
+  attributes: [{attribute: 'km25.cluster', label: 'Cluster ID'}],
 });
 
 angular
   .module('hs', [
     'hs.addLayers',
     'hs.datasource_selector',
-    'hs.draw',
     'hs.geolocation',
     'hs.info',
     'hs.layermanager',
@@ -170,7 +155,6 @@ angular
     // allowAddExternalDatasets: false,
     panelsEnabled: {
       composition_browser: false,
-      draw: false,
       //info: false,
       saveMap: false,
       language: false,