|
71 | 71 | 'selected'; |
72 | 72 | } |
73 | 73 |
|
| 74 | + function updateBenchmarkSelector() { |
| 75 | + let selectedBenchmark = document.querySelector('#benchmark_selector').value; |
| 76 | +
|
| 77 | + let selectedClass = document.querySelector('#asset_class_selector').value; |
| 78 | + let selectedSector = document.querySelector('#sector_selector').value; |
| 79 | + let selectedMarket = document.querySelector('#equity_market_selector').value; |
| 80 | +
|
| 81 | + let filteredTechmixData = techmix_data |
| 82 | + .filter((d) => d.asset_class == selectedClass) |
| 83 | + .filter((d) => d.ald_sector == selectedSector) |
| 84 | + .filter((d) => d.equity_market == selectedMarket) |
| 85 | + .filter(d => !(d.this_portfolio)); |
| 86 | + let benchmarksTechmix = new Set(d3.map(filteredTechmixData, (d) => d.portfolio_name).keys()); |
| 87 | +
|
| 88 | + let filteredVolTrajData = traj_data |
| 89 | + .filter((d) => d.asset_class == selectedClass) |
| 90 | + .filter((d) => d.ald_sector == selectedSector) |
| 91 | + .filter((d) => d.equity_market == selectedMarket) |
| 92 | + .filter(d => (d.this_benchmark)); |
| 93 | + let benchmarksVolTraj = new Set(d3.map(filteredVolTrajData, (d) => d.portfolio_name).keys()); |
| 94 | +
|
| 95 | + let benchmarks = Array.from(benchmarksTechmix.union(benchmarksVolTraj)); |
| 96 | +
|
| 97 | + const benchmarkSelector = document.querySelector('#benchmark_selector'); |
| 98 | + benchmarkSelector.length = 0; |
| 99 | + benchmarks.forEach((benchmark) => benchmarkSelector.add(new Option(benchmark, benchmark))); |
| 100 | + benchmarkSelector.options[Math.max(0, benchmarks.indexOf(selectedBenchmark))].selected = |
| 101 | + 'selected'; |
| 102 | + } |
| 103 | +
|
74 | 104 | function addEventListeners() { |
75 | 105 | const go_button_landing = document.querySelector('#go_button_landing'); |
76 | 106 | const asset_class_selector = document.querySelector('#asset_class_selector'); |
|
88 | 118 | }); |
89 | 119 |
|
90 | 120 | sector_selector.addEventListener('change', function () { |
| 121 | + updateBenchmarkSelector(); |
91 | 122 | fetchTrajectoryAlignment(); |
92 | 123 | fetchTechmix(); |
93 | 124 | fetchEmissionIntensityPlot(); |
94 | 125 | }); |
95 | 126 |
|
96 | 127 | asset_class_selector.addEventListener('change', function () { |
| 128 | + updateBenchmarkSelector(); |
97 | 129 | fetchTrajectoryAlignment(); |
98 | 130 | fetchTechmix(); |
99 | 131 | fetchEmissionIntensityPlot(); |
|
115 | 147 | }); |
116 | 148 | const equity_market_selector = document.querySelector('#equity_market_selector'); |
117 | 149 | equity_market_selector.addEventListener('change', function () { |
| 150 | + updateBenchmarkSelector(); |
118 | 151 | fetchTrajectoryAlignment(); |
119 | 152 | fetchTechmix(); |
120 | 153 | fetchEmissionIntensityPlot(); |
|
129 | 162 | setValuesSectorSelectors(); |
130 | 163 | setValuesAssetClassSelector(); |
131 | 164 | updateScenarioSelector(); |
| 165 | + updateBenchmarkSelector(); |
132 | 166 | addEventListeners(); |
133 | 167 | fetchTechmix(); |
134 | 168 | fetchTrajectoryAlignment(); |
|
269 | 303 | </select> |
270 | 304 | </label> |
271 | 305 | <label class="label"> |
272 | | - <span>Benchmark</span> |
| 306 | + <span id="benchmark-label">Benchmark ⓘ</span> |
| 307 | + <div class="hide dashboard-tooltip card p-4 shadow-xl"> |
| 308 | + Applies to the production volume alignment and the technology mix plots. |
| 309 | + </div> |
273 | 310 | <select class="select variant-outline-surface" id="benchmark_selector"> |
274 | | - <option value="iShares Global Corp Bond UCITS ETF" |
275 | | - >iShares Global Corp Bond UCITS ETF</option |
276 | | - > |
277 | | - <option value="iShares Core S&P 500 ETF">iShares Core S&P 500 ETF</option> |
278 | | - <option value="iShares MSCI ACWI ETF">iShares MSCI ACWI ETF</option> |
279 | | - <option value="iShares MSCI Emerging Markets ETF" |
280 | | - >iShares MSCI Emerging Markets ETF</option |
281 | | - > |
282 | | - <option value="iShares MSCI World ETF">iShares MSCI World ETF</option> |
| 311 | + <option value="Not_selected">Please select</option> |
283 | 312 | </select> |
284 | 313 | </label> |
285 | 314 | </div> |
|
295 | 324 | #scenario-label:hover + .hide { |
296 | 325 | display: inline-block; |
297 | 326 | } |
| 327 | +
|
| 328 | + #benchmark-label:hover + .hide { |
| 329 | + display: inline-block; |
| 330 | + } |
298 | 331 | </style> |
0 commit comments