{"action":"created","issue":{"url":"https://api.github.com/repos/vega/vega/issues/491","labels_url":"https://api.github.com/repos/vega/vega/issues/491/labels{/name}","comments_url":"https://api.github.com/repos/vega/vega/issues/491/comments","events_url":"https://api.github.com/repos/vega/vega/issues/491/events","html_url":"https://github.com/vega/vega/issues/491","id":125953525,"number":491,"title":"Incorrect ordering for ordinal scale in presence of negative/float values","user":{"login":"randyzwitch","id":2762787,"avatar_url":"https://avatars.githubusercontent.com/u/2762787?v=3","gravatar_id":"","url":"https://api.github.com/users/randyzwitch","html_url":"https://github.com/randyzwitch","followers_url":"https://api.github.com/users/randyzwitch/followers","following_url":"https://api.github.com/users/randyzwitch/following{/other_user}","gists_url":"https://api.github.com/users/randyzwitch/gists{/gist_id}","starred_url":"https://api.github.com/users/randyzwitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randyzwitch/subscriptions","organizations_url":"https://api.github.com/users/randyzwitch/orgs","repos_url":"https://api.github.com/users/randyzwitch/repos","events_url":"https://api.github.com/users/randyzwitch/events{/privacy}","received_events_url":"https://api.github.com/users/randyzwitch/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-11T14:17:06Z","updated_at":"2016-01-19T16:40:11Z","closed_at":"2016-01-19T15:23:50Z","body":"A user of my Julia package pointed this out:\r\n\r\n```json\r\n{\r\n  \"width\": 500,\r\n  \"height\": 200,\r\n  \"padding\": {\"top\": 10,\"left\": 30,\"bottom\": 30,\"right\": 10},\r\n  \"data\": [\r\n    {\r\n      \"name\": \"table\",\r\n      \"values\": [\r\n        {\"x\": -2.5,\"y\": 10},\r\n        {\"x\": -0.5,\"y\": 15},\r\n        {\"x\": 1,\"y\": 28},\r\n        {\"x\": 2,\"y\": 55},\r\n        {\"x\": 3,\"y\": 43},\r\n        {\"x\": 4,\"y\": 91},\r\n        {\"x\": 5,\"y\": 81},\r\n        {\"x\": 6,\"y\": 53},\r\n        {\"x\": 7,\"y\": 19},\r\n        {\"x\": 8,\"y\": 87},\r\n        {\"x\": 9,\"y\": 52},\r\n        {\"x\": 10,\"y\": 48},\r\n        {\"x\": 11,\"y\": 24},\r\n        {\"x\": 12,\"y\": 49},\r\n        {\"x\": 13,\"y\": 87},\r\n        {\"x\": 14,\"y\": 66},\r\n        {\"x\": 15,\"y\": 17},\r\n        {\"x\": 16,\"y\": 27},\r\n        {\"x\": 17,\"y\": 68},\r\n        {\"x\": 18,\"y\": 16},\r\n        {\"x\": 19,\"y\": 49},\r\n        {\"x\": 20,\"y\": 15},\r\n        {\"x\": -1,\"y\": 10},\r\n        {\"x\": -2,\"y\": 15}\r\n      ]\r\n    }\r\n  ],\r\n  \"scales\": [\r\n    {\r\n      \"name\": \"x\",\r\n      \"type\": \"ordinal\",\r\n      \"range\": \"width\",\r\n      \"domain\": {\"data\": \"table\",\"field\": \"x\"},\r\n      \"sort\": true\r\n    },\r\n    {\r\n      \"name\": \"y\",\r\n      \"type\": \"linear\",\r\n      \"range\": \"height\",\r\n      \"domain\": {\"data\": \"table\",\"field\": \"y\"},\r\n      \"nice\": true\r\n    }\r\n  ],\r\n  \"axes\": [{\"type\": \"x\",\"scale\": \"x\"},{\"type\": \"y\",\"scale\": \"y\"}],\r\n  \"marks\": [\r\n    {\r\n      \"type\": \"rect\",\r\n      \"from\": {\"data\": \"table\"},\r\n      \"properties\": {\r\n        \"enter\": {\r\n          \"x\": {\"scale\": \"x\",\"field\": \"x\"},\r\n          \"width\": {\"scale\": \"x\",\"band\": true,\"offset\": -1},\r\n          \"y\": {\"scale\": \"y\",\"field\": \"y\"},\r\n          \"y2\": {\"scale\": \"y\",\"value\": 0}\r\n        },\r\n        \"update\": {\"fill\": {\"value\": \"steelblue\"}},\r\n        \"hover\": {\"fill\": {\"value\": \"red\"}}\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\n![vega](https://cloud.githubusercontent.com/assets/2762787/12235773/ee0b443e-b843-11e5-8c97-a53c20611141.png)\r\n\r\nIf you change the X scale to linear, you lose the ability to auto-calculate bar width using `band`. So not sure if this is a bug in the ordinal scaling, my misunderstanding, or an edge case?"},"comment":{"url":"https://api.github.com/repos/vega/vega/issues/comments/172910735","html_url":"https://github.com/vega/vega/issues/491#issuecomment-172910735","issue_url":"https://api.github.com/repos/vega/vega/issues/491","id":172910735,"user":{"login":"arvind","id":42262,"avatar_url":"https://avatars.githubusercontent.com/u/42262?v=3","gravatar_id":"","url":"https://api.github.com/users/arvind","html_url":"https://github.com/arvind","followers_url":"https://api.github.com/users/arvind/followers","following_url":"https://api.github.com/users/arvind/following{/other_user}","gists_url":"https://api.github.com/users/arvind/gists{/gist_id}","starred_url":"https://api.github.com/users/arvind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arvind/subscriptions","organizations_url":"https://api.github.com/users/arvind/orgs","repos_url":"https://api.github.com/users/arvind/repos","events_url":"https://api.github.com/users/arvind/events{/privacy}","received_events_url":"https://api.github.com/users/arvind/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T16:40:11Z","updated_at":"2016-01-19T16:40:11Z","body":":+1: "}}