Skip to content

Commit 7595849

Browse files
committed
581a dry colors - plug in colorscale/
1 parent ab843f5 commit 7595849

File tree

6 files changed

+45
-71
lines changed

6 files changed

+45
-71
lines changed

src/traces/choropleth/attributes.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var extendFlat = require('../../lib/extend').extendFlat;
1515

1616
var ScatterGeoMarkerLineAttrs = ScatterGeoAttrs.marker.line;
1717

18-
module.exports = {
18+
module.exports = extendFlat({}, colorscaleAttrs, {
1919
locations: {
2020
valType: 'data_array',
2121
description: [
@@ -38,17 +38,10 @@ module.exports = {
3838
width: ScatterGeoMarkerLineAttrs.width
3939
}
4040
},
41-
zauto: colorscaleAttrs.zauto,
42-
zmin: colorscaleAttrs.zmin,
43-
zmax: colorscaleAttrs.zmax,
44-
colorscale: colorscaleAttrs.colorscale,
45-
autocolorscale: colorscaleAttrs.autocolorscale,
46-
reversescale: colorscaleAttrs.reversescale,
47-
showscale: colorscaleAttrs.showscale,
4841
hoverinfo: extendFlat({}, plotAttrs.hoverinfo, {
4942
flags: ['location', 'z', 'text', 'name']
5043
}),
5144
_nestedModules: {
5245
'colorbar': 'Colorbar'
5346
}
54-
};
47+
});

src/traces/contour/attributes.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010

1111
var heatmapAttrs = require('../heatmap/attributes');
1212
var scatterAttrs = require('../scatter/attributes');
13+
var colorscaleAttrs = require('../../components/colorscale/attributes');
1314
var extendFlat = require('../../lib/extend').extendFlat;
1415

1516
var scatterLineAttrs = scatterAttrs.line;
1617

17-
module.exports = {
18+
module.exports = extendFlat({}, colorscaleAttrs, {
1819
z: heatmapAttrs.z,
1920
x: heatmapAttrs.x,
2021
x0: heatmapAttrs.x0,
@@ -27,14 +28,6 @@ module.exports = {
2728
xtype: heatmapAttrs.xtype,
2829
ytype: heatmapAttrs.ytype,
2930

30-
zauto: heatmapAttrs.zauto,
31-
zmin: heatmapAttrs.zmin,
32-
zmax: heatmapAttrs.zmax,
33-
colorscale: heatmapAttrs.colorscale,
34-
autocolorscale: heatmapAttrs.autocolorscale,
35-
reversescale: heatmapAttrs.reversescale,
36-
showscale: heatmapAttrs.showscale,
37-
3831
connectgaps: heatmapAttrs.connectgaps,
3932

4033
autocontour: {
@@ -122,4 +115,4 @@ module.exports = {
122115
_nestedModules: {
123116
'colorbar': 'Colorbar'
124117
}
125-
};
118+
});

src/traces/heatmap/attributes.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ var colorscaleAttrs = require('../../components/colorscale/attributes');
1414
var extendFlat = require('../../lib/extend').extendFlat;
1515

1616

17-
module.exports = extendFlat(
18-
{},
17+
module.exports = extendFlat({},
1918
colorscaleAttrs,
20-
{
21-
autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale,
22-
{dflt: false})
23-
},
19+
{autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})},
2420
{
2521
z: {
2622
valType: 'data_array',

src/traces/histogram2d/attributes.js

+32-34
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,40 @@
1010

1111
var histogramAttrs = require('../histogram/attributes');
1212
var heatmapAttrs = require('../heatmap/attributes');
13+
var colorscaleAttrs = require('../../components/colorscale/attributes');
1314

14-
module.exports = {
15-
x: histogramAttrs.x,
16-
y: histogramAttrs.y,
15+
var extendFlat = require('../../lib/extend').extendFlat;
1716

18-
z: {
19-
valType: 'data_array',
20-
description: 'Sets the aggregation data.'
21-
},
22-
marker: {
23-
color: {
17+
module.exports = extendFlat({},
18+
colorscaleAttrs,
19+
{autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})},
20+
{
21+
x: histogramAttrs.x,
22+
y: histogramAttrs.y,
23+
24+
z: {
2425
valType: 'data_array',
2526
description: 'Sets the aggregation data.'
27+
},
28+
marker: {
29+
color: {
30+
valType: 'data_array',
31+
description: 'Sets the aggregation data.'
32+
}
33+
},
34+
35+
histnorm: histogramAttrs.histnorm,
36+
histfunc: histogramAttrs.histfunc,
37+
autobinx: histogramAttrs.autobinx,
38+
nbinsx: histogramAttrs.nbinsx,
39+
xbins: histogramAttrs.xbins,
40+
autobiny: histogramAttrs.autobiny,
41+
nbinsy: histogramAttrs.nbinsy,
42+
ybins: histogramAttrs.ybins,
43+
44+
zsmooth: heatmapAttrs.zsmooth,
45+
46+
_nestedModules: {
47+
'colorbar': 'Colorbar'
2648
}
27-
},
28-
29-
histnorm: histogramAttrs.histnorm,
30-
histfunc: histogramAttrs.histfunc,
31-
autobinx: histogramAttrs.autobinx,
32-
nbinsx: histogramAttrs.nbinsx,
33-
xbins: histogramAttrs.xbins,
34-
autobiny: histogramAttrs.autobiny,
35-
nbinsy: histogramAttrs.nbinsy,
36-
ybins: histogramAttrs.ybins,
37-
38-
zauto: heatmapAttrs.zauto,
39-
zmin: heatmapAttrs.zmin,
40-
zmax: heatmapAttrs.zmax,
41-
colorscale: heatmapAttrs.colorscale,
42-
autocolorscale: heatmapAttrs.autocolorscale,
43-
reversescale: heatmapAttrs.reversescale,
44-
showscale: heatmapAttrs.showscale,
45-
46-
zsmooth: heatmapAttrs.zsmooth,
47-
48-
_nestedModules: {
49-
'colorbar': 'Colorbar'
50-
}
51-
};
49+
});

src/traces/histogram2dcontour/attributes.js

+5-10
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010

1111
var histogram2dAttrs = require('../histogram2d/attributes');
1212
var contourAttrs = require('../contour/attributes');
13+
var colorscaleAttrs = require('../../components/colorscale/attributes');
1314

14-
module.exports = {
15+
var extendFlat = require('../../lib/extend').extendFlat;
16+
17+
module.exports = extendFlat({}, colorscaleAttrs, {
1518
x: histogram2dAttrs.x,
1619
y: histogram2dAttrs.y,
1720
z: histogram2dAttrs.z,
@@ -26,14 +29,6 @@ module.exports = {
2629
nbinsy: histogram2dAttrs.nbinsy,
2730
ybins: histogram2dAttrs.ybins,
2831

29-
zauto: contourAttrs.zauto,
30-
zmin: contourAttrs.zmin,
31-
zmax: contourAttrs.zmax,
32-
colorscale: contourAttrs.colorscale,
33-
autocolorscale: contourAttrs.autocolorscale,
34-
reversescale: contourAttrs.reversescale,
35-
showscale: contourAttrs.showscale,
36-
3732
autocontour: contourAttrs.autocontour,
3833
ncontours: contourAttrs.ncontours,
3934
contours: contourAttrs.contours,
@@ -42,4 +37,4 @@ module.exports = {
4237
_nestedModules: {
4338
'colorbar': 'Colorbar'
4439
}
45-
};
40+
});

src/traces/surface/attributes.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
109
'use strict';
1110

1211
var Color = require('../../components/color');
1312
var colorscaleAttrs = require('../../components/colorscale/attributes');
1413
var extendFlat = require('../../lib/extend').extendFlat;
1514

16-
1715
function makeContourProjAttr(axLetter) {
1816
return {
1917
valType: 'boolean',
@@ -121,6 +119,7 @@ module.exports = {
121119
].join(' ')
122120
},
123121

122+
// Todo this block has a structure of colorscale/attributes.js but with colorscale/color_attributes.js names
124123
cauto: colorscaleAttrs.zauto,
125124
cmin: colorscaleAttrs.zmin,
126125
cmax: colorscaleAttrs.zmax,

0 commit comments

Comments
 (0)