def renderHist()

in jsuarez/extra/embyr_deprecated/embyr2d/render.py [0:0]


def renderHist(screen, dat, fonts, W, H, mul=1, border=4, 
      bg=Neon.BLACK.rgb, colors=(Neon.GREEN.rgb, Neon.RED.rgb, Neon.BLUE.rgb)):
   px = 8
   spacer = 3
   blockSize = 64
   valSize = 32
   txtW = 45
   txtH = 20
   leftPad = 16
   barSz = 8
   delta = 0
   colorInd = 0
   x = 0 
   scale = 1
   if np.max(dat) > H:
       scale = H / np.max(dat)
   for block in dat:
      for origVal in block: 
         val = int(origVal / scale)
         #val = int(100*np.random.rand())
         color = colors[colorInd % len(block)] 
         xx, yy = x+border+barSz, H-val-border
         screen.rect(color, (xx, yy, barSz, val))

         x += valSize
         #if ww > graphW:
         #   return
         text = fonts.small.render(str(origVal), 1, Neon.YELLOW.rgb)
         screen.blit(text, (xx-txtW, yy-txtH))