Skip to content

Commit b8be795

Browse files
fix(highcharts): address review feedback for line-retention-cohort
Attempt 1/3 - fixes based on AI review
1 parent c05b5f0 commit b8be795

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

plots/line-retention-cohort/implementations/highcharts.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" pyplots.ai
1+
"""pyplots.ai
22
line-retention-cohort: User Retention Curve by Cohort
33
Library: highcharts unknown | Python 3.14.3
44
Quality: 82/100 | Created: 2026-03-16
@@ -78,8 +78,9 @@
7878
"labels": {"style": {"fontSize": "28px"}, "format": "{value}%"},
7979
"min": 0,
8080
"max": 100,
81+
"tickInterval": 20,
8182
"gridLineWidth": 1,
82-
"gridLineColor": "rgba(0, 0, 0, 0.12)",
83+
"gridLineColor": "rgba(0, 0, 0, 0.08)",
8384
"plotLines": [
8485
{
8586
"value": 20,
@@ -109,13 +110,26 @@
109110
"x": -30,
110111
}
111112

113+
# Tooltip - distinctive Highcharts feature
114+
chart.options.tooltip = {
115+
"shared": True,
116+
"valueSuffix": "%",
117+
"headerFormat": '<span style="font-size:24px;font-weight:bold">{point.key}</span><br/>',
118+
"pointFormat": '<span style="color:{series.color}">\u25cf</span> {series.name}: <b>{point.y}%</b><br/>',
119+
"style": {"fontSize": "20px"},
120+
}
121+
112122
# Plot options
113123
chart.options.plot_options = {
114-
"line": {"lineWidth": 5, "marker": {"enabled": True, "radius": 9, "lineWidth": 2, "lineColor": "#ffffff"}}
124+
"line": {
125+
"lineWidth": 5,
126+
"marker": {"enabled": True, "radius": 9, "lineWidth": 2, "lineColor": "#ffffff"},
127+
"animation": False,
128+
}
115129
}
116130

117-
# Colors - cohesive palette starting with Python Blue, older cohorts lighter
118-
colors = ["#a3c4d9", "#7baac4", "#5290ae", "#306998", "#1a4d6e"]
131+
# Colors - distinct, colorblind-safe palette starting with Python Blue
132+
colors = ["#306998", "#e07b39", "#2ca02c", "#d62728", "#8c564b"]
119133

120134
# Add series - older cohorts first (thinner), newest last (thickest)
121135
for i, (cohort, rates) in enumerate(retention_data.items()):
@@ -125,6 +139,9 @@
125139
series.color = colors[i]
126140
series.line_width = 3 + i
127141
series.marker = {"radius": 5 + i}
142+
# Zones: dash line below 20% retention target (distinctive Highcharts feature)
143+
series.zone_axis = "y"
144+
series.zones = [{"value": 20, "dashStyle": "Dot"}, {"dashStyle": "Solid"}]
128145
chart.add_series(series)
129146

130147
# Export

0 commit comments

Comments
 (0)