Scatter Plot PL xG Data with both xP and Points with button
This example visualizes Premier League expected goals (xG) data for Arsenal, plotting both actual points and expected points (xP) across matchweeks as separate scatter plot layers over a shared axis. A clickable “Team” button toggles a dropdown menu listing all teams, allowing the user to filter and compare different squads. The visualization is built with D3 v7, using `scaleLinear` for axes, `csvParse` to load data from a GitHub gist, and applies a join-based approach for incremental SVG rendering of circles and menus. The code also integrates custom axis and dropdown modules.
AI-generated descriptionA scatter plot of the PL xG data with axes and a button.
Help from: https://d3-graph-gallery.com/graph/line_select.html and https://www.w3schools.com/howto/howto_js_dropdown.asp and https://www.freecodecamp.org/news/how-to-build-a-dropdown-menu-with-javascript/ and https://alvarotrigo.com/blog/drop-down-menu-javascript/