Skip to content

[puppeteer] Make height/width styles optional #419

@ivan-jelev

Description

@ivan-jelev

Hello,

We are trying to migrate from exporter 2.x to 3.x-beta + Highchart 11+ and facing couple of issues.
One of them is unwanted container height/width CSS which doesn't reflect runtime changes to chart width/height.

Use case: we have horizontal line chart with dynamic amount of horizontal columns/bars. Based on the amount of bars we are calculating the total height of the chart in the callback function.

Due to this css styles we are getting our chart cut (I assume scrolling appears on real page).

Plz consider to make this styles optional or maybe completely remove.

Note that it worked as expected in exporter v2.x
Plz let me know if you need more info.

Thanks.

let injCSS = false;
if (exportOptions.export.strInj) {
const injCSS = document.createElement('style');
injCSS.textContent = `
#chart-container {
height: ${chart.height}px;
max-width: ${chart.width}px;
}
#chart-container #container{
height: ${chart.height}px;
max-width: ${chart.width}px;
}
`;
document.head.appendChild(injCSS);
}
createChart(chartOptions, exportOptions);
// Remove the injected CSS
if (injCSS) {
document.head.removeChild(injCSS);
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions