function createNodes(rawData) {
    // Use the max total_amount in the data as the max in the scale's domain
    // note we have to ensure the total_amount is a number.
    var maxAmount = d3.max(rawData, function (d) { return +d.value; });
    //edited: joanna 03052019
    // Sizes bubbles based on area.
    // @v4: new flattened scale names.
    /*var radiusScale = d3.scalePow()
      .exponent(0.5)
      .range([2, 85])
      .domain([0, maxAmount]);*/
    //manually adjust first
    //TODO: Adjust from the front end
    console.log("maxAmount=",maxAmount)
    var adj
    if (maxAmount < 100 ){
      adj = 2
    }else if (maxAmount > 100 && maxAmount <= 200 ){
      adj = 4
    } else if (maxAmount > 200 && maxAmount <= 300 ){
      adj = 5
    } else if (maxAmount > 300 && maxAmount <= 400 ){
      adj = 10
    } else if (maxAmount > 400 && maxAmount <= 500 ){
      adj = 20
    } else {
      adj = 50
    }

    var d_min = (maxAmount+10)*(-1)
    var d_max = (maxAmount+10)
    var r_min = d_min/adj
    var r_max = d_max/adj

    //var radiusScale = d3.scalePow().domain([-100,100]).range([-50,50]);
    //var radiusScale = d3.scalePow().exponent(0.4).domain([0,30]).range([1,30]);
    //var radiusScale = d3.scalePow().exponent(0.10).domain([0,maxAmount]).range([1,maxAmount+10]);
    //var radiusScale = d3.scalePow().domain([-400,400]).range([-100,100]);
    var radiusScale = d3.scalePow().domain([d_min,d_max]).range([r_min,r_max]);

    //adjust again for each results in index.html page
    if (maxAmount < 50){
      radiusScale = d3.scalePow().domain([-80,80]).range([-50,50]);
    }

    // Use map() to convert raw data into node data.
    // Checkout http://learnjsdata.com/ for more on
    // working with data.
    var myNodes = rawData.map(function (d) {
      return {
        //id: d.id,
        radius: radiusScale(+d.value),
        value: +d.value,
        name: d.label,
        label: d.label,
        category: d.category,
        x: Math.random() * 900,
        y: Math.random() * 800
      };
    });

    // sort them to prevent occlusion of smaller nodes.
    myNodes.sort(function (a, b) { return b.value - a.value; });

    return myNodes;
  }
/*
   * This data manipulation function takes the raw data from
   * the CSV file and converts it into an array of node objects.
   * Each node will store data and visualization values to visualize
   * a bubble.
   *
   * rawData is expected to be an array of data objects, read in from
   * one of d3's loading functions like d3.csv.
   *
   * This function returns the new node array, with a node in that
   * array for each element in the rawData input.
   */
This data manipulation function takes the raw data from
the CSV file and converts it into an array of node objects.
Each node will store data and visualization values to visualize
a bubble.

rawData is expected to be an array of data objects, read in from
one of d3's loading functions like d3.csv.

This function returns the new node array, with a node in that
array for each element in the rawData input.
This data manipulation function takes the raw data from the CSV file and converts it into an array of node objects . Each node will store data and visualization values to visualize a bubble . rawData is expected to be an array of data objects read in from one of d3 ' s loading functions like d3 . csv . This function returns the new node array with a node in that array for each element in the rawData input .
function createNodes(rawData) {
    var maxAmount = d3.max(rawData, function (d) { return +d.value; });
    console.log("maxAmount=",maxAmount)
    var adj
    if (maxAmount < 100 ){
      adj = 2
    }else if (maxAmount > 100 && maxAmount <= 200 ){
      adj = 4
    } else if (maxAmount > 200 && maxAmount <= 300 ){
      adj = 5
    } else if (maxAmount > 300 && maxAmount <= 400 ){
      adj = 10
    } else if (maxAmount > 400 && maxAmount <= 500 ){
      adj = 20
    } else {
      adj = 50
    }
    var d_min = (maxAmount+10)*(-1)
    var d_max = (maxAmount+10)
    var r_min = d_min/adj
    var r_max = d_max/adj
    var radiusScale = d3.scalePow().domain([d_min,d_max]).range([r_min,r_max]);
    if (maxAmount < 50){
      radiusScale = d3.scalePow().domain([-80,80]).range([-50,50]);
    }
    var myNodes = rawData.map(function (d) {
      return {
        radius: radiusScale(+d.value),
        value: +d.value,
        name: d.label,
        label: d.label,
        category: d.category,
        x: Math.random() * 900,
        y: Math.random() * 800
      };
    });
    myNodes.sort(function (a, b) { return b.value - a.value; });
    return myNodes;
  }
function createNodes ( rawData ) { var maxAmount = d3 . max ( rawData , function ( d ) { return + d . value ; } ) ; console . log ( "maxAmount=" , maxAmount ) var adj if ( maxAmount < 100 ) { adj = 2 } else if ( maxAmount > 100 && maxAmount <= 200 ) { adj = 4 } else if ( maxAmount > 200 && maxAmount <= 300 ) { adj = 5 } else if ( maxAmount > 300 && maxAmount <= 400 ) { adj = 10 } else if ( maxAmount > 400 && maxAmount <= 500 ) { adj = 20 } else { adj = 50 } var d_min = ( maxAmount + 10 ) * ( - 1 ) var d_max = ( maxAmount + 10 ) var r_min = d_min / adj var r_max = d_max / adj var radiusScale = d3 . scalePow ( ) . domain ( [ d_min , d_max ] ) . range ( [ r_min , r_max ] ) ; if ( maxAmount < 50 ) { radiusScale = d3 . scalePow ( ) . domain ( [ - 80 , 80 ] ) . range ( [ - 50 , 50 ] ) ; } var myNodes = rawData . map ( function ( d ) { return { radius : radiusScale ( + d . value ) , value : + d . value , name : d . label , label : d . label , category : d . category , x : Math . random ( ) * 900 , y : Math . random ( ) * 800 } ; } ) ; myNodes . sort ( function ( a , b ) { return b . value - a . value ; } ) ; return myNodes ; }
This data manipulation function takes the raw data from
 the CSV file and converts it into an array of node objects.
This data manipulation function takes the raw data from the CSV file and converts it into an array of node objects .
// Use the max total_amount in the data as the max in the scale's domain // note we have to ensure the total_amount is a number. //edited: joanna 03052019 // Sizes bubbles based on area. // @v4: new flattened scale names. /*var radiusScale = d3.scalePow()
      .exponent(0.5)
      .range([2, 85])
      .domain([0, maxAmount]);*/ //manually adjust first //TODO: Adjust from the front end //var radiusScale = d3.scalePow().domain([-100,100]).range([-50,50]); //var radiusScale = d3.scalePow().exponent(0.4).domain([0,30]).range([1,30]); //var radiusScale = d3.scalePow().exponent(0.10).domain([0,maxAmount]).range([1,maxAmount+10]); //var radiusScale = d3.scalePow().domain([-400,400]).range([-100,100]); //adjust again for each results in index.html page // Use map() to convert raw data into node data. // Checkout http://learnjsdata.com/ for more on // working with data. //id: d.id, // sort them to prevent occlusion of smaller nodes.