Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/src/figure/FigureEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the GNU Affero General Public License version 3 (AGPLv3).
import { useEffect, useLayoutEffect, useRef, useState } from 'react'
import Plotly from 'plotly.js-dist-min'
import type { Data as PlotlyData } from 'plotly.js'
import { api } from '../api/client'
import { errorMessage } from '../api/errorMessage'
import type { AnnotationSource, ComparisonRunSpec } from '../api/types'
Expand Down Expand Up @@ -89,7 +90,7 @@ function PanePlot({ study, pane, doc, showLegend, w, h, version, onEntries }: {
if (cancelled) return
const fig = paneFigure(raw, pane, doc, { showLegend, widthPx: w, heightPx: h })
onEntries(legendEntries(fig))
return Plotly.react(el, fig.data as Plotly.Data[], fig.layout, { staticPlot: true, displayModeBar: false })
return Plotly.react(el, fig.data as PlotlyData[], fig.layout, { staticPlot: true, displayModeBar: false })
})
.catch(e => { if (!cancelled) setError(errorMessage(e)) })
.finally(() => { if (!cancelled) setLoading(false) })
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/figure/export.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// © 2026 Joshua Benjamin Jewell. All rights reserved.
// Licensed under the GNU Affero General Public License version 3 (AGPLv3).
import Plotly from 'plotly.js-dist-min'
import type { Data as PlotlyData, Layout as PlotlyLayout } from 'plotly.js'
import { PX_PER_MM, PX_PER_PT, MM_PER_IN, figureGeometry, titlePt, type FigureDoc } from './types'
import { layoutLegend, legendEntries, mergeEntries } from './legend'
import type { PlotSpec } from './charts'
Expand All @@ -11,7 +12,7 @@ const SVG_NS = 'http://www.w3.org/2000/svg'
/** Plotly's SVG of one pane. */
async function paneSvg(fig: PlotSpec): Promise<SVGSVGElement> {
const w = fig.layout.width as number, h = fig.layout.height as number
const url = await Plotly.toImage({ data: fig.data as Plotly.Data[], layout: fig.layout as Partial<Plotly.Layout> },
const url = await Plotly.toImage({ data: fig.data as PlotlyData[], layout: fig.layout as Partial<PlotlyLayout> },
{ format: 'svg', width: w, height: h })
const text = decodeURIComponent(url.slice(url.indexOf(',') + 1))
return new DOMParser().parseFromString(text, 'image/svg+xml').documentElement as unknown as SVGSVGElement
Expand Down
Loading