viewof jump_rating = V({
data: {values: movies},
transform: [
{filter: {field: "Genre", oneOf: genreSelection}},
{filter: {field: "Month", oneOf: monthSelection}},
{filter: {field: "Year", oneOf: yearSelection}},
],
hconcat: [{
width: 300,
height: 300,
selection: {
MPAArating: {
type: "multi", fields: ["MPAA_Rating"], bind: "legend",
},
rating: {
type: "single",
fields: ["MPAA_Rating"],
bind: {input: "select", options: [null, "NR", "G", "PG", "PG-13", "TV-MA", "M", "R", "NC-17"]}
},
criticBrush : { type: "interval"}
},
transform: [
{filter: {selection: "audienceBrush", fields: ["RT_Critic"]}}
],
mark: {
type: "circle",
size:50
},
encoding: {
x:{field: "Jump_Count", type: "quantitative"},
y:{field: "RT_Critic", type: "quantitative",axis: {title: "Rotton Tomatoes CRITICS Ratings"}},
color: {
selection: "MPAArating",
field: "MPAA_Rating", "type": "nominal",
scale: {
domain: ["NR", "G", "PG", "PG-13", "TV-MA", "M", "R", "NC-17"],
range: ["#a5a4a4", "#83c444", "#287b3d", "#e9bf1e", "#e18c26", "#dd4d3d", "#921f1f", "#330808"]
},
},
opacity: {
condition: {"selection": "rating", "value": 1},
// condition: {"selection": "criticBrush", "value": 1},
value: 0.05
},
tooltip: [
{field: "Movie_Name", type: "nominal", title: "Movie"},
{field: "MPAA_Rating", type: "nominal", title: "MPAA Rating"},
{field: "RT_Critic", type: "quantitative", title: "Rotten Tomatoes Critic Score"},
{field: "RT_Audience", type: "quantitative", title: "Rotten Tomatoes Audience Score"},
{field: "Jump_Count", type: "quantitative", title: "Jump Count"},
{field: "Genre", type: "nominal", title: "Subgenre"}
],
}
},{
width: 300,
height: 300,
mark: {
type: "circle",
size:50
},
transform: [
{filter: {selection: "criticBrush"}}
],
selection: {
MPAArating: {
type: "multi", fields: ["MPAA_Rating"], bind: "legend"
},
audienceBrush : { type: "interval"}
},
encoding: {
x:{field: "Jump_Count", type: "quantitative"},
y:{field: "RT_Audience", type: "quantitative",axis: {title: "Rotton Tomatoes AUDIENCE Ratings"}},
color: {
condition: {
selection: "MPAArating",
field: "MPAA_Rating", type: "nominal"
},
},
opacity: {
condition: {"selection": "rating", "value": 1},
// condition: {"selection": "audienceBrush", "value": 1},
value: 0.05
},
tooltip: [
{field: "Movie_Name", type: "nominal", title: "Movie"},
{field: "MPAA_Rating", type: "nominal", title: "MPAA Rating"},
{field: "RT_Critic", type: "quantitative", title: "Rotten Tomatoes Critic Score"},
{field: "RT_Audience", type: "quantitative", title: "Rotten Tomatoes Audience Score"},
{field: "Jump_Count", type: "quantitative", title: "Jump Count"},
{field: "Genre", type: "nominal", title: "Subgenre"}
],
},
},
{
transform: [
{filter: {selection: "audienceBrush"}},
{filter: {selection: "criticBrush"}}
],
width: 300,
height: 200,
mark: "bar",
selection: {
MPAArating: {fields: ["MPAA_Rating"], on: "click", type: "multi"}
},
encoding: {
y: {field: "MPAA_Rating", type: "nominal"},
x: {aggregate: "count", field: "*", type: "quantitative"},
opacity: {
condition: {selection: "MPAArating", value: 1},
value: 0.05
},
}
}]
})