File size: 1,841 Bytes
3fde923
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
function renderKPIChart(labels, data) {
  const ctx = document.getElementById('kpiChart').getContext('2d');
  if (window.kpiChart) window.kpiChart.destroy();

  window.kpiChart = new Chart(ctx, {
    type: 'bar',
    data: {
      labels: labels,
      datasets: [{
        label: 'IRR (%)',
        data: data,
        backgroundColor: '#00C3A3',
        borderColor: '#2DECBF',
        borderWidth: 1,
        borderRadius: 6,
      }]
    },
    options: {
      responsive: true,
      plugins: {
        legend: { display: false },
        tooltip: { mode: 'index', intersect: false, bodyColor: '#FFFFFF', titleColor: '#FFFFFF' }
      },
      scales: {
        x: {
          ticks: { color: '#FFFFFF' },
          grid: { color: 'rgba(255,255,255,0.1)' }
        },
        y: {
          ticks: { color: '#FFFFFF' },
          grid: { color: 'rgba(255,255,255,0.1)' }
        }
      }
    }
  });
}

function renderTornadoChart(labels, data) {
  const ctx = document.getElementById('tornadoChart').getContext('2d');
  if (window.tornadoChart) window.tornadoChart.destroy();

  window.tornadoChart = new Chart(ctx, {
    type: 'bar',
    data: {
      labels: labels,
      datasets: [{
        label: 'ΔIRR',
        data: data,
        backgroundColor: '#2DECBF',
        borderRadius: 5
      }]
    },
    options: {
      indexAxis: 'y',
      responsive: true,
      plugins: {
        legend: { display: false },
        tooltip: { bodyColor: '#FFFFFF', titleColor: '#FFFFFF' }
      },
      scales: {
        x: {
          ticks: { color: '#FFFFFF' },
          grid: { color: 'rgba(255,255,255,0.1)' }
        },
        y: {
          ticks: { color: '#FFFFFF' },
          grid: { color: 'rgba(255,255,255,0.1)' }
        }
      }
    }
  });
}