diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 25dfee7967..93c6a95271 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -39,8 +39,19 @@ export interface PlotScatterDataPoint { yaxis: LayoutAxis; } +export interface PlotDatum { + curveNumber: number; + data: PlotData; + pointIndex: number; + pointNumber: number; + x: Datum; + xaxis: LayoutAxis; + y: Datum; + yaxis: LayoutAxis; +} + export interface PlotMouseEvent { - points: PlotScatterDataPoint[]; + points: PlotDatum[]; event: MouseEvent; } @@ -55,10 +66,10 @@ export interface SelectionRange { y: number[]; } -export type PlotSelectedData = Partial; +export type PlotSelectedData = Partial; export interface PlotSelectionEvent { - points: PlotScatterDataPoint[]; + points: PlotDatum[]; range?: SelectionRange; lassoPoints?: SelectionRange; } diff --git a/types/plotly.js/test/core-tests.ts b/types/plotly.js/test/core-tests.ts index 6e35de55c6..ba48a8ee03 100644 --- a/types/plotly.js/test/core-tests.ts +++ b/types/plotly.js/test/core-tests.ts @@ -1,5 +1,5 @@ import * as Plotly from 'plotly.js/lib/core'; -import { ScatterData, Layout, PlotlyHTMLElement, newPlot } from 'plotly.js/lib/core'; +import { Datum, ScatterData, Layout, PlotlyHTMLElement, newPlot } from 'plotly.js/lib/core'; const graphDiv = '#test'; @@ -336,8 +336,8 @@ function rand() { }); myPlot.on('plotly_selected', (data) => { - const x = [] as number[]; - const y = [] as number[]; + const x = [] as Datum[]; + const y = [] as Datum[]; const N = 1000; const color1 = '#7b3294'; const color1Light = '#c2a5cf'; diff --git a/types/plotly.js/test/index-tests.ts b/types/plotly.js/test/index-tests.ts index d4b274b321..89786a5375 100644 --- a/types/plotly.js/test/index-tests.ts +++ b/types/plotly.js/test/index-tests.ts @@ -1,5 +1,5 @@ import * as Plotly from 'plotly.js'; -import { Layout, PlotData, PlotlyHTMLElement, newPlot } from 'plotly.js'; +import { Datum, Layout, PlotData, PlotlyHTMLElement, newPlot } from 'plotly.js'; const graphDiv = '#test'; @@ -446,8 +446,8 @@ function rand() { }); myPlot.on('plotly_selected', (data) => { - const x = [] as number[]; - const y = [] as number[]; + const x = [] as Datum[]; + const y = [] as Datum[]; const N = 1000; const color1 = '#7b3294'; const color1Light = '#c2a5cf';