Skip to content

Instantly share code, notes, and snippets.

@reinholdsson
Last active April 19, 2016 10:29
Show Gist options
  • Save reinholdsson/5735146 to your computer and use it in GitHub Desktop.
Save reinholdsson/5735146 to your computer and use it in GitHub Desktop.
rCharts: Top 50 DVD Rentals
library(httr)
library(rCharts)
library(RJSONIO)
library(data.table)
# Settings
.API_KEY <- "" # fill in your api key
.LIMIT <- 50
.URL <- sprintf(
"http://api.rottentomatoes.com/api/public/v1.0/lists/dvds/top_rentals.json?apikey=%s&limit=%s",
.API_KEY,
.LIMIT
)
# Retrieve the data from the API
movieJSON <- paste(readLines(.URL, warn = FALSE), collapse = "")
movieList <- fromJSON(movieJSON, simplify = F)
movieTable <- rbindlist(lapply(movieList$movies, function(movie) {
data.table(
x = movie$ratings$critics_score,
y = movie$ratings$audience_score,
name = sprintf("<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>%1$s</th></tr><tr><td><img src='%2$s' height='91' width='61'></td><td align='left'>Year: %3$s<br>Runtime: %6$s<br>Audience: %7$s<br>Critics: %4$s<br>M-rating: %5$s</td></tr></table>",
movie$title,
movie$posters$thumbnail,
movie$year,
movie$ratings$critics_rating,
movie$mpaa_rating,
movie$runtime,
movie$ratings$audience_rating
),
url = movie$links$alternate,
category = movie$mpaa_rating
)
}))
# Split the list into categories
movieSeries <- lapply(split(movieTable, movieTable$category), function(x) {
res <- lapply(split(x, rownames(x)), as.list)
names(res) <- NULL
return(res)
})
# Create the chart object
a <- rCharts::Highcharts$new()
invisible(sapply(movieSeries, function(x) {
a$series(data = x, type = "scatter", name = x[[1]]$category)
}
))
a$plotOptions(
scatter = list(
cursor = "pointer",
point = list(
events = list(
click = "#! function() { window.open(this.options.url); } !#")),
marker = list(
symbol = "circle",
radius = 5
)
)
)
a$xAxis(title = list(text = "Critics Score"), labels = list(format = "{value} %"))
a$yAxis(title = list(text = "Audience Score"), labels = list(format = "{value} %"))
a$tooltip(useHTML = T, formatter = "#! function() { return this.point.name; } !#")
a$colors(
'rgba(223, 83, 83, .75)',
'rgba(60, 179, 113, .75)',
'rgba(238, 130, 238, .75)',
'rgba(30, 144, 255, .75)',
'rgba(139, 139, 131, .75)'
)
a$legend(
align = 'right',
verticalAlign = 'middle',
layout = 'vertical',
title = list(text = "M-Rating")
)
a$title(text = "Top 50 DVD Rentals")
a$subtitle(text = "Retrieved using the Rotten Tomatoes API")
# Plot it!
a
<!doctype HTML>
<html>
<head>
<link rel='stylesheet' href="http://netdna.bootstrapcdn.com/bootswatch/2.3.1/cosmo/bootstrap.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css" >
<link rel='stylesheet' href="http://twitter.github.io/bootstrap/assets/js/google-code-prettify/prettify.css">
<script src='http://code.jquery.com/jquery-1.9.1.min.js' type='text/javascript'></script>
<script src='http://code.highcharts.com/highcharts.js' type='text/javascript'></script>
<script src='http://code.highcharts.com/highcharts-more.js' type='text/javascript'></script>
<style>
.rChart {
display: block
margin: auto auto;
width: 800px;
height: 400px;
}
body {
margin-top: 60px;
}
</style>
</head>
<body>
<div class='container'>
<div class='row'>
<div class='span9'>
<div id='chart20921d7918e' class='rChart nvd3Plot highcharts'></div>
<br/>
<pre><code class='r'>library(httr)
library(rCharts)
library(RJSONIO)
library(data.table)
# Settings
.API_KEY &lt;- &quot;&quot; # fill in your api key
.LIMIT &lt;- 50
.URL &lt;- sprintf(
&quot;http://api.rottentomatoes.com/api/public/v1.0/lists/dvds/top_rentals.json?apikey=%s&amp;limit=%s&quot;,
.API_KEY,
.LIMIT
)
# Retrieve the data from the API
movieJSON &lt;- paste(readLines(.URL, warn = FALSE), collapse = &quot;&quot;)
movieList &lt;- fromJSON(movieJSON, simplify = F)
movieTable &lt;- rbindlist(lapply(movieList$movies, function(movie) {
data.table(
x = movie$ratings$critics_score,
y = movie$ratings$audience_score,
name = sprintf(&quot;&lt;table cellpadding='4' style='line-height:1.5'&gt;&lt;tr&gt;&lt;th colspan='3'&gt;%1$s&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;img src='%2$s' height='91' width='61'&gt;&lt;/td&gt;&lt;td align='left'&gt;Year: %3$s&lt;br&gt;Runtime: %6$s&lt;br&gt;Audience: %7$s&lt;br&gt;Critics: %4$s&lt;br&gt;M-rating: %5$s&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&quot;,
movie$title,
movie$posters$thumbnail,
movie$year,
movie$ratings$critics_rating,
movie$mpaa_rating,
movie$runtime,
movie$ratings$audience_rating
),
url = movie$links$alternate,
category = movie$mpaa_rating
)
}))
# Split the list into categories
movieSeries &lt;- lapply(split(movieTable, movieTable$category), function(x) {
res &lt;- lapply(split(x, rownames(x)), as.list)
names(res) &lt;- NULL
return(res)
})
# Create the chart object
a &lt;- rCharts::Highcharts$new()
invisible(sapply(movieSeries, function(x) {
a$series(data = x, type = &quot;scatter&quot;, name = x[[1]]$category)
}
))
a$plotOptions(
scatter = list(
cursor = &quot;pointer&quot;,
point = list(
events = list(
click = &quot;#! function() { window.open(this.options.url); } !#&quot;)),
marker = list(
symbol = &quot;circle&quot;,
radius = 5
)
)
)
a$xAxis(title = list(text = &quot;Critics Score&quot;), labels = list(format = &quot;{value} %&quot;))
a$yAxis(title = list(text = &quot;Audience Score&quot;), labels = list(format = &quot;{value} %&quot;))
a$tooltip(useHTML = T, formatter = &quot;#! function() { return this.point.name; } !#&quot;)
a$colors(
'rgba(223, 83, 83, .75)',
'rgba(60, 179, 113, .75)',
'rgba(238, 130, 238, .75)',
'rgba(30, 144, 255, .75)',
'rgba(139, 139, 131, .75)'
)
a$legend(
align = 'right',
verticalAlign = 'middle',
layout = 'vertical',
title = list(text = &quot;M-Rating&quot;)
)
a$title(text = &quot;Top 50 DVD Rentals&quot;)
a$subtitle(text = &quot;Retrieved using the Rotten Tomatoes API&quot;)
# Plot it!
a
</code></pre>
</div>
</div>
</div>
<script type='text/javascript'>
(function($){
$(function () {
var chart = new Highcharts.Chart({
"dom": "chart20921d7918e",
"width": 800,
"height": 400,
"credits": {
"href": null,
"text": null
},
"title": {
"text": "Top 50 DVD Rentals"
},
"yAxis": {
"title": {
"text": "Audience Score"
},
"labels": {
"format": "{value} %"
}
},
"series": [
{
"data": [
{
"x": 99,
"y": 82,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Finding Nemo</th></tr><tr><td><img src='http://content6.flixster.com/movie/10/84/19/10841916_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2003<br>Runtime: 100<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: G</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/finding_nemo/",
"category": "G"
}
],
"type": "scatter",
"name": "G"
},
{
"data": [
{
"x": 27,
"y": 57,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Escape From Planet Earth</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/17/16/11171699_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 89<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: PG</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/escape_from_planet_earth_2013/",
"category": "PG"
},
{
"x": 85,
"y": 62,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>A Monster in Paris</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/15/93/11159334_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2011<br>Runtime: 89<br>Audience: Upright<br>Critics: Fresh<br>M-rating: PG</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/a_monster_in_paris/",
"category": "PG"
},
{
"x": 98,
"y": 84,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Brooklyn Castle</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/16/67/11166757_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 102<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: PG</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/brooklyn_castle_2012/",
"category": "PG"
}
],
"type": "scatter",
"name": "PG"
},
{
"data": [
{
"x": 80,
"y": 78,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Warm Bodies</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/17/14/11171434_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 97<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: PG-13</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/warm_bodies/",
"category": "PG-13"
},
{
"x": 61,
"y": 69,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Jack Reacher</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/17/06/11170621_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 130<br>Audience: Upright<br>Critics: Fresh<br>M-rating: PG-13</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/jack_reacher/",
"category": "PG-13"
},
{
"x": 13,
"y": 70,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Safe Haven</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/16/77/11167789_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 115<br>Audience: Upright<br>Critics: Rotten<br>M-rating: PG-13</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/safe_haven/",
"category": "PG-13"
},
{
"x": 38,
"y": 43,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Guilt Trip</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/17/06/11170620_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 96<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: PG-13</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_guilt_trip/",
"category": "PG-13"
},
{
"x": 81,
"y": 85,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Impossible</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/17/03/11170393_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 113<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: PG-13</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_impossible_2012/",
"category": "PG-13"
},
{
"x": 45,
"y": 56,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Beautiful Creatures</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/17/07/11170795_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 124<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: PG-13</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/beautiful_creatures_2013/",
"category": "PG-13"
},
{
"x": 36,
"y": 54,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Dark Skies</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/17/13/11171396_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 97<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: PG-13</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/dark_skies_2013/",
"category": "PG-13"
},
{
"x": 27,
"y": 50,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Sorcerer and the White Snake</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/16/83/11168317_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 99<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: PG-13</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_sorcerer_and_the_white_snake/",
"category": "PG-13"
},
{
"x": 44,
"y": 76,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Last Ride</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/16/55/11165514_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 102<br>Audience: Upright<br>Critics: Rotten<br>M-rating: PG-13</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_last_ride_2011/",
"category": "PG-13"
},
{
"x": 65,
"y": 59,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Mama</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/17/06/11170616_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 100<br>Audience: Spilled<br>Critics: Fresh<br>M-rating: PG-13</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/mama_2013/",
"category": "PG-13"
}
],
"type": "scatter",
"name": "PG-13"
},
{
"data": [
{
"x": 15,
"y": 44,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>A Good Day To Die Hard</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/17/12/11171258_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 97<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/a_good_day_to_die_hard/",
"category": "R"
},
{
"x": 85,
"y": 75,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Side Effects</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/17/07/11170750_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 106<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/side_effects_2013/",
"category": "R"
},
{
"x": 30,
"y": 43,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Broken City</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/17/06/11170618_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 108<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/broken_city/",
"category": "R"
},
{
"x": 40,
"y": 54,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Parker</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/17/13/11171324_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 118<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/parker_2012/",
"category": "R"
},
{
"x": 88,
"y": 94,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Django Unchained</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/17/17/11171702_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 165<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/django_unchained_2012/",
"category": "R"
},
{
"x": 60,
"y": 58,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Last Stand</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/17/09/11170918_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 107<br>Audience: Spilled<br>Critics: Fresh<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/last_stand_2013/",
"category": "R"
},
{
"x": 51,
"y": 45,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Promised Land</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/17/06/11170615_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 106<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/1016837-promised_land/",
"category": "R"
},
{
"x": 38,
"y": 50,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Stand Up Guys</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/17/13/11171323_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 94<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/stand_up_guys/",
"category": "R"
},
{
"x": 23,
"y": 49,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Haunting in Connecticut 2: Ghosts of Georgia</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/17/03/11170392_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 100<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_haunting_in_connecticut_2_ghosts_of_georgia/",
"category": "R"
},
{
"x": 38,
"y": 34,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Hyde Park on Hudson</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/16/94/11169447_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 95<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/hyde_park_on_hudson/",
"category": "R"
},
{
"x": 38,
"y": 33,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The ABCs of Death</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/16/42/11164272_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 129<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_abcs_of_death/",
"category": "R"
},
{
"x": 67,
"y": 71,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Cloud Atlas</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/16/87/11168701_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 172<br>Audience: Upright<br>Critics: Fresh<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/cloud_atlas_2012/",
"category": "R"
},
{
"x": 60,
"y": 55,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>John Dies at the End</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/16/71/11167149_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 99<br>Audience: Spilled<br>Critics: Fresh<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/john_dies_at_the_end/",
"category": "R"
},
{
"x": 84,
"y": 72,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Dragon</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/16/73/11167303_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 98<br>Audience: Upright<br>Critics: Fresh<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/swordsmen/",
"category": "R"
},
{
"x": 44,
"y": 42,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Bad Kids Go to Hell</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/16/72/11167299_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 91<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/bad_kids_go_to_hell/",
"category": "R"
},
{
"x": 46,
"y": 46,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Sweeney</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/16/96/11169663_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 112<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_sweeney/",
"category": "R"
},
{
"x": 92,
"y": 88,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Silver Linings Playbook</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/17/06/11170611_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 122<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/silver_linings_playbook/",
"category": "R"
},
{
"x": 76,
"y": 72,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>It's a Disaster</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/16/56/11165615_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 88<br>Audience: Upright<br>Critics: Fresh<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/its_a_disaster/",
"category": "R"
},
{
"x": 31,
"y": 36,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Oranges</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/17/11/11171116_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 92<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_oranges_2011/",
"category": "R"
},
{
"x": 77,
"y": 75,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Any Day Now</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/16/75/11167534_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 97<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/any_day_now_2012/",
"category": "R"
},
{
"x": 27,
"y": 29,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Numbers Station</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/16/94/11169469_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 89<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_numbers_station/",
"category": "R"
},
{
"x": 45,
"y": 37,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Details</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/16/71/11167100_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 91<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_details_2010/",
"category": "R"
},
{
"x": 19,
"y": 55,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Baytown Outlaws</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/16/78/11167811_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 98<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_baytown_outlaws/",
"category": "R"
},
{
"x": 44,
"y": 39,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Save The Date</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/16/72/11167249_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 98<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/save_the_date_2012/",
"category": "R"
},
{
"x": 69,
"y": 46,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Not Fade Away</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/17/06/11170619_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 112<br>Audience: Spilled<br>Critics: Fresh<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/not_fade_away_2012/",
"category": "R"
},
{
"x": 19,
"y": 45,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Texas Chainsaw</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/17/13/11171397_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 91<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/texas_chainsaw/",
"category": "R"
},
{
"x": 32,
"y": 61,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Gangster Squad</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/17/03/11170394_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 110<br>Audience: Upright<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/gangster_squad_2012/",
"category": "R"
},
{
"x": 20,
"y": 58,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Identity Thief</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/17/09/11170920_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 112<br>Audience: Spilled<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/identity_thief/",
"category": "R"
},
{
"x": 12,
"y": 60,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>A Haunted House</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/17/06/11170617_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 86<br>Audience: Upright<br>Critics: Rotten<br>M-rating: R</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/a_haunted_house/",
"category": "R"
}
],
"type": "scatter",
"name": "R"
},
{
"data": [
{
"x": 68,
"y": 51,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Wuthering Heights</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/16/69/11166968_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 128<br>Audience: Spilled<br>Critics: Certified Fresh<br>M-rating: Unrated</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/wuthering_heights_2011/",
"category": "Unrated"
},
{
"x": 94,
"y": 85,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>The Central Park Five</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/16/74/11167457_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 120<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: Unrated</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/the_central_park_five_2012/",
"category": "Unrated"
},
{
"x": 80,
"y": 67,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Hitler's Children</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/16/71/11167119_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 80<br>Audience: Upright<br>Critics: Fresh<br>M-rating: Unrated</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/hitlers_children_2012/",
"category": "Unrated"
},
{
"x": 27,
"y": 62,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Struck by Lightning</th></tr><tr><td><img src='http://content7.flixster.com/movie/11/16/87/11168777_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 84<br>Audience: Upright<br>Critics: Rotten<br>M-rating: Unrated</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/struck_by_lightning_2012/",
"category": "Unrated"
},
{
"x": 93,
"y": 77,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Lore</th></tr><tr><td><img src='http://content8.flixster.com/movie/11/16/67/11166766_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 108<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: Unrated</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/lore/",
"category": "Unrated"
},
{
"x": 88,
"y": 77,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Upstream Color</th></tr><tr><td><img src='http://content6.flixster.com/movie/11/16/78/11167896_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2013<br>Runtime: 96<br>Audience: Upright<br>Critics: Certified Fresh<br>M-rating: Unrated</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/upstream_color/",
"category": "Unrated"
},
{
"x": 93,
"y": 69,
"name": "<table cellpadding='4' style='line-height:1.5'><tr><th colspan='3'>Meet the Fokkens</th></tr><tr><td><img src='http://content9.flixster.com/movie/11/16/60/11166083_mob.jpg' height='91' width='61'></td><td align='left'>Year: 2012<br>Runtime: 80<br>Audience: Upright<br>Critics: Fresh<br>M-rating: Unrated</td></tr></table>",
"url": "http://www.rottentomatoes.com/m/meet_the_fokkens/",
"category": "Unrated"
}
],
"type": "scatter",
"name": "Unrated"
}
],
"plotOptions": {
"scatter": {
"cursor": "pointer",
"point": {
"events": {
"click": function() { window.open(this.options.url); }
}
},
"marker": {
"symbol": "circle",
"radius": 5
}
}
},
"xAxis": {
"title": {
"text": "Critics Score"
},
"labels": {
"format": "{value} %"
}
},
"tooltip": {
"useHTML": true,
"formatter": function() { return this.point.name; }
},
"colors": [
"rgba(223, 83, 83, .75)",
"rgba(60, 179, 113, .75)",
"rgba(238, 130, 238, .75)",
"rgba(30, 144, 255, .75)",
"rgba(139, 139, 131, .75)"
],
"legend": {
"align": "right",
"verticalAlign": "middle",
"layout": "vertical",
"title": {
"text": "M-Rating"
}
},
"subtitle": {
"text": "Retrieved using the Rotten Tomatoes API"
},
"id": "chart20921d7918e",
"chart": {
"renderTo": "chart20921d7918e"
}
});
});
})(jQuery);
</script>
</body>
<!-- Google Prettify -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/188.0.0/prettify.js"></script>
<script
src='https://google-code-prettify.googlecode.com/svn-history/r232/trunk/src/lang-r.js'>
</script>
<script>
var pres = document.getElementsByTagName("pre");
for (var i=0; i < pres.length; ++i) {
pres[i].className = "prettyprint linenums";
}
prettyPrint();
</script>
</html>
@reinholdsson
Copy link
Author

The style/css needs to be tweaked a bit to be fully compatible with Firefox and/or IE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment