abhiram89

problem in loading the script while loading

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