I have a variable Params passed in as an argument to the makePlot function. I would like to access it within the d3.json request but it is coming up as undefined. See Below.
const makePlot = (Params) => {
// Params defined here
d3.json(`somedata.json`, (error, data) => {
// Params not defined here
data.forEach((d) => {
d.Params.something = Number(d.Params.something);
d.Params.somethingElse = Number(d.Params.somethingElse);
});
};
Is there any way to rectify this?