aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-09-03 10:09:08 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-09-04 14:21:20 +0000
commitdfbe2ed44f34f8bdabc5ca598387d7543fb9591b (patch)
tree64a441356df901b1a6619690128eb62e6bcc3689
parent8cf7b72368903bf5225e088dd330cc47e34d8bb5 (diff)
dashboard/app: add total value on Bugs/Month graph
-rw-r--r--dashboard/app/graphs.go9
-rw-r--r--dashboard/app/templates/graph_histogram.html17
2 files changed, 19 insertions, 7 deletions
diff --git a/dashboard/app/graphs.go b/dashboard/app/graphs.go
index e4ded73d6..f3f62577e 100644
--- a/dashboard/app/graphs.go
+++ b/dashboard/app/graphs.go
@@ -73,8 +73,9 @@ type uiGraphHeader struct {
}
type uiGraphColumn struct {
- Hint string
- Vals []uiGraphValue
+ Hint string
+ Annotation float32
+ Vals []uiGraphValue
}
type uiGraphValue struct {
@@ -499,7 +500,9 @@ func createFoundBugs(c context.Context, bugs []*Bug) *uiGraph {
col := uiGraphColumn{Hint: month.Format("Jan-06")}
stats := months[month]
for _, typ := range types {
- col.Vals = append(col.Vals, uiGraphValue{Val: float32(stats[typ.name])})
+ val := float32(stats[typ.name])
+ col.Vals = append(col.Vals, uiGraphValue{Val: val})
+ col.Annotation += val
}
columns = append(columns, col)
}
diff --git a/dashboard/app/templates/graph_histogram.html b/dashboard/app/templates/graph_histogram.html
index 930d7b912..2f7a6bcc4 100644
--- a/dashboard/app/templates/graph_histogram.html
+++ b/dashboard/app/templates/graph_histogram.html
@@ -15,12 +15,20 @@ Number of found bugs per month.
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(function() {
+ var data = new google.visualization.DataTable();
+ data.addColumn({type: 'string'});
+ {{range $.Graph.Headers}}
+ data.addColumn({type: 'number', label: "{{.Name}}"});
+ {{end}}
+ data.addColumn({type: 'number', role: 'annotation'});
+ data.addRows([
+ {{range $.Graph.Columns}}
+ ["{{.Hint}}", {{range .Vals}}{{.Val}},{{end}} {{.Annotation}}],
+ {{end}}
+ ]);
new google.visualization.ColumnChart (
document.getElementById('graph_div')).
- draw(google.visualization.arrayToDataTable([
- ["-", {{range $.Graph.Headers}}"{{.Name}}", {{end}}],
- {{range $.Graph.Columns}}["{{.Hint}}", {{range .Vals}}{{.Val}},{{end}}],{{end}}
- ]), {
+ draw(data, {
width: "100%",
chartArea: {width: '90%', height: '85%'},
legend: {position: 'in'},
@@ -33,6 +41,7 @@ Number of found bugs per month.
{{$idx}}: {color: "{{$hdr.Color}}"},
{{end}}
},
+ annotations: { textStyle: { color: 'black', bold: true }},
})
});
</script>