Reusable 3D Vector Field Chart
Example
let chartHolder = d3.select("#chartholder");
let myData = [...];
let vectorFunction = (x, y, z, value) => {
return {
vx: Math.pow(x, 2) + y * Math.pow(x, 2),
vy: Math.pow(y, 2) - x * Math.pow(z, 2),
vz: Math.pow(z, 2)
};
};
let myChart = d3.x3d.chart.vectorFieldChart()
.vectorFunction(vectorFunction);
chartHolder.datum(myData).call(myChart);