How to choose data column based on the varying slider?

Dear all, I was trying to select any column of the database according to the slider, but it seems didn’t work. The simple codes were attacthed, thank you very much for your time!

Simple slider codes

Here you go:

// data format modification
// create single object
dataMod = Object.fromEntries( => [d.Countries, d[yearString]]))

The problem in your code was that you wrote d.yearString instead of d[yearString]. I’ve also simplified the code a bit.

1 Like