src/graph/surface

Types

Axis = object
  max*: tuple[val: float, pixel: int]
  min*: tuple[val: float, pixel: int]
  unpadded*: tuple[min: float, max: float]
  origin: float
  padding: int
Surface = object
  width*: int
  height*: int
  x*: Axis
  y*: Axis
  ratio: float
  origin*: tuple[x0, y0: float]
  pixels*: seq[Color]
  plots*: seq[tuple[x, y: seq[float], c: Color, done: bool]]
  bg*: Color
  drawgrid*: bool
  drawbox*: bool
  drawticks*: bool
  drawlabels*: bool

Procs

proc pixelFromVal(a: Axis; val: float): int {...}{.raises: [], tags: [].}
proc pixelFromVal2(a: Axis; val: float; invert: bool = false): float {...}{.raises: [], tags: [].}
proc `[]`(sur: Surface; i, j: int): Color {...}{.raises: [], tags: [].}
j: position along the horizontal axis i: position along the vertical axis IN PIXEL
proc `[]=`(sur: var Surface; i, j: int; color: Color) {...}{.raises: [], tags: [].}
proc `[]`(sur: Surface; x, y: float): Color {...}{.raises: [], tags: [].}
x: position along the horizontal axis y: position along the vertical axis VALUES NOT IN PIXEL
proc `[]=`(sur: var Surface; x, y: float; color: Color) {...}{.raises: [], tags: [].}
proc fillWith(sur: var Surface; color: Color = White) {...}{.raises: [], tags: [].}
Loop over every pixel in img and sets its color to color
proc initAxis(v0, v1: float; origin: float = 0.0; p0 = 0; p1: int = 288; padding = 10): Axis {...}{.
    raises: [], tags: [].}
padding is a percentage?
proc initSurface(x, y: Axis): Surface {...}{.raises: [], tags: [].}
proc initSurface(x0, w, y0, h: int): Surface {...}{.raises: [], tags: [].}
proc grid(s: var Surface) {...}{.raises: [], tags: [].}
proc box(s: var Surface; ticks = false) {...}{.raises: [], tags: [].}