chart2 = {
const hover = vl.selectSingle("hover")
.on("mouseover")
.encodings("x")
.nearest(true)
.clear("moouseout")
.init({ x: { year: 2014, month: 3, date: 25 } });
const lineAndPoint = vl.layer(
vl.markLine(),
vl.markPoint()
.transform(vl.filter(hover))
).encode(
vl.y().fieldQ("value"),
vl.color().fieldN("Actor1CountryCode")
);
const rule =vl.markRule({ strokeWidth: 0.5, tooltip: true })
.transform(vl.pivot("Actor1CountryCode").value("value").groupby(["MonthYear"]))
.encode(
vl.opacity().value(0).if(hover, vl.value(0.7)),
vl.tooltip([vl.fieldT("MonthYear")])
)
.select(hover);
return vl
.layer(lineAndPoint, rule )
.encode(vl.x().fieldT("MonthYear"))
.data(chart_data1)
.width(width - 150)
.height(300)
.render();
}