{
`md Difference of Ticket Price Chart`
const labelTicketPrice = ['Berlin-Warsaw','Zurich-Milan','Paris-Barcelona','London-Amsterdam','Munich-Budapest','London-Marseille'];
const point1 = vl.markPoint({filled: true, size: 100})
.data(stats)
.encode(
vl.x().fieldQ('AvgTicketPriceEuros').title('Average Ticket Price (Euros)'),
vl.y().fieldN('Route').sort(labelTicketPrice),
vl.color().fieldN('Mode')
.legend({labelFontSize: 18, titleFontSize: 18, titleAnchor: 'middle', orient:'top'})
);
const line1 = point1.markLine({strokeWidth: 3, strokeDash: [8, 4], opacity: 0.8})
.encode(
vl.detail().fieldN('Route'),
vl.color().value("#B0C4DE")
);
const ticketchart = vl.layer(point1,line1).width(400).height(200)
.title({text: "Difference of Ticket Price (Financial Cost)", fontSize: 15});
`md Difference of CO2 emission Chart`
const labelCO2 = ['Zurich-Milan','Paris-Barcelona','London-Amsterdam','Munich-Budapest','London-Marseille','Berlin-Warsaw'];
const point2 = vl.markPoint({filled: true, size: 100})
.data(stats)
.encode(
vl.x().fieldQ('CO2InKGramsPerPassenger').title('Average CO2 Emissions Per Passenger (kg)'),
vl.y().fieldN('Route').sort(labelCO2),
vl.color().fieldN('Mode').legend(null)
);
const line2 = point2.markLine({strokeWidth: 3, strokeDash: [8, 4], opacity: 0.8})
.encode(
vl.detail().fieldN('Route'),
vl.color().value("#B0C4DE")
);
const co2chart = vl.layer(point2,line2).width(400).height(200)
.title({text: "Difference of CO2 Emission (Environmental Cost)", fontSize: 15});
`md Difference of Ticket Price Chart`
const labeltraveltime = ['Zurich-Milan','London-Amsterdam','Munich-Budapest','Berlin-Warsaw','Paris-Barcelona','London-Marseille'];
const point3 = vl.markPoint({filled: true, size: 100})
.data(stats)
.encode(
vl.x().fieldQ('AvgTravelTimeMinutes').title('Average Travel Time (min)'),
vl.y().fieldN('Route').sort(labeltraveltime),
vl.color().fieldN('Mode').legend(null)
);
const line3 = point3.markLine({strokeWidth: 3, strokeDash: [8, 4], opacity: 0.8})
.encode(
vl.detail().fieldN('Route'),
vl.color().value("#B0C4DE")
);
const traveltimechart = vl.layer(point3,line3).width(400).height(200)
.title({text: "Difference of Travel Time (Time Cost)", fontSize: 15});
`md Putting together three charts`
return vl.vconcat(ticketchart, co2chart, traveltimechart)
.title({text: 'Comparing Travel Costs By Taking Plane and Train', fontSize: 25, fontType: 'Tahoma', anchor: 'middle'})
.render();
}