abhiram89

data is at the top

Aug 19th, 2012
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.45 KB | None | 0 0
  1. <div data-show="<%= @options.first.dbrick.id %>_show" data-bar="<%= @options.first.dbrick.id %>_bar" data-line="<%= @options.first.dbrick.id %>_line">
  2. <div class="show span pull-right show">Line</div><br />
  3.  
  4.  
  5. <script type="text/javascript" charset="utf-8">
  6.  
  7. $(document).ready(function(){
  8. var s1 = <%= @options.map { |x| x.votes.count }.inspect %>;
  9. var s2 = <%= @options.map { |x| x.votes.count }.inspect %>;
  10. plot1 = $.jqplot("<%= @options.first.dbrick.id %>_bar", [s2, s1], {
  11. // Turns on animatino for all series in this plot.
  12. animate: true,
  13. // Will animate plot on calls to plot1.replot({resetAxes:true})
  14. animateReplot: true,
  15. cursor: {
  16. show: true,
  17. zoom: true,
  18. looseZoom: true,
  19. showTooltip: true
  20. },
  21. series:[
  22. {
  23. pointLabels: {
  24.  
  25. show: true
  26. },
  27. renderer: $.jqplot.BarRenderer,
  28. showHighlight: false,
  29. yaxis: 'y2axis',
  30. rendererOptions: {
  31. // Speed up the animation a little bit.
  32. // This is a number of milliseconds.
  33. // Default for bar series is 3000.
  34. animation: {
  35. speed: 2500
  36. },
  37. barWidth: 15,
  38. barPadding: -15,
  39. barMargin: 0,
  40. highlightMouseOver: true
  41. }
  42. },
  43. {
  44. rendererOptions: {
  45. // speed up the animation a little bit.
  46. // This is a number of milliseconds.
  47. // Default for a line series is 2500.
  48. animation: {
  49. speed: 2000
  50. }
  51. }
  52. }
  53. ],
  54. axesDefaults: {
  55. pad: 0
  56. },
  57. axes: {
  58. // These options will set up the x axis like a category axis.
  59. xaxis: {
  60. tickInterval: 1,
  61. drawMajorGridlines: false,
  62. drawMinorGridlines: true,
  63. drawMajorTickMarks: false,
  64. rendererOptions: {
  65. tickInset: 0.5,
  66. minorTicks: 1
  67.  
  68. }
  69. },
  70. yaxis: {
  71. tickOptions: {
  72. formatString: "%'d"
  73. },
  74. rendererOptions: {
  75.  
  76. forceTickAt0: true
  77. }
  78. },
  79. y2axis: {
  80. tickOptions: {
  81. formatString: "%'d"
  82. },
  83. rendererOptions: {
  84. // align the ticks on the y2 axis with the y axis.
  85. alignTicks: true,
  86. forceTickAt0: true
  87. }
  88. }
  89. },
  90. highlighter: {
  91. show: true,
  92. showLabel: true,
  93. tooltipAxes: 'y',
  94. sizeAdjust: 7.5 , tooltipLocation : 'ne'
  95. }
  96. });
  97. });
  98.  
  99. </script>
  100.  
  101.  
  102.  
  103. <div id="<%= @options.first.dbrick.id %>_bar" class="<%= @options.first.dbrick.id %>_bar" style="width:630 px; height:150px; display:block" class="span"></div>
  104.  
  105.  
  106.  
  107.  
  108.  
  109. <script type="text/javascript" charset="utf-8">
  110.  
  111. $(document).ready(function(){
  112. var s1 = <%= @options.map { |x| x.votes.count }.inspect %>;
  113. var s2 = <%= @options.map { |x| x.votes.count }.inspect %>;
  114. plot1 = $.jqplot("<%= @options.first.dbrick.id %>_line ", [s2, s1], {
  115. // Turns on animatino for all series in this plot.
  116. animate: true,
  117. // Will animate plot on calls to plot1.replot({resetAxes:true})
  118. animateReplot: true,
  119. cursor: {
  120. show: true,
  121. zoom: true,
  122. looseZoom: true,
  123. showTooltip: true
  124. },
  125. series:[
  126. {
  127. pointLabels: {
  128.  
  129. show: true
  130. },
  131. renderer: $.jqplot.BarRenderer,
  132. showHighlight: false,
  133. yaxis: 'y2axis',
  134. rendererOptions: {
  135. // Speed up the animation a little bit.
  136. // This is a number of milliseconds.
  137. // Default for bar series is 3000.
  138. animation: {
  139. speed: 2500
  140. },
  141. barWidth: 15,
  142. barPadding: -15,
  143. barMargin: 0,
  144. highlightMouseOver: true
  145. }
  146. },
  147. {
  148. rendererOptions: {
  149. // speed up the animation a little bit.
  150. // This is a number of milliseconds.
  151. // Default for a line series is 2500.
  152. animation: {
  153. speed: 2000
  154. }
  155. }
  156. }
  157. ],
  158. axesDefaults: {
  159. pad: 0
  160. },
  161. axes: {
  162. // These options will set up the x axis like a category axis.
  163. xaxis: {
  164. tickInterval: 1,
  165. drawMajorGridlines: false,
  166. drawMinorGridlines: true,
  167. drawMajorTickMarks: false,
  168. rendererOptions: {
  169. tickInset: 0.5,
  170. minorTicks: 1
  171.  
  172. }
  173. },
  174. yaxis: {
  175. tickOptions: {
  176. formatString: "%'d"
  177. },
  178. rendererOptions: {
  179.  
  180. forceTickAt0: true
  181. }
  182. },
  183. y2axis: {
  184. tickOptions: {
  185. formatString: "%'d"
  186. },
  187. rendererOptions: {
  188. // align the ticks on the y2 axis with the y axis.
  189. alignTicks: true,
  190. forceTickAt0: true
  191. }
  192. }
  193. },
  194. highlighter: {
  195. show: true,
  196. showLabel: true,
  197. tooltipAxes: 'y',
  198. sizeAdjust: 7.5 , tooltipLocation : 'ne'
  199. }
  200. });
  201. });
  202.  
  203. </script>
  204.  
  205.  
  206.  
  207. <div id="<%= @options.first.dbrick.id %>_line" class="<%= @options.first.dbrick.id %>_line" style="width:630 px; height:150px; display:none" class="span"></div>
  208.  
  209. </div>
Advertisement
Add Comment
Please, Sign In to add comment