{"action":"created","issue":{"url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/416","labels_url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/416/labels{/name}","comments_url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/416/comments","events_url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/416/events","html_url":"https://github.com/ScottLogic/d3-financial-components/pull/416","id":88389396,"number":416,"title":"Legend component","user":{"login":"ColinEberhardt","id":1098110,"avatar_url":"https://avatars.githubusercontent.com/u/1098110?v=3","gravatar_id":"","url":"https://api.github.com/users/ColinEberhardt","html_url":"https://github.com/ColinEberhardt","followers_url":"https://api.github.com/users/ColinEberhardt/followers","following_url":"https://api.github.com/users/ColinEberhardt/following{/other_user}","gists_url":"https://api.github.com/users/ColinEberhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/ColinEberhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ColinEberhardt/subscriptions","organizations_url":"https://api.github.com/users/ColinEberhardt/orgs","repos_url":"https://api.github.com/users/ColinEberhardt/repos","events_url":"https://api.github.com/users/ColinEberhardt/events{/privacy}","received_events_url":"https://api.github.com/users/ColinEberhardt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-15T10:54:39Z","updated_at":"2015-06-18T16:39:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ScottLogic/d3-financial-components/pulls/416","html_url":"https://github.com/ScottLogic/d3-financial-components/pull/416","diff_url":"https://github.com/ScottLogic/d3-financial-components/pull/416.diff","patch_url":"https://github.com/ScottLogic/d3-financial-components/pull/416.patch"},"body":"Added a new legend component.\r\n\r\nThe legend renders a HTML table, based on an array of items:\r\n\r\n    var legend = fc.charts.legend()\r\n            .items([\r\n                ['open', function(d) { return priceFormat(d.open); }],\r\n                ['high', function(d) { return priceFormat(d.high); }],\r\n                ['low', function(d) { return priceFormat(d.low); }],\r\n                ['close', function(d) { return priceFormat(d.close); }]\r\n            ]);\r\n\r\nEach item within the array is an array of two values, the label and the value. Both are 'functored' allowing functions to be used for the label as well as the value.\r\n\r\nExample:\r\n\r\n![screen shot 2015-06-15 at 11 56 38](https://cloud.githubusercontent.com/assets/1098110/8158515/a7a4d250-1355-11e5-9b08-93ba00107f7c.png)\r\n\r\n\r\nThe decorate function is passed a selection with each 'tr' element within the table.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/comments/113212998","html_url":"https://github.com/ScottLogic/d3-financial-components/pull/416#issuecomment-113212998","issue_url":"https://api.github.com/repos/ScottLogic/d3-financial-components/issues/416","id":113212998,"user":{"login":"ColinEberhardt","id":1098110,"avatar_url":"https://avatars.githubusercontent.com/u/1098110?v=3","gravatar_id":"","url":"https://api.github.com/users/ColinEberhardt","html_url":"https://github.com/ColinEberhardt","followers_url":"https://api.github.com/users/ColinEberhardt/followers","following_url":"https://api.github.com/users/ColinEberhardt/following{/other_user}","gists_url":"https://api.github.com/users/ColinEberhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/ColinEberhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ColinEberhardt/subscriptions","organizations_url":"https://api.github.com/users/ColinEberhardt/orgs","repos_url":"https://api.github.com/users/ColinEberhardt/repos","events_url":"https://api.github.com/users/ColinEberhardt/events{/privacy}","received_events_url":"https://api.github.com/users/ColinEberhardt/received_events","type":"User","site_admin":false},"created_at":"2015-06-18T16:39:13Z","updated_at":"2015-06-18T16:39:13Z","body":"we could flip it round, and have the configuration data introduced to the legend via the data-join but that feels like doing things the wrong way round to me! Although I can see some advantages, e.g. allowing you to make the legend items dynamic.\r\n\r\nRegarding dataJoin, I don't think this work in this case where the UI is constructed via a nested data-join, although I didn't actually give it a try to see if it would work or would be easily adapted / extended."}}