Foros del Web » Programando para Internet » Jquery »

No se como modificar grafica

Estas en el tema de No se como modificar grafica en el foro de Jquery en Foros del Web. Estoy haciendo una gráfica me encontré este ejemplo que me gusto pero no le entiendo muy bien , la función separa el navegador de la ...
  #1 (permalink)  
Antiguo 18/06/2015, 15:22
 
Fecha de Ingreso: junio-2015
Mensajes: 78
Antigüedad: 8 años, 10 meses
Puntos: 0
No se como modificar grafica

Estoy haciendo una gráfica me encontré este ejemplo que me gusto pero no le entiendo muy bien , la función separa el navegador de la versión , lo distingue por que uno es texto y el otro numérico, pero ahora yo quiero dividirlo en dos texto una es la categoria y otro seria la sub categoria

quien me puede ayudar para codificarlo y sirve q aprenda algo no se si estoy en el foro correcto..

Gracias de antemano
Código Javascript:
Ver original
  1. [
  2. $(function () {
  3.  
  4.     Highcharts.data({
  5.         csv: document.getElementById('tsv').innerHTML,
  6.         itemDelimiter: '\t',
  7.         parsed: function (columns) {
  8.  
  9.             var brands = {},
  10.                 brandsData = [],
  11.                 versions = {},
  12.                 drilldownSeries = [];
  13.  
  14.             // Parse percentage strings
  15.             columns[1] = $.map(columns[1], function (value) {
  16.                 if (value.indexOf('%') === value.length - 1) {
  17.                     value = parseFloat(value);
  18.                 }
  19.                 return value;
  20.             });
  21.  
  22.             $.each(columns[0], function (i, name) {
  23.                 var brand,
  24.                     version;
  25.  
  26.                 if (i > 0) {
  27.  
  28.                     // Remove special edition notes
  29.                     name = name.split(' -')[0];
  30.  
  31.                     // Split into brand and version
  32.                     version = name.match(/([0-9]+[\.0-9x]*)/);
  33.                     if (version) {
  34.                         version = version[0];
  35.                     }
  36.                     brand = name.replace(version, '');
  37.  
  38.                     // Create the main data
  39.                     if (!brands[brand]) {
  40.                         brands[brand] = columns[1][i];
  41.                     } else {
  42.                         brands[brand] += columns[1][i];
  43.                     }
  44.  
  45.                     // Create the version data
  46.                     if (version !== null) {
  47.                         if (!versions[brand]) {
  48.                             versions[brand] = [];
  49.                         }
  50.                         versions[brand].push(['v' + version, columns[1][i]]);
  51.                     }
  52.                 }
  53.  
  54.             });
  55.  
  56.             $.each(brands, function (name, y) {
  57.                 brandsData.push({
  58.                     name: name,
  59.                     y: y,
  60.                     drilldown: versions[name] ? name : null
  61.                 });
  62.             });
  63.             $.each(versions, function (key, value) {
  64.                 drilldownSeries.push({
  65.                     name: key,
  66.                     id: key,
  67.                     data: value
  68.                 });
  69.             });
  70.  
  71.             // Create the chart
  72.             $('#container').highcharts({
  73.                 chart: {
  74.                     type: 'column'
  75.                 },
  76.                 title: {
  77.                     text: 'Browser market shares. November, 2013'
  78.                 },
  79.                 subtitle: {
  80.                     text: 'Click the columns to view versions. Source: netmarketshare.com.'
  81.                 },
  82.                 xAxis: {
  83.                     type: 'category'
  84.                 },
  85.                 yAxis: {
  86.                     title: {
  87.                         text: 'Total percent market share'
  88.                     }
  89.                 },
  90.                 legend: {
  91.                     enabled: false
  92.                 },
  93.                 plotOptions: {
  94.                     series: {
  95.                         borderWidth: 0,
  96.                         dataLabels: {
  97.                             enabled: true,
  98.                             format: '{point.y:.1f}%'
  99.                         }
  100.                     }
  101.                 },
  102.  
  103.                 tooltip: {
  104.                     headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
  105.                     pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>'
  106.                 },
  107.  
  108.                 series: [{
  109.                     name: 'Brands',
  110.                     colorByPoint: true,
  111.                     data: brandsData
  112.                 }],
  113.                 drilldown: {
  114.                     series: drilldownSeries
  115.                 }
  116.             });
  117.         }
  118.     });
  119. });



Código HTML:
Ver original
  1. <script src="http://code.highcharts.com/highcharts.js"></script>
  2. <script src="http://code.highcharts.com/modules/data.js"></script>
  3. <script src="http://code.highcharts.com/modules/drilldown.js"></script>
  4.  
  5. <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
  6.  
  7. <!-- Data from www.netmarketshare.com. Select Browsers => Desktop share by version. Download as tsv. -->
  8. <pre id="tsv" style="display:none">Browser Version  Total Market Share
  9. Microsoft Internet Explorer 8.0 26.61%
  10. Microsoft Internet Explorer 9.0 16.96%
  11. Chrome 18.0 8.01%
  12. Chrome 19.0 7.73%
  13. Firefox 12  6.72%
  14. Microsoft Internet Explorer 6.0 6.40%
  15. Firefox 11  4.72%
  16. Microsoft Internet Explorer 7.0 3.55%
  17. Safari 5.1  3.53%
  18. Firefox 13  2.16%
  19. Firefox 3.6 1.87%
  20. Opera 11.x  1.30%
  21. Chrome 17.0 1.13%
  22. Firefox 10  0.90%
  23. Safari 5.0  0.85%
  24. Firefox 9.0 0.65%
  25. Firefox 8.0 0.55%
  26. Firefox 4.0 0.50%
  27. Chrome 16.0 0.45%
  28. Firefox 3.0 0.36%
  29. Firefox 3.5 0.36%
  30. Firefox 6.0 0.32%
  31. Firefox 5.0 0.31%
  32. Firefox 7.0 0.29%
  33. Proprietary or Undetectable 0.29%
  34. Chrome 18.0 - Maxthon Edition   0.26%
  35. Chrome 14.0 0.25%
  36. Chrome 20.0 0.24%
  37. Chrome 15.0 0.18%
  38. Chrome 12.0 0.16%
  39. Opera 12.x  0.15%
  40. Safari 4.0  0.14%
  41. Chrome 13.0 0.13%
  42. Safari 4.1  0.12%
  43. Chrome 11.0 0.10%
  44. Firefox 14  0.10%
  45. Firefox 2.0 0.09%
  46. Chrome 10.0 0.09%
  47. Opera 10.x  0.09%
  48. Microsoft Internet Explorer 8.0 - Tencent Traveler Edition  0.09%</pre>

Última edición por ggol15; 19/06/2015 a las 10:14

Etiquetas: html, javascript, modificar
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:12.