GeographicaGS / AXA-Humanity

https://axa-humanity.geographica.io
0 stars 0 forks source link

Incluir al final de cada KPI los Objetivos de la ONU relacionados con él #44

Closed josegilg closed 7 years ago

josegilg commented 7 years ago

Documentado en Invision, pantalla _HomeBoard-country-drag

@paulajpozuelo no permitamos relacionar más de 3 con cada KPI. Si no, el contenedor se desmonta y en cualquier caso, quedará muy recargado.

Cada objetivo abrirá una página externa (ONU) en pestaña nueva.

captura de pantalla 2017-07-07 a las 13 14 10

Los recursos gráficos que debemos usar están en: https://drive.google.com/open?id=0B_QGNYzQG9_Dc19hZVE1X29Vdkk

eamador commented 7 years ago

@paulajpozuelo para esto creo que los podemos definir en el indicators.json en un array con nombre (por ejemplo) "goals", que lo podemos poner justo debajo de "info", y pondríamos el numero de "objetivo" al que corresponda (del 1 al 17), quedando algo así:

{
        "id": 8,
        "category_id": 3,
        "title": "What's the contribution to pensions?",
        "unit": "%",
        "unitText": "of GDP",
        "info": {
          "headline": "Metadata",
          "body": "Data extracted from OECD.Stat. 2015."
        },
        "goals": [
          10,
          2,
          5
        ],
        "tableName": "kpi_08",
        "layers": [
          {
            "sql": "SELECT q.id as cartodb_id, q.id,(SELECT the_geom FROM continents WHERE id = q.id) AS the_geom, (SELECT centroid FROM continents WHERE id = q.id) AS the_geom_webmercator, (SELECT name FROM continents WHERE id = q.id) AS name, round((100 * q.data_population / q.total_population)::numeric,2) AS data FROM ( SELECT c.id AS id, SUM(sub_q.data_population) AS data_population, SUM(sub_q.total_population) AS total_population FROM continents c, ( SELECT ST_Centroid(k.the_geom) AS the_geom, (k.data * g.data / 100) AS data_population, g.data AS total_population FROM (SELECT the_geom, data, iso3 FROM kpi_08 WHERE data IS NOT NULL) k INNER JOIN (SELECT id, data FROM gross_domestic_product WHERE data IS NOT NULL) g ON k.iso3 = g.id) sub_q WHERE ST_Intersects(c.the_geom, sub_q.the_geom) GROUP BY c.id ) q",
            "cartocss": "#layer ['mapnik::geometry_type'=1] [zoom<4] {marker-width: ramp([data], range(48, 112), quantiles(5)); marker-fill: #f07662; marker-fill-opacity: 0.85; marker-allow-overlap: true; marker-line-width: 1; marker-line-color: #ec4d33; marker-line-opacity: 1; [zoom=3]{ marker-width: ramp([data], range(48, 112), quantiles(5));} [zoom=4]{ marker-width: ramp([data], range(64, 160), quantiles(5));}} #layer::labels { text-name: [data] + '%'; text-face-name: 'DejaVu Sans Book'; text-size: 13; text-fill: #FFF; text-opacity: 1; text-allow-overlap: true; text-halo-fill: #fff; text-halo-radius: 0.1;}",
            "interactivity": [
              "cartodb_id",
              "name",
              "data"
            ]
          },
          {
            "sql": "SELECT cartodb_id,the_geom_webmercator, data, iso3 as id,name, (SELECT AVG(data) FROM kpi_08) as average FROM kpi_08",
            "cartocss": "#layer [zoom>=4] {polygon-fill: ramp([data], (#ec4d33, #f07662, #F6ADA1, #F9C8C0, #FCE4E0), quantiles); polygon-opacity: 0.9; line-width: 1; line-color: #ec4d33; line-opacity: 0.4; line-comp-op: multiply;}",
            "interactivity": [
              "cartodb_id",
              "name",
              "data",
              "average"
            ]
          }
        ]
      }