Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <body>
  3. <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
  4. <script src="http://code.highcharts.com/highcharts.js"></script>
  5. <script src="http://code.highcharts.com/modules/exporting.js"> </script>
  6. <script>
  7. $(function () {
  8. js_platform = <?php echo json_encode($platform); ?>;
  9. js_totalTest = <?php echo json_encode($totalTest); ?>;
  10. $('#container').highcharts({
  11. chart: {
  12. type: 'column'
  13. },
  14. title: {
  15. text: 'Overall avalibility of testcases on each platform'
  16. },
  17. xAxis: {
  18. categories: js_platform
  19. },
  20. yAxis: {
  21. min: 0,
  22. title: {
  23. text: 'Total fruit consumption'
  24. },
  25. stackLabels: {
  26. enabled: true,
  27. style: {
  28. fontWeight: 'bold',
  29. color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
  30. }
  31. }
  32. },
  33. legend: {
  34. align: 'right',
  35. x: -70,
  36. verticalAlign: 'top',
  37. y: 20,
  38. floating: true,
  39. backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'white',
  40. borderColor: '#CCC',
  41. borderWidth: 1,
  42. shadow: false
  43. },
  44. tooltip: {
  45. formatter: function() {
  46. return '<b>'+ this.x +'</b><br/>'+
  47. this.series.name +': '+ this.y +'<br/>'+
  48. 'Total: '+ this.point.stackTotal;
  49. }
  50. },
  51. plotOptions: {
  52. column: {
  53. stacking: 'normal',
  54. dataLabels: {
  55. enabled: true,
  56. color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
  57. style: {
  58. textShadow: '0 0 3px black, 0 0 3px black'
  59. }
  60. }
  61. }
  62. },
  63. series: [{
  64. name: 'John',
  65. data: [5, 3, 4, 7, 2]
  66. }, {
  67. name: 'Jane',
  68. data: [2, 2, 3, 2, 1]
  69. }, {
  70. name: 'Joe',
  71. data: [3, 4, 4, 2, 5]
  72. }]
  73. });
  74. });
  75. </script>
  76.  
  77. <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
  78.  
  79. </body>
  80. </html>
  81.  
  82. series:
  83. [{
  84. data: [<?php echo join($totalTest, ',') ?>]
  85. }]
  86.  
  87. var arr = [];
  88. for(var i=0;i<js_totalTest.length;i++)
  89. {
  90. arr[i] = {};
  91. arr[i]['name'] = ''; //Here push your series name field in your example "John, Jane etc"
  92.  
  93. for(var j=0;j<s.length;j++)
  94. {
  95. arr_data.push(parseInt(s[j]));
  96. }
  97. arr[i]['data'] = parseInt('') ; // Here push your series data (Eg: 5 ,3 , etc.)
  98. }
  99.  
  100. series: arr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement