|
1 | | -""" pyplots.ai |
| 1 | +"""pyplots.ai |
2 | 2 | area-basic: Basic Area Chart |
3 | | -Library: highcharts unknown | Python 3.13.11 |
4 | | -Quality: 91/100 | Created: 2025-12-23 |
| 3 | +Library: highcharts 1.10.3 | Python 3.14.2 |
| 4 | +Quality: /100 | Updated: 2026-02-11 |
5 | 5 | """ |
6 | 6 |
|
7 | 7 | import tempfile |
|
43 | 43 |
|
44 | 44 | # Title |
45 | 45 | chart.options.title = { |
46 | | - "text": "area-basic · highcharts · pyplots.ai", |
| 46 | + "text": "area-basic \u00b7 highcharts \u00b7 pyplots.ai", |
47 | 47 | "style": {"fontSize": "72px", "fontWeight": "bold"}, |
48 | 48 | } |
49 | 49 |
|
|
55 | 55 | "gridLineColor": "rgba(0, 0, 0, 0.1)", |
56 | 56 | } |
57 | 57 |
|
58 | | -# Y-axis |
| 58 | +# Y-axis — set min close to data range to avoid wasted whitespace |
59 | 59 | chart.options.y_axis = { |
60 | | - "title": {"text": "Daily Visitors", "style": {"fontSize": "48px"}}, |
| 60 | + "title": {"text": "Daily Visitors (count)", "style": {"fontSize": "48px"}}, |
61 | 61 | "labels": {"style": {"fontSize": "36px"}}, |
62 | 62 | "gridLineWidth": 1, |
63 | 63 | "gridLineColor": "rgba(0, 0, 0, 0.1)", |
| 64 | + "min": 1000, |
64 | 65 | } |
65 | 66 |
|
66 | 67 | # Plot options with semi-transparent fill and gradient |
|
73 | 74 | "lineWidth": 4, |
74 | 75 | "marker": {"enabled": True, "radius": 8, "fillColor": "#306998"}, |
75 | 76 | "color": "#306998", |
| 77 | + "tooltip": {"headerFormat": "<b>Day {point.x}</b><br/>", "pointFormat": "Visitors: {point.y:,.0f}"}, |
76 | 78 | } |
77 | 79 | } |
78 | 80 |
|
|
130 | 132 | chrome_options.add_argument("--no-sandbox") |
131 | 133 | chrome_options.add_argument("--disable-dev-shm-usage") |
132 | 134 | chrome_options.add_argument("--disable-gpu") |
133 | | -chrome_options.add_argument("--window-size=5000,3000") |
| 135 | +chrome_options.add_argument("--window-size=4800,2700") |
134 | 136 |
|
135 | 137 | driver = webdriver.Chrome(options=chrome_options) |
136 | 138 | driver.get(f"file://{temp_path}") |
137 | 139 | time.sleep(5) # Wait for chart to render |
138 | 140 |
|
139 | | -# Screenshot the chart element specifically for exact 4800x2700 |
140 | | -container = driver.find_element("id", "container") |
141 | | -container.screenshot("plot.png") |
| 141 | +driver.save_screenshot("plot.png") |
142 | 142 | driver.quit() |
143 | 143 |
|
144 | 144 | Path(temp_path).unlink() # Clean up temp file |
0 commit comments