remove loan from some charts
This commit is contained in:
parent
410aa7e112
commit
469f7af7a4
1 changed files with 19 additions and 21 deletions
|
|
@ -32,7 +32,7 @@ class ChartManager {
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
plugins: {
|
plugins: {
|
||||||
legend: { position: 'top' },
|
legend: { position: 'top' },
|
||||||
title: { display: true, text: 'ROI Progression Over Time' }
|
title: { display: true, text: 'ROI Progression Over Time - Direct Investment Only' }
|
||||||
},
|
},
|
||||||
scales: {
|
scales: {
|
||||||
y: {
|
y: {
|
||||||
|
|
@ -65,7 +65,7 @@ class ChartManager {
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
plugins: {
|
plugins: {
|
||||||
legend: { position: 'top' },
|
legend: { position: 'top' },
|
||||||
title: { display: true, text: 'Net Financial Position (Break-Even Analysis)' }
|
title: { display: true, text: 'Net Financial Position - Direct Investment Only' }
|
||||||
},
|
},
|
||||||
scales: {
|
scales: {
|
||||||
y: {
|
y: {
|
||||||
|
|
@ -252,21 +252,20 @@ class ChartManager {
|
||||||
const maxMonths = Math.max(...scenarios.map(s => this.calculator.monthlyData[s].length));
|
const maxMonths = Math.max(...scenarios.map(s => this.calculator.monthlyData[s].length));
|
||||||
const monthLabels = Array.from({ length: maxMonths }, (_, i) => `M${i + 1}`);
|
const monthLabels = Array.from({ length: maxMonths }, (_, i) => `M${i + 1}`);
|
||||||
|
|
||||||
// Update ROI Progression Chart with both models
|
// Update ROI Progression Chart - Direct Investment Only
|
||||||
this.charts.roiProgression.data.labels = monthLabels;
|
this.charts.roiProgression.data.labels = monthLabels;
|
||||||
this.charts.roiProgression.data.datasets = scenarios.filter(s => this.calculator.results[s]).map(scenario => {
|
this.charts.roiProgression.data.datasets = scenarios.filter(s =>
|
||||||
const scenarioBase = scenario.replace('_direct', '').replace('_loan', '');
|
this.calculator.results[s] && s.includes('_direct')
|
||||||
const model = scenario.includes('_loan') ? 'loan' : 'direct';
|
).map(scenario => {
|
||||||
const isDirect = model === 'direct';
|
const scenarioBase = scenario.replace('_direct', '');
|
||||||
const scenarioName = this.calculator.scenarios[scenarioBase]?.name || scenarioBase;
|
const scenarioName = this.calculator.scenarios[scenarioBase]?.name || scenarioBase;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: `${scenarioName} (${model.charAt(0).toUpperCase() + model.slice(1)})`,
|
label: `${scenarioName}`,
|
||||||
data: this.calculator.monthlyData[scenario].map(d => d.roiPercent),
|
data: this.calculator.monthlyData[scenario].map(d => d.roiPercent),
|
||||||
borderColor: colors[scenarioBase],
|
borderColor: colors[scenarioBase],
|
||||||
backgroundColor: colors[scenarioBase] + (isDirect ? '30' : '15'),
|
backgroundColor: colors[scenarioBase] + '30',
|
||||||
borderDash: isDirect ? [] : [5, 5],
|
borderWidth: 3,
|
||||||
borderWidth: isDirect ? 3 : 2,
|
|
||||||
tension: 0.4,
|
tension: 0.4,
|
||||||
pointBackgroundColor: this.calculator.monthlyData[scenario].map(d =>
|
pointBackgroundColor: this.calculator.monthlyData[scenario].map(d =>
|
||||||
d.roiPercent >= 0 ? colors[scenarioBase] : '#dc3545'
|
d.roiPercent >= 0 ? colors[scenarioBase] : '#dc3545'
|
||||||
|
|
@ -275,25 +274,24 @@ class ChartManager {
|
||||||
});
|
});
|
||||||
this.charts.roiProgression.update();
|
this.charts.roiProgression.update();
|
||||||
|
|
||||||
// Update Net Position Chart (Break-Even Analysis) with both models
|
// Update Net Position Chart (Break-Even Analysis) - Direct Investment Only
|
||||||
this.charts.netPosition.data.labels = monthLabels;
|
this.charts.netPosition.data.labels = monthLabels;
|
||||||
this.charts.netPosition.data.datasets = scenarios.filter(s => this.calculator.results[s]).map(scenario => {
|
this.charts.netPosition.data.datasets = scenarios.filter(s =>
|
||||||
const scenarioBase = scenario.replace('_direct', '').replace('_loan', '');
|
this.calculator.results[s] && s.includes('_direct')
|
||||||
const model = scenario.includes('_loan') ? 'loan' : 'direct';
|
).map(scenario => {
|
||||||
const isDirect = model === 'direct';
|
const scenarioBase = scenario.replace('_direct', '');
|
||||||
const scenarioName = this.calculator.scenarios[scenarioBase]?.name || scenarioBase;
|
const scenarioName = this.calculator.scenarios[scenarioBase]?.name || scenarioBase;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: `${scenarioName} (${model.charAt(0).toUpperCase() + model.slice(1)}) Net Position`,
|
label: `${scenarioName} Net Position`,
|
||||||
data: this.calculator.monthlyData[scenario].map(d => d.netPosition),
|
data: this.calculator.monthlyData[scenario].map(d => d.netPosition),
|
||||||
borderColor: colors[scenarioBase],
|
borderColor: colors[scenarioBase],
|
||||||
backgroundColor: colors[scenarioBase] + (isDirect ? '30' : '15'),
|
backgroundColor: colors[scenarioBase] + '30',
|
||||||
borderDash: isDirect ? [] : [5, 5],
|
borderWidth: 3,
|
||||||
borderWidth: isDirect ? 3 : 2,
|
|
||||||
tension: 0.4,
|
tension: 0.4,
|
||||||
fill: {
|
fill: {
|
||||||
target: 'origin',
|
target: 'origin',
|
||||||
above: colors[scenarioBase] + (isDirect ? '20' : '10'),
|
above: colors[scenarioBase] + '20',
|
||||||
below: '#dc354510'
|
below: '#dc354510'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue