Skip to content

Commit

Permalink
pass width and height as separate inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Sep 18, 2018
1 parent bafb382 commit 86ee56c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 5 additions & 1 deletion superset/assets/src/utils/createAdaptor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export default function createAdaptor(Component, transformProps = IDENTITY) {
return function adaptor(slice, payload, setControlValue) {
const basicChartInput = new BasicChartInput(slice, payload, setControlValue);
ReactDOM.render(
<Component {...transformProps(basicChartInput)} />,
<Component
width={slice.width()}
height={slice.height()}
{...transformProps(basicChartInput)}
/>,
document.querySelector(slice.selector),
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
export default function transformProps(basicChartInput) {
const { height, formData, payload } = basicChartInput;
const { formData, payload } = basicChartInput;
const { maxBubbleSize, showBubbles } = formData;

return {
data: payload.data,
height,
maxBubbleSize: parseInt(maxBubbleSize, 10),
showBubbles,
};
Expand Down
3 changes: 0 additions & 3 deletions superset/assets/src/visualizations/models/BasicChartInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import convertKeysToCamelCase from '../../utils/convertKeysToCamelCase';

export default class BasicChartInput {
constructor(slice, payload, setControlValue) {
this.width = slice.width();
this.height = slice.height();
this.annotationData = slice.annotationData;
this.formData = convertKeysToCamelCase(slice.formData);

this.payload = payload;
this.setControlValue = setControlValue;
}
Expand Down

0 comments on commit 86ee56c

Please sign in to comment.