As you can see in my attached observable notebook, I have a drop down menu with years in it. They are being interpreted as numbers and are including a comma. How can I go about removing that to just have a flat year.
The 4-digit year is a number, so is getting formatted with the thousands separator. I would cast the index to a string:
groupYears = d3.group(mlb_homeruns_stats, (d) => d.year.toString())
and then
viewof filter_date_select = Inputs.select(
groupYears,
{ value: groupYears.get("2024"), sort: true, label: "MLB Season" }
)
Define the grouped data separately so that you can default the value to the “2024” data.
Thank you so much. That was a very helpful answer. Much appreciated!!
1 Like