Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request example using fetched data #221

Open
keithpjolley opened this issue Jul 2, 2022 · 1 comment
Open

Request example using fetched data #221

keithpjolley opened this issue Jul 2, 2022 · 1 comment
Labels
question Further information is requested

Comments

@keithpjolley
Copy link

Can you create an example that uses fetched data? I'm trying to do something like:

var myChart = d3.x3d.chart.scatterPlot()
    .mappings({ x: 'x', y: 'y', z: 'z', size: 'size', color: 'color' })
    .colors(d3.schemeRdYlGn[8])
    .sizeRange([0.1, 1.5]);

var chartHolder = d3.select("#chartholder");

const refreshChart = () => {
    var myData = d3.x3d.randomData.dataset6(200);
    chartHolder.datum(myData).call(myChart);
};

d3.select("#refresh").attr("onclick", "refreshChart2()");
refreshChart();

d3.json('data1.json').then((data) => {
    //refreshChart();
}).catch(() => {
    console.log('fail');
});

but I can't figure out why the above works but if I comment out the first refreshChart() and uncomment out the second it fails.

@keithpjolley
Copy link
Author

And yes I'm aware that the refreshChart() doesn't actually use the data I'm pulling. I wanted to eliminate that as a source of error.

@jamesleesaunders jamesleesaunders added the question Further information is requested label Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants