{"action":"created","issue":{"url":"https://api.github.com/repos/plotly/plotly.js/issues/3126","repository_url":"https://api.github.com/repos/plotly/plotly.js","labels_url":"https://api.github.com/repos/plotly/plotly.js/issues/3126/labels{/name}","comments_url":"https://api.github.com/repos/plotly/plotly.js/issues/3126/comments","events_url":"https://api.github.com/repos/plotly/plotly.js/issues/3126/events","html_url":"https://github.com/plotly/plotly.js/pull/3126","id":371684657,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0MDc3Nzg0","number":3126,"title":"support template string on hover","user":{"login":"antoinerg","id":301546,"node_id":"MDQ6VXNlcjMwMTU0Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/301546?v=4","gravatar_id":"","url":"https://api.github.com/users/antoinerg","html_url":"https://github.com/antoinerg","followers_url":"https://api.github.com/users/antoinerg/followers","following_url":"https://api.github.com/users/antoinerg/following{/other_user}","gists_url":"https://api.github.com/users/antoinerg/gists{/gist_id}","starred_url":"https://api.github.com/users/antoinerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoinerg/subscriptions","organizations_url":"https://api.github.com/users/antoinerg/orgs","repos_url":"https://api.github.com/users/antoinerg/repos","events_url":"https://api.github.com/users/antoinerg/events{/privacy}","received_events_url":"https://api.github.com/users/antoinerg/received_events","type":"User","site_admin":false},"labels":[{"id":353739539,"node_id":"MDU6TGFiZWwzNTM3Mzk1Mzk=","url":"https://api.github.com/repos/plotly/plotly.js/labels/status:%20discussion%20needed","name":"status: discussion needed","color":"cab2d6","default":false},{"id":330750748,"node_id":"MDU6TGFiZWwzMzA3NTA3NDg=","url":"https://api.github.com/repos/plotly/plotly.js/labels/status:%20reviewable","name":"status: reviewable","color":"33a02c","default":false},{"id":282886925,"node_id":"MDU6TGFiZWwyODI4ODY5MjU=","url":"https://api.github.com/repos/plotly/plotly.js/labels/type:%20feature","name":"type: feature","color":"1f78b4","default":false}],"state":"open","locked":false,"assignee":{"login":"antoinerg","id":301546,"node_id":"MDQ6VXNlcjMwMTU0Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/301546?v=4","gravatar_id":"","url":"https://api.github.com/users/antoinerg","html_url":"https://github.com/antoinerg","followers_url":"https://api.github.com/users/antoinerg/followers","following_url":"https://api.github.com/users/antoinerg/following{/other_user}","gists_url":"https://api.github.com/users/antoinerg/gists{/gist_id}","starred_url":"https://api.github.com/users/antoinerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoinerg/subscriptions","organizations_url":"https://api.github.com/users/antoinerg/orgs","repos_url":"https://api.github.com/users/antoinerg/repos","events_url":"https://api.github.com/users/antoinerg/events{/privacy}","received_events_url":"https://api.github.com/users/antoinerg/received_events","type":"User","site_admin":false},"assignees":[{"login":"antoinerg","id":301546,"node_id":"MDQ6VXNlcjMwMTU0Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/301546?v=4","gravatar_id":"","url":"https://api.github.com/users/antoinerg","html_url":"https://github.com/antoinerg","followers_url":"https://api.github.com/users/antoinerg/followers","following_url":"https://api.github.com/users/antoinerg/following{/other_user}","gists_url":"https://api.github.com/users/antoinerg/gists{/gist_id}","starred_url":"https://api.github.com/users/antoinerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoinerg/subscriptions","organizations_url":"https://api.github.com/users/antoinerg/orgs","repos_url":"https://api.github.com/users/antoinerg/repos","events_url":"https://api.github.com/users/antoinerg/events{/privacy}","received_events_url":"https://api.github.com/users/antoinerg/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/plotly/plotly.js/milestones/39","html_url":"https://github.com/plotly/plotly.js/milestone/39","labels_url":"https://api.github.com/repos/plotly/plotly.js/milestones/39/labels","id":3788135,"node_id":"MDk6TWlsZXN0b25lMzc4ODEzNQ==","number":39,"title":"v1.43.0","description":"","creator":{"login":"etpinard","id":6675409,"node_id":"MDQ6VXNlcjY2NzU0MDk=","avatar_url":"https://avatars0.githubusercontent.com/u/6675409?v=4","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":7,"closed_issues":3,"state":"open","created_at":"2018-11-01T13:33:50Z","updated_at":"2018-11-12T14:59:18Z","due_on":null,"closed_at":null},"comments":12,"created_at":"2018-10-18T19:49:38Z","updated_at":"2018-11-12T18:04:23Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/3126","html_url":"https://github.com/plotly/plotly.js/pull/3126","diff_url":"https://github.com/plotly/plotly.js/pull/3126.diff","patch_url":"https://github.com/plotly/plotly.js/pull/3126.patch"},"body":"Closes #3007 \r\n\r\nHowever, there are several caveats:\r\n\r\n1 - In the process of making that PR, I realized that there are a lot of computed values on hover that are not emitted in hover events. Because we are passing the hover event data to the template, only a limited subset of the total information is currently available. Enriching the event data for each trace is probably outside the scope of the current PR since it should benefit BOTH `hovertemplate` and `plotly_hover` events. However, it is something that can be done fairly easily and separately (some traces already have an `event_data.js` file in place where such code would go)!\r\n\r\n2 - Some traces have many hover labels. For example, in `box` traces, there are six labels when hovering on a box. As of right now, the numerical value for each of those is assigned to variable `y` regardless of what it represents (`q(1|3)`, `min`, `max`, etc.). We should certainly add a `label` variable alongside in order for template `'%{label}: %{y}'` to exactly reproduce the current hover labels while enabling number formatting. All traces with several different hover labels would have to implement this change.\r\n\r\nIn the future, to support different templates for each hover labels, we could either allow `hovertemplate` to be an object with a key for each label (`{q1: 'templatestring', min: 'templatestring', ...}`)  OR we can move everything in nested attributes :  `{q1: {hovertemplate: '...'}, min: {hovertemplate: '...'}, ...}`. The latter has the advantages of allowing further customization for each label (think color or hiding)  since each of them could have a nested `hoverinfo` and `hoverlabel`. We need to think carefully about this one. The latter approach is what @alexcjohnson and I decided to do in our latest work for `sankey` traces (see PR https://github.com/plotly/plotly.js/pull/3096).\r\n\r\n3 - Right now, `hovertemplate` doesn't control the content of the secondary labels. As @alexcjohnson pointed out, this could be supported by a special tag `<extra>Secondary box content here</extra>`.\r\n\r\nPlease chime in :)\r\n"},"comment":{"url":"https://api.github.com/repos/plotly/plotly.js/issues/comments/437975726","html_url":"https://github.com/plotly/plotly.js/pull/3126#issuecomment-437975726","issue_url":"https://api.github.com/repos/plotly/plotly.js/issues/3126","id":437975726,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzk3NTcyNg==","user":{"login":"antoinerg","id":301546,"node_id":"MDQ6VXNlcjMwMTU0Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/301546?v=4","gravatar_id":"","url":"https://api.github.com/users/antoinerg","html_url":"https://github.com/antoinerg","followers_url":"https://api.github.com/users/antoinerg/followers","following_url":"https://api.github.com/users/antoinerg/following{/other_user}","gists_url":"https://api.github.com/users/antoinerg/gists{/gist_id}","starred_url":"https://api.github.com/users/antoinerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoinerg/subscriptions","organizations_url":"https://api.github.com/users/antoinerg/orgs","repos_url":"https://api.github.com/users/antoinerg/repos","events_url":"https://api.github.com/users/antoinerg/events{/privacy}","received_events_url":"https://api.github.com/users/antoinerg/received_events","type":"User","site_admin":false},"created_at":"2018-11-12T18:04:23Z","updated_at":"2018-11-12T18:04:23Z","author_association":"COLLABORATOR","body":"For good measure, I added initial support for #2618 in f89baca by making the axes' title available in `hovertemplate`. I think it's a must have."}}
{"actor":{"display_login":"antoinerg"}}