Skip to content

Commit bb85f42

Browse files
fix for #30 and #22
1 parent 8941e24 commit bb85f42

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,17 @@ You can see an example of this method in action [here](https://codepen.io/rsreus
191191
| `data` | `Array` | `[]` | list of trace objects |
192192
| `layout` | `Object` | `undefined` | layout object |
193193
| `config` | `Object` | `undefined` | config object |
194-
| `style` | `Object` | `{position: 'relative', display: 'inline-block'}` | used to style the containing `<div>` |
194+
| `style` | `Object` | `{position: 'relative', display: 'inline-block'}` | used to style the `<div>` into which the plot is rendered |
195+
| `className` | `string` | `undefined` | applied to the `<div>` into which the plot is rendered |
195196
| `frames` | `Array` | `undefined` | list of frame objects |
196197
| `useResizeHandler` | `Boolean` | `false` | When true, adds a call to `Plotly.Plot.resize()` as a `window.resize` event handler |
197-
| `fit` | `Boolean` | `false` | When true, disregards `layout.width` and `layout.height` and fits to the parent div size, updating on `window.resize` |
198198
| `revision` | `Number` | `undefined` | When provided, causes the plot to update *only* when the revision is incremented. |
199199
| `debug` | `Boolean` | `false` | Assign the graph div to `window.gd` for debugging |
200200
| `onInitialized` | `Function` | `undefined` | Callback executed after plot is initialized |
201201
| `onPurge` | `Function` | `undefined` | Callback executed when component unmounts. Unmounting triggers a Plotly.purge event which strips the graphDiv of all plotly.js related information including data and layout. This hook gives application writers a chance to pull data and layout off the DOM. |
202202
| `onUpdate` | `Function` | `undefined` | Callback executed when a plotly.js API method resolves |
203203
| `onError` | `Function` | `undefined` | Callback executed when a plotly.js API method rejects |
204+
| `fit` | `Boolean` | `false` | *deprecated* When true, will set `layout.height` and `layout.width` to the component's parent's size if they are unspecified, and will update them on `window.resize` |
204205

205206
### Event handler props
206207

src/factory.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,13 @@ export default function plotComponentFactory(Plotly) {
260260
}
261261

262262
render() {
263-
return <div style={this.props.style} ref={this.getRef} />;
263+
return (
264+
<div
265+
style={this.props.style}
266+
ref={this.getRef}
267+
className={this.props.className}
268+
/>
269+
);
264270
}
265271
}
266272

@@ -277,6 +283,7 @@ export default function plotComponentFactory(Plotly) {
277283
onUpdate: PropTypes.func,
278284
debug: PropTypes.bool,
279285
style: PropTypes.object,
286+
className: PropTypes.string,
280287
useResizeHandler: PropTypes.bool,
281288
};
282289

0 commit comments

Comments
 (0)