-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
218 lines (195 loc) · 11.5 KB
/
index.html
File metadata and controls
218 lines (195 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Coffee Value Chain — Global Dashboard</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div id="topbar">
<h1><span style="color:#FFFFFF">B</span><span style="color:#F0E4CC">e</span><span
style="color:#D9C090">a</span><span style="color:#C4A870">n</span><span style="color:#D9C090">M</span><span
style="color:#F0E4CC">a</span><span style="color:#FFFFFF">p</span></h1>
<span style="font-size:10px;color:rgba(245,236,215,1);letter-spacing:.06em;font-weight:600;">YEAR</span>
<span class="year-badge" id="topbar-year">2023</span>
<button id="topbar-play" title="Play timeline">▶</button>
</div>
<div id="main-row">
<div id="map-container">
<div id="map-loading">Loading map data…</div>
<div id="arc-legend">
<div class="arc-legend-row"><span class="alg-sw" style="background:#5C3317;color:#5C3317"></span>Export raw →
</div>
<div class="arc-legend-row"><span class="alg-sw" style="background:#A0522D;color:#A0522D"></span>Export proc. →
</div>
<div class="arc-legend-row"><span class="alg-sw" style="background:#B8935A;color:#B8935A"></span>← Import raw
</div>
<div class="arc-legend-row"><span class="alg-sw" style="background:#E8C878;color:#E8C878"></span>← Import proc.
</div>
</div>
<div id="ti-legend"
style="position:absolute;bottom:8px;right:8px;background:rgba(42,28,14,0.82);border-radius:4px;padding:6px 9px;pointer-events:none;z-index:3;">
<div
style="font-size:8px;font-weight:600;color:#C8A96E;letter-spacing:.06em;text-transform:uppercase;margin-bottom:4px;">
Transformation Index</div>
<div style="font-size:7px;color:rgba(245,236,215,0.55);margin-bottom:5px;font-style:italic;">Color & Height =
Net Transformation Volume</div>
<div
style="display:flex;height:7px;border-radius:2px;overflow:hidden;width:110px;margin-bottom:3px;background:linear-gradient(to right, #A8A8A8, #6B4226);">
</div>
<div style="display:flex;justify-content:space-between;width:110px;margin-bottom:5px;">
<span style="font-size:6.5px;color:rgba(200,169,110,0.7);">Low TI</span>
<span style="font-size:6.5px;color:rgba(200,169,110,0.7);">High TI</span>
</div>
<div style="font-size:7px;color:rgba(245,236,215,0.38);font-style:italic;line-height:1.5;">Hover for TI net
quantity · Click to select<br>Drag to rotate · scroll to zoom</div>
</div>
</div>
<div id="side-panel">
<div class="sp-section" style="flex-shrink:0;">
<div>
<span id="sp-country-name">Brazil</span>
<span class="sp-rank" id="sp-rank">#1 Producer</span>
</div>
<div class="stat-pills">
<div class="stat-pill"><span class="sv" id="sp-ti">—</span><span class="sl">Transform.<br>Index</span></div>
<div class="stat-pill"><span class="sv" id="sp-top-export">—</span><span class="sl" id="sp-top-export-lbl">Top
export<br>partner</span></div>
<div class="stat-pill"><span class="sv" id="sp-vol">—</span><span class="sl" id="sp-vol-lbl">Total
export<br>volume</span></div>
<div class="stat-pill"><span class="sv" id="sp-imp-vol">—</span><span class="sl" id="sp-imp-vol-lbl">Total
import<br>volume</span></div>
</div>
<div class="w-annot"
style="position:static;background:none;border:none;padding:2px 0 0;font-size:8px;color:rgba(74,44,23,0.5);max-width:none;">
Stat pills update on country select</div>
</div>
<div class="sp-section" style="flex-shrink:0;">
<div class="sp-title">Raw vs. processed export value · USD/tonne</div>
<div id="sp-bar-chart-rows"></div>
</div>
<button id="flow-mode-btn"
style="position:absolute;top:10px;right:10px;z-index:10;font-size:8px;padding:2px 8px;border-radius:8px;border:1px solid var(--tan);background:var(--espresso);color:var(--cream);cursor:pointer;letter-spacing:.04em;">Show
Value</button>
<div class="sp-section" style="flex:1;overflow-y:auto;min-height:0;">
<div style="margin-bottom:4px;">
<div class="sp-title" style="margin-bottom:0" id="sp-export-title">Top export flows</div>
</div>
<div id="sp-flows-export">
<div style="font-size:9px;color:var(--coffee);padding:4px 0;">Click a country to see flows.</div>
</div>
</div>
<div class="sp-section" style="flex:1;overflow-y:auto;min-height:0;">
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:4px;">
<div class="sp-title" style="margin-bottom:0" id="sp-import-title">Top import flows</div>
<div id="sp-import-summary"
style="font-size:8px;font-weight:600;color:var(--espresso);background:var(--sand);border-radius:6px;padding:2px 7px;flex-shrink:0;">
</div>
</div>
<div id="sp-flows-import"></div>
</div>
<div id="sp-concentration" style="flex-shrink:0;padding:5px 12px 6px;border-top:1px solid var(--border);"></div>
</div>
</div>
<div id="tick-row">
<div style="width:44px;flex-shrink:0;"></div>
<div class="tick-labels-inner">
<span>1986</span><span>1990</span><span>1995</span><span>2000</span>
<span>2005</span><span>2010</span><span>2015</span><span>2020</span><span>2024</span>
</div>
<div style="width:42px;flex-shrink:0;"></div>
</div>
<div id="slider-row">
<button id="slider-play" title="Play / pause">▶</button>
<input type="range" id="year-slider" min="1986" max="2024" value="2023">
<span id="year-display">2023</span>
</div>
<div id="bottom-row">
<!-- Widget 4: Global Value Timeline -->
<div class="bot-panel" id="timeline-panel">
<div class="bot-title" style="letter-spacing:0.07em;">PRICE PER TONNE OVER TIME · USD</div>
<div style="font-size:8px;color:rgba(74,44,23,0.45);font-style:italic;margin:-3px 0 4px;flex-shrink:0;">Export raw
· Export proc. · Import raw · Import proc.</div>
<svg id="timeline-svg" viewBox="0 0 340 105" preserveAspectRatio="none"
style="flex:1;min-height:0;display:block;width:100%;">
<!-- D3 Areas -->
<path id="timeline-raw-area" fill="rgba(92,51,23,0.13)" />
<path id="timeline-proc-area" fill="rgba(160,82,45,0.10)" />
<path id="timeline-impraw-area" fill="rgba(184,147,90,0.07)" />
<path id="timeline-impproc-area" fill="rgba(232,200,120,0.05)" />
<!-- Static Grid Lines -->
<line x1="32" y1="80.7" x2="230" y2="80.7" stroke="rgba(92,56,28,0.12)" stroke-width=".5"
stroke-dasharray="3 4" />
<line x1="32" y1="66.1" x2="230" y2="66.1" stroke="rgba(92,56,28,0.12)" stroke-width=".5"
stroke-dasharray="3 4" />
<line x1="32" y1="51.5" x2="230" y2="51.5" stroke="rgba(92,56,28,0.12)" stroke-width=".5"
stroke-dasharray="3 4" />
<line x1="32" y1="36.9" x2="230" y2="36.9" stroke="rgba(92,56,28,0.12)" stroke-width=".5"
stroke-dasharray="3 4" />
<line x1="32" y1="8" x2="32" y2="88" stroke="rgba(92,56,28,0.35)" stroke-width=".8" />
<line x1="32" y1="88" x2="230" y2="88" stroke="rgba(92,56,28,0.35)" stroke-width=".8" />
<!-- Static Text -->
<text x="29" y="83" fill="#7A5030" font-size="7" text-anchor="end">$500</text>
<text x="29" y="68.5" fill="#7A5030" font-size="7" text-anchor="end">$1,500</text>
<text x="29" y="54" fill="#7A5030" font-size="7" text-anchor="end">$2,500</text>
<text x="29" y="39.4" fill="#7A5030" font-size="7" text-anchor="end">$3,500</text>
<text x="32" y="97" fill="#7A5030" font-size="7" text-anchor="middle">1986</text>
<text x="79" y="97" fill="#7A5030" font-size="7" text-anchor="middle">1995</text>
<text x="131" y="97" fill="#7A5030" font-size="7" text-anchor="middle">2005</text>
<text x="183" y="97" fill="#7A5030" font-size="7" text-anchor="middle">2015</text>
<text x="230" y="97" fill="#7A5030" font-size="7" text-anchor="middle">2024</text>
<!-- D3 Lines -->
<path id="timeline-raw" fill="none" stroke="#5C3317" stroke-width="1.6" stroke-linecap="round"
stroke-linejoin="round" />
<path id="timeline-proc" fill="none" stroke="#A0522D" stroke-width="1.6" stroke-linecap="round"
stroke-linejoin="round" />
<path id="timeline-impraw" fill="none" stroke="#B8935A" stroke-width="1.3" stroke-linecap="round"
stroke-linejoin="round" stroke-dasharray="3 2" />
<path id="timeline-impproc" fill="none" stroke="#E8C878" stroke-width="1.3" stroke-linecap="round"
stroke-linejoin="round" stroke-dasharray="3 2" />
<!-- D3 Dots -->
<g id="timeline-dots"></g>
<g id="timeline-dots-expproc"></g>
<g id="timeline-dots-impraw"></g>
<g id="timeline-dots-impproc"></g>
<text id="timeline-raw-label" x="234" y="44" fill="#5C3317" font-size="6.5" font-weight="600">Export raw</text>
<text id="timeline-proc-label" x="234" y="35" fill="#A0522D" font-size="6.5" font-weight="600">Export
proc.</text>
<text id="timeline-impraw-label" x="234" y="53" fill="#8B6030" font-size="6.5" font-weight="600">Import
raw</text>
<text id="timeline-impproc-label" x="234" y="62" fill="#9A7020" font-size="6.5" font-weight="600">Import
proc.</text>
<line id="timeline-cursor" x1="210" y1="8" x2="210" y2="88" stroke="rgba(74,44,23,0.45)" stroke-width="1"
stroke-dasharray="2 3" />
</svg>
<div id="timeline-bar-hint"
style="font-size:7px;color:rgba(245,236,215,0.60);font-style:italic;padding:2px 8px 1px;flex-shrink:0;text-align:right;">
</div>
<div class="w-annot"><b>Raw price</b> = global avg unit value (USD/t). <b>Processed</b> = raw × 1.35. <b>Import
prices</b> (dashed) = export prices + 8% freight & insurance estimate. <b>Shaded area</b> = value-added
gap. Cursor = year slider.</div>
</div>
<!-- Widget 5: Sankey -->
<div class="bot-panel" id="sankey-panel" style="border-right:none;">
<div class="bot-title">Coffee value chain — Producers · Processors · Consumers</div>
<svg id="sankey-svg" viewBox="0 0 420 108" preserveAspectRatio="xMidYMid meet"
style="flex:1;min-height:0;display:block;width:100%;"></svg>
<div class="w-annot"
style="position:static;max-width:none;width:100%;box-sizing:border-box;margin-top:4px;font-size:7.5px;line-height:1.4;border-radius:3px;padding:3px 8px;">
<b>Producers → Processors</b>: raw green bean exports (FAO item 656). <b>Processors → Consumers</b>:
roasted/processed coffee exports only (FAO item 657). <b>Processors</b> = countries where ≥30% of coffee exports
are roasted. Flow width = share of each column's world total.
</div>
</div>
</div>
<div id="map-tooltip"></div>
<!-- Scripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"
crossorigin="anonymous"></script>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="https://unpkg.com/d3-sankey@0.12.3/dist/d3-sankey.min.js"></script>
<script type="module" src="js/app.js"></script>
</body>
</html>