Skip to content

Commit 6a2646a

Browse files
committed
Plotly v3 - Drop transforms from the API
plotly/plotly.js#7240, plotly/plotly.js#7254
1 parent 655e7ed commit 6a2646a

File tree

7 files changed

+6
-94
lines changed

7 files changed

+6
-94
lines changed

types/plotly.js/index.d.ts

+1-57
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,6 @@ export type Color =
13041304
| Array<string | number | undefined | null>
13051305
| Array<Array<string | number | undefined | null>>;
13061306
export type ColorScale = string | string[] | Array<[number, string]>;
1307-
export type DataTransform = Partial<Transform>;
13081307
export type ScatterData = PlotData;
13091308

13101309
export interface PlotData {
@@ -1468,7 +1467,6 @@ export interface PlotData {
14681467
delta: Partial<Delta>;
14691468
gauge: Partial<Gauge>;
14701469
number: Partial<PlotNumber>;
1471-
transforms: DataTransform[];
14721470
orientation: "v" | "h";
14731471
width: number | number[];
14741472
boxmean: boolean | "sd";
@@ -1537,48 +1535,6 @@ export interface PlotData {
15371535
uid: string;
15381536
}
15391537

1540-
/**
1541-
* These interfaces are based on attribute descriptions in
1542-
* https://github.com/plotly/plotly.js/tree/9d6144304308fc3007f0facf2535d38ea3e9b26c/src/transforms
1543-
*/
1544-
export interface TransformStyle {
1545-
target: number | string | number[] | string[];
1546-
value: Partial<PlotData>;
1547-
}
1548-
1549-
export interface TransformAggregation {
1550-
target: string;
1551-
func?:
1552-
| "count"
1553-
| "sum"
1554-
| "avg"
1555-
| "median"
1556-
| "mode"
1557-
| "rms"
1558-
| "stddev"
1559-
| "min"
1560-
| "max"
1561-
| "first"
1562-
| "last"
1563-
| undefined;
1564-
funcmode?: "sample" | "population" | undefined;
1565-
enabled?: boolean | undefined;
1566-
}
1567-
1568-
export interface Transform {
1569-
type: "aggregate" | "filter" | "groupby" | "sort";
1570-
enabled: boolean;
1571-
target: number | string | number[] | string[];
1572-
operation: string;
1573-
aggregations: TransformAggregation[];
1574-
preservegaps: boolean;
1575-
groups: string | number[] | string[];
1576-
nameformat: string;
1577-
styles: TransformStyle[];
1578-
value: any;
1579-
order: "ascending" | "descending";
1580-
}
1581-
15821538
export interface ColorBarTitle {
15831539
text: string;
15841540
font: Partial<Font>;
@@ -1874,9 +1830,6 @@ export interface Config {
18741830
*/
18751831
logging: boolean | 0 | 1 | 2;
18761832

1877-
/** Set global transform to be applied to all traces with no specification needed */
1878-
globalTransforms: any[];
1879-
18801833
/** Which localization should we use? Should be a string like 'en' or 'en-US' */
18811834
locale: string;
18821835

@@ -2740,15 +2693,6 @@ interface LocaleModule {
27402693
format: Record<string, unknown>;
27412694
}
27422695

2743-
interface TransformModule {
2744-
moduleType: "transform";
2745-
name: string;
2746-
transform: any;
2747-
calcTransform: any;
2748-
attributes: Record<string, unknown>;
2749-
supplyDefaults: any;
2750-
}
2751-
27522696
interface ComponentModule {
27532697
moduleType: "component";
27542698
name: string;
@@ -2760,4 +2704,4 @@ interface ApiMethodModule {
27602704
fn: any;
27612705
}
27622706

2763-
type PlotlyModule = TraceModule | LocaleModule | TransformModule | ComponentModule | ApiMethodModule;
2707+
type PlotlyModule = TraceModule | LocaleModule | ComponentModule | ApiMethodModule;

types/plotly.js/lib/aggregate.d.ts

-6
This file was deleted.

types/plotly.js/lib/filter.d.ts

-6
This file was deleted.

types/plotly.js/lib/groupby.d.ts

-6
This file was deleted.

types/plotly.js/lib/sort.d.ts

-6
This file was deleted.

types/plotly.js/test/index-tests.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const graphDiv = "#test";
104104
},
105105
],
106106
width: 2,
107-
} as PlotData;
107+
} as Partial<PlotData>;
108108
const trace2 = {
109109
yaxis: "y2",
110110
x: unpack(testrows, "lifeExp"),
@@ -115,7 +115,7 @@ const graphDiv = "#test";
115115
xhoverformat: ",.0f",
116116
yhoverformat: ",.",
117117
zhoverformat: ",.",
118-
} as PlotData;
118+
} as Partial<PlotData>;
119119
const trace3 = {
120120
xaxis: "x2",
121121
y: unpack(testrows, "gdpPercap"),
@@ -125,7 +125,7 @@ const graphDiv = "#test";
125125
xhoverformat: ",.0f",
126126
yhoverformat: ",.",
127127
zhoverformat: ",.",
128-
} as PlotData;
128+
} as Partial<PlotData>;
129129
const data = [trace1, trace2, trace3];
130130
const layout = {
131131
title: {
@@ -158,7 +158,7 @@ const graphDiv = "#test";
158158
showgrid: false,
159159
zeroline: false,
160160
},
161-
};
161+
} as Partial<Layout>;
162162
Plotly.newPlot(graphDiv, data, layout);
163163
})();
164164
(() => {
@@ -169,7 +169,7 @@ const graphDiv = "#test";
169169
x: [1999, 2000, 2001, 2002],
170170
y: [10, 9, 8, 7],
171171
type: "scatter",
172-
} as PlotData,
172+
} as Partial<PlotData>,
173173
];
174174
const layout2 = { title: { text: "Revenue" } };
175175
Plotly.newPlot(graphDiv, data2, layout2);

