From 9b711fb5ee5875be7263e774c1b6f2b95ee26997 Mon Sep 17 00:00:00 2001 From: Megan Riel-Mehan Date: Wed, 22 Aug 2018 17:01:40 -0700 Subject: [PATCH 01/20] added histogram as plot type option --- types/plotly.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 7bdf862ea2..e4904fff98 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -423,7 +423,7 @@ export type Color = string | Array | Array Date: Wed, 22 Aug 2018 18:21:15 -0700 Subject: [PATCH 02/20] added transform interface --- types/plotly.js/index.d.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index e4904fff98..a14ba14aba 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -470,8 +470,39 @@ export interface ScatterData { name: string; connectgaps: boolean; visible: boolean | 'legendonly'; + transforms: Transform[]; } +/** + * These interfaces are based on attribute descriptions in + * https://github.com/plotly/plotly.js/tree/9d6144304308fc3007f0facf2535d38ea3e9b26c/src/transforms + */ + +export interface TransformStyle { + target: number | string | number[] | string[]; + value: Partial; +} + +export interface TransformAggregation { + target: string; + func?: 'count' | 'sum' | 'avg' | 'median' | 'mode' | 'rms' | 'stddev' | 'min' | 'max' | 'first' | 'last'; + funcmode?: 'sample' | 'population'; + enabled?: boolean; +} + +export interface Transform { + type: 'aggregate' | 'filter' | 'groupby' | 'sort'; + enabled?: boolean; + target?: number | string | number[] | string[]; + operation?: string; + aggregations?: TransformAggregation[]; + preservegaps?: boolean; + groups?: string | number[] | string[]; + nameformat: string; + styles?: TransformStyle[]; + value?: any; + order?: 'ascending' | 'descending'; +} /** * Any combination of "x", "y", "z", "text", "name" joined with a "+" OR "all" or "none" or "skip". * examples: "x", "y", "x+y", "x+y+z", "all" From bd493ea22415d7abf3feaa56428d4a3fc2c040b4 Mon Sep 17 00:00:00 2001 From: Megan Riel-Mehan Date: Wed, 22 Aug 2018 18:21:59 -0700 Subject: [PATCH 03/20] added additional x axes in layout interface --- types/plotly.js/index.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index a14ba14aba..84cad93b48 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -192,6 +192,14 @@ export interface Layout { separators: string; hidesources: boolean; xaxis: Partial; + xaxis2: Partial; + xaxis3: Partial; + xaxis4: Partial; + xaxis5: Partial; + xaxis6: Partial; + xaxis7: Partial; + xaxis8: Partial; + xaxis9: Partial; yaxis: Partial; yaxis2: Partial; yaxis3: Partial; From a1dadf7b216f65c63795ef92609b805505f510fd Mon Sep 17 00:00:00 2001 From: Megan Riel-Mehan Date: Thu, 23 Aug 2018 11:26:47 -0700 Subject: [PATCH 04/20] updated selection interface to include selection description --- types/plotly.js/index.d.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 84cad93b48..3a5784ae21 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -49,10 +49,20 @@ export interface PlotCoordinate { pointNumber: number; } -export interface PlotSelectionEvent { - points: PlotCoordinate[]; +export interface SelectionDescription { + x: number[], + y: number[], } +export type PlotSelectedData = Partial; + +export interface PlotSelectionEvent { + points: PlotSelectedData[]; + range?: SelectionDescription; + lassoPoints?: SelectionDescription; +} + + export type PlotRestyleEvent = [ any, // update object -- attribute updated: new value number[] // array of traces updated From 13253643343e5efedd0f50f3aa9929a84f55e206 Mon Sep 17 00:00:00 2001 From: Megan Riel-Mehan Date: Thu, 23 Aug 2018 17:20:01 -0700 Subject: [PATCH 05/20] Renamed ScatterData and ScatterMarker since they're used for other plots --- types/plotly.js/index.d.ts | 820 +++++++++++++++++++------------------ 1 file changed, 411 insertions(+), 409 deletions(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 3a5784ae21..0e943ef569 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -29,7 +29,7 @@ export interface Point { export interface PlotScatterDataPoint { curveNumber: number; - data: ScatterData; + data: PlotData; pointIndex: number; pointNumber: number; x: number; @@ -57,12 +57,11 @@ export interface SelectionDescription { export type PlotSelectedData = Partial; export interface PlotSelectionEvent { - points: PlotSelectedData[]; + points: PlotScatterDataPoint[]; range?: SelectionDescription; lassoPoints?: SelectionDescription; } - export type PlotRestyleEvent = [ any, // update object -- attribute updated: new value number[] // array of traces updated @@ -151,10 +150,10 @@ export interface PlotlyHTMLElement extends HTMLElement { on(event: 'plotly_sliderend', callback: (event: SliderEndEvent) => void): void; on(event: 'plotly_sliderstart', callback: (event: SliderStartEvent) => void): void; on(event: 'plotly_event', callback: (data: any) => void): void; - on(event: 'plotly_beforeplot' , callback: (event: BeforePlotEvent) => boolean): void; + on(event: 'plotly_beforeplot', callback: (event: BeforePlotEvent) => boolean): void; on(event: 'plotly_afterexport' | 'plotly_afterplot' | 'plotly_animated' | 'plotly_animationinterrupted' | 'plotly_autosize' | 'plotly_beforeexport' | 'plotly_deselect' | 'plotly_doubleclick' | 'plotly_framework' | 'plotly_redraw' | - 'plotly_transitioning' | 'plotly_transitioninterrupted' , callback: () => void): void; + 'plotly_transitioning' | 'plotly_transitioninterrupted', callback: () => void): void; } export interface ToImgopts { @@ -394,32 +393,32 @@ export interface ModeBarButton { /** name / id of the buttons (for tracking) */ name: string; - /** - * text that appears while hovering over the button, - * enter null, false or '' for no hover text - */ + /** + * text that appears while hovering over the button, + * enter null, false or '' for no hover text + */ title: string; - /** - * svg icon object associated with the button - * can be linked to Plotly.Icons to use the default plotly icons - */ + /** + * svg icon object associated with the button + * can be linked to Plotly.Icons to use the default plotly icons + */ icon: string | Icon; /** icon positioning */ gravity?: string; - /** - * click handler associated with the button, a function of - * 'gd' (the main graph object) and - * 'ev' (the event object) - */ + /** + * click handler associated with the button, a function of + * 'gd' (the main graph object) and + * 'ev' (the event object) + */ click: ButtonClickEvent; - /** - * attribute associated with button, - * use this with 'val' to keep track of the state - */ + /** + * attribute associated with button, + * use this with 'val' to keep track of the state + */ attr?: string; /** initial 'attr' value, can be a function of gd */ @@ -436,12 +435,13 @@ export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int export type Dash = 'solid' | 'dot' | 'dash' | 'longdash' | 'dashdot' | 'longdashdot'; -export type Data = Partial; +export type Data = Partial; export type Color = string | Array | Array>; - +export type DataTransForm = Partial; +export type ScatterData = PlotData; // Bar Scatter -export interface ScatterData { - type: 'bar' | 'histogram' | 'pointcloud' | 'scatter' | 'scattergl' | 'scatter3d' |'surface'; +export interface PlotData { + type: 'bar' | 'histogram' | 'pointcloud' | 'scatter' | 'scattergl' | 'scatter3d' | 'surface'; x: Datum[] | Datum[][] | TypedArray; y: Datum[] | Datum[][] | TypedArray; z: Datum[] | Datum[][] | Datum[][][] | TypedArray; @@ -456,7 +456,7 @@ export interface ScatterData { 'line.shape': 'linear' | 'spline' | 'hv' | 'vh' | 'hvh' | 'vhv'; 'line.smoothing': number; 'line.simplify': boolean; - marker: Partial; + marker: Partial; 'marker.symbol': string | string[]; // Drawing.symbolList 'marker.color': Color; 'marker.opacity': number | number[]; @@ -472,15 +472,15 @@ export interface ScatterData { mode: 'lines' | 'markers' | 'text' | 'lines+markers' | 'text+markers' | 'text+lines' | 'text+lines+markers' | 'none'; hoveron: 'points' | 'fills'; hoverinfo: 'all' | 'name' | 'none' | 'skip' | 'text' | - 'x' | 'x+text' | 'x+name' | - 'x+y' | 'x+y+text' | 'x+y+name' | - 'x+y+z' | 'x+y+z+text' | 'x+y+z+name' | - 'y+x' | 'y+x+text' | 'y+x+name' | - 'y+z' | 'y+z+text' | 'y+z+name' | - 'y+x+z' | 'y+x+z+text' | 'y+x+z+name' | - 'z+x' | 'z+x+text' | 'z+x+name' | - 'z+y+x' | 'z+y+x+text' | 'z+y+x+name' | - 'z+x+y' | 'z+x+y+text' | 'z+x+y+name'; + 'x' | 'x+text' | 'x+name' | + 'x+y' | 'x+y+text' | 'x+y+name' | + 'x+y+z' | 'x+y+z+text' | 'x+y+z+name' | + 'y+x' | 'y+x+text' | 'y+x+name' | + 'y+z' | 'y+z+text' | 'y+z+name' | + 'y+x+z' | 'y+x+z+text' | 'y+x+z+name' | + 'z+x' | 'z+x+text' | 'z+x+name' | + 'z+y+x' | 'z+y+x+text' | 'z+y+x+name' | + 'z+x+y' | 'z+x+y+text' | 'z+x+y+name'; hoverlabel: Partial