mirror of
https://github.com/status-im/whispervis.git
synced 2025-02-08 11:23:53 +00:00
Fix cumulative chart
This commit is contained in:
parent
04b7f45420
commit
c24057befc
@ -69,17 +69,26 @@ func (s *StatsPage) UpdateStats(g *graph.Graph, plog *propagation.Log) {
|
|||||||
linkCounts := make([]float64, len(plog.Timestamps))
|
linkCounts := make([]float64, len(plog.Timestamps))
|
||||||
nodeCum := make([]float64, len(plog.Timestamps))
|
nodeCum := make([]float64, len(plog.Timestamps))
|
||||||
linkCum := make([]float64, len(plog.Timestamps))
|
linkCum := make([]float64, len(plog.Timestamps))
|
||||||
var totalNode, totalLink int64
|
|
||||||
|
nodesMap := make(map[int]int)
|
||||||
|
linksMap := make(map[int]int)
|
||||||
|
|
||||||
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])
|
nodes := len(plog.Nodes[i])
|
||||||
links := len(plog.Links[i])
|
links := len(plog.Links[i])
|
||||||
totalNode += int64(nodes)
|
|
||||||
totalLink += int64(links)
|
|
||||||
nodeCounts[i] = float64(nodes)
|
nodeCounts[i] = float64(nodes)
|
||||||
linkCounts[i] = float64(links)
|
linkCounts[i] = float64(links)
|
||||||
nodeCum[i] = float64(totalNode)
|
|
||||||
linkCum[i] = float64(totalLink)
|
for _, nodeIdx := range plog.Nodes[i] {
|
||||||
|
nodesMap[nodeIdx]++
|
||||||
|
}
|
||||||
|
for _, linkIdx := range plog.Links[i] {
|
||||||
|
linksMap[linkIdx]++
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeCum[i] = float64(len(nodesMap))
|
||||||
|
linkCum[i] = float64(len(linksMap))
|
||||||
}
|
}
|
||||||
|
|
||||||
data := charts.NewChartData()
|
data := charts.NewChartData()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user