@@ -19,8 +19,8 @@ import type { Icon, Template } from './layout';
1919export type Root = string | HTMLElement ;
2020
2121/**
22- * Figure-shaped object accepted by `toImage`/`downloadImage` when called
23- * without an attached graph div.
22+ * Figure-shaped object accepted by `newPlot` (in the `data` position) and
23+ * by `toImage`/`downloadImage` when called without an attached graph div.
2424 */
2525export interface PlotlyDataLayoutConfig {
2626 /** Trace data array. */
@@ -29,6 +29,8 @@ export interface PlotlyDataLayoutConfig {
2929 layout ?: Partial < Layout > ;
3030 /** Optional config overrides. */
3131 config ?: Partial < Config > ;
32+ /** Optional animation frames. */
33+ frames ?: Frame [ ] ;
3234}
3335
3436/** Either a regular root target or a figure-shaped object. */
@@ -46,34 +48,34 @@ export interface StaticPlots {
4648
4749/** Names of icons bundled with Plotly's mode-bar. */
4850export type DefaultIcons =
49- | 'undo'
50- | 'home'
51- | 'camera-retro'
52- | 'zoombox'
53- | 'pan'
54- | 'zoom_plus'
55- | 'zoom_minus'
56- | 'autoscale'
57- | 'tooltip_basic'
58- | 'tooltip_compare'
59- | 'plotlylogo'
60- | 'z-axis'
6151 | '3d_rotate'
52+ | 'autoscale'
53+ | 'camera-retro'
6254 | 'camera'
63- | 'movie'
64- | 'question'
6555 | 'disk'
66- | 'drawopenpath '
56+ | 'drawcircle '
6757 | 'drawclosedpath'
68- | 'lasso'
69- | 'selectbox'
7058 | 'drawline'
59+ | 'drawopenpath'
7160 | 'drawrect'
72- | 'drawcircle'
7361 | 'eraseshape'
74- | 'spikeline'
62+ | 'home'
63+ | 'lasso'
64+ | 'movie'
65+ | 'newplotlylogo'
66+ | 'pan'
7567 | 'pencil'
76- | 'newplotlylogo' ;
68+ | 'plotlylogo'
69+ | 'question'
70+ | 'selectbox'
71+ | 'spikeline'
72+ | 'tooltip_basic'
73+ | 'tooltip_compare'
74+ | 'undo'
75+ | 'z-axis'
76+ | 'zoom_minus'
77+ | 'zoom_plus'
78+ | 'zoombox' ;
7779
7880/** Map of built-in icon name → `Icon` definition. */
7981export type IconsMap = { [ K in DefaultIcons ] : Icon } ;
@@ -194,6 +196,18 @@ export function newPlot(
194196 layout ?: Partial < Layout > ,
195197 config ?: Partial < Config >
196198) : Promise < PlotlyHTMLElement > ;
199+ /**
200+ * Create a new plot at `root` from a figure-shaped object containing
201+ * `data`/`layout`/`config`/`frames`. Replaces any existing plot.
202+ *
203+ * @param root - graph div id or element
204+ * @param figure - figure-shaped object
205+ * @returns the graph div once the plot has rendered
206+ */
207+ export function newPlot (
208+ root : Root ,
209+ figure : PlotlyDataLayoutConfig
210+ ) : Promise < PlotlyHTMLElement > ;
197211
198212/** Update layout properties on an existing plot. */
199213export function relayout ( root : Root , layout : Partial < Layout > ) : Promise < PlotlyHTMLElement > ;
0 commit comments