Commit dc7bc33
authored
🎨 Improved y-axis scaling and country names in Analytics (#28708)
## Newsletter chart y-axis scaling
The **Avg. click rate** chart on Analytics → Newsletters used a
fixed-step rounding (nearest 0.1) for its y-axis, which snapped the
upper bound to 10% even when the click rate was a fraction of a percent
— making sub-1% bars effectively invisible.
This change brackets the y-axis to the actual data:
- `< 1%` → `0% – 1%`
- `1% – 10%` → `0%` to the next whole percent above the max
- `10% – 100%` → `0%` to the next multiple of 10 above the max
The avg reference line value is included in the bracket pick, so the
dashed avg line is always inside the visible range (previously it could
fall outside and be hidden).
Examples:
| Max value | Old upper | New upper |
|-----------|-----------|-----------|
| 0.4% | 10% | 1% |
| 3.2% | 10% | 4% |
| 9.2% | 10% | 10% |
| 28% | 30% | 30% |
| 36% | 40% | 40% |
## Country names in Web analytics
The Locations card used to render the official ISO country names from
`i18n-iso-countries` ("Russian Federation", "Taiwan, Province of China",
"Korea, Republic of"…), which read awkwardly. We now ask the library for
the short/common form via `getName(code, 'en', {select: 'alias'})` and
add a few manual overrides for countries where the library has no alias.
Net result:
- Russian Federation → Russia
- People's Republic of China → China
- Taiwan, Province of China → Taiwan
- Islamic Republic of Iran → Iran
- Korea, Republic of → South Korea
- United States of America → United States
- United Kingdom → UK
- Viet Nam → Vietnam
- Czech Republic → Czechia
- Lao People's Democratic Republic → Laos
- Moldova, Republic of → Moldova
- Syrian Arab Republic → Syria
- …plus a handful of similar tidy-ups
ref https://linear.app/tryghost/issue/NY-1365/1 parent cd4f5fd commit dc7bc33
7 files changed
Lines changed: 37 additions & 24 deletions
File tree
- apps
- posts/src
- utils
- views/PostAnalytics
- Web/components
- components
- stats/src
- utils
- views/Stats
- Locations/components
- Newsletters/components
- components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
Lines changed: 19 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
214 | 222 | | |
215 | 223 | | |
216 | 224 | | |
217 | 225 | | |
218 | 226 | | |
219 | | - | |
| 227 | + | |
220 | 228 | | |
221 | 229 | | |
222 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
0 commit comments