Skip to content

Commit a6b2b34

Browse files
committed
Plotly v3 - Drop transforms from the API
plotly/plotly.js#7240, plotly/plotly.js#7254
1 parent 3b0094f commit a6b2b34

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
@@ -1305,7 +1305,6 @@ export type Color =
13051305
| Array<string | number | undefined | null>
13061306
| Array<Array<string | number | undefined | null>>;
13071307
export type ColorScale = string | string[] | Array<[number, string]>;
1308-
export type DataTransform = Partial<Transform>;
13091308
export type ScatterData = PlotData;
13101309

13111310
export interface PlotData {
@@ -1469,7 +1468,6 @@ export interface PlotData {
14691468
delta: Partial<Delta>;
14701469
gauge: Partial<Gauge>;
14711470
number: Partial<PlotNumber>;
1472-
transforms: DataTransform[];
14731471
orientation: "v" | "h";
14741472
width: number | number[];
14751473
boxmean: boolean | "sd";
@@ -1538,48 +1536,6 @@ export interface PlotData {
15381536
uid: string;
15391537
}
15401538

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

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

@@ -2741,15 +2694,6 @@ interface LocaleModule {
27412694
format: Record<string, unknown>;
27422695
}
27432696

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

2764-
type PlotlyModule = TraceModule | LocaleModule | TransformModule | ComponentModule | ApiMethodModule;
2708+
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)