Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert image workarounds #3821

Merged
merged 2 commits into from
Oct 29, 2024
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
5 changes: 0 additions & 5 deletions src/static/js/almanac.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,6 @@ function googleSheetsPixelNotLoaded() {
//We use Google Sheets for detailed visualisations
//Check for support and switch out images if supported
function upgradeInteractiveFigures() {

// Temporarily disable charts since embedding is currently broken in Sheets
// See: https://github.com/HTTPArchive/almanac.httparchive.org/issues/3803
return;

try {
if (!isInPrintMode() && bigEnoughForInteractiveFigures() && !dataSaverEnabled() && highBandwidthConnection() && highResolutionCanvasSupported()) {

Expand Down
8 changes: 3 additions & 5 deletions src/tools/generate/generate_figure_images.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const take_single_screenshot = async (graphUrl, filename) => {

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

// Temporarily replace `&format=interactive` with `&format=image`
const chartUrl = sheets_chart ? graphUrl.replaceAll('&format=interactive', '&format=image') : 'http://localhost:8080/' + graphUrl;
const chartUrl = sheets_chart ? graphUrl : 'http://localhost:8080/' + graphUrl;
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({
Expand All @@ -21,9 +20,8 @@ const take_single_screenshot = async (graphUrl, filename) => {
});


// Temporarily handle `&format=image` instead of `&format=interactive`
// const el = sheets_chart ? await page.$('#embed_chart') : await page.$('main');
const el = sheets_chart ? await page.$('img') : await page.$('main');
// Charts are in #embed_chart, maps are in #c div div
const el = sheets_chart ? await page.$('#embed_chart, #c div div') : await page.$('main');
await el.screenshot({ path: filename });
await browser.close();
}
Expand Down
Loading