- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.9k
Treemap new trace type #4185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treemap new trace type #4185
Changes from 1 commit
ec6a9de
              52ded31
              320f81a
              06d93ae
              6cc8590
              6a595b6
              671e864
              648167d
              6dad958
              cceee49
              f3d38b8
              088b0e0
              e23a577
              eb54f24
              0e3185f
              fdd69e7
              a7b6074
              4c85360
              65c0e02
              ca4b385
              0012fa1
              544977e
              13e0449
              57dec38
              65f0213
              ad24987
              36fb510
              284bf6d
              4e2c328
              0cf5bf6
              2405ba4
              19c7a61
              4e3b7f3
              e5181ac
              e9c0202
              e4bc91e
              a54ca9c
              d7b06a1
              c91f9db
              ceb13f7
              1270d67
              35ea4b3
              1de80d9
              e7e22c6
              6130f96
              e3a8e91
              14674d6
              01c5f68
              4c7a092
              1860826
              d2b07b5
              1fdf574
              3004a9a
              4d790a1
              1c6e47b
              e339bf5
              1309bfd
              217c0f4
              8416883
              c918da9
              7d67c7a
              f8cef49
              3c12bf6
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|  | @@ -487,10 +487,31 @@ exports.formatSliceLabel = function(pt, entry, trace, cd, fullLayout) { | |||||||||
| var cd0 = cd[0]; | ||||||||||
| var cdi = pt.data.data; | ||||||||||
| var hierarchy = cd0.hierarchy; | ||||||||||
| var isRoot = helpers.isHierarchyRoot(pt); | ||||||||||
| var isEntry = helpers.isEntry(pt); | ||||||||||
| var parent = isEntry ? pt._parent : pt.parent; | ||||||||||
|  | ||||||||||
| var ref; | ||||||||||
| var getLabel = function(d) { | ||||||||||
| if(d.hasOwnProperty('hierarchy')) return d.hierarchy.label; | ||||||||||
| if(!(d.data && d.data.data)) return ''; | ||||||||||
| var id = helpers.getPtId(d); | ||||||||||
| for(var q = 0; q < cd.length; q++) { | ||||||||||
| if(cd[q].label === id) { | ||||||||||
| return id; | ||||||||||
| } | ||||||||||
| } | ||||||||||
| return ''; | ||||||||||
| }; | ||||||||||
|  | ||||||||||
| var getVal = function(d) { | ||||||||||
| if(d.hasOwnProperty('hierarchy')) return d.hierarchy.value; | ||||||||||
| return d.hasOwnProperty('v') ? d.v : d.value; | ||||||||||
| }; | ||||||||||
|  | ||||||||||
| var calcPercent = function() { | ||||||||||
| return (trace.branchvalues ? cdi.v : cdi.value) / (ref.value || ref.v); | ||||||||||
| var result = (trace.branchvalues ? cdi.v : cdi.value) / getVal(ref); | ||||||||||
| return isFinite(result) ? result : 1; | ||||||||||
| }; | ||||||||||
|  | ||||||||||
| if(trace.type === 'treemap' && helpers.isHeader(pt, trace)) { | ||||||||||
|          | ||||||||||
| if(isHeader && noRoomForHeader) return; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... with the formatSliceLabel below:
plotly.js/src/traces/treemap/draw_descendants.js
Lines 167 to 169 in 217c0f4
| if(isHeader && noRoomForHeader) return; | |
| var tx = formatSliceLabel(pt, entry, trace, cd, fullLayout) || ' '; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Moved to treemap/draw_descendants.js in 8416883.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|  | @@ -507,7 +507,7 @@ describe('Test sunburst hover:', function() { | |||
| curveNumber: 0, | ||||
| pointNumber: 0, | ||||
| label: 'Eve', | ||||
| parent: '' | ||||
| parent: '"root"' | ||||
|          | ||||
| return str === '' ? '"root"' : str; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the side-effects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply getting blank string (nothing) referring to the dummy root label in hover; which I think is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 8416883.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does
dget ahierarchykey?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here:
plotly.js/src/traces/treemap/plot.js
Lines 90 to 93 in 217c0f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in 8416883.