ggplotnim/ggplot_ticks

Source   Edit  

Procs

proc getTicks(s: Scale): int {....raises: [], tags: [].}
Returns a valid number of ticks based on the given Scale. This will either be the numTicks field if it is some, else it will be a default (10). Source   Edit  
proc getXTicks(fs: FilledScales): int {....raises: [], tags: [].}
Returns a valid number of ticks for X. Either returns the number of ticks given to the X scale (e.g. via scale_x_continuous or friends) or returns a default of 10 ticks. Source   Edit  
proc getYTicks(fs: FilledScales): int {....raises: [], tags: [].}
Returns a valid number of ticks for Y. Either returns the number of ticks given to the Y scale (e.g. via scale_y_continuous or friends) or returns a default of 10 ticks. Source   Edit  
proc handleDateScaleTicks(view: Viewport; p: GgPlot; axKind: AxisKind;
                          scale: Scale; theme: Theme; hideTickLabels = false;
                          margin = none[Coord1D]()): seq[GraphObject] {....raises: [
    ValueError, KeyError, Exception, TimeFormatParseError, TimeParseError],
    tags: [RootEffect, TimeEffect].}
Handles generation of ticks that respect the DateScale object. Namely parses the data in the given axis according to isTimestamp or parseDate and then leaves only those ticks within dateSpacing according to formatString. Source   Edit  
proc handleDiscreteTicks(view: Viewport; p: GgPlot; axKind: AxisKind;
                         labelSeq: seq[Value]; theme: Theme;
                         isSecondary = false; hideTickLabels = false;
                         centerTicks = true; margin = none[Coord1D]();
                         format: proc (x: Value): string): seq[GraphObject] {.
    ...raises: [Exception, ValueError], tags: [].}
Source   Edit  
proc handleTicks(view: Viewport; filledScales: FilledScales; p: GgPlot;
                 axKind: AxisKind; theme: Theme; hideTickLabels = false;
                 numTicksOpt = none[int](); boundScaleOpt = none[Scale]()): seq[
    GraphObject] {....raises: [ValueError, Exception, KeyError,
                            TimeFormatParseError, TimeParseError],
                   tags: [RootEffect, TimeEffect].}
This handles the creation of the tick positions and tick labels. It automatically updates the x and y scales of both the viewport and the filledScales! margin is the tick label margin in centimeter! Source   Edit