8000 Update to support Plotly 2.0.0 interface. · plotly/angular-plotly.js@7e0ac49 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7e0ac49

Browse files
xaxis-iiandrefarzat
authored andcommitted
Update to support Plotly 2.0.0 interface.
1 parent 255d9b9 commit 7e0ac49

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

projects/plotly/src/lib/plotly.service.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,20 @@ export class PlotlyService {
9595
public plot(div: Plotly.PlotlyHTMLElement, data: Plotly.Data[], layout?: Partial<Plotly.Layout>, config?: Partial<Plotly.Config>, frames?: Partial<Plotly.Config>[]): Promise<any> {
9696
if (frames) {
9797
const obj = {data, layout, config, frames};
98-
return this._getPlotly().plot(div, obj) as Promise<any>;
98+
if (typeOf(this.__getPlotly.plot === 'function')) {
99+
return this._getPlotly().plot(div, obj) as Promise<any>;
100+
} else {
101+
// Adds support for Plotly 2.0.0 release candidates
102+
return this._getPlotly().newPlot(div, obj) as Promise<any>;
103+
}
99104
}
100105

101-
return this._getPlotly().plot(div, data, layout, config) as Promise<any>;
106+
if (typeOf(this.__getPlotly.plot === 'function')) {
107+
return this._getPlotly().plot(div, data, layout, config) as Promise<any>;
108+
} else {
109+
// Adds support for Plotly 2.0.0 release candidates
110+
return this._getPlotly().newPlot(div, data, layout, config) as Promise<any>;
111+
}
102112
}
103113

104114
public update(div: Plotly.PlotlyHTMLElement, data: Plotly.Data[], layout?: Partial<Plotly.Layout>, config?: Partial<Plotly.Config>, frames?: Partial<Plotly.Config>[]): Promise<any> {

0 commit comments

Comments
 (0)
0