Ver Mensaje Individual
  #5 (permalink)  
Antiguo 01/06/2015, 13:25
jc1992
 
Fecha de Ingreso: noviembre-2010
Mensajes: 156
Antigüedad: 13 años, 5 meses
Puntos: 0
Respuesta: Sustituir variable javascript

Hola y gracias por responder , me "ha funcionado" lo pongo entre comillas porqué estoy en la misma situación de antes.

El mapa se muestra correctamente , pero no me muestra la información del value.
Código Javascript:
Ver original
  1. $.ajax({
  2.                 type: "GET",
  3.                 dataType: 'json',
  4.                 url: "total", // This is the URL to the API
  5.                 success:json,
  6.                 })
  7.                
  8.                 function json(response){
  9.                     console.log(response);
  10.                     data = response; //Y aquí los asignas a data
  11.                 }

Te dejo el código Javascript entero aunque no sé si tendrá algo que ver.

Código Javascript:
Ver original
  1. <script type="text/javascript">
  2.             $(function () {
  3.  
  4.                 $.ajax({
  5.                 type: "GET",
  6.                 dataType: 'json',
  7.                 url: "total", // This is the URL to the API
  8.                 success:json,
  9.                 })
  10.                
  11.                 function json(response){
  12.                     console.log(response);
  13.                     data = response; //Y aquí los asignas a data
  14.                 }
  15.                 // Prepare demo data
  16.                 var data = [];    
  17.                 // Initiate the chart
  18.                 $('#container').highcharts('Map', {
  19.                    
  20.                     title : {
  21.                         text : 'Mapa de españa',
  22.                     },
  23.  
  24.                     subtitle : {
  25.                         text : 'Source map: <a href="http://code.highcharts.com/mapdata/countries/es/es-all.js">countries/es/es-all</a>'
  26.                     },
  27.  
  28.                     mapNavigation: {
  29.                         enabled: true,
  30.                         buttonOptions: {
  31.                             verticalAlign: 'bottom'
  32.                         }
  33.                     },
  34.  
  35.                     colorAxis: {
  36.                         min: 0
  37.                     },
  38.  
  39.                     series : [{
  40.                         data : data,
  41.                         mapData: Highcharts.maps['countries/es/es-all'],
  42.                         joinBy: 'hc-key',
  43.                         name: 'Random data',
  44.                         states: {
  45.                             hover: {
  46.                                 color: '#BADA55'
  47.                             }
  48.                         },
  49.                         dataLabels: {
  50.                             enabled: true,
  51.                             format: '{point.name}'
  52.                         }
  53.                     }, {
  54.                         name: 'Separators',
  55.                         type: 'mapline',
  56.                         data: Highcharts.geojson(Highcharts.maps['countries/es/es-all'], 'mapline'),
  57.                         color: 'silver',
  58.                         showInLegend: false,
  59.                         enableMouseTracking: false
  60.                     }]
  61.                 });
  62.             });
  63.         </script>