-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Icicle Trace #5546
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
Merged
Merged
Icicle Trace #5546
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
b3c9c08
start icicle trace by duplicating and adjusting treemap code
archmoj 66c6730
can reuse treemp/draw_ancestors and sunburt/style
archmoj b3e1bb9
working prototype
archmoj 0822bf5
drop unused treemap props and bring in relevant sunburst props for ic…
archmoj 5aa3310
add tiling orientation for icicle
archmoj 46182ad
add some icicle mocks and baselines and validate them
archmoj 9f4f248
where possible reuse treemap attributes in icicle
archmoj d5fc016
adjust syntax test for icicle children
archmoj 1477ceb
add(mocks): icicle plots that showcase left, right, top, and down ori…
Coding-with-Adam 4f53fe1
start icicle trace by duplicating and adjusting treemap code
archmoj f2e0698
can reuse treemp/draw_ancestors and sunburt/style
archmoj 9c0ad73
working prototype
archmoj 77235b4
drop unused treemap props and bring in relevant sunburst props for ic…
archmoj 938cf4a
add tiling orientation for icicle
archmoj 9a57346
add some icicle mocks and baselines and validate them
archmoj 5b5bb5e
where possible reuse treemap attributes in icicle
archmoj b82fad6
adjust syntax test for icicle children
archmoj 3360d78
add(mocks): icicle plots that showcase left, right, top, and down ori…
Coding-with-Adam e8f63dc
Merge branch 'master' of https://github.com/plotly/plotly.js into ici…
Coding-with-Adam 4607077
combine all 4 icicle direction mocks into single mock
Coding-with-Adam be5ec77
Merge branch 'icicle-trace-base' of https://github.com/plotly/plotly.…
Coding-with-Adam 716de6a
test(mocks): remove icicle-max-depth-3 mocks
mtwichan c6a9420
test(mocks): add icicle_coffee-maxdepth3-all-directions image
mtwichan 154c4ad
test(mocks): add titles and modify layout for icicle_coffee-maxdepth3…
Coding-with-Adam 746804d
test(mocks): update icicle_coffee-maxdepth3-all-directions.png
mtwichan 81a6b5c
add icicle mocks and baselines
Coding-with-Adam f420d1e
Merge branch 'icicle-trace-base' of https://github.com/plotly/plotly.…
Coding-with-Adam c8e0b6d
replace baselines with ci-generated baselines
Coding-with-Adam 2931707
add new mocks to mock_test.js for jasmine tests
Coding-with-Adam 6eb3a38
correct jasmine icicle tests in mock_test.js (ALL SUCCESS)
Coding-with-Adam 8ed4b8f
refactor(icicle): remove extra if statement in default.js
mtwichan feb8785
Merge branch 'icicle-trace-base' of https://github.com/plotly/plotly.…
mtwichan b2c921e
reuse treemap plot in icicle
archmoj 80b4e17
correct icicle and treemap plots without cd
archmoj 6b0ddd9
reuse treemap plot in icicle
archmoj 74c75ad
cherry-pick two commits for plot refactor
archmoj 595c73d
fix parsing error
Coding-with-Adam a068139
fix(plot): remove redeclared plotOne() for treemap
Coding-with-Adam 40c0615
modify(mock): reverse order of the leaf-opacity mock
Coding-with-Adam 17164b1
remove(getKey): unused in treemap file
Coding-with-Adam da3b6ce
fix(mock): correct the annotations
Coding-with-Adam 8065e46
correct(baseline): use ci generated artifact from tests
Coding-with-Adam 8197431
fix(maxdepth): icicles fill up their domain if using maxdepth
Coding-with-Adam 575f3c1
Merge branch 'master' into icicle-trace-base
Coding-with-Adam d00383a
fix(partition): correct the calculation for the new width of the d3 p…
Coding-with-Adam 06a7c94
fix(transition): ensure elements grow in from zero width/height when …
Coding-with-Adam 7b5d690
fix(partition): correct the height calculation for vertical icicles
Coding-with-Adam 5d9a05c
style(icicle): syntax errors caught in ci
Coding-with-Adam c755d09
test(mocks): update mock images to reflect current code
Coding-with-Adam dc24f92
refactor(plot_one): compactify the code that corrects elements transi…
Coding-with-Adam ef56481
test(jasmine): defaults, calc, hover for icicle
Coding-with-Adam e9c602d
refactor(jasmine tests): correct syntax-source
Coding-with-Adam 02a9a03
test(mock_test): add uniformtext_icicle
Coding-with-Adam 8e88271
test(jasmine): add more tests for icicle
Coding-with-Adam b743eff
refactor(test): remove unused functions and variables
Coding-with-Adam 9067c1b
fix(text transition): icicle text now smoothly transitions into its t…
Coding-with-Adam c2bab55
refactor(plot_one): remove extra spaces after minus sign
Coding-with-Adam 4402d45
fix(icicle): if you click icicle, the root color does not expand acro…
Coding-with-Adam dd3cc91
refactor(plot_one): add semicolon
Coding-with-Adam 3b17a90
merge with master branch
Coding-with-Adam fdff0e7
update icicle_values_colorscale baseline
archmoj eaad10d
reuse treemap draw in icicle
archmoj d96f3f1
reuse flip tree in icicle
archmoj c57dda5
avoid multiple string comparisons
archmoj 7140c3e
docs(icicle): clarify the description; set default to 0
Coding-with-Adam ae4be8c
update baselines with zero pad
archmoj 7de2bd9
add pad to uniformtext_icicle mock
archmoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
module.exports = require('../src/traces/icicle'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
'use strict'; | ||
|
||
var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; | ||
var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; | ||
|
||
var colorScaleAttrs = require('../../components/colorscale/attributes'); | ||
var domainAttrs = require('../../plots/domain').attributes; | ||
var pieAttrs = require('../pie/attributes'); | ||
var sunburstAttrs = require('../sunburst/attributes'); | ||
var treemapAttrs = require('../treemap/attributes'); | ||
var constants = require('../treemap/constants'); | ||
var extendFlat = require('../../lib/extend').extendFlat; | ||
|
||
module.exports = { | ||
labels: sunburstAttrs.labels, | ||
parents: sunburstAttrs.parents, | ||
|
||
values: sunburstAttrs.values, | ||
branchvalues: sunburstAttrs.branchvalues, | ||
count: sunburstAttrs.count, | ||
|
||
level: sunburstAttrs.level, | ||
maxdepth: sunburstAttrs.maxdepth, | ||
|
||
tiling: { | ||
orientation: { | ||
valType: 'enumerated', | ||
values: ['v', 'h'], | ||
dflt: 'h', | ||
editType: 'plot', | ||
description: [ | ||
'When set in conjunction with `tiling.flip`, determines on', | ||
'which side the root nodes are drawn in the chart. If', | ||
'`tiling.orientation` is *v* and `tiling.flip` is **, the root', | ||
'nodes appear at the top. If `tiling.orientation` is *v* and', | ||
'`tiling.flip` is *y*, the root nodes appear at the bottom. If', | ||
'`tiling.orientation` is *h* and `tiling.flip` is **, the', | ||
'root nodes appear at the left. If `tiling.orientation` is *h*', | ||
'and `tiling.flip` is *x*, the root nodes appear at the right.', | ||
].join(' ') | ||
}, | ||
|
||
flip: treemapAttrs.tiling.flip, | ||
|
||
pad: { | ||
valType: 'number', | ||
min: 0, | ||
dflt: 0, | ||
editType: 'plot', | ||
description: [ | ||
'Sets the inner padding (in px).' | ||
].join(' ') | ||
}, | ||
|
||
|
||
editType: 'calc', | ||
}, | ||
|
||
marker: extendFlat({ | ||
colors: sunburstAttrs.marker.colors, | ||
|
||
line: sunburstAttrs.marker.line, | ||
|
||
editType: 'calc' | ||
}, | ||
colorScaleAttrs('marker', { | ||
colorAttr: 'colors', | ||
anim: false // TODO: set to anim: true? | ||
}) | ||
), | ||
|
||
leaf: sunburstAttrs.leaf, | ||
|
||
pathbar: treemapAttrs.pathbar, | ||
|
||
text: pieAttrs.text, | ||
textinfo: sunburstAttrs.textinfo, | ||
// TODO: incorporate `label` and `value` in the eventData | ||
texttemplate: texttemplateAttrs({editType: 'plot'}, { | ||
keys: constants.eventDataKeys.concat(['label', 'value']) | ||
}), | ||
|
||
hovertext: pieAttrs.hovertext, | ||
hoverinfo: sunburstAttrs.hoverinfo, | ||
hovertemplate: hovertemplateAttrs({}, { | ||
keys: constants.eventDataKeys | ||
}), | ||
|
||
textfont: pieAttrs.textfont, | ||
insidetextfont: pieAttrs.insidetextfont, | ||
outsidetextfont: treemapAttrs.outsidetextfont, | ||
|
||
textposition: treemapAttrs.textposition, | ||
sort: pieAttrs.sort, | ||
root: sunburstAttrs.root, | ||
|
||
domain: domainAttrs({name: 'icicle', trace: true, editType: 'calc'}), | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
var plots = require('../../plots/plots'); | ||
|
||
exports.name = 'icicle'; | ||
|
||
exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { | ||
plots.plotBasePlot(exports.name, gd, traces, transitionOpts, makeOnCompleteCallback); | ||
}; | ||
|
||
exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { | ||
plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
var calc = require('../sunburst/calc'); | ||
|
||
exports.calc = function(gd, trace) { | ||
return calc.calc(gd, trace); | ||
}; | ||
|
||
exports.crossTraceCalc = function(gd) { | ||
return calc._runCrossTraceCalc('icicle', gd); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
'use strict'; | ||
|
||
var Lib = require('../../lib'); | ||
var attributes = require('./attributes'); | ||
var Color = require('../../components/color'); | ||
var handleDomainDefaults = require('../../plots/domain').defaults; | ||
var handleText = require('../bar/defaults').handleText; | ||
var TEXTPAD = require('../bar/constants').TEXTPAD; | ||
|
||
var Colorscale = require('../../components/colorscale'); | ||
var hasColorscale = Colorscale.hasColorscale; | ||
var colorscaleDefaults = Colorscale.handleDefaults; | ||
|
||
module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { | ||
function coerce(attr, dflt) { | ||
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); | ||
} | ||
|
||
var labels = coerce('labels'); | ||
var parents = coerce('parents'); | ||
|
||
if(!labels || !labels.length || !parents || !parents.length) { | ||
traceOut.visible = false; | ||
return; | ||
} | ||
|
||
var vals = coerce('values'); | ||
if(vals && vals.length) { | ||
coerce('branchvalues'); | ||
} else { | ||
coerce('count'); | ||
} | ||
|
||
coerce('level'); | ||
coerce('maxdepth'); | ||
|
||
coerce('tiling.orientation'); | ||
coerce('tiling.flip'); | ||
coerce('tiling.pad'); | ||
|
||
var text = coerce('text'); | ||
coerce('texttemplate'); | ||
if(!traceOut.texttemplate) coerce('textinfo', Array.isArray(text) ? 'text+label' : 'label'); | ||
|
||
coerce('hovertext'); | ||
coerce('hovertemplate'); | ||
|
||
var hasPathbar = coerce('pathbar.visible'); | ||
|
||
var textposition = 'auto'; | ||
handleText(traceIn, traceOut, layout, coerce, textposition, { | ||
hasPathbar: hasPathbar, | ||
moduleHasSelected: false, | ||
moduleHasUnselected: false, | ||
moduleHasConstrain: false, | ||
moduleHasCliponaxis: false, | ||
moduleHasTextangle: false, | ||
moduleHasInsideanchor: false | ||
}); | ||
coerce('textposition'); | ||
|
||
var lineWidth = coerce('marker.line.width'); | ||
if(lineWidth) coerce('marker.line.color', layout.paper_bgcolor); | ||
|
||
coerce('marker.colors'); | ||
var withColorscale = traceOut._hasColorscale = ( | ||
hasColorscale(traceIn, 'marker', 'colors') || | ||
(traceIn.marker || {}).coloraxis // N.B. special logic to consider "values" colorscales | ||
); | ||
if(withColorscale) { | ||
colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'marker.', cLetter: 'c'}); | ||
} | ||
|
||
coerce('leaf.opacity', withColorscale ? 1 : 0.7); | ||
|
||
traceOut._hovered = { | ||
marker: { | ||
line: { | ||
width: 2, | ||
color: Color.contrast(layout.paper_bgcolor) | ||
} | ||
} | ||
}; | ||
|
||
if(hasPathbar) { | ||
// This works even for multi-line labels as icicle pathbar trim out line breaks | ||
coerce('pathbar.thickness', traceOut.pathbar.textfont.size + 2 * TEXTPAD); | ||
|
||
coerce('pathbar.side'); | ||
coerce('pathbar.edgeshape'); | ||
} | ||
|
||
coerce('sort'); | ||
|
||
coerce('root.color'); | ||
|
||
handleDomainDefaults(traceOut, layout, coerce); | ||
|
||
// do not support transforms for now | ||
traceOut._length = null; | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.