Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Weird FFx/Safari bars bug #1631

Merged
merged 4 commits into from
Jul 21, 2016
Merged

Weird FFx/Safari bars bug #1631

merged 4 commits into from
Jul 21, 2016

Conversation

gemfarmer
Copy link
Contributor

Fixes issue(s) #1602

😎 PREVIEW

Changes proposed in this pull request:

  • fixed bug that was preventing maps and charts to render on safari. This was the result of the <eiti-data-map> component script existing on the national page without any elements to reference.
  • fixed bar chart bug that was causing some years to have multiple bars. This was the result of an inconsistency between the year_range for that chart and the years in its affiliated dataset. I filtered the data so that only years within that range were accounted for and rendered.

/cc @meiqimichelle @shawnbot

@shawnbot
Copy link
Contributor

Whoa, what? Are you saying that the component script threw an error because there weren't any of those components on the page?

@gemfarmer
Copy link
Contributor Author

gemfarmer commented Jul 20, 2016

@shawnbot
Copy link
Contributor

Ahhhhhh, I see! Reviewing.

@gemfarmer
Copy link
Contributor Author

There was a line in the d3-svg-legend script that was erroring out because the context that it was trying to render it in was null

@@ -102,6 +104,12 @@
}
});

// filter the data so that only values within the domain
// are included in calculations and rendering
data = data.filter(function(d){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a space between the ) and {. I'm wondering why Hound didn't spot this...

@gemfarmer
Copy link
Contributor Author

I should rephrase that. If the eiti-data-map component exists, but the class that corresponds to the svg-legend, .legend-svg, does not exist, it was throwing an error.

@gemfarmer
Copy link
Contributor Author

@shawnbot does this look better now?

.call(legend);

// reverse because the scale is in ascending order
var _steps = d3.range(0, 9).reverse();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, but why _steps here and not just steps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I did this to not overwrite steps from above, but I guess I'm not totally sure that would be problematic, come to think of it. I merged for now, because this came up in standup, but should be refactored later.

@gemfarmer gemfarmer merged commit daca8d9 into state-pages Jul 21, 2016
@gemfarmer gemfarmer deleted the bars-bug branch July 21, 2016 17:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants