Skip to content

Commit

Permalink
Fixing plotly#10
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianIssott committed Jul 7, 2022
1 parent 975973c commit 3f5e665
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Default Values:
* `hiddenAttributes`: []
* `hiddenFromAggregators`: []
* `hiddenFromDragDrop`: []
* `valueFilter`: []


## FAQ
Expand Down
2 changes: 1 addition & 1 deletion dash_pivottable/PivotTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class PivotTable(Component):
orders by row total
- aggregatorName (string; optional): Which aggregator is currently selected. E.g. Count, Sum, Average, etc.
- vals (list; optional): Vals for the aggregator.
- valueFilter (dict; optional): Value filter for each attibute name.
- valueFilter (dict; optional): Value filter for each attribute name.
- rendererName (string; optional): Which renderer is currently selected. E.g. Table, Line Chart, Scatter
Chart, etc."""
@_explicitize_args
Expand Down
12 changes: 10 additions & 2 deletions dash_pivottable/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,22 @@
"name": "array"
},
"required": false,
"description": "Vals for the aggregator."
"description": "Vals for the aggregator.",
"defaultValue": {
"value": "[]",
"computed": false
}
},
"valueFilter": {
"type": {
"name": "object"
},
"required": false,
"description": "Value filter for each attibute name."
"description": "Value filter for each attribute name.",
"defaultValue": {
"value": "[]",
"computed": false
}
},
"rendererName": {
"type": {
Expand Down
23 changes: 16 additions & 7 deletions src/lib/components/PivotTable.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const PlotlyRenderers = createPlotlyRenderers(Plot);
export default class PivotTable extends Component {
constructor(props) {
super(props);
this.state = props;
this.handleChange = this.handleChange.bind(this);
}

Expand All @@ -46,7 +45,9 @@ export default class PivotTable extends Component {
rows,
rowOrder,
aggregatorName,
rendererName
rendererName,
valueFilter,
vals,
} = state;

if (typeof this.props.setProps === 'function') {
Expand All @@ -56,7 +57,9 @@ export default class PivotTable extends Component {
rows,
rowOrder,
aggregatorName,
rendererName
rendererName,
valueFilter,
vals,
});
}

Expand All @@ -70,7 +73,9 @@ export default class PivotTable extends Component {
hiddenFromAggregators,
hiddenFromDragDrop,
menuLimit,
unusedOrientationCutoff
unusedOrientationCutoff,
valueFilter,
vals,
} = this.props;

return (
Expand All @@ -83,7 +88,9 @@ export default class PivotTable extends Component {
hiddenFromDragDrop={hiddenFromDragDrop}
menuLimit={menuLimit}
unusedOrientationCutoff={unusedOrientationCutoff}
{...this.state}
valueFilter={valueFilter}
vals={vals}
{...this.props}
/>
);
}
Expand All @@ -94,7 +101,9 @@ PivotTable.defaultProps = {
unusedOrientationCutoff: 85,
hiddenAttributes: [],
hiddenFromAggregators: [],
hiddenFromDragDrop: []
hiddenFromDragDrop: [],
valueFilter: [],
vals: [],
};

PivotTable.propTypes = {
Expand Down Expand Up @@ -181,7 +190,7 @@ PivotTable.propTypes = {
vals: PropTypes.array,

/**
* Value filter for each attibute name.
* Value filter for each attribute name.
*/
valueFilter: PropTypes.object,

Expand Down
1 change: 1 addition & 0 deletions tests/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def test_callbacks(dash_duo):
'col_order': 'key_a_to_z',
'aggregator': 'Average',
'renderer': 'Grouped Column Chart',
'data_length': 'Data length: 245',
}

app = import_app('usage')
Expand Down

0 comments on commit 3f5e665

Please sign in to comment.