These are chat archives for FreeCodeCamp/DataScience

6th
Dec 2017
Matthew Barlowe
@mcbarlowe
Dec 06 2017 02:34

@becausealice2
```function default_data(error) {
if (error) throw error;

  d3.json('https://d3js.org/us-10m.v1.json', function (json){
    svg.append('g')
      .attr('class', 'states')
    .selectAll('path')
    .data(topojson.feature(json, json.objects.states).features)
    .enter()
    .append('path')
      .attr('fill', function(d) {return default_color(default_percentages.get(d.id)); })
      .attr('d', path)
    .append('title')
      .text('test');})
}

```
This was what I need in my onclick functions to get it to change color scale as I clicked my buttons and got rid of my us variable

function default_data(error) {
if (error) throw error;
  d3.json('https://d3js.org/us-10m.v1.json', function (json){
    svg.append('g')
      .attr('class', 'states')
    .selectAll('path')
    .data(topojson.feature(json, json.objects.states).features)
    .enter()
    .append('path')
      .attr('fill', function(d) {return default_color(default_percentages.get(d.id)); })
      .attr('d', path)
    .append('title')
      .text('test');})
}
there that's better
I don't know if I'm completely redrawing the map again there or just changing its fill attribute based on the values returned from the dictionary but as of right now its working how I want it to
Alice Jiang
@becausealice2
Dec 06 2017 02:46
It does look like you're completely redrawing the map
Matthew Barlowe
@mcbarlowe
Dec 06 2017 02:52
ah ok well it works for now and I just need to get this done by the end of this weekend. I appreciate your help and taking the time to look over my awful javascript
Alice Jiang
@becausealice2
Dec 06 2017 02:56
Don't say awful
say "beginner"
It's much more impressive
Matthew Barlowe
@mcbarlowe
Dec 06 2017 02:57
lol yeah javascript/d3 is just so different too me. The asynchronous nature is throwing me for a loop cause I don't know what's being called and when
Alice Jiang
@becausealice2
Dec 06 2017 05:30
Yeah, JavaScript is a special language.
Carlos Jose Fragoso Santoni
@cjfragoso
Dec 06 2017 23:51
hi
Matthew Barlowe
@mcbarlowe
Dec 06 2017 23:59
Hello