lib/rhoconnect/web-console/templates/jqplot.erb in rhoconnect-3.3.1.beta4 vs lib/rhoconnect/web-console/templates/jqplot.erb in rhoconnect-3.3.1

- old
+ new

@@ -22,39 +22,39 @@ end %> <% if s.nil? or s['data'].length < 1 %> <center>No data for <b><%= s.nil? ? "" : s['name'] %></b></center><br/><br/> <% else %> - <div id="chartdiv" style="height:295px;width:670px; display:none;"></div> + <div id="chartdiv" style="height:295px;width:570px; display:none;"></div> <%end%> <% def fix_json(instring) outstring = instring.gsub(/"/,"'") outstring = outstring.gsub(/('.*?enderer'):'(.*?)'/,'\1:\2') outstring end %> -<% if @displayname.nil? %> + <script type="text/javascript"> -document.getElementById('chartdiv').style.display = '';plot = $.jqplot('chartdiv',<%=@sources[0]['data'].to_json.gsub(/"/,"'")%>,<%=fix_json(@sources[0]['options'].to_json)%>); plot.redraw(); + var doc = document.getElementById('chartdiv'); + if(doc){ + doc.style.display = ''; + plot = $.jqplot('chartdiv',<%=@sources[0]['data'].to_json.gsub(/"/,"'")%>,<%=fix_json(@sources[0]['options'].to_json)%>); + plot.redraw(); + } </script> -<%end%> + <br/> -<% if @sources.length > 1%> +<% if @keys and @keys.length > 1%> <ul id='source-list' class='nav nav-pills' style='margin-left:35px'> - <% @sources.each do |source| %> - <% if @displayname == source['name'] %> - <script type="text/javascript"> - document.getElementById('chartdiv').style.display = '';plot = $.jqplot('chartdiv',<%=source['data'].to_json.gsub(/"/,"'")%>,<%=fix_json(source['options'].to_json)%>); plot.redraw(); - </script> - <% end %> - <li class="<%=source['name'] == @displayname ? 'active' : ''%>"> - <a id='<%=@graph_t == 'http' ? "http_timing" : "source_timing_display"%>' style="margin-right:5px"><%= source['name'] %></a></li> + <% @keys.each do |key| %> + <li class="<%=key == @keyname ? 'active' : ''%>"> + <a class='source_timing_key' style="margin-right:5px" id='<%=@sources[0]['name']%>'><%= key %></a></li> <% end%> </ul> <% end %>