Skip to content

Commit 2595731

Browse files
committed
first cut ternary layout attributes
1 parent 811c874 commit 2595731

File tree

3 files changed

+145
-0
lines changed

3 files changed

+145
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright 2012-2016, 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+
12+
module.exports = {
13+
subplot: {
14+
valType: 'subplotid',
15+
role: 'info',
16+
dflt: 'ternary',
17+
description: [
18+
'Sets a reference between this trace\'s data coordinates and',
19+
'a ternary subplot.',
20+
'If *ternary* (the default value), the data refer to `layout.ternary`.',
21+
'If *ternary2*, the data refer to `layout.ternary2`, and so on.'
22+
].join(' ')
23+
}
24+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* Copyright 2012-2016, 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+
12+
var axesAttrs = require('../../cartesian/layout_attributes');
13+
var colorAttrs = require('../../components/color/attributes');
14+
var extendFlat = require('../../../lib/extend').extendFlat;
15+
16+
17+
module.exports = {
18+
title: axesAttrs.title,
19+
titlefont: axesAttrs.titlefont,
20+
color: { // TODO: support this for all other kinds of axes as well
21+
valType: 'color',
22+
dflt: colorAttrs.defaultLine,
23+
role: 'style',
24+
description: [
25+
'Sets line, font, tick, and grid color for this axis',
26+
'all at once. Individual pieces can override this.'
27+
].join(' ')
28+
},
29+
// ticks
30+
nticks: axesAttrs.nticks,
31+
ticks: axesAttrs.ticks,
32+
ticklen: axesAttrs.ticklen,
33+
tickwidth: axesAttrs.tickwidth,
34+
tickcolor: axesAttrs.tickcolor,
35+
showticklabels: axesAttrs.showticklabels,
36+
tickfont: axesAttrs.tickfont,
37+
tickangle: axesAttrs.tickangle,
38+
// lines and grids
39+
showline: extendFlat({}, axesAttrs.showline, {dflt: true}),
40+
linecolor: axesAttrs.linecolor,
41+
linewidth: axesAttrs.linewidth,
42+
showgrid: axesAttrs.showgrid,
43+
gridcolor: axesAttrs.gridcolor,
44+
gridwidth: axesAttrs.gridwidth,
45+
// range
46+
min: {
47+
valType: 'number',
48+
dflt: 0,
49+
role: 'info',
50+
min: 0,
51+
description: [
52+
'The minimum value visible on this axis.',
53+
'The maximum is determined by the sum minus the minimum',
54+
'values of the other two axes. The full view corresponds to',
55+
'all the minima set to zero.'
56+
].join(' ')
57+
}
58+
};
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/**
2+
* Copyright 2012-2016, 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+
var colorAttrs = require('../../../components/color/attributes');
12+
var ternaryAxesAttrs = require('./axis_attributes');
13+
14+
15+
module.exports = {
16+
domain: {
17+
x: {
18+
valType: 'info_array',
19+
role: 'info',
20+
items: [
21+
{valType: 'number', min: 0, max: 1},
22+
{valType: 'number', min: 0, max: 1}
23+
],
24+
dflt: [0, 1],
25+
description: [
26+
'Sets the horizontal domain of this subplot',
27+
'(in plot fraction).'
28+
].join(' ')
29+
},
30+
y: {
31+
valType: 'info_array',
32+
role: 'info',
33+
items: [
34+
{valType: 'number', min: 0, max: 1},
35+
{valType: 'number', min: 0, max: 1}
36+
],
37+
dflt: [0, 1],
38+
description: [
39+
'Sets the vertical domain of this subplot',
40+
'(in plot fraction).'
41+
].join(' ')
42+
}
43+
},
44+
bgcolor: {
45+
valType: 'color',
46+
role: 'style',
47+
dflt: colorAttrs.background,
48+
description: 'Set the background color of the subplot'
49+
},
50+
sum: {
51+
valType: 'number',
52+
role: 'info',
53+
dflt: 1,
54+
min: 0,
55+
description: [
56+
'The number each triplet should sum to,',
57+
'and the maximum range of each axis'
58+
].join(' ')
59+
},
60+
aaxis: ternaryAxesAttrs,
61+
baxis: ternaryAxesAttrs,
62+
caxis: ternaryAxesAttrs
63+
};

0 commit comments

Comments
 (0)