{
const brush = vl.selectInterval().encodings('x');
const attributeSelect = vl.selectSingle().encodings("x");
const ageDistribution = vl.markBar({tooltip: true})
.data(percentRankCategory)
.params(brush)
.encode(
vl.x().fieldQ('Age').title("Distribution of Age of Other "+ outputPercentileName+" Picked players" ),
vl.y().count().axis({ orient: 'right' }).axis({ })
)
.width(width/2.3)
.height(400)
.config({ view: { stroke: null }})
.padding(70);
const zscoreTop50players = vl.markBar({tooltip: true})
.data(top50perpentile)
.encode(
vl.x().fieldN('Name').title("Names of players in" ),
vl.y().fieldQ('meanZscore'),
vl.tooltip(['Name', 'meanZscore']),
vl.opacity().if(brush, vl.value(0.75)).value(0.05)
).select(attributeSelect).encode(
vl.color().if(attributeSelect, vl.color().value("steelblue")).value("lightgrey")
)
.width(width/2.3)
.height(250);
const lineChartTurnedPoint = vl.layer
(vl.markCircle()
.data(top50perpentile)
.params(vl.selectInterval().bind("scales"))
.encode(
vl.x().fieldQ("avgCapability").scale({"domain": [0,100]}),
vl.y().fieldQ(features).scale({"domain": [0,100]}),
vl.tooltip().fieldN(['Name'])
).transform(
vl.filter(attributeSelect)
)
,
vl.markCircle()
.params(vl.selectInterval().bind("scales"))
.data(selectedClub)
.encode(
vl.x().fieldQ("avgCapability").scale({"domain": [0,100]}),
vl.y().fieldQ(features).scale({"domain": [0,100]}),
vl.color(
{
condition: [
{
value: "red",
test:
{
field: "Name",
oneOf: [playerName]
}
},
],
value: "lightgrey",
}
),
vl.tooltip().fieldN(['Name'])
)
)
.width(width * 0.6).height(150)
return vl.vconcat(vl.vconcat(ageDistribution,zscoreTop50players),lineChartTurnedPoint).render();
}