D3_data_journalism/assets/js/app.js
// Update y-axis scale based on data
Update y-axis scale based on data
Update y - axis scale based on data
function yScale(censusData, chosenYAxis) {
  var yLinearScale = d3.scaleLinear()
    .range([chartHeight, 0])
    .domain([d3.min(censusData, d => d[chosenYAxis]) * 0.8,
             d3.max(censusData, d => d[chosenYAxis]) * 1.1
    ]);
  return yLinearScale;
}
function yScale ( censusData , chosenYAxis ) { var yLinearScale = d3 . scaleLinear ( ) . range ( [ chartHeight , 0 ] ) . domain ( [ d3 . min ( censusData , d => d [ chosenYAxis ] ) * 0.8 , d3 . max ( censusData , d => d [ chosenYAxis ] ) * 1.1 ] ) ; return yLinearScale ; }
Update y-axis scale based on data
Update y - axis scale based on data