Skip to content

Commit

Permalink
move legend to the left of the plot
Browse files Browse the repository at this point in the history
  • Loading branch information
jharshman committed Dec 13, 2023
1 parent 717d812 commit 1f82d7d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tsplot/plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NewPlotFromTimeSeriesIterator(tsi *monitoring.TimeSeriesIterator, legendKey

// Find the maximum datapoint between the different time series data.
// Use this to scale the Y Axis.
curMax, _ := findMaxFromPoints(points)
curMax, _ := findMaxFromPoints(timeSeries.GetValueType(), points)
if curMax > yMax {
yMax = curMax
}
Expand All @@ -105,11 +105,13 @@ func NewPlotFromTimeSeriesIterator(tsi *monitoring.TimeSeriesIterator, legendKey
// add to legend
legendEntry, _ := plotter.NewPolygon()
legendEntry.Color = lineColor
p.Legend.Left = true
p.Legend.Add(timeSeries.GetMetric().GetLabels()[legendKey], legendEntry)

p.Y.Max = yMax + 200
}

// set Y Axis scale
p.Y.Max = yMax + 200

for _, opt := range opts {
opt(p)
}
Expand Down

0 comments on commit 1f82d7d

Please sign in to comment.