Skip to content

Commit 3fded33

Browse files
committed
Fixing plotly#10
1 parent 30e0980 commit 3fded33

File tree

5 files changed

+29
-10
lines changed

5 files changed

+29
-10
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Default Values:
6161
* `hiddenAttributes`: []
6262
* `hiddenFromAggregators`: []
6363
* `hiddenFromDragDrop`: []
64+
* `valueFilter`: []
6465

6566

6667
## FAQ

dash_pivottable/PivotTable.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class PivotTable(Component):
4848
orders by row total
4949
- aggregatorName (string; optional): Which aggregator is currently selected. E.g. Count, Sum, Average, etc.
5050
- vals (list; optional): Vals for the aggregator.
51-
- valueFilter (dict; optional): Value filter for each attibute name.
51+
- valueFilter (dict; optional): Value filter for each attribute name.
5252
- rendererName (string; optional): Which renderer is currently selected. E.g. Table, Line Chart, Scatter
5353
Chart, etc."""
5454
@_explicitize_args

dash_pivottable/metadata.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,22 @@
133133
"name": "array"
134134
},
135135
"required": false,
136-
"description": "Vals for the aggregator."
136+
"description": "Vals for the aggregator.",
137+
"defaultValue": {
138+
"value": "[]",
139+
"computed": false
140+
}
137141
},
138142
"valueFilter": {
139143
"type": {
140144
"name": "object"
141145
},
142146
"required": false,
143-
"description": "Value filter for each attibute name."
147+
"description": "Value filter for each attribute name.",
148+
"defaultValue": {
149+
"value": "[]",
150+
"computed": false
151+
}
144152
},
145153
"rendererName": {
146154
"type": {

src/lib/components/PivotTable.react.js

+16-7
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const PlotlyRenderers = createPlotlyRenderers(Plot);
3535
export default class PivotTable extends Component {
3636
constructor(props) {
3737
super(props);
38-
this.state = props;
3938
this.handleChange = this.handleChange.bind(this);
4039
}
4140

@@ -46,7 +45,9 @@ export default class PivotTable extends Component {
4645
rows,
4746
rowOrder,
4847
aggregatorName,
49-
rendererName
48+
rendererName,
49+
valueFilter,
50+
vals,
5051
} = state;
5152

5253
if (typeof this.props.setProps === 'function') {
@@ -56,7 +57,9 @@ export default class PivotTable extends Component {
5657
rows,
5758
rowOrder,
5859
aggregatorName,
59-
rendererName
60+
rendererName,
61+
valueFilter,
62+
vals,
6063
});
6164
}
6265

@@ -70,7 +73,9 @@ export default class PivotTable extends Component {
7073
hiddenFromAggregators,
7174
hiddenFromDragDrop,
7275
menuLimit,
73-
unusedOrientationCutoff
76+
unusedOrientationCutoff,
77+
valueFilter,
78+
vals,
7479
} = this.props;
7580

7681
return (
@@ -83,7 +88,9 @@ export default class PivotTable extends Component {
8388
hiddenFromDragDrop={hiddenFromDragDrop}
8489
menuLimit={menuLimit}
8590
unusedOrientationCutoff={unusedOrientationCutoff}
86-
{...this.state}
91+
valueFilter={valueFilter}
92+
vals={vals}
93+
{...this.props}
8794
/>
8895
);
8996
}
@@ -94,7 +101,9 @@ PivotTable.defaultProps = {
94101
unusedOrientationCutoff: 85,
95102
hiddenAttributes: [],
96103
hiddenFromAggregators: [],
97-
hiddenFromDragDrop: []
104+
hiddenFromDragDrop: [],
105+
valueFilter: [],
106+
vals: [],
98107
};
99108

100109
PivotTable.propTypes = {
@@ -181,7 +190,7 @@ PivotTable.propTypes = {
181190
vals: PropTypes.array,
182191

183192
/**
184-
* Value filter for each attibute name.
193+
* Value filter for each attribute name.
185194
*/
186195
valueFilter: PropTypes.object,
187196

tests/test_callbacks.py

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def test_callbacks(dash_duo):
1313
'col_order': 'key_a_to_z',
1414
'aggregator': 'Average',
1515
'renderer': 'Grouped Column Chart',
16+
'data_length': 'Data length: 245',
1617
}
1718

1819
app = import_app('usage')

0 commit comments

Comments
 (0)