forked from plotly/plotly.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
layout_attributes.js
123 lines (116 loc) · 4.17 KB
/
layout_attributes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
'use strict';
var colorAttrs = require('../../components/color/attributes');
var domainAttrs = require('../domain').attributes;
var axesAttrs = require('../cartesian/layout_attributes');
var overrideAll = require('../../plot_api/edit_types').overrideAll;
var extendFlat = require('../../lib/extend').extendFlat;
var ternaryAxesAttrs = {
title: {
text: axesAttrs.title.text,
font: axesAttrs.title.font
// TODO does standoff here make sense?
},
color: axesAttrs.color,
// ticks
tickmode: extendFlat({}, axesAttrs.tickmode, {
values: ['auto', 'linear', 'array'],
description: [
'Sets the tick mode for this axis.',
'If *auto*, the number of ticks is set via `nticks`.',
'If *linear*, the placement of the ticks is determined by',
'a starting position `tick0` and a tick step `dtick`',
'(*linear* is the default value if `tick0` and `dtick` are provided).',
'If *array*, the placement of the ticks is set via `tickvals`',
'and the tick text is `ticktext`.',
'(*array* is the default value if `tickvals` is provided).'
].join(' ')
}),
nticks: extendFlat({}, axesAttrs.nticks, {dflt: 6, min: 1}),
tick0: axesAttrs.tick0,
dtick: axesAttrs.dtick,
tickvals: axesAttrs.tickvals,
ticktext: axesAttrs.ticktext,
ticks: axesAttrs.ticks,
ticklen: axesAttrs.ticklen,
tickwidth: axesAttrs.tickwidth,
tickcolor: axesAttrs.tickcolor,
ticklabelstep: axesAttrs.ticklabelstep,
showticklabels: axesAttrs.showticklabels,
showtickprefix: axesAttrs.showtickprefix,
tickprefix: axesAttrs.tickprefix,
showticksuffix: axesAttrs.showticksuffix,
ticksuffix: axesAttrs.ticksuffix,
showexponent: axesAttrs.showexponent,
exponentformat: axesAttrs.exponentformat,
minexponent: axesAttrs.minexponent,
separatethousands: axesAttrs.separatethousands,
tickfont: axesAttrs.tickfont,
tickangle: axesAttrs.tickangle,
tickformat: axesAttrs.tickformat,
tickformatstops: axesAttrs.tickformatstops,
hoverformat: axesAttrs.hoverformat,
// lines and grids
showline: extendFlat({}, axesAttrs.showline, {dflt: true}),
linecolor: axesAttrs.linecolor,
linewidth: axesAttrs.linewidth,
showgrid: extendFlat({}, axesAttrs.showgrid, {dflt: true}),
gridcolor: axesAttrs.gridcolor,
gridwidth: axesAttrs.gridwidth,
griddash: axesAttrs.griddash,
layer: axesAttrs.layer,
// range
min: {
valType: 'number',
dflt: 0,
min: 0,
description: [
'The minimum value visible on this axis.',
'The maximum is determined by the sum minus the minimum',
'values of the other two axes. The full view corresponds to',
'all the minima set to zero.'
].join(' ')
},
_deprecated: {
title: axesAttrs._deprecated.title,
titlefont: axesAttrs._deprecated.titlefont
}
};
var attrs = module.exports = overrideAll({
domain: domainAttrs({name: 'ternary'}),
bgcolor: {
valType: 'color',
dflt: colorAttrs.background,
description: 'Set the background color of the subplot'
},
sum: {
valType: 'number',
dflt: 1,
min: 0,
description: [
'The number each triplet should sum to,',
'and the maximum range of each axis'
].join(' ')
},
aaxis: ternaryAxesAttrs,
baxis: ternaryAxesAttrs,
caxis: ternaryAxesAttrs
}, 'plot', 'from-root');
// set uirevisions outside of `overrideAll` so we can get `editType: none`
attrs.uirevision = {
valType: 'any',
editType: 'none',
description: [
'Controls persistence of user-driven changes in axis `min` and `title`,',
'if not overridden in the individual axes.',
'Defaults to `layout.uirevision`.'
].join(' ')
};
attrs.aaxis.uirevision = attrs.baxis.uirevision = attrs.caxis.uirevision = {
valType: 'any',
editType: 'none',
description: [
'Controls persistence of user-driven changes in axis `min`,',
'and `title` if in `editable: true` configuration.',
'Defaults to `ternary<N>.uirevision`.'
].join(' ')
};