function redrawAxis() {
                // Update the x-axis based on the updated xScale range
                this.select(`.${styles.x.split(' ')[0]}`)
                    .attr('transform', function() {
                        if(y.domain()[0] >= 0) {
                            return 'translate(0, ' + y(y.domain()[0]) + ')';
                        } else if (y.domain()[0] < 0 && y.domain()[1] < 0) {
                            return 'translate(0, ' + y(y.domain()[1]) + ')';
                        } else {
                            return 'translate(0, ' + y(0) + ')';
                        }
                    })
                    .call(xAxis);

                // Update the y-axis based on the updated yScale range
                this.select(`.${styles.y.split(' ')[0]}`)
                    .attr('transform', function() {
                        if(x.domain()[0] >= 0) {
                            return 'translate(' + x(x.domain()[0]) + ', 0)';
                        } else if (x.domain()[0] < 0 && x.domain()[1] < 0) {
                            return 'translate(' + x(x.domain()[1]) + ', 0)';
                        } else {
                            return 'translate(' + x(0) + ', 0)';
                        }
                    })
                    .call(yAxis);

                var ticks = this.selectAll(`.${styles.x.split(' ')[0]} > g.tick`);
                var lastTick = ticks[0][ticks[0].length - 1];
                d3.select(lastTick).select('text').style('text-anchor', 'end');
            }
// Update the positions and values of the X and Y Axis
Update the positions and values of the X and Y Axis
Update the positions and values of the X and Y Axis
function redrawAxis() {
                this.select(`.${styles.x.split(' ')[0]}`)
                    .attr('transform', function() {
                        if(y.domain()[0] >= 0) {
                            return 'translate(0, ' + y(y.domain()[0]) + ')';
                        } else if (y.domain()[0] < 0 && y.domain()[1] < 0) {
                            return 'translate(0, ' + y(y.domain()[1]) + ')';
                        } else {
                            return 'translate(0, ' + y(0) + ')';
                        }
                    })
                    .call(xAxis);
                this.select(`.${styles.y.split(' ')[0]}`)
                    .attr('transform', function() {
                        if(x.domain()[0] >= 0) {
                            return 'translate(' + x(x.domain()[0]) + ', 0)';
                        } else if (x.domain()[0] < 0 && x.domain()[1] < 0) {
                            return 'translate(' + x(x.domain()[1]) + ', 0)';
                        } else {
                            return 'translate(' + x(0) + ', 0)';
                        }
                    })
                    .call(yAxis);
                var ticks = this.selectAll(`.${styles.x.split(' ')[0]} > g.tick`);
                var lastTick = ticks[0][ticks[0].length - 1];
                d3.select(lastTick).select('text').style('text-anchor', 'end');
            }
function redrawAxis ( ) { this . select ( ` ${ styles . x . split ( ' ' ) [ 0 ] } ` ) . attr ( 'transform' , function ( ) { if ( y . domain ( ) [ 0 ] >= 0 ) { return 'translate(0, ' + y ( y . domain ( ) [ 0 ] ) + ')' ; } else if ( y . domain ( ) [ 0 ] < 0 && y . domain ( ) [ 1 ] < 0 ) { return 'translate(0, ' + y ( y . domain ( ) [ 1 ] ) + ')' ; } else { return 'translate(0, ' + y ( 0 ) + ')' ; } } ) . call ( xAxis ) ; this . select ( ` ${ styles . y . split ( ' ' ) [ 0 ] } ` ) . attr ( 'transform' , function ( ) { if ( x . domain ( ) [ 0 ] >= 0 ) { return 'translate(' + x ( x . domain ( ) [ 0 ] ) + ', 0)' ; } else if ( x . domain ( ) [ 0 ] < 0 && x . domain ( ) [ 1 ] < 0 ) { return 'translate(' + x ( x . domain ( ) [ 1 ] ) + ', 0)' ; } else { return 'translate(' + x ( 0 ) + ', 0)' ; } } ) . call ( yAxis ) ; var ticks = this . selectAll ( ` ${ styles . x . split ( ' ' ) [ 0 ] } ` ) ; var lastTick = ticks [ 0 ] [ ticks [ 0 ] . length - 1 ] ; d3 . select ( lastTick ) . select ( 'text' ) . style ( 'text-anchor' , 'end' ) ; }
Update the positions and values of the X and Y Axis
Update the positions and values of the X and Y Axis
// Update the x-axis based on the updated xScale range // Update the y-axis based on the updated yScale range