Skip to content

Commit 8176b98

Browse files
added events to render function
1 parent 185904e commit 8176b98

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

dist/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ var PlotlyChart = /** @class */ (function (_super) {
189189
if (this.props.onUnHover) {
190190
this.container.on('plotly_unhover', this.props.onUnHover);
191191
}
192+
if (this.props.onEvent) {
193+
this.container.on('plotly_event', this.props.onEvent);
194+
}
192195
window.addEventListener('resize', this.resize);
193196
};
194197
PlotlyChart.prototype.componentWillReceiveProps = function (nextProps) {
@@ -205,7 +208,7 @@ var PlotlyChart = /** @class */ (function (_super) {
205208
};
206209
PlotlyChart.prototype.render = function () {
207210
var _this = this;
208-
var _a = this.props, data = _a.data, layout = _a.layout, config = _a.config, onClick = _a.onClick, onHover = _a.onHover, onSelected = _a.onSelected, onUnHover = _a.onUnHover, other = __rest(_a, ["data", "layout", "config", "onClick", "onHover", "onSelected", "onUnHover"]);
211+
var _a = this.props, data = _a.data, layout = _a.layout, config = _a.config, onAfterExport = _a.onAfterExport, onAfterPlot = _a.onAfterPlot, onAnimated = _a.onAnimated, onAnimatingFrame = _a.onAnimatingFrame, onAnimationInterrupted = _a.onAnimationInterrupted, onAutoSize = _a.onAutoSize, onBeforeExport = _a.onBeforeExport, onClick = _a.onClick, onClickAnnotation = _a.onClickAnnotation, onDeselect = _a.onDeselect, onDoubleClick = _a.onDoubleClick, onFramework = _a.onFramework, onHover = _a.onHover, onLegendClick = _a.onLegendClick, onLegendDoubleClick = _a.onLegendDoubleClick, onRelayout = _a.onRelayout, onRestyle = _a.onRestyle, onRedraw = _a.onRedraw, onSelected = _a.onSelected, onSelecting = _a.onSelecting, onSliderChange = _a.onSliderChange, onSliderEnd = _a.onSliderEnd, onSliderStart = _a.onSliderStart, onTransitioning = _a.onTransitioning, onTransitionInterrupted = _a.onTransitionInterrupted, onUnHover = _a.onUnHover, onEvent = _a.onEvent, other = __rest(_a, ["data", "layout", "config", "onAfterExport", "onAfterPlot", "onAnimated", "onAnimatingFrame", "onAnimationInterrupted", "onAutoSize", "onBeforeExport", "onClick", "onClickAnnotation", "onDeselect", "onDoubleClick", "onFramework", "onHover", "onLegendClick", "onLegendDoubleClick", "onRelayout", "onRestyle", "onRedraw", "onSelected", "onSelecting", "onSliderChange", "onSliderEnd", "onSliderStart", "onTransitioning", "onTransitionInterrupted", "onUnHover", "onEvent"]);
209212
return (React.createElement("div", __assign({}, other, { ref: function (node) { return __awaiter(_this, void 0, void 0, function () {
210213
var _a;
211214
return __generator(this, function (_b) {

src/index.tsx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ class PlotlyChart extends React.Component<IPlotlyChartProps, any> {
126126
if (this.props.onUnHover) {
127127
this.container!.on('plotly_unhover', this.props.onUnHover);
128128
}
129+
if (this.props.onEvent) {
130+
this.container!.on('plotly_event', this.props.onEvent);
131+
}
129132
window.addEventListener('resize', this.resize);
130133
}
131134

@@ -160,7 +163,39 @@ class PlotlyChart extends React.Component<IPlotlyChartProps, any> {
160163
}
161164

162165
public render() {
163-
const { data, layout, config, onClick, onHover, onSelected, onUnHover, ...other } = this.props;
166+
const {
167+
data,
168+
layout,
169+
config,
170+
onAfterExport,
171+
onAfterPlot,
172+
onAnimated,
173+
onAnimatingFrame,
174+
onAnimationInterrupted,
175+
onAutoSize,
176+
onBeforeExport,
177+
onClick,
178+
onClickAnnotation,
179+
onDeselect,
180+
onDoubleClick,
181+
onFramework,
182+
onHover,
183+
onLegendClick,
184+
onLegendDoubleClick,
185+
onRelayout,
186+
onRestyle,
187+
onRedraw,
188+
onSelected,
189+
onSelecting,
190+
onSliderChange,
191+
onSliderEnd,
192+
onSliderStart,
193+
onTransitioning,
194+
onTransitionInterrupted,
195+
onUnHover,
196+
onEvent,
197+
...other
198+
} = this.props;
164199
return (
165200
<div
166201
{...other}

0 commit comments

Comments
 (0)