Public
Edited
May 18, 2023
Insert cell
Insert cell
laxstats = FileAttachment("ncaa_stats_May17.csv").csv({typed: true})
Insert cell
import { vl } from "@vega/vega-lite-api" // Draw the chart

Insert cell
viewof variousCharts = {

const freshmen = vl.markCircle() // Make a scatter chart
.data(laxstats)
.title("Scoring By Year - Freshmen")
.transform(
vl.filter('datum.Year == "Fr"')
)
.encode(
vl.x().fieldQ("Goals"), // For x, use the Horsepower field
vl.y().fieldQ("Assists"), // For y, use the Miles_per_Gallon field
vl.tooltip([vl.fieldN("Full Name"),vl.fieldN("Team"),vl.fieldQ("Points")]), // For tooltips, show the Name field
)
.height(500)
.width(600);

const sophomore = vl.markCircle() // Make a scatter chart
.data(laxstats)
.title("Scoring By Year - Sophomore")
.transform(
vl.filter('datum.Year == "So"')
)
.encode(
vl.x().fieldQ("Goals"), // For x, use the Horsepower field
vl.y().fieldQ("Assists"), // For y, use the Miles_per_Gallon field
vl.tooltip([vl.fieldN("Full Name"),vl.fieldN("Team"),vl.fieldQ("Points")]), // For tooltips, show the Name field
)
.height(500)
.width(600);
const junior = vl.markCircle() // Make a scatter chart
.data(laxstats)
.title("Scoring By Year - Junior")
.transform(
vl.filter('datum.Year == "Jr"')
)
.encode(
vl.x().fieldQ("Goals"), // For x, use the Horsepower field
vl.y().fieldQ("Assists"), // For y, use the Miles_per_Gallon field
vl.tooltip([vl.fieldN("Full Name"),vl.fieldN("Team"),vl.fieldQ("Points")]), // For tooltips, show the Name field
)
.height(500)
.width(600);
const senior = vl.markCircle() // Make a scatter chart
.data(laxstats)
.title("Scoring By Year - Senior")
.transform(
vl.filter('datum.Year == "Sr"')
)
.encode(
vl.x().fieldQ("Goals"), // For x, use the Horsepower field
vl.y().fieldQ("Assists"), // For y, use the Miles_per_Gallon field
vl.tooltip([vl.fieldN("Full Name"),vl.fieldN("Team"),vl.fieldQ("Points")]), // For tooltips, show the Name field
).height(500)
.width(600);

return vl.vconcat(vl.hconcat(freshmen, sophomore, junior, senior),).render()

}
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more