Skip to content

Commit 7896a4e

Browse files
fix for plotly#30 and plotly#22
1 parent 765fe5c commit 7896a4e

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
@@ -264,7 +264,13 @@ export default function plotComponentFactory(Plotly) {
264264
}
265265

266266
render() {
267-
return <div style={this.props.style} ref={this.getRef} />;
267+
return (
268+
<div
269+
style={this.props.style}
270+
ref={this.getRef}
271+
className={this.props.className}
272+
/>
273+
);
268274
}
269275
}
270276

@@ -281,6 +287,7 @@ export default function plotComponentFactory(Plotly) {
281287
onUpdate: PropTypes.func,
282288
debug: PropTypes.bool,
283289
style: PropTypes.object,
290+
className: PropTypes.string,
284291
useResizeHandler: PropTypes.bool,
285292
};
286293

0 commit comments

Comments
 (0)