1
1
'use strict' ;
2
2
3
- var Plotly = require ( './plotly' ) ;
3
+ var Plotly = require ( '../.. /plotly' ) ;
4
4
var d3 = require ( 'd3' ) ;
5
5
var isNumeric = require ( 'fast-isnumeric' ) ;
6
6
@@ -17,122 +17,10 @@ Plotly.Plots.register(bars, 'bar',
17
17
] . join ( ' ' )
18
18
} ) ;
19
19
20
- // For coerce-level coupling
21
- var scatterAttrs = Plotly . Scatter . attributes ,
22
- scatterMarkerAttrs = scatterAttrs . marker ,
23
- scatterMarkerLineAttrs = scatterMarkerAttrs . line ;
24
-
25
- bars . attributes = {
26
- x : scatterAttrs . x ,
27
- x0 : scatterAttrs . x0 ,
28
- dx : scatterAttrs . dx ,
29
- y : scatterAttrs . y ,
30
- y0 : scatterAttrs . y0 ,
31
- dy : scatterAttrs . dy ,
32
- text : scatterAttrs . text ,
33
- orientation : {
34
- valType : 'enumerated' ,
35
- role : 'info' ,
36
- values : [ 'v' , 'h' ] ,
37
- description : [
38
- 'Sets the orientation of the bars.' ,
39
- 'With *v* (*h*), the value of the each bar spans' ,
40
- 'along the vertical (horizontal).'
41
- ] . join ( ' ' )
42
- } ,
43
- marker : {
44
- color : scatterMarkerAttrs . color ,
45
- colorscale : scatterMarkerAttrs . colorscale ,
46
- cauto : scatterMarkerAttrs . cauto ,
47
- cmax : scatterMarkerAttrs . cmax ,
48
- cmin : scatterMarkerAttrs . cmin ,
49
- autocolorscale : scatterMarkerAttrs . autocolorscale ,
50
- reversescale : scatterMarkerAttrs . reversescale ,
51
- showscale : scatterMarkerAttrs . showscale ,
52
- line : {
53
- color : scatterMarkerLineAttrs . color ,
54
- colorscale : scatterMarkerLineAttrs . colorscale ,
55
- cauto : scatterMarkerLineAttrs . cauto ,
56
- cmax : scatterMarkerLineAttrs . cmax ,
57
- cmin : scatterMarkerLineAttrs . cmin ,
58
- width : scatterMarkerLineAttrs . width ,
59
- autocolorscale : scatterMarkerLineAttrs . autocolorscale ,
60
- reversescale : scatterMarkerLineAttrs . reversescale
61
- }
62
- } ,
63
-
64
- r : scatterAttrs . r , // FIXME this shouldn't get included in 'histogram'
65
- t : scatterAttrs . t ,
66
-
67
- _composedModules : { // composed module coupling
68
- 'histogram' : 'Histogram'
69
- } ,
70
- _nestedModules : { // nested module coupling
71
- 'error_y' : 'ErrorBars' ,
72
- 'error_x' : 'ErrorBars' ,
73
- 'marker.colorbar' : 'Colorbar'
74
- } ,
75
-
76
- _deprecated : {
77
- bardir : {
78
- valType : 'enumerated' ,
79
- role : 'info' ,
80
- values : [ 'v' , 'h' ] ,
81
- description : 'Renamed to `orientation`.'
82
- }
83
- }
84
- } ;
85
20
86
- bars . layoutAttributes = {
87
- barmode : {
88
- valType : 'enumerated' ,
89
- values : [ 'stack' , 'group' , 'overlay' ] ,
90
- dflt : 'group' ,
91
- role : 'info' ,
92
- description : [
93
- 'Determines how bars at the same location coordinate' ,
94
- 'are displayed on the graph.' ,
95
- 'With *stack*, the bars are stacked on top of one another' ,
96
- 'With *group*, the bars are plotted next to one another' ,
97
- 'centered around the shared location.' ,
98
- 'With *overlay*, the bars are plotted over one another,' ,
99
- 'you might need to an *opacity* to see multiple bars.'
100
- ] . join ( ' ' )
101
- } ,
102
- barnorm : {
103
- valType : 'enumerated' ,
104
- values : [ '' , 'fraction' , 'percent' ] ,
105
- dflt : '' ,
106
- role : 'info' ,
107
- description : [
108
- 'Sets the normalization for bar traces on the graph.' ,
109
- 'With *fraction*, the value of each bar is divide by the sum of the' ,
110
- 'values at the location coordinate.' ,
111
- 'With *percent*, the results form *fraction* are presented in percents.'
112
- ] . join ( ' ' )
113
- } ,
114
- bargap : {
115
- valType : 'number' ,
116
- min : 0 ,
117
- max : 1 ,
118
- role : 'style' ,
119
- description : [
120
- 'Sets the gap (in plot fraction) between bars of' ,
121
- 'adjacent location coordinates.'
122
- ] . join ( ' ' )
123
- } ,
124
- bargroupgap : {
125
- valType : 'number' ,
126
- min : 0 ,
127
- max : 1 ,
128
- dflt : 0 ,
129
- role : 'style' ,
130
- description : [
131
- 'Sets the gap (in plot fraction) between bars of' ,
132
- 'the same location coordinate.'
133
- ] . join ( ' ' )
134
- }
135
- } ;
21
+ bars . attributes = require ( './attributes' ) ;
22
+
23
+ bars . layoutAttributes = require ( './layout_attributes' ) ;
136
24
137
25
bars . supplyDefaults = function ( traceIn , traceOut , defaultColor , layout ) {
138
26
function coerce ( attr , dflt ) {
0 commit comments