Skip to content

Commit dc7f46b

Browse files
authored
Figure generation workaround (#3818)
1 parent c1abfd9 commit dc7f46b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/tools/generate/generate_figure_images.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const take_single_screenshot = async (graphUrl, filename) => {
77

88
const sheets_chart = graphUrl.startsWith('https://docs.google.com/spreadsheets') ? true : false;
99

10-
const chartUrl = sheets_chart ? graphUrl : 'http://localhost:8080/' + graphUrl;
10+
// Temporarily replace `&format=interactive` with `&format=image`
11+
const chartUrl = sheets_chart ? graphUrl.replaceAll('&format=interactive', '&format=image') : 'http://localhost:8080/' + graphUrl;
1112
const browser = await puppeteer.launch();
1213
const page = await browser.newPage();
1314
await page.setViewport({
@@ -18,7 +19,11 @@ const take_single_screenshot = async (graphUrl, filename) => {
1819
await page.goto(chartUrl, {
1920
waitUntil: 'networkidle2',
2021
});
21-
const el = sheets_chart ? await page.$('#embed_chart') : await page.$('main');
22+
23+
24+
// Temporarily handle `&format=image` instead of `&format=interactive`
25+
// const el = sheets_chart ? await page.$('#embed_chart') : await page.$('main');
26+
const el = sheets_chart ? await page.$('img') : await page.$('main');
2227
await el.screenshot({ path: filename });
2328
await browser.close();
2429
}

0 commit comments

Comments
 (0)