Skip to content

Commit

Permalink
Merge pull request #5245 from plotly/rootcolor-tests
Browse files Browse the repository at this point in the history
Apply root.color in treemap & sunburst style and adopt tests
  • Loading branch information
archmoj authored Nov 3, 2020
2 parents aad34f1 + 03ea08d commit b5caa8f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/traces/treemap/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ function styleOne(s, pt, trace, opts) {
lineColor = trace._hovered.marker.line.color;
lineWidth = trace._hovered.marker.line.width;
} else {
if(isRoot && fillColor === 'rgba(0,0,0,0)') {
opacity = 0;
if(isRoot && fillColor === trace.root.color) {
opacity = 100;
lineColor = 'rgba(0,0,0,0)';
lineWidth = 0;
} else {
Expand Down
Binary file modified test/image/baselines/sunburst_inside-text-orientation_clock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/treemap_textposition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions test/image/mocks/sunburst_inside-text-orientation_clock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name": "horizontal",
"insidetextorientation": "horizontal",
"type": "sunburst",
"root": { "color": "yellow" },
"parents": [
"",
"A",
Expand Down Expand Up @@ -77,6 +78,7 @@
"name": "radial",
"insidetextorientation": "radial",
"type": "sunburst",
"root": { "color": "yellow" },
"parents": [
"",
"A",
Expand Down Expand Up @@ -150,6 +152,7 @@
"name": "tangential",
"insidetextorientation": "tangential",
"type": "sunburst",
"root": { "color": "yellow" },
"parents": [
"",
"A",
Expand Down Expand Up @@ -223,6 +226,7 @@
"name": "auto",
"insidetextorientation": "auto",
"type": "sunburst",
"root": { "color": "yellow" },
"parents": [
"",
"A",
Expand Down
9 changes: 9 additions & 0 deletions test/image/mocks/treemap_textposition.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"data": [
{
"type": "treemap",
"root": { "color": "yellow" },
"textinfo": "label+text+percent parent+percent entry+percent root",
"name": "bottom left textposition",
"textposition": "bottom left",
Expand Down Expand Up @@ -110,6 +111,7 @@
},
{
"type": "treemap",
"root": { "color": "yellow" },
"textinfo": "label+text+percent parent+percent entry+percent root",
"name": "bottom center textposition",
"textposition": "bottom center",
Expand Down Expand Up @@ -219,6 +221,7 @@
},
{
"type": "treemap",
"root": { "color": "yellow" },
"textinfo": "label+text+percent parent+percent entry+percent root",
"name": "bottom right textposition",
"textposition": "bottom right",
Expand Down Expand Up @@ -330,6 +333,7 @@
},
{
"type": "treemap",
"root": { "color": "yellow" },
"textinfo": "label+text+percent parent+percent entry+percent root",
"name": "middle left textposition",
"textposition": "middle left",
Expand Down Expand Up @@ -436,6 +440,7 @@
},
{
"type": "treemap",
"root": { "color": "yellow" },
"textinfo": "label+text+percent parent+percent entry+percent root",
"name": "middle center textposition",
"textposition": "middle center",
Expand Down Expand Up @@ -543,6 +548,7 @@
},
{
"type": "treemap",
"root": { "color": "yellow" },
"textinfo": "label+text+percent parent+percent entry+percent root",
"name": "middle right textposition",
"textposition": "middle right",
Expand Down Expand Up @@ -649,6 +655,7 @@
},
{
"type": "treemap",
"root": { "color": "yellow" },
"textinfo": "label+text+percent parent+percent entry+percent root",
"name": "top left textposition",
"textposition": "top left",
Expand Down Expand Up @@ -759,6 +766,7 @@
},
{
"type": "treemap",
"root": { "color": "yellow" },
"textinfo": "label+text+percent parent+percent entry+percent root",
"name": "top center textposition",
"textposition": "top center",
Expand Down Expand Up @@ -869,6 +877,7 @@
},
{
"type": "treemap",
"root": { "color": "yellow" },
"textinfo": "label+text+percent parent+percent entry+percent root",
"name": "top right textposition",
"textposition": "top right",
Expand Down

0 comments on commit b5caa8f

Please sign in to comment.