Skip to content

Commit fea4d47

Browse files
update(bubble-packed): highcharts — comprehensive quality review
Comprehensive review improving code quality, data choice, visual design, spec compliance, and library feature usage.
1 parent 7e47de1 commit fea4d47

2 files changed

Lines changed: 31 additions & 35 deletions

File tree

plots/bubble-packed/implementations/highcharts.py

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
""" pyplots.ai
1+
"""pyplots.ai
22
bubble-packed: Basic Packed Bubble Chart
3-
Library: highcharts unknown | Python 3.13.11
4-
Quality: 90/100 | Created: 2025-12-23
3+
Library: highcharts 1.10.3 | Python 3.14.3
4+
Quality: /100 | Updated: 2026-02-23
55
"""
66

77
import tempfile
@@ -17,9 +17,7 @@
1717

1818

1919
# Data - Company market share by sector
20-
# Packed bubbles group by sector with size representing market value
2120
data = [
22-
# Technology sector
2321
{
2422
"name": "Technology",
2523
"data": [
@@ -30,7 +28,6 @@
3028
{"name": "Cybersecurity", "value": 280},
3129
],
3230
},
33-
# Finance sector
3431
{
3532
"name": "Finance",
3633
"data": [
@@ -40,7 +37,6 @@
4037
{"name": "Fintech", "value": 260},
4138
],
4239
},
43-
# Healthcare sector
4440
{
4541
"name": "Healthcare",
4642
"data": [
@@ -50,7 +46,6 @@
5046
{"name": "Healthcare Services", "value": 240},
5147
],
5248
},
53-
# Energy sector
5449
{
5550
"name": "Energy",
5651
"data": [
@@ -59,7 +54,6 @@
5954
{"name": "Utilities", "value": 290},
6055
],
6156
},
62-
# Consumer sector
6357
{
6458
"name": "Consumer",
6559
"data": [
@@ -72,23 +66,29 @@
7266
]
7367

7468
# Colorblind-safe palette for sectors
75-
colors = ["#306998", "#FFD43B", "#9467BD", "#17BECF", "#8C564B"]
69+
colors = ["#306998", "#E5A02E", "#9467BD", "#17BECF", "#8C564B"]
7670

7771
# Create chart
7872
chart = Chart(container="container")
7973
chart.options = HighchartsOptions()
8074

8175
# Chart configuration
82-
chart.options.chart = {"type": "packedbubble", "width": 4800, "height": 2700, "backgroundColor": "#ffffff"}
76+
chart.options.chart = {
77+
"type": "packedbubble",
78+
"width": 4800,
79+
"height": 2700,
80+
"backgroundColor": "#ffffff",
81+
"margin": [100, 50, 100, 50],
82+
}
8383

8484
# Title
8585
chart.options.title = {
86-
"text": "bubble-packed · Market Sectors · highcharts · pyplots.ai",
86+
"text": "bubble-packed \u00b7 highcharts \u00b7 pyplots.ai",
8787
"style": {"fontSize": "64px", "fontWeight": "bold"},
8888
}
8989

9090
# Subtitle
91-
chart.options.subtitle = {"text": "Circle size represents market value ($B)", "style": {"fontSize": "36px"}}
91+
chart.options.subtitle = {"text": "Market value by sector ($B)", "style": {"fontSize": "36px", "color": "#666666"}}
9292

9393
# Tooltip
9494
chart.options.tooltip = {
@@ -103,12 +103,12 @@
103103
# Plot options for packed bubble
104104
chart.options.plot_options = {
105105
"packedbubble": {
106-
"minSize": "60%",
107-
"maxSize": "180%",
106+
"minSize": "80%",
107+
"maxSize": "250%",
108108
"zMin": 0,
109109
"zMax": 1000,
110110
"layoutAlgorithm": {
111-
"gravitationalConstant": 0.02,
111+
"gravitationalConstant": 0.05,
112112
"splitSeries": False,
113113
"seriesInteraction": True,
114114
"dragBetweenSeries": False,
@@ -117,7 +117,7 @@
117117
"dataLabels": {
118118
"enabled": True,
119119
"format": "{point.name}",
120-
"filter": {"property": "y", "operator": ">", "value": 230},
120+
"filter": {"property": "y", "operator": ">", "value": 260},
121121
"style": {"fontSize": "28px", "fontWeight": "bold", "color": "white", "textOutline": "2px contrast"},
122122
},
123123
}
@@ -126,19 +126,15 @@
126126
# Add series with colors
127127
series_list = []
128128
for i, sector in enumerate(data):
129-
series_config = {
130-
"type": "packedbubble",
131-
"name": sector["name"],
132-
"data": sector["data"],
133-
"color": colors[i % len(colors)],
134-
}
135-
series_list.append(series_config)
129+
series_list.append(
130+
{"type": "packedbubble", "name": sector["name"], "data": sector["data"], "color": colors[i % len(colors)]}
131+
)
136132

137133
chart.options.series = series_list
138134

139135
# Download Highcharts JS and highcharts-more.js for packed bubble support
140-
highcharts_url = "https://code.highcharts.com/highcharts.js"
141-
highcharts_more_url = "https://code.highcharts.com/highcharts-more.js"
136+
highcharts_url = "https://cdn.jsdelivr.net/npm/highcharts/highcharts.js"
137+
highcharts_more_url = "https://cdn.jsdelivr.net/npm/highcharts/highcharts-more.js"
142138

143139
with urllib.request.urlopen(highcharts_url, timeout=30) as response:
144140
highcharts_js = response.read().decode("utf-8")
@@ -167,8 +163,8 @@
167163
<html>
168164
<head>
169165
<meta charset="utf-8">
170-
<script src="https://code.highcharts.com/highcharts.js"></script>
171-
<script src="https://code.highcharts.com/highcharts-more.js"></script>
166+
<script src="https://cdn.jsdelivr.net/npm/highcharts/highcharts.js"></script>
167+
<script src="https://cdn.jsdelivr.net/npm/highcharts/highcharts-more.js"></script>
172168
</head>
173169
<body style="margin:0;">
174170
<div id="container" style="width: 100%; height: 100vh;"></div>
@@ -191,7 +187,7 @@
191187

192188
driver = webdriver.Chrome(options=chrome_options)
193189
driver.get(f"file://{temp_path}")
194-
time.sleep(5) # Wait for chart to render
190+
time.sleep(5)
195191
driver.save_screenshot("plot_raw.png")
196192
driver.quit()
197193

@@ -201,4 +197,4 @@
201197
img_cropped.save("plot.png")
202198
Path("plot_raw.png").unlink()
203199

204-
Path(temp_path).unlink() # Clean up temp file
200+
Path(temp_path).unlink()

plots/bubble-packed/metadata/highcharts.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
library: highcharts
22
specification_id: bubble-packed
33
created: '2025-12-23T09:16:17Z'
4-
updated: '2025-12-23T09:25:45Z'
5-
generated_by: claude-opus-4-5-20251101
4+
updated: 2026-02-23T15:35:00+00:00
5+
generated_by: claude-opus-4-6
66
workflow_run: 20456562080
77
issue: 0
8-
python_version: 3.13.11
9-
library_version: unknown
8+
python_version: "3.14.3"
9+
library_version: "1.10.3"
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/bubble-packed/highcharts/plot.png
1111
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/bubble-packed/highcharts/plot_thumb.png
1212
preview_html: https://storage.googleapis.com/pyplots-images/plots/bubble-packed/highcharts/plot.html
13-
quality_score: 90
13+
quality_score: null
1414
impl_tags:
1515
dependencies:
1616
- pillow

0 commit comments

Comments
 (0)