{"action":"created","issue":{"url":"https://api.github.com/repos/vega/vega/issues/1453","repository_url":"https://api.github.com/repos/vega/vega","labels_url":"https://api.github.com/repos/vega/vega/issues/1453/labels{/name}","comments_url":"https://api.github.com/repos/vega/vega/issues/1453/comments","events_url":"https://api.github.com/repos/vega/vega/issues/1453/events","html_url":"https://github.com/vega/vega/issues/1453","id":380387699,"node_id":"MDU6SXNzdWUzODAzODc2OTk=","number":1453,"title":"Allow setting default in ordinal range for color","user":{"login":"saulshanabrook","id":1186124,"node_id":"MDQ6VXNlcjExODYxMjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1186124?v=4","gravatar_id":"","url":"https://api.github.com/users/saulshanabrook","html_url":"https://github.com/saulshanabrook","followers_url":"https://api.github.com/users/saulshanabrook/followers","following_url":"https://api.github.com/users/saulshanabrook/following{/other_user}","gists_url":"https://api.github.com/users/saulshanabrook/gists{/gist_id}","starred_url":"https://api.github.com/users/saulshanabrook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saulshanabrook/subscriptions","organizations_url":"https://api.github.com/users/saulshanabrook/orgs","repos_url":"https://api.github.com/users/saulshanabrook/repos","events_url":"https://api.github.com/users/saulshanabrook/events{/privacy}","received_events_url":"https://api.github.com/users/saulshanabrook/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2018-11-13T14:04:16Z","updated_at":"2018-11-14T02:05:52Z","closed_at":"2018-11-13T20:00:12Z","author_association":"NONE","body":"I have a discrete field and I am able to map different colors to it's different values. However, I would like to have a final color map to all the other colors which I didn't set up a mapping for.\r\n\r\nThis might be possible already and I was just unable to find it.\r\n\r\nThe motiviation is reproducing MapD's example of plotting dots for each tweet colored by country: https://www.omnisci.com/docs/latest/6_vegaTutorials.html#getting-more-from-your-data-1\r\n\r\nIn their custom Vega they have a way of specifying a default value:\r\n\r\n```json\r\n\"scales:\" [\r\n     .\r\n     .\r\n     .\r\n  {\r\n    \"name\": \"color\",\r\n    \"type\": \"ordinal\",\r\n    \"domain\": [\"en\",  \"es\", \"fr\"],\r\n    \"range\": [\"#27aeef\", \"#87bc45\", \"#ef9b20\"],\r\n    \"default\": \"gray\",\r\n    \"nullValue\": \"#cacaca\"\r\n  }\r\n]\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/vega/vega/issues/comments/438510453","html_url":"https://github.com/vega/vega/issues/1453#issuecomment-438510453","issue_url":"https://api.github.com/repos/vega/vega/issues/1453","id":438510453,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODUxMDQ1Mw==","user":{"login":"jheer","id":202799,"node_id":"MDQ6VXNlcjIwMjc5OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/202799?v=4","gravatar_id":"","url":"https://api.github.com/users/jheer","html_url":"https://github.com/jheer","followers_url":"https://api.github.com/users/jheer/followers","following_url":"https://api.github.com/users/jheer/following{/other_user}","gists_url":"https://api.github.com/users/jheer/gists{/gist_id}","starred_url":"https://api.github.com/users/jheer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jheer/subscriptions","organizations_url":"https://api.github.com/users/jheer/orgs","repos_url":"https://api.github.com/users/jheer/repos","events_url":"https://api.github.com/users/jheer/events{/privacy}","received_events_url":"https://api.github.com/users/jheer/received_events","type":"User","site_admin":false},"created_at":"2018-11-14T02:05:52Z","updated_at":"2018-11-14T02:05:52Z","author_association":"MEMBER","body":"An even simpler (and more efficient) expression would be:\r\n\r\n`scale('color', datum.category) || 'grey'`\r\n\r\nThis will work so long as the scale domain is defined and `domainImplicit` is not set to `true`.\r\n\r\nAlso: Under the hood, D3 does support setting an `unknown` value on ordinal scales, however, this will  return a default value for **any** value not included in the domain, not just null or missing data. One option for Vega could be to leverage that functionality, so long as those semantics are acceptable."}}
{"actor":{"display_login":"jheer"}}