fix sankey
This commit is contained in:
@@ -10,11 +10,17 @@ export type FlowTotals = {
|
||||
grid_to_batt_kwh: number
|
||||
}
|
||||
|
||||
/**
|
||||
* d3-sankey vyžaduje acyklický graf. Jeden uzel „Síť“ vede na cyklus
|
||||
* Síť→Baterie (nabíjení) a Baterie→Síť (export) → „circular link“.
|
||||
* Rozdělení na Import (zdroj) a Export (stok) cyklus odstraní.
|
||||
*/
|
||||
const NODES = [
|
||||
{ id: 'FVE' },
|
||||
{ id: 'Síť' },
|
||||
{ id: 'Import ze sítě' },
|
||||
{ id: 'Baterie' },
|
||||
{ id: 'Spotřeba' },
|
||||
{ id: 'Export do sítě' },
|
||||
] as const
|
||||
|
||||
function buildLinks(t: FlowTotals): { source: string; target: string; value: number }[] {
|
||||
@@ -24,11 +30,11 @@ function buildLinks(t: FlowTotals): { source: string; target: string; value: num
|
||||
}
|
||||
add('FVE', 'Spotřeba', t.pv_to_load_kwh)
|
||||
add('FVE', 'Baterie', t.pv_to_batt_kwh)
|
||||
add('FVE', 'Síť', t.pv_to_grid_kwh)
|
||||
add('FVE', 'Export do sítě', t.pv_to_grid_kwh)
|
||||
add('Baterie', 'Spotřeba', t.batt_to_load_kwh)
|
||||
add('Baterie', 'Síť', t.batt_to_grid_kwh)
|
||||
add('Síť', 'Spotřeba', t.grid_to_load_kwh)
|
||||
add('Síť', 'Baterie', t.grid_to_batt_kwh)
|
||||
add('Baterie', 'Export do sítě', t.batt_to_grid_kwh)
|
||||
add('Import ze sítě', 'Spotřeba', t.grid_to_load_kwh)
|
||||
add('Import ze sítě', 'Baterie', t.grid_to_batt_kwh)
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user