diff --git a/console/frontend/src/views/VisualizePage.vue b/console/frontend/src/views/VisualizePage.vue index cdaccf57..5c8e94ea 100644 --- a/console/frontend/src/views/VisualizePage.vue +++ b/console/frontend/src/views/VisualizePage.vue @@ -185,10 +185,16 @@ watch([fetchedData, isDark], ([data, isDark]) => { itemStyle: { color: color(idx, false, theme), }, - lineStyle: { - color: color(idx, false, theme), - width: 1, - }, + lineStyle: + idx == data.rows.length - 1 + ? { + color: isDark ? "#ddd" : "#111", + width: 2, + } + : { + color: color(idx, false, theme), + width: 1, + }, areaStyle: { opacity: 0.95, color: new graphic.LinearGradient(0, 0, 0, 1, [ diff --git a/console/graph.go b/console/graph.go index c9744655..659a0617 100644 --- a/console/graph.go +++ b/console/graph.go @@ -481,7 +481,14 @@ func (c *Component) graphHandlerFunc(gc *gin.Context) { rows[i] = k i++ } + // Sort by sum, except we want "Other" to be last sort.Slice(rows, func(i, j int) bool { + if rowKeys[rows[i]][0] == "Other" { + return false + } + if rowKeys[rows[j]][0] == "Other" { + return true + } return rowSums[rows[i]] > rowSums[rows[j]] }) output.Rows = make([][]string, len(rows)) diff --git a/console/graph_test.go b/console/graph_test.go index 52f9ab06..6811e9bf 100644 --- a/console/graph_test.go +++ b/console/graph_test.go @@ -418,11 +418,11 @@ func TestGraphHandler(t *testing.T) { // Sorted by sum of bps "rows": [][]string{ {"router1", "provider2"}, // 10000 - {"Other", "Other"}, // 2100 {"router1", "provider1"}, // 1600 {"router2", "provider2"}, // 1200 {"router2", "provider3"}, // 1100 {"router2", "provider4"}, // 1000 + {"Other", "Other"}, // 2100 }, "t": []string{ "2009-11-10T23:00:00Z", @@ -431,35 +431,35 @@ func TestGraphHandler(t *testing.T) { }, "points": [][]int{ {2000, 5000, 3000}, - {1900, 100, 100}, {1000, 500, 100}, {1200, 0, 0}, {1100, 0, 0}, {0, 900, 100}, + {1900, 100, 100}, }, "min": []int{ 2000, 100, + 0, + 0, + 0, 100, - 0, - 0, - 0, }, "max": []int{ 5000, - 1900, 1000, 1200, 1100, 900, + 1900, }, "average": []int{ 3333, - 700, 533, 400, 366, 333, + 700, }, } mockConn.EXPECT().