Skip to content

Instantly share code, notes, and snippets.

@michellemho
Last active December 20, 2016 23:13
Show Gist options
  • Save michellemho/6a3f28f5e7531fff85d8d2ae1e6e4c58 to your computer and use it in GitHub Desktop.
Save michellemho/6a3f28f5e7531fff85d8d2ae1e6e4c58 to your computer and use it in GitHub Desktop.

Context

Please explain here below what you were doing when the issue happened\

I was making a choropleth map of the presidential election and noticed that CartoCSS styling was not behaving as expected.

Steps to Reproduce

Please break down here below all the needed steps to reproduce the issue

  1. Create map with this election dataset: https://team.carto.com/u/michellemho-carto/dataset/michellemho-carto.education_by_race_county_copy_copy_2

  2. Style using CartoCSS:

#selector{

  polygon-gamma: 0.4;
  polygon-opacity: 0.9;

  [county_winner = 'dem'] {
  polygon-fill: ramp([pct_dem], (#9CC0E3, #6193C7, #006AAB), equal);
  line-width: 0.25
  }
  [county_winner = 'gop'] {
   polygon-fill: ramp([pct_gop], (#FBD0D0, #E99D99, #CF615D), equal);
      line-width: 0.25
  }

  polygon-fill: #d3d3d3;
}

Current Result

Please describe here below the current result you got

There appears to only be two shades of blue and red. When a category widget for "county_winner" is added and the map is filtered, only then does a third shade appears.

Expected result

Please describe here below what should be the expected behaviour

I expected to have three shades of blue and red.

Browser and version

What internet browser (Chrome, Firefox, etc) and version was you using and version

Chrome

.carto file

Don't forget to rename .carto file to .zip file to be able to upload to github

https://team.carto.com/u/michellemho-carto/builder/e75b77e2-c636-11e6-9e8d-0e3ebc282e83/embed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment