anchor.diff:      $('[data-indicator]').click(function(e){
         var year = $('body').data('year');
         var indicator = $('.metric.selected').data('indicator');
  -
  -      console.log(year, indicator);
  -
         layer.show();
   
  -      var query = "select t.cartodb_id, t.place_id, t.nameunit as name, t.the_geom, t.the_geom_webmercator, i."+indicator+" as value from ign_spanish_adm3_municipalities_displaced_canary as t full join indicators_"+year+" as i on i.place_id = t.place_id";
  +      var query = "select i.cartodb_id, t.place_id, t.nameunit as name, t.the_geom, t.the_geom_webmercator, i."+indicator+" as value from ign_spanish_adm3_municipalities_displaced_canary as t full join indicators_"+year+" as i on i.place_id = t.place_id";
         console.log(query);
         layer.setSQL(query);
   
  
positive.code: <% content_for(:javascript) do %>
  $(function () {
  CSS['gasto_por_habitante'] = "\
  #indicators_2016 [ value <= 10]  { polygon-fill: #d73027; }\
  #indicators_2016 [ value > 200]  { polygon-fill: #f79272; }\
  #indicators_2016 [ value > 800]  { polygon-fill: #fff2cc; }\
  #indicators_2016 [ value > 1500] { polygon-fill: #8cce8a; }\
  #indicators_2016 [ value > 3000] { polygon-fill: #1a9850; }\
  ";
  
  CSS['gasto_total'] = "\
  #indicators_2016 [ value <= 100000]  { polygon-fill: #d73027; }\
  #indicators_2016 [ value > 2000000]  { polygon-fill: #f79272; }\
  #indicators_2016 [ value > 8000000]  { polygon-fill: #fff2cc; }\
  #indicators_2016 [ value > 15000000] { polygon-fill: #8cce8a; }\
  #indicators_2016 [ value > 30000000] { polygon-fill: #1a9850; }\
  ";
  
  CSS['budgets'] = "\
  #indicators_2016 [ value <= 100000]  { polygon-fill: #d73027; }\
  #indicators_2016 [ value > 2000000]  { polygon-fill: #f79272; }\
  #indicators_2016 [ value > 8000000]  { polygon-fill: #fff2cc; }\
  #indicators_2016 [ value > 15000000] { polygon-fill: #8cce8a; }\
  #indicators_2016 [ value > 30000000] { polygon-fill: #1a9850; }\
  ";
  
  CSS['planned_vs_executed'] = "\
  #indicators_2016 [ value <= 100000]  { polygon-fill: #d73027; }\
  #indicators_2016 [ value > 2000000]  { polygon-fill: #f79272; }\
  #indicators_2016 [ value > 8000000]  { polygon-fill: #fff2cc; }\
  #indicators_2016 [ value > 15000000] { polygon-fill: #8cce8a; }\
  #indicators_2016 [ value > 30000000] { polygon-fill: #1a9850; }\
  ";
  
  CSS['population'] = "\
  #indicators_2016 [ value <= 1000]   { polygon-fill: #d73027; }\
  #indicators_2016 [ value > 2000]    { polygon-fill: #f79272; }\
  #indicators_2016 [ value > 10000]   { polygon-fill: #fff2cc; }\
  #indicators_2016 [ value > 100000]  { polygon-fill: #8cce8a; }\
  #indicators_2016 [ value > 1000000] { polygon-fill: #1a9850; }\
  ";
  
  CSS['debt'] = "\
  #indicators_2016 [ value <= 1000]   { polygon-fill: #d73027; }\
  #indicators_2016 [ value > 2000]    { polygon-fill: #f79272; }\
  #indicators_2016 [ value > 10000]   { polygon-fill: #fff2cc; }\
  #indicators_2016 [ value > 100000]  { polygon-fill: #8cce8a; }\
  #indicators_2016 [ value > 1000000] { polygon-fill: #1a9850; }\
  
negative.code:     $(document).on('renderBudgetLineCategory', function(e){
        $('.metric').removeClass('selected');
        var year = $('body').data('year');
  
        layer.show();
  
        var query = "select i.cartodb_id, t.place_id, t.nameunit as name, t.the_geom, t.the_geom_webmercator, i.code, i.kind, i.area, i.amount, i.amount_per_inhabitant as value from ign_spanish_adm3_municipalities_displaced_canary as t full join planned_budgets_"+year+" as i on i.place_id = t.place_id" +
        " WHERE code='"+e.code+"' AND kind='" + e.kind + "' AND area='" + e.area[0] + "'";
        console.log(query);
        layer.setSQL(query);
  
  