File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ func executeQuery(cmd *cobra.Command, args []string) error {
163163
164164 p , err := ts .Plot ([]tsplot.PlotOption {tsplot .WithXAxisName ("UTC" ),
165165 tsplot .WithXTimeTicks (time .Kitchen ),
166+ tsplot .WithFontSize (float64 (12 )),
166167 tsplot .WithGrid (colornames .Darkgrey ),
167168 tsplot .WithTitle (metric )}... )
168169 if err != nil {
Original file line number Diff line number Diff line change 55 "time"
66
77 "gonum.org/v1/plot"
8+ "gonum.org/v1/plot/font"
89 "gonum.org/v1/plot/plotter"
910 monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
1011 "google.golang.org/protobuf/types/known/durationpb"
@@ -84,6 +85,16 @@ func WithXTimeTicks(format string) PlotOption {
8485 }
8586}
8687
88+ // WithFontSize configures the font sizes for the plot's Title, Axis', and Legend.
89+ func WithFontSize (size float64 ) PlotOption {
90+ return func (p * plot.Plot ) {
91+ p .Title .TextStyle .Font .Size = font .Length (size )
92+ p .X .Label .TextStyle .Font .Size = font .Length (size )
93+ p .Y .Label .TextStyle .Font .Size = font .Length (size )
94+ p .Legend .TextStyle .Font .Size = font .Length (size )
95+ }
96+ }
97+
8798// ApplyDefaultHighContrast applies the default high contrast color scheme to the *plot.Plot.
8899func ApplyDefaultHighContrast (p * plot.Plot ) {
89100 opts := []PlotOption {
You can’t perform that action at this time.
0 commit comments