Skip to content

Commit 8dccf50

Browse files
fix(highcharts): improve area-basic screenshot rendering
- Add explicit labels enabled for x-axis - Add tickmarkPlacement for better axis rendering - Use container element screenshot instead of full page - Adjust window size for proper rendering
1 parent e6de0dd commit 8dccf50

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

plots/highcharts/area/area-basic/default.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@
3838
chart.options.x_axis = {
3939
"title": {"text": "Month", "style": {"fontSize": "40px"}},
4040
"categories": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
41-
"labels": {"style": {"fontSize": "32px"}},
41+
"labels": {"style": {"fontSize": "32px"}, "enabled": True},
4242
"gridLineWidth": 1,
4343
"gridLineColor": "rgba(0, 0, 0, 0.1)",
44+
"tickmarkPlacement": "on",
4445
}
4546

4647
chart.options.y_axis = {
@@ -93,12 +94,16 @@
9394
chrome_options.add_argument("--no-sandbox")
9495
chrome_options.add_argument("--disable-dev-shm-usage")
9596
chrome_options.add_argument("--disable-gpu")
96-
chrome_options.add_argument("--window-size=4800,2700")
97+
chrome_options.add_argument("--window-size=4800,2800")
9798

9899
driver = webdriver.Chrome(options=chrome_options)
100+
driver.set_window_size(4800, 2800)
99101
driver.get(f"file://{temp_path}")
100102
time.sleep(5)
101-
driver.save_screenshot("plot.png")
103+
104+
# Get the container element and screenshot it directly
105+
container = driver.find_element("id", "container")
106+
container.screenshot("plot.png")
102107
driver.quit()
103108

104109
Path(temp_path).unlink()

0 commit comments

Comments
 (0)