You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This component will refresh the plot via [`Plotly.react`](https://plot.ly/javascript/plotlyjs-function-reference/#plotlyreact) if any of the following are true:
105
105
106
-
* The `revision` prop is defined and has changed, OR;
107
-
* One of `data`, `layout` or `config` has changed identity as checked via a shallow `===`, OR;
108
-
* The number of elements in `frames` has changed
106
+
- The `revision` prop is defined and has changed, OR;
107
+
- One of `data`, `layout` or `config` has changed identity as checked via a shallow `===`, OR;
108
+
- The number of elements in `frames` has changed
109
109
110
110
Furthermore, when called, [`Plotly.react`](https://plot.ly/javascript/plotlyjs-function-reference/#plotlyreact) will only refresh the data being plotted if the _identity_ of the data arrays (e.g. `x`, `y`, `marker.color` etc) has changed, or if `layout.datarevision` has changed.
111
111
@@ -117,32 +117,32 @@ In short, this means that simply adding data points to a trace in `data` or chan
117
117
118
118
**Warning**: for the time being, this component may _mutate_ its `layout` and `data` props in response to user input, going against React rules. This behaviour will change in the near future once https://github.com/plotly/plotly.js/issues/2389 is completed.
|`data`|`Array`|`[]`| list of trace objects (see https://plot.ly/javascript/reference/)|
123
-
|`layout`|`Object`|`undefined`| layout object (see https://plot.ly/javascript/reference/#layout)|
124
-
|`frames`|`Array`|`undefined`| list of frame objects (see https://plot.ly/javascript/reference/)|
125
-
|`config`|`Object`|`undefined`| config object (see https://plot.ly/javascript/configuration-options/)|
126
-
|`revision`|`Number`|`undefined`| When provided, causes the plot to update when the revision is incremented. |
127
-
|`onInitialized`|`Function(figure, graphDiv)`|`undefined`| Callback executed after plot is initialized. See below for parameter information. |
128
-
|`onUpdate`|`Function(figure, graphDiv)`|`undefined`| Callback executed when when a plot is updated due to new data or layout, or when user interacts with a plot. See below for parameter information.|
129
-
|`onPurge`|`Function(figure, graphDiv)`|`undefined`| Callback executed when component unmounts, before `Plotly.purge` strips the `graphDiv` of all private attributes. See below for parameter information. |
130
-
|`onError`|`Function(err)`|`undefined`| Callback executed when a plotly.js API method rejects |
131
-
|`divId`|`string`|`undefined`| id assigned to the `<div>` into which the plot is rendered. |
132
-
|`className`|`string`|`undefined`| applied to the `<div>` into which the plot is rendered |
133
-
|`style`|`Object`|`{position: 'relative', display: 'inline-block'}`| used to style the `<div>` into which the plot is rendered |
134
-
|`debug`|`Boolean`|`false`| Assign the graph div to `window.gd` for debugging |
135
-
|`useResizeHandler`|`Boolean`|`false`| When true, adds a call to `Plotly.Plot.resize()` as a `window.resize` event handler |
|`data`|`Array`|`[]`| list of trace objects (see https://plot.ly/javascript/reference/)|
123
+
|`layout`|`Object`|`undefined`| layout object (see https://plot.ly/javascript/reference/#layout)|
124
+
|`frames`|`Array`|`undefined`| list of frame objects (see https://plot.ly/javascript/reference/)|
125
+
|`config`|`Object`|`undefined`| config object (see https://plot.ly/javascript/configuration-options/)|
126
+
|`revision`|`Number`|`undefined`| When provided, causes the plot to update when the revision is incremented. |
127
+
|`onInitialized`|`Function(figure, graphDiv)`|`undefined`| Callback executed after plot is initialized. See below for parameter information. |
128
+
|`onUpdate`|`Function(figure, graphDiv)`|`undefined`| Callback executed when a plot is updated due to new data or layout, or when user interacts with a plot. See below for parameter information. |
129
+
|`onPurge`|`Function(figure, graphDiv)`|`undefined`| Callback executed when component unmounts, before `Plotly.purge` strips the `graphDiv` of all private attributes. See below for parameter information. |
130
+
|`onError`|`Function(err)`|`undefined`| Callback executed when a plotly.js API method rejects |
131
+
|`divId`|`string`|`undefined`| id assigned to the `<div>` into which the plot is rendered. |
132
+
|`className`|`string`|`undefined`| applied to the `<div>` into which the plot is rendered |
133
+
|`style`|`Object`|`{position: 'relative', display: 'inline-block'}`| used to style the `<div>` into which the plot is rendered |
134
+
|`debug`|`Boolean`|`false`| Assign the graph div to `window.gd` for debugging |
135
+
|`useResizeHandler`|`Boolean`|`false`| When true, adds a call to `Plotly.Plot.resize()` as a `window.resize` event handler |
136
136
137
137
**Note**: To make a plot responsive, i.e. to fill its containing element and resize when the window is resized, use `style` or `className` to set the dimensions of the element (i.e. using `width: 100%; height: 100%` or some similar values) and set `useResizeHandler` to `true` while setting `layout.autosize` to `true` and leaving `layout.height` and `layout.width` undefined. This can be seen in action in [this CodePen](https://codepen.io/nicolaskruchten/pen/ERgBZX) and will implement the behaviour documented here: https://plot.ly/javascript/responsive-fluid-layout/
The `onInitialized`, `onUpdate` and `onPurge` props are all functions which will be called with two arguments: `figure` and `graphDiv`.
142
142
143
-
*`figure` is a serializable object with three keys corresponding to input props: `data`, `layout` and `frames`.
144
-
* As mentioned above, for the time being, this component may _mutate_ its `layout` and `data` props in response to user input, going against React rules. This behaviour will change in the near future once https://github.com/plotly/plotly.js/issues/2389 is completed.
145
-
*`graphDiv` is a reference to the (unserializable) DOM node into which the figure was rendered.
143
+
-`figure` is a serializable object with three keys corresponding to input props: `data`, `layout` and `frames`.
144
+
- As mentioned above, for the time being, this component may _mutate_ its `layout` and `data` props in response to user input, going against React rules. This behaviour will change in the near future once https://github.com/plotly/plotly.js/issues/2389 is completed.
145
+
-`graphDiv` is a reference to the (unserializable) DOM node into which the figure was rendered.
0 commit comments