|
22 | 22 | new techmix_sector(document.querySelector('#techmix-plot'), techmix_data); |
23 | 23 | } |
24 | 24 |
|
25 | | - function fetchTrajectoryAlignment() { |
26 | | - new trajectory_alignment(document.querySelector('#trajectory-plot'), traj_data); |
| 25 | + function fetchTrajectoryAlignmentIfApplicable() { |
| 26 | + const volTrajectorySectors = ['Power', 'Automotive', 'Oil&Gas', 'Coal']; |
| 27 | + let chosenSector = document.querySelector('#sector_selector').value; |
| 28 | + if (volTrajectorySectors.includes(chosenSector)) { |
| 29 | + document.querySelector('#trajectory-box').classList.remove('hidden'); |
| 30 | + new trajectory_alignment(document.querySelector('#trajectory-plot'), traj_data); |
| 31 | + } else { |
| 32 | + document.querySelector('#trajectory-box').classList.add('hidden'); |
| 33 | + } |
27 | 34 | } |
28 | 35 |
|
29 | 36 | function fetchEmissionIntensityPlot() { |
|
247 | 254 | fetchExposureStats(); |
248 | 255 | if (checkDataAvailability()) { |
249 | 256 | showAnalysisHideAlert(); |
250 | | - fetchTrajectoryAlignment(); |
| 257 | + fetchTrajectoryAlignmentIfApplicable(); |
251 | 258 | fetchTechmix(); |
252 | 259 | fetchEmissionIntensityPlot(); |
253 | 260 | } else { |
|
263 | 270 | updateScenarioSelector(); |
264 | 271 | updateEquityMarketSelector(); |
265 | 272 | updateBenchmarkSelector(); |
266 | | - fetchTrajectoryAlignment(); |
| 273 | + fetchTrajectoryAlignmentIfApplicable(); |
267 | 274 | fetchTechmix(); |
268 | 275 | fetchEmissionIntensityPlot(); |
269 | 276 | } else { |
|
280 | 287 | updateAllocationMethodSelector(); |
281 | 288 | updateEquityMarketSelector(); |
282 | 289 | updateBenchmarkSelector(); |
283 | | - fetchTrajectoryAlignment(); |
| 290 | + fetchTrajectoryAlignmentIfApplicable(); |
284 | 291 | fetchTechmix(); |
285 | 292 | fetchEmissionIntensityPlot(); |
286 | 293 | } else { |
|
289 | 296 | }); |
290 | 297 | const benchmark_selector = document.querySelector('#benchmark_selector'); |
291 | 298 | benchmark_selector.addEventListener('change', function () { |
292 | | - fetchTrajectoryAlignment(); |
| 299 | + fetchTrajectoryAlignmentIfApplicable(); |
293 | 300 | fetchTechmix(); |
294 | 301 | }); |
295 | 302 | const scenario_source_selector = document.querySelector('#scenario_source_selector'); |
296 | 303 | scenario_source_selector.addEventListener('change', function () { |
297 | 304 | updateScenarioSelector(); |
298 | | - fetchTrajectoryAlignment(); |
| 305 | + fetchTrajectoryAlignmentIfApplicable(); |
299 | 306 | fetchTechmix(); |
300 | 307 | }); |
301 | 308 | const scenario_selector = document.querySelector('#scenario_selector'); |
|
305 | 312 | const equity_market_selector = document.querySelector('#equity_market_selector'); |
306 | 313 | equity_market_selector.addEventListener('change', function () { |
307 | 314 | updateBenchmarkSelector(); |
308 | | - fetchTrajectoryAlignment(); |
| 315 | + fetchTrajectoryAlignmentIfApplicable(); |
309 | 316 | fetchTechmix(); |
310 | 317 | fetchEmissionIntensityPlot(); |
311 | 318 | }); |
312 | 319 | const allocation_method_selector = document.querySelector('#allocation_method_selector'); |
313 | 320 | allocation_method_selector.addEventListener('change', function () { |
314 | | - fetchTrajectoryAlignment(); |
| 321 | + fetchTrajectoryAlignmentIfApplicable(); |
315 | 322 | fetchEmissionIntensityPlot(); |
316 | 323 | }); |
317 | 324 | } |
|
328 | 335 | updateBenchmarkSelector(); |
329 | 336 | addEventListeners(); |
330 | 337 | fetchTechmix(); |
331 | | - fetchTrajectoryAlignment(); |
| 338 | + fetchTrajectoryAlignmentIfApplicable(); |
332 | 339 | fetchEmissionIntensityPlot(); |
333 | 340 | } else { |
334 | 341 | handleNoDataForAssetSectorCombination(); |
|
396 | 403 | </div> |
397 | 404 | <div class="analysis-content grid sm:grid-cols-12 p-4 bg-teal-300" id="analysis-content"> |
398 | 405 | <div class="analysis-plots sm:col-span-10 p-4 bg-yellow-300"> |
399 | | - <div class="plot-trajectory-box grid p-4 bg-orange-300"> |
| 406 | + <div class="plot-trajectory-box grid p-4 bg-orange-300" id="trajectory-box"> |
400 | 407 | <div class="trajectory-explanation bg-cyan-300"> |
401 | 408 | <h4 class="h4">Production volume alignment over time for technologies in the sector</h4> |
402 | 409 | <p> |
|
0 commit comments