mirror of
https://github.com/status-im/whispervis.git
synced 2025-02-12 13:07:35 +00:00
Fix nodes/links count chart
This commit is contained in:
parent
276e2ec3b8
commit
aeadf127aa
@ -75,11 +75,24 @@ func (s *StatsPage) UpdateStats(g *graph.Graph, plog *propagation.Log) {
|
|||||||
|
|
||||||
for i, ts := range plog.Timestamps {
|
for i, ts := range plog.Timestamps {
|
||||||
labels[i] = fmt.Sprintf("%d", ts)
|
labels[i] = fmt.Sprintf("%d", ts)
|
||||||
nodes := len(plog.Nodes[i])
|
|
||||||
links := len(plog.Links[i])
|
// calculate unique new nodes
|
||||||
|
var nodes, links int
|
||||||
|
for _, nodeIdx := range plog.Nodes[i] {
|
||||||
|
if _, ok := nodesMap[nodeIdx]; !ok {
|
||||||
|
nodes++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, linkIdx := range plog.Links[i] {
|
||||||
|
if _, ok := linksMap[linkIdx]; !ok {
|
||||||
|
links++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nodeCounts[i] = float64(nodes)
|
nodeCounts[i] = float64(nodes)
|
||||||
linkCounts[i] = float64(links)
|
linkCounts[i] = float64(links)
|
||||||
|
|
||||||
|
// calculate unique cumulative nodes
|
||||||
for _, nodeIdx := range plog.Nodes[i] {
|
for _, nodeIdx := range plog.Nodes[i] {
|
||||||
nodesMap[nodeIdx]++
|
nodesMap[nodeIdx]++
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user