{"action":"created","issue":{"url":"https://api.github.com/repos/plotly/plotly.js/issues/1031","repository_url":"https://api.github.com/repos/plotly/plotly.js","labels_url":"https://api.github.com/repos/plotly/plotly.js/issues/1031/labels{/name}","comments_url":"https://api.github.com/repos/plotly/plotly.js/issues/1031/comments","events_url":"https://api.github.com/repos/plotly/plotly.js/issues/1031/events","html_url":"https://github.com/plotly/plotly.js/issues/1031","id":182647611,"number":1031,"title":"Passing additional metadata to points","user":{"login":"rreusser","id":572717,"avatar_url":"https://avatars.githubusercontent.com/u/572717?v=3","gravatar_id":"","url":"https://api.github.com/users/rreusser","html_url":"https://github.com/rreusser","followers_url":"https://api.github.com/users/rreusser/followers","following_url":"https://api.github.com/users/rreusser/following{/other_user}","gists_url":"https://api.github.com/users/rreusser/gists{/gist_id}","starred_url":"https://api.github.com/users/rreusser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rreusser/subscriptions","organizations_url":"https://api.github.com/users/rreusser/orgs","repos_url":"https://api.github.com/users/rreusser/repos","events_url":"https://api.github.com/users/rreusser/events{/privacy}","received_events_url":"https://api.github.com/users/rreusser/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/plotly/plotly.js/labels/status:%20discussion%20needed","name":"status: discussion needed","color":"cab2d6"},{"url":"https://api.github.com/repos/plotly/plotly.js/labels/type:%20feature","name":"type: feature","color":"1f78b4"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/plotly/plotly.js/milestones/12","html_url":"https://github.com/plotly/plotly.js/milestones/v1.19.0","labels_url":"https://api.github.com/repos/plotly/plotly.js/milestones/12/labels","id":2068037,"number":12,"title":"v1.19.0","description":"","creator":{"login":"etpinard","id":6675409,"avatar_url":"https://avatars.githubusercontent.com/u/6675409?v=3","gravatar_id":"","url":"https://api.github.com/users/etpinard","html_url":"https://github.com/etpinard","followers_url":"https://api.github.com/users/etpinard/followers","following_url":"https://api.github.com/users/etpinard/following{/other_user}","gists_url":"https://api.github.com/users/etpinard/gists{/gist_id}","starred_url":"https://api.github.com/users/etpinard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etpinard/subscriptions","organizations_url":"https://api.github.com/users/etpinard/orgs","repos_url":"https://api.github.com/users/etpinard/repos","events_url":"https://api.github.com/users/etpinard/events{/privacy}","received_events_url":"https://api.github.com/users/etpinard/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":1,"state":"open","created_at":"2016-10-13T14:45:23Z","updated_at":"2016-10-18T14:04:54Z","due_on":"2016-10-27T00:00:00Z","closed_at":null},"comments":3,"created_at":"2016-10-12T22:14:37Z","updated_at":"2016-10-18T17:16:53Z","closed_at":null,"body":"@chriddyp has requested, for example, a slider that selects which subset of data to show. The easiest way to accomplish this is if points are able to carry some additional metadata on which a transform can filter. My simplistic approach was to add a single attribute (see: #1028), but after talking with @etpinard, here is a proposal for a slight generalization:\r\n\r\nI will call it `METADATA` because I haven't found a name I like yet. Please substitute your preferred name for now.\r\n\r\n`METADATA` is supplied to points as follows:\r\n\r\n```javascript\r\n[{\r\n  x: [1, 2, 3, 4],\r\n  y: [5, 6, 7, 8],\r\n  METADATA: [{\r\n    name: 'country',\r\n    values: ['USA', 'Canada', 'Canada', 'Mexico']\r\n  }]\r\n}]\r\n```\r\n\r\nIn this example, there is just one field. Adding a transform could filter on this attribute as follows:\r\n\r\n```javascript\r\n[{\r\n  x: [1, 2, 3, 4],\r\n  y: [5, 6, 7, 8],\r\n  METADATA: [{\r\n    name: 'country',\r\n    values: ['USA', 'Canada', 'Canada', 'Mexico']\r\n  }],\r\n  transforms: [{\r\n    type: 'filter',\r\n    operation: '{}',\r\n    filtersrc: 'METADATA.country',\r\n    value: ['USA', 'Canada']\r\n  }]\r\n}]\r\n```\r\n\r\nThis would filter out the fourth point since it corresponds to `Mexico`.\r\n\r\n(One small note is that `filtersrc` would need a special case for `METADATA.country` since it's not *strictly* a nested property lookup. This does not seem problematic though.)\r\n\r\nThe upshot is that we can add metadata to points that adds capability and otherwise interacts with nothing. So it shouldn't be difficult to maintain.\r\n\r\nThe downside is that this is a new direction for plotly so should be considered carefully and with knowledge of whether this is consistent with how the front-end can be reasonably made to work.\r\n\r\ncc: @etpinard @chriddyp @alexcjohnson \r\n(and please cc others who may have a particular opinion about this)"},"comment":{"url":"https://api.github.com/repos/plotly/plotly.js/issues/comments/254576597","html_url":"https://github.com/plotly/plotly.js/issues/1031#issuecomment-254576597","issue_url":"https://api.github.com/repos/plotly/plotly.js/issues/1031","id":254576597,"user":{"login":"rreusser","id":572717,"avatar_url":"https://avatars.githubusercontent.com/u/572717?v=3","gravatar_id":"","url":"https://api.github.com/users/rreusser","html_url":"https://github.com/rreusser","followers_url":"https://api.github.com/users/rreusser/followers","following_url":"https://api.github.com/users/rreusser/following{/other_user}","gists_url":"https://api.github.com/users/rreusser/gists{/gist_id}","starred_url":"https://api.github.com/users/rreusser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rreusser/subscriptions","organizations_url":"https://api.github.com/users/rreusser/orgs","repos_url":"https://api.github.com/users/rreusser/repos","events_url":"https://api.github.com/users/rreusser/events{/privacy}","received_events_url":"https://api.github.com/users/rreusser/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T17:16:53Z","updated_at":"2016-10-18T17:16:53Z","body":"@chriddyp Thinking strictly about the json, I'm not sure a *transform* is the most desirable place for metadata about the points. Thinking about the UI though, I can see why it might be desirable to instantiate a transform that encapsulates the data it needs rather then injecting data into the trace itself."}}
{"actor":{"display_login":"rreusser"}}