types/plotly.js/test/register-tests.ts

-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import aggregate from "plotly.js/lib/aggregate";
21
import bar from "plotly.js/lib/bar";
32
import barpolar from "plotly.js/lib/barpolar";
43
import box from "plotly.js/lib/box";
@@ -12,10 +11,8 @@ import contour from "plotly.js/lib/contour";
1211
import contourcarpet from "plotly.js/lib/contourcarpet";
1312
import Plotly from "plotly.js/lib/core";
1413
import densitymapbox from "plotly.js/lib/densitymapbox";
15-
import filter from "plotly.js/lib/filter";
1614
import funnel from "plotly.js/lib/funnel";
1715
import funnelarea from "plotly.js/lib/funnelarea";
18-
import groupby from "plotly.js/lib/groupby";
1916
import heatmap from "plotly.js/lib/heatmap";
2017
import histogram from "plotly.js/lib/histogram";
2118
import histogram2d from "plotly.js/lib/histogram2d";
@@ -40,7 +37,6 @@ import scatterpolar from "plotly.js/lib/scatterpolar";
4037
import scatterpolargl from "plotly.js/lib/scatterpolargl";
4138
import scattersmith from "plotly.js/lib/scattersmith";
4239
import scatterternary from "plotly.js/lib/scatterternary";
43-
import sort from "plotly.js/lib/sort";
4440
import splom from "plotly.js/lib/splom";
4541
import streamtube from "plotly.js/lib/streamtube";
4642
import sunburst from "plotly.js/lib/sunburst";
@@ -52,7 +48,6 @@ import volume from "plotly.js/lib/volume";
5248
import waterfall from "plotly.js/lib/waterfall";
5349

5450
Plotly.register([
55-
aggregate,
5651
bar,
5752
barpolar,
5853
box,
@@ -65,10 +60,8 @@ Plotly.register([
6560
contour,
6661
contourcarpet,
6762
densitymapbox,
68-
filter,
6963
funnel,
7064
funnelarea,
71-
groupby,
7265
heatmap,
7366
histogram,
7467
histogram2d,
@@ -93,7 +86,6 @@ Plotly.register([
9386
scatterpolargl,
9487
scattersmith,
9588
scatterternary,
96-
sort,
9789
splom,
9890
streamtube,
9991
sunburst,

0 commit comments

Comments
 (0)