Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. <script type="text/javascript">
  2.  
  3. $(function () {
  4. $('#soaotc_daily_chart').highcharts({
  5. chart: {
  6. zoomType: 'xy'
  7. },
  8. title: {
  9. text: 'Average Monthly Temperature and Rainfall in Tokyo'
  10. },
  11. subtitle: {
  12. text: 'Source: WorldClimate.com'
  13. },
  14. xAxis: [{
  15. categories: [
  16. <?php
  17. foreach ($day["DATE"] as $key ) {
  18. echo "$key".",";
  19. }
  20. ?>
  21. ]
  22. }],
  23. yAxis: [{ // Primary yAxis
  24. labels: {
  25. format: '{value}°C',
  26. style: {
  27. color: Highcharts.getOptions().colors[1]
  28. }
  29. },
  30. title: {
  31. text: 'Temperature',
  32. style: {
  33. color: Highcharts.getOptions().colors[1]
  34. }
  35. }
  36. }, { // Secondary yAxis
  37. title: {
  38. text: 'Rainfall',
  39. style: {
  40. color: Highcharts.getOptions().colors[0]
  41. }
  42. },
  43. labels: {
  44. format: '{value} mm',
  45. style: {
  46. color: Highcharts.getOptions().colors[0]
  47. }
  48. },
  49. opposite: true
  50. }],
  51. tooltip: {
  52. shared: true
  53. },
  54. legend: {
  55. layout: 'vertical',
  56. align: 'left',
  57. x: 120,
  58. verticalAlign: 'top',
  59. y: 100,
  60. floating: true,
  61. backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
  62. },
  63. series: [{
  64. name: 'Population',
  65. type: 'column',
  66. yAxis: 1,
  67. data: [
  68. <?php
  69. foreach ($day['POPULATION'] as $key ) {
  70. echo $key.",";
  71. }
  72.  
  73. ?>
  74. ],
  75. tooltip: {
  76. valueSuffix: ' mm'
  77. }
  78.  
  79. }, {
  80. name: 'Amount',
  81. type: 'spline',
  82. data: [
  83. <?php
  84. foreach ($day['SUM_AMOUNT'] as $key ) {
  85. echo $key.",";
  86. }
  87.  
  88. ?>
  89. ],
  90. tooltip: {
  91. valueSuffix: '°C'
  92. }
  93. }]
  94. });
  95. });
  96.  
  97. </script>
  98.  
  99.  
  100. <div class = "container">
  101. <form class="form_horizontal" method = "post" action="<?php echo site_url('#')?>">
  102. <fieldset>
  103. <div class="form-group">
  104. <label for="dtp_input2" class="col-md-1 control-label">Date </label>
  105. <div class="input-group date form_date col-md-5" data-date="" data-date-format="ddmmyyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
  106. <input class="form-control" size="16" type="text" value="" readonly>
  107. <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
  108. </div>
  109. <br/>
  110. <label class="col-md-1 control-label"></label>
  111. <button type="submit" class="col-md-1 btn btn-default">Submit</button>
  112. <input type="hidden" id="dtp_input2" value="" /><br/>
  113. </div>
  114. </fieldset>
  115. </form>
  116. <?php
  117.  
  118. print_r($day);
  119. foreach ($day['NUM_OF_POPULATION'] as $key ) {
  120. $population[] = $key;
  121. }
  122. foreach ($day['START_EXECUTION'] as $key ) {
  123. $date[] = $key;
  124. }
  125. foreach ($day['SUM_AMOUNT'] as $key ) {
  126. $amount[] = $key;
  127. }
  128.  
  129. ?>
  130. <div id="soaotc_daily_chart" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
  131. <br/>
  132. <?php
  133. if(count($day)>0){
  134. // print_r($day);
  135. echo '<table class="table table-hover">';
  136.  
  137. $cols = array_keys($day);
  138. echo '<tr>';
  139. foreach ($cols as $col) echo '<th>' . $col . '</th>';
  140. echo '</tr>';
  141.  
  142. foreach ($day[$cols[0]] as $i => $null) {
  143. echo '<tr>';
  144. foreach ($cols as $col) echo '<td>' . $day[$col][$i] . '</td>';
  145. echo '</tr>';
  146. }
  147.  
  148. echo '</table>';
  149. }
  150. ?>
  151.  
  152. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement