Soonsu_column.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Highcharts Example</title>
  6. <!-- 1. Add these JavaScript inclusions in the head of your page -->
  7. <script type="text/javascript" src="../../../emr/smmobileweb/js/jquery.min.js"></script>
  8. <script type="text/javascript" src="../../../emr/smmobileweb/js/highcharts-android.js"></script>
  9. <script type="text/javascript" src="../../../emr/smmobileweb/js/Soonsu_chart.js"></script>
  10. <!-- 1a) Optional: add a theme file -->
  11. <!--
  12. <script type="text/javascript" src="../js/themes/gray.js"></script>
  13. -->
  14. <!-- 1b) Optional: the exporting module -->
  15. <script type="text/javascript" src="../../../emr/smmobileweb/js/modules/exporting.js"></script>
  16. <!-- 2. Add the JavaScript to initialize the chart on document ready -->
  17. <script type="text/javascript">
  18. /**
  19. * Visualize an HTML table using Highcharts. The top (horizontal) header
  20. * is used for series names, and the left (vertical) header is used
  21. * for category names. This function is based on jQuery.
  22. * @param {Object} table The reference to the HTML table to visualize
  23. * @param {Object} options Highcharts options
  24. */
  25. Highcharts.visualize = function(table, options) {
  26. // the categories
  27. options.xAxis.categories = [];
  28. $('tbody th', table).each( function(i) {
  29. options.xAxis.categories.push(this.innerHTML);
  30. });
  31. // the data series
  32. options.series = [];
  33. $('tr', table).each( function(i) {
  34. var tr = this;
  35. $('th, td', tr).each( function(j) {
  36. if (j > 0) { // skip first column
  37. if (i == 0) { // get the name and init the series
  38. options.series[j - 1] = {
  39. name: this.innerHTML,
  40. data: []
  41. };
  42. } else { // add values
  43. options.series[j - 1].data.push(parseFloat(this.innerHTML));
  44. }
  45. }
  46. });
  47. });
  48. var chart = new Highcharts.Chart(options);
  49. }
  50. var print = {buttons : null};
  51. // On document ready, call visualize on the datatable.
  52. $(document).ready(function() {
  53. var table = document.getElementById('datatable'),
  54. options = {
  55. chart: {
  56. renderTo: 'container',
  57. defaultSeriesType: 'column'
  58. },
  59. credits: {
  60. enabled: false
  61. },
  62. exporting:{buttons : null},
  63. title: {
  64. text: ''
  65. },
  66. xAxis: {
  67. },
  68. yAxis: {
  69. title: {
  70. text: ''
  71. }
  72. },
  73. tooltip: {
  74. formatter: function() {
  75. return '<b>'+ this.series.name +'</b><br/>'+
  76. this.x.toLowerCase() + ':' + this.y ;
  77. }
  78. }
  79. };
  80. Highcharts.visualize(table, options);
  81. });
  82. </script>
  83. </head>
  84. <body scroll="no" topmargin="0" leftmargin="0">
  85. <!-- 3. Add the container -->
  86. <div id="container" style="width: 450px; height: 275px; margin-left: 0px"></div>
  87. <table id="datatable" style="display:none;">
  88. <thead>
  89. <tr>
  90. <th></th>
  91. <th>2008년</th>
  92. <th>2009년</th>
  93. <th>2010년</th>
  94. <th>2011년</th>
  95. </tr>
  96. </thead>
  97. <tbody>
  98. <tr>
  99. <th>1/4분기</th>
  100. <td>6000</td>
  101. <td>15000</td>
  102. <td>12000</td>
  103. <td>14000</td>
  104. </tr>
  105. <tr>
  106. <th>2/4분기</th>
  107. <td>7000</td>
  108. <td>10000</td>
  109. <td>9000</td>
  110. <td>12000</td>
  111. </tr>
  112. <tr>
  113. <th>3/4분기</th>
  114. <td>8000</td>
  115. <td>9000</td>
  116. <td>10000</td>
  117. <td>11000</td>
  118. </tr>
  119. <tr>
  120. <th>4/4분기</th>
  121. <td>10000</td>
  122. <td>8000</td>
  123. <td>9000</td>
  124. <td>9500</td>
  125. </tr>
  126. </tbody>
  127. </table>
  128. </body>
  129. </html>