{"action":"created","issue":{"url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/223","labels_url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/223/labels{/name}","comments_url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/223/comments","events_url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/223/events","html_url":"https://github.com/ScottLogic/d3-financial-components/issues/223","id":53742461,"number":223,"title":"Annotation tool generates elements with duplicate (non-unique) IDs","user":{"login":"jleft","id":2017615,"avatar_url":"https://avatars.githubusercontent.com/u/2017615?v=3","gravatar_id":"","url":"https://api.github.com/users/jleft","html_url":"https://github.com/jleft","followers_url":"https://api.github.com/users/jleft/followers","following_url":"https://api.github.com/users/jleft/following{/other_user}","gists_url":"https://api.github.com/users/jleft/gists{/gist_id}","starred_url":"https://api.github.com/users/jleft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jleft/subscriptions","organizations_url":"https://api.github.com/users/jleft/orgs","repos_url":"https://api.github.com/users/jleft/repos","events_url":"https://api.github.com/users/jleft/events{/privacy}","received_events_url":"https://api.github.com/users/jleft/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ScottLogic/d3-financial-components/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/ScottLogic/d3-financial-components/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"jleft","id":2017615,"avatar_url":"https://avatars.githubusercontent.com/u/2017615?v=3","gravatar_id":"","url":"https://api.github.com/users/jleft","html_url":"https://github.com/jleft","followers_url":"https://api.github.com/users/jleft/followers","following_url":"https://api.github.com/users/jleft/following{/other_user}","gists_url":"https://api.github.com/users/jleft/gists{/gist_id}","starred_url":"https://api.github.com/users/jleft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jleft/subscriptions","organizations_url":"https://api.github.com/users/jleft/orgs","repos_url":"https://api.github.com/users/jleft/repos","events_url":"https://api.github.com/users/jleft/events{/privacy}","received_events_url":"https://api.github.com/users/jleft/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2015-01-08T11:49:45Z","updated_at":"2015-01-14T22:54:19Z","closed_at":null,"body":"Unless an [annotation's `index`](https://github.com/ScottLogic/d3-financial-components/blob/67a49925df10007a31ea5b692e4c66e1c4bf2fba/components/tools/annotation.js#L6) is explicitly set, multiple instances of the component will generate elements with the same ID:\r\n\r\n![annotation-ids](https://cloud.githubusercontent.com/assets/2017615/5662003/b7e66a68-972a-11e4-9a90-2038d441d735.PNG)\r\n\r\nI think the component's default behavior should avoid this issue, similar to the clipping path's ID in chart layout.\r\n\r\nI'm not sure if a default ID is necessary at all? If not, then the simplest solution would be to remove it.\r\n\r\nOtherwise, I'd suggest allowing the user the explicitly set an ID for the element (it's their responsibility to ensure it's unique), but if the ID isn't explicitly set, then the index should be incremented (in a similar way to [chartLayout](https://github.com/ScottLogic/d3-financial-components/blob/67a49925df10007a31ea5b692e4c66e1c4bf2fba/components/utilities/chartLayout.js#L455)).\r\n\r\nThoughts?"},"comment":{"url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/comments/70009252","html_url":"https://github.com/ScottLogic/d3-financial-components/issues/223#issuecomment-70009252","issue_url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/223","id":70009252,"user":{"login":"chrisprice","id":433457,"avatar_url":"https://avatars.githubusercontent.com/u/433457?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisprice","html_url":"https://github.com/chrisprice","followers_url":"https://api.github.com/users/chrisprice/followers","following_url":"https://api.github.com/users/chrisprice/following{/other_user}","gists_url":"https://api.github.com/users/chrisprice/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisprice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisprice/subscriptions","organizations_url":"https://api.github.com/users/chrisprice/orgs","repos_url":"https://api.github.com/users/chrisprice/repos","events_url":"https://api.github.com/users/chrisprice/events{/privacy}","received_events_url":"https://api.github.com/users/chrisprice/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T22:54:19Z","updated_at":"2015-01-14T22:54:19Z","body":"I'd hold off any work on this until #230 is resolved."}}