From d293adbd229ae60428cd2c32d78c9180470924b1 Mon Sep 17 00:00:00 2001 From: Julian Langschaedel Date: Fri, 5 May 2017 03:48:31 +0200 Subject: [PATCH] change Dot Size and graph MaxHistoSize calc in AutoHistoSize mode --- opengl/bookmap/bookmap.go | 3 ++- opengl/bookmap/graph.go | 10 ++++++++++ opengl/bookmap/graph_draw.go | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/opengl/bookmap/bookmap.go b/opengl/bookmap/bookmap.go index 7acc5e2..0c765d4 100644 --- a/opengl/bookmap/bookmap.go +++ b/opengl/bookmap/bookmap.go @@ -143,7 +143,8 @@ func (s *Bookmap) Render() { stats := s.Graph.Book.Book.StateAsStats() statsSlot.Fill(stats) if s.MaxSizeHisto == 0 || s.AutoHistoSize { - s.MaxSizeHisto = round(statsSlot.MaxSize/2, 0) + //s.MaxSizeHisto = round(statsSlot.MaxSize/2, 0) + s.MaxSizeHisto = round(s.Graph.MaxHistoSize()*0.60, 0) } s.Graph.DrawTimeslots(gc, x, ((s.Texture.Height - s.RowHeight) / s.RowHeight), s.RowHeight, s.PriceScrollPosition, s.PriceSteps, s.MaxSizeHisto) diff --git a/opengl/bookmap/graph.go b/opengl/bookmap/graph.go index 730f0ab..6690636 100644 --- a/opengl/bookmap/graph.go +++ b/opengl/bookmap/graph.go @@ -49,6 +49,16 @@ func NewGraph(db *bolt.DB, productID string, width, slotWidth, slotSteps int) *G return g } +func (g *Graph) MaxHistoSize() float64 { + var max float64 + for _, slot := range g.Timeslots { + if slot.MaxSize > max { + max = slot.MaxSize + } + } + return max +} + func (g *Graph) ClearSlotRows() { for _, slot := range g.Timeslots { slot.Rows = make([]*TimeSlotRow, 0, len(slot.Rows)) diff --git a/opengl/bookmap/graph_draw.go b/opengl/bookmap/graph_draw.go index ebe9c0b..e85457b 100644 --- a/opengl/bookmap/graph_draw.go +++ b/opengl/bookmap/graph_draw.go @@ -46,7 +46,7 @@ func (g *Graph) DrawTradeDots(gc *draw2dimg.GraphicContext, x, rowHeight, priceP angle := 360 * (math.Pi / 180.0) xx := (cx + (float64(g.SlotWidth) / 2)) - t := (slot.AskTradeSize / (maxSizeHisto / 2)) + t := (slot.AskTradeSize / (maxSizeHisto * 0.8)) if t > 1.0 { t = 1.0 } @@ -76,7 +76,7 @@ func (g *Graph) DrawTradeDots(gc *draw2dimg.GraphicContext, x, rowHeight, priceP angle := 360 * (math.Pi / 180.0) xx := (cx + (float64(g.SlotWidth) / 2)) - t := (slot.AskTradeSize / (maxSizeHisto / 2)) + t := (slot.BidTradeSize / (maxSizeHisto * 0.8)) if t > 1.0 { t = 1.0 }