File tree Expand file tree Collapse file tree 5 files changed +22
-2
lines changed Expand file tree Collapse file tree 5 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ Plotly.register([
26
26
27
27
require ( './pie' ) ,
28
28
require ( './sunburst' ) ,
29
+ require ( './treemap' ) ,
29
30
require ( './funnelarea' ) ,
30
31
31
32
require ( './scatter3d' ) ,
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright 2012-2019, Plotly, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ 'use strict' ;
10
+
11
+ module . exports = require ( '../src/traces/treemap' ) ;
Original file line number Diff line number Diff line change @@ -1159,6 +1159,10 @@ lib.isValidTextValue = function(v) {
1159
1159
return v || v === 0 ;
1160
1160
} ;
1161
1161
1162
+ /**
1163
+ * @param {number } ratio
1164
+ * @param {number } n (number of decimal places)
1165
+ */
1162
1166
lib . formatPercent = function ( ratio , n ) {
1163
1167
n = n || 0 ;
1164
1168
var str = ( Math . round ( 100 * ratio * Math . pow ( 10 , n ) ) * Math . pow ( 0.1 , n ) ) . toFixed ( n ) + '%' ;
Original file line number Diff line number Diff line change @@ -2450,7 +2450,7 @@ var traceUIControlPatterns = [
2450
2450
{ pattern : / ( ^ | v a l u e \. ) v i s i b l e $ / , attr : 'legend.uirevision' } ,
2451
2451
{ pattern : / ^ d i m e n s i o n s \[ \d + \] \. c o n s t r a i n t r a n g e / } ,
2452
2452
{ pattern : / ^ n o d e \. ( x | y | g r o u p s ) / } , // for Sankey nodes
2453
- { pattern : / ^ l e v e l $ / } , // for Sunburst traces
2453
+ { pattern : / ^ l e v e l $ / } , // for Sunburst & Treemap traces
2454
2454
2455
2455
// below this you must be in editable: true mode
2456
2456
// TODO: I still put name and title with `trace.uirevision`
@@ -3780,6 +3780,9 @@ function makePlotFramework(gd) {
3780
3780
// single pie layer for the whole plot
3781
3781
fullLayout . _pielayer = fullLayout . _paper . append ( 'g' ) . classed ( 'pielayer' , true ) ;
3782
3782
3783
+ // single treemap layer for the whole plot
3784
+ fullLayout . _treemaplayer = fullLayout . _paper . append ( 'g' ) . classed ( 'treemaplayer' , true ) ;
3785
+
3783
3786
// single sunburst layer for the whole plot
3784
3787
fullLayout . _sunburstlayer = fullLayout . _paper . append ( 'g' ) . classed ( 'sunburstlayer' , true ) ;
3785
3788
Original file line number Diff line number Diff line change @@ -2773,9 +2773,10 @@ plots.doCalcdata = function(gd, traces) {
2773
2773
gd . _hmpixcount = 0 ;
2774
2774
gd . _hmlumcount = 0 ;
2775
2775
2776
- // for sharing colors across pies / sunbursts / funnelarea (and for legend)
2776
+ // for sharing colors across pies / sunbursts / treemap / funnelarea (and for legend)
2777
2777
fullLayout . _piecolormap = { } ;
2778
2778
fullLayout . _sunburstcolormap = { } ;
2779
+ fullLayout . _treemapcolormap = { } ;
2779
2780
fullLayout . _funnelareacolormap = { } ;
2780
2781
2781
2782
// If traces were specified and this trace was not included,
You can’t perform that action at this time.
0 commit comments