Skip to content
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

Introducing voronoi new trace type #6987

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a8cca6c
copy treemap
archmoj Apr 26, 2024
31f6252
rename
archmoj Apr 26, 2024
39ed838
handle voronoi in other places in src
archmoj Apr 26, 2024
d1e84f9
add voronoi mocks
archmoj Apr 26, 2024
a26975a
add voronoi to lib
archmoj Apr 26, 2024
30d7b58
adjust tasks
archmoj Apr 26, 2024
d08edbf
test schema
archmoj Apr 26, 2024
c8dde61
init baselines
archmoj Apr 26, 2024
da4dc24
copy treemap test
archmoj Apr 26, 2024
908d1c8
test voronoi
archmoj Apr 26, 2024
a3eb8b7
additional voronoi tests
archmoj Apr 26, 2024
35d699f
reuse treemap draw and constants
archmoj Apr 26, 2024
4455bca
reuse flip_tree
archmoj Apr 26, 2024
34344c7
reuse styleOne
archmoj Apr 26, 2024
8a3b091
install d3-voronoi-treemap
archmoj Apr 26, 2024
3c5879e
install polygon-offset
archmoj Apr 26, 2024
3bf2b57
delete voronoi/partition
archmoj Apr 26, 2024
d13a597
voila
archmoj Apr 26, 2024
847fe77
new baselines
archmoj Apr 26, 2024
55390b8
remove textposition and marker.pad
archmoj Apr 26, 2024
c1bbefd
use tiling pad
archmoj Apr 26, 2024
78baf65
declare tiling options for voronoi
archmoj Apr 27, 2024
506e215
improve fit drawing various shapes
archmoj Apr 27, 2024
7daa783
no flip option for now
archmoj Apr 27, 2024
2e23d96
update schema
archmoj Apr 27, 2024
4fc8ab3
update mocks and baselines
archmoj Apr 27, 2024
3124b1a
lint src
archmoj Apr 27, 2024
c37895c
fix seed
archmoj Apr 27, 2024
63933d2
uninstall install :)
archmoj Apr 27, 2024
6c81568
revise attributes
archmoj Apr 27, 2024
e98391a
install round-polygon
archmoj Apr 29, 2024
a9c6c50
adjust webpack config
archmoj Apr 29, 2024
8876f54
implement cornerradius for voronoi
archmoj Apr 29, 2024
99fabc4
mocks and baselines with cornerradius
archmoj Apr 29, 2024
a4d34f2
test tiling.seed
archmoj Apr 29, 2024
9ff28d9
voronoi.depthfade default to reversed instead of true
archmoj May 1, 2024
14f540a
baselines using new depthfade default
archmoj May 1, 2024
2dd29b4
Merge remote-tracking branch 'origin/master' into voronoi
archmoj Aug 20, 2024
b34dc17
update plot schema
archmoj Aug 20, 2024
67d684e
format new mocks
archmoj Aug 20, 2024
3cd3357
update new baselines
archmoj Aug 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/index-strict.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Plotly.register([
require('./pie'),
require('./sunburst'),
require('./treemap'),
require('./voronoi'),
require('./icicle'),
require('./funnelarea'),
require('./scatter3d'),
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Plotly.register([
require('./pie'),
require('./sunburst'),
require('./treemap'),
require('./voronoi'),
require('./icicle'),
require('./funnelarea'),
require('./scatter3d'),
Expand Down
3 changes: 3 additions & 0 deletions lib/voronoi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

module.exports = require('../src/traces/voronoi');
91 changes: 91 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"d3-interpolate": "^3.0.1",
"d3-time": "^1.1.0",
"d3-time-format": "^2.2.3",
"d3-voronoi-treemap": "^1.1.2",
"fast-isnumeric": "^1.1.4",
"gl-mat4": "^1.2.0",
"gl-text": "^1.4.0",
Expand All @@ -103,12 +104,14 @@
"parse-svg-path": "^0.1.2",
"point-in-polygon": "^1.1.0",
"polybooljs": "^1.2.2",
"polygon-offset": "^0.3.2",
"probe-image-size": "^7.2.3",
"regl": "npm:@plotly/regl@^2.1.2",
"regl-error2d": "^2.0.12",
"regl-line2d": "^3.1.3",
"regl-scatter2d": "^3.3.1",
"regl-splom": "^1.0.14",
"round-polygon": "^0.6.7",
"strongly-connected-components": "^1.0.1",
"superscript-text": "^1.0.0",
"svg-path-sdf": "^1.1.3",
Expand Down
5 changes: 4 additions & 1 deletion src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3805,12 +3805,15 @@ function makePlotFramework(gd) {
// single pie layer for the whole plot
fullLayout._pielayer = fullLayout._paper.append('g').classed('pielayer', true);

// single treemap layer for the whole plot
// single icicle layer for the whole plot
fullLayout._iciclelayer = fullLayout._paper.append('g').classed('iciclelayer', true);

// single treemap layer for the whole plot
fullLayout._treemaplayer = fullLayout._paper.append('g').classed('treemaplayer', true);

// single voronoi layer for the whole plot
fullLayout._voronoilayer = fullLayout._paper.append('g').classed('voronoilayer', true);

// single sunburst layer for the whole plot
fullLayout._sunburstlayer = fullLayout._paper.append('g').classed('sunburstlayer', true);

Expand Down
3 changes: 2 additions & 1 deletion src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -3043,10 +3043,11 @@ plots.doCalcdata = function(gd, traces) {
gd._hmpixcount = 0;
gd._hmlumcount = 0;

// for sharing colors across pies / sunbursts / treemap / icicle / funnelarea (and for legend)
// for sharing colors across pies / sunbursts / treemap / voronoi / icicle / funnelarea (and for legend)
fullLayout._piecolormap = {};
fullLayout._sunburstcolormap = {};
fullLayout._treemapcolormap = {};
fullLayout._voronoicolormap = {};
fullLayout._iciclecolormap = {};
fullLayout._funnelareacolormap = {};

Expand Down
1 change: 1 addition & 0 deletions src/traces/bar/uniform_text.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function resizeText(gd, gTrace, traceType) {
selector = 'g.slice';
break;
case 'treemap' :
case 'voronoi' :
case 'icicle' :
selector = 'g.slice, g.pathbar';
break;
Expand Down
2 changes: 1 addition & 1 deletion src/traces/pie/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function handleMarkerDefaults(traceIn, traceOut, layout, coerce, isPie) {
if(lineWidth) {
coerce('marker.line.color',
isPie ? undefined :
layout.paper_bgcolor // case of funnelarea, sunburst, icicle, treemap
layout.paper_bgcolor // case of funnelarea, sunburst, icicle, treemap, voronoi
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/traces/sunburst/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ module.exports = {
editType: 'calc',
dflt: 'rgba(0,0,0,0)',
description: [
'sets the color of the root node for a sunburst/treemap/icicle trace.',
'sets the color of the root node for a sunburst/treemap/voronoi/icicle trace.',
'this has no effect when a colorscale is used to set the markers.'
].join(' ')
},
Expand Down
2 changes: 2 additions & 0 deletions src/traces/sunburst/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL;

var sunburstExtendedColorWays = {};
var treemapExtendedColorWays = {};
var voronoiExtendedColorWays = {};
var icicleExtendedColorWays = {};

exports.calc = function(gd, trace) {
Expand Down Expand Up @@ -248,6 +249,7 @@ exports._runCrossTraceCalc = function(desiredType, gd) {
colorWay = generateExtendedColors(colorWay,
desiredType === 'icicle' ? icicleExtendedColorWays :
desiredType === 'treemap' ? treemapExtendedColorWays :
desiredType === 'voronoi' ? voronoiExtendedColorWays :
sunburstExtendedColorWays
);
}
Expand Down
1 change: 1 addition & 0 deletions src/traces/sunburst/fx.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = function attachFxHandlers(sliceTop, entry, gd, cd, opts) {
var isSunburst = trace.type === 'sunburst';
var isTreemapOrIcicle =
trace.type === 'treemap' ||
trace.type === 'voronoi' ||
trace.type === 'icicle';

// hover state vars
Expand Down
2 changes: 1 addition & 1 deletion src/traces/treemap/draw_descendants.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ module.exports = function drawDescendants(gd, cd, entry, slices, opts) {
pt._y0 = viewY(pt.y0);
pt._y1 = viewY(pt.y1);

pt._hoverX = viewX(pt.x1 - trace.marker.pad.r),
pt._hoverX = viewX(pt.x1 - trace.marker.pad.r);
pt._hoverY = hasBottom ?
viewY(pt.y1 - trace.marker.pad.b / 2) :
viewY(pt.y0 + trace.marker.pad.t / 2);
Expand Down
Loading