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

Skip to content

Commit 70fa028

Browse files
committed
adding waterfall attributes
1 parent 05e4163 commit 70fa028

File tree

4 files changed

+123
-4
lines changed

4 files changed

+123
-4
lines changed

src/traces/waterfall/attributes.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/**
2+
* Copyright 2012-2019, 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 barAttrs = require('../bar/attributes');
12+
13+
module.exports = {
14+
15+
x: barAttrs.x,
16+
x0: barAttrs.x0,
17+
dx: barAttrs.dx,
18+
y: barAttrs.y,
19+
y0: barAttrs.y0,
20+
dy: barAttrs.dy,
21+
22+
text: barAttrs.text,
23+
hovertext: barAttrs.hovertext,
24+
hovertemplate: barAttrs.hovertemplate,
25+
26+
textposition: barAttrs.textposition,
27+
28+
textfont: barAttrs.textfont,
29+
30+
insidetextfont: barAttrs.insidetextfont,
31+
32+
outsidetextfont: barAttrs.outsidetextfont,
33+
34+
constraintext: barAttrs.constraintext,
35+
36+
cliponaxis: barAttrs.cliponaxis,
37+
38+
orientation: barAttrs.orientation,
39+
40+
base: barAttrs.base,
41+
42+
offset: barAttrs.offset,
43+
44+
width: barAttrs.width,
45+
marker: barAttrs.marker,
46+
47+
selected: barAttrs.selected,
48+
unselected: barAttrs.unselected,
49+
50+
r: barAttrs.r,
51+
t: barAttrs.t,
52+
53+
_deprecated: barAttrs._deprecated,
54+
55+
report: {
56+
editType: 'calc',
57+
58+
after: {
59+
valType: 'data_array',
60+
dflt: [],
61+
role: 'info',
62+
editType: 'calc',
63+
description: [
64+
'Specifies the indices of horizontal or vertical slices',
65+
'on the axis depending on `orientation`.'
66+
].join(' ')
67+
},
68+
text: {
69+
valType: 'string',
70+
dflt: 'sum',
71+
arrayOk: true,
72+
role: 'info',
73+
editType: 'calc',
74+
description: [
75+
'Sets text elements associated with all/each `fall`',
76+
'If a single string, the same string appears over',
77+
'all the data points.',
78+
'If an array of string, the items are mapped in order to the',
79+
'this trace\'s `fall` indices.'
80+
].join(' ')
81+
}
82+
}
83+
};

src/traces/waterfall/defaults.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Copyright 2012-2019, 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+
10+
'use strict';
11+
12+
var Lib = require('../../lib');
13+
var barDefaults = require('../bar/defaults');
14+
var attributes = require('./attributes');
15+
16+
module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
17+
18+
barDefaults(traceIn, traceOut, defaultColor, layout);
19+
20+
function coerce(attr, dflt) {
21+
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
22+
}
23+
24+
coerce('report.text');
25+
coerce('report.after');
26+
};

src/traces/waterfall/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
var Waterfall = {};
1313

14-
Waterfall.attributes = require('../bar/attributes');
14+
Waterfall.attributes = require('./attributes');
1515
Waterfall.layoutAttributes = require('../bar/layout_attributes');
16-
Waterfall.supplyDefaults = require('../bar/defaults');
16+
Waterfall.supplyDefaults = require('./defaults');
1717
Waterfall.supplyLayoutDefaults = require('../bar/layout_defaults');
1818
Waterfall.calc = require('../bar/calc');
1919
Waterfall.crossTraceCalc = require('../bar/cross_trace_calc').crossTraceCalc;

test/image/mocks/waterfall_display-positive-negative-contributions.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616
5
1717
],
1818
"name": "first",
19-
"type": "waterfall"
19+
"type": "waterfall",
20+
"report" : {
21+
"after": [2, 5],
22+
"label": ["intermediate sum", "total"]
23+
},
24+
"orientation": "v"
2025
},
2126
{
2227
"x": [
@@ -34,7 +39,12 @@
3439
-2
3540
],
3641
"name": "second",
37-
"type": "waterfall"
42+
"type": "waterfall",
43+
"report" : {
44+
"after": [2, 5],
45+
"label": ["intermediate sum", "total"]
46+
},
47+
"orientation": "v"
3848
}
3949
],
4050
"layout": {

0 commit comments

Comments
 (0)