Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 6, 2022. It is now read-only.

Commit de92572

Browse files
committed
make bar and histogram have distinct attribute object,
- no more 'composed module' logic.
1 parent b043ec3 commit de92572

File tree

2 files changed

+42
-15
lines changed

2 files changed

+42
-15
lines changed

src/traces/bar/attributes.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,9 @@ module.exports = {
5151
}
5252
},
5353

54-
r: scatterAttrs.r, // FIXME this shouldn't get included in 'histogram'
54+
r: scatterAttrs.r,
5555
t: scatterAttrs.t,
5656

57-
_composedModules: { // composed module coupling
58-
'histogram': 'Histogram'
59-
},
6057
_nestedModules: { // nested module coupling
6158
'error_y': 'ErrorBars',
6259
'error_x': 'ErrorBars',

src/traces/histogram/attributes.js

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
'use strict';
1111

1212
var barAttrs = require('../bar/attributes');
13+
var extendFlat = require('../../lib').extendFlat;
14+
15+
var barMarkerAttrs = barAttrs.marker;
16+
var barMarkerLineAttrs = barMarkerAttrs.line;
1317

1418

1519
module.exports = {
@@ -25,17 +29,10 @@ module.exports = {
2529
'Sets the sample data to be binned on the y axis.'
2630
].join(' ')
2731
},
28-
z: {
29-
valType: 'data_array',
30-
description: 'Sets the aggregation data.'
31-
},
32-
marker: {
33-
color: { // FIXME this overrides 'bar'
34-
valType: 'data_array',
35-
arrayOk: undefined
36-
}
37-
},
32+
33+
text: barAttrs.text,
3834
orientation: barAttrs.orientation,
35+
3936
histfunc: {
4037
valType: 'enumerated',
4138
values: ['count', 'sum', 'avg', 'min', 'max'],
@@ -78,6 +75,7 @@ module.exports = {
7875
'(here, the sum of all bin area equals 1).'
7976
].join(' ')
8077
},
78+
8179
autobinx: {
8280
valType: 'boolean',
8381
dflt: true,
@@ -95,6 +93,7 @@ module.exports = {
9593
description: 'Sets the number of x axis bins.'
9694
},
9795
xbins: makeBinsAttr('x'),
96+
9897
autobiny: {
9998
valType: 'boolean',
10099
dflt: true,
@@ -111,7 +110,38 @@ module.exports = {
111110
role: 'style',
112111
description: 'Sets the number of y axis bins.'
113112
},
114-
ybins: makeBinsAttr('y')
113+
ybins: makeBinsAttr('y'),
114+
115+
marker: {
116+
color: barMarkerAttrs.color,
117+
colorscale: barMarkerAttrs.colorscale,
118+
cauto: barMarkerAttrs.cauto,
119+
cmax: barMarkerAttrs.cmax,
120+
cmin: barMarkerAttrs.cmin,
121+
autocolorscale: barMarkerAttrs.autocolorscale,
122+
reversescale: barMarkerAttrs.reversescale,
123+
showscale: barMarkerAttrs.showscale,
124+
line: {
125+
color: barMarkerLineAttrs.color,
126+
colorscale: barMarkerLineAttrs.colorscale,
127+
cauto: barMarkerLineAttrs.cauto,
128+
cmax: barMarkerLineAttrs.cmax,
129+
cmin: barMarkerLineAttrs.cmin,
130+
autocolorscale: barMarkerLineAttrs.autocolorscale,
131+
reversescale: barMarkerLineAttrs.reversescale,
132+
width: extendFlat({}, barMarkerLineAttrs.width, {dflt: 0})
133+
}
134+
},
135+
136+
_nestedModules: {
137+
'error_y': 'ErrorBars',
138+
'error_x': 'ErrorBars',
139+
'marker.colorbar': 'Colorbar'
140+
},
141+
142+
_deprecated: {
143+
bardir: barAttrs._deprecated.bardir
144+
}
115145
};
116146

117147
function makeBinsAttr(axLetter) {

0 commit comments

Comments
 (0)