D3_data_journalism/assets/js/app.js
// Update x-axis scale based on data
Update x-axis scale based on data
Update x - axis scale based on data
function xScale(censusData, chosenXAxis) {
  var xLinearScale = d3.scaleLinear()
    .range([0, chartWidth])
    .domain([d3.min(censusData, d => d[chosenXAxis]) * 0.8,
             d3.max(censusData, d => d[chosenXAxis]) * 1.1
    ]);
  return xLinearScale;
}
function xScale ( censusData , chosenXAxis ) { var xLinearScale = d3 . scaleLinear ( ) . range ( [ 0 , chartWidth ] ) . domain ( [ d3 . min ( censusData , d => d [ chosenXAxis ] ) * 0.8 , d3 . max ( censusData , d => d [ chosenXAxis ] ) * 1.1 ] ) ; return xLinearScale ; }
Update x-axis scale based on data
Update x - axis scale based on data