Garmaine Staff asked 1 year ago

Im making a data visualization using d3 and react. Im trying to use react to render and d3 just for make calculations.

To draw X-Axis I have a <g> with a reference and to render the X-axis I just use:

const drawAxis = (graphData: graphData[], refXAxis: any, refYAxis: any, xScale: ScaleD3, yScale: ScaleD3): void => {
    let xAxis = d3.axisBottom(xScale);
    let yAxis = d3.axisLeft(yScale);
    let a = d3.select(refXAxis).call(xAxis);
    d3.select(refYAxis).call(yAxis); // so, this line manipulates DOM, I want to do *this* with react.
};

Is it possible to make this in react way?.