Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

The non-inline annotated_timeline method now refers to google's jsapi…

… like the inline version.
  • Loading branch information...
commit bf6b5e56f5953fa67c1aeb8f1c44f9e483b99444 1 parent de02f95
@duff authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/annotated_timeline.rb
View
6 lib/annotated_timeline.rb
@@ -26,8 +26,7 @@ module AnnotatedTimeline
#this version will automatically create a div inline for you.
#note that if it is in the middle of the page, the javascript will try to execute before the page load completes
def inline_annotated_timeline(daily_counts_by_type, width = 750, height = 300, div_id_to_create = 'graph', options = {})
- html = "<script type=\"text/javascript\" src=\"http://www.google.com/jsapi\"></script>"
- html << annotated_timeline(daily_counts_by_type, div_id_to_create, options)
+ html = annotated_timeline(daily_counts_by_type, div_id_to_create, options)
html << "<div id=\"#{div_id_to_create}\" style=\"width: #{width}px\; height: #{height}px\;\"></div>"
end
@@ -40,7 +39,8 @@ def annotated_timeline(daily_counts_by_type, div_id = 'graph', options = {})
google_options = format_options_for_javascript(options, daily_graph)
data_args = google_options.any? ? "data, {#{google_options.join(", ")}}" : "data"
- html = "<script type=\"text/javascript\">
+ html = '<script type="text/javascript" src="http://www.google.com/jsapi"></script>'
+ html << "<script type=\"text/javascript\">
google.load(\"visualization\", \"1\", {packages:[\"annotatedtimeline\"]});
google.setOnLoadCallback(drawChart);
function drawChart(){
Please sign in to comment.
Something went wrong with that request. Please try again.