JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

spork/charts/line-chart

spork


    function
    /usr/local/lib/janet/spork/charts.janet on line 620, column 1

    
    (line-chart &named width height data font background-color text-color color-map point-radius x-min x-max y-min y-max padding title circle-points scatter grid legend super-sample stroke-thickness format-x format-y save-as legend-map line-style x-label y-label x-suffix x-prefix y-suffix y-prefix x-column y-column x-ticks x-minor-ticks y-minor-ticks x-labels-vertical)

    Render a line chart. Returns a gfx2d/Image which can be further 
    manipulated with the spork/gfx2d module.

    Basic Parameters

    * :width - canvas width
    * :height - canvas height
    * :data - a data frame to use for data
    * :title - an optional title to add to the rendered image
    * :font - font used to draw text, including title, legend, and axes 
      labels
    * :save-as - save the generated image to file. Can be any format 
      supported by the gfx2d module
    * :x-column - the name of the data frame column to use for the x 
      axis
    * :y-column - a single column or array of column names to use for 
      the chart
    * :x-ticks - manually set the tick marks on the X axis instead of 
      auto-detecting them

    Axes Styling

    * :x-label - optional label for the x axis
    * :y-label - optional label for the y axis
    * :grid - set to true to turn on drawing grid lines
    * :x-suffix - add a string suffix to each tick label on the x-axis
    * :y-suffix - add a string suffix to each tick label on the x-axis
    * :x-prefix - add a string prefix to each tick label on the y-axis
    * :y-prefix - add a string prefix to each tick label on the y-axis
    * :x-minor-ticks - how many, if any, small ticks to add between 
      each large tick mark on the x axis
    * :y-minor-ticks - how many, if any, small ticks to add between 
      each large tick mark on the y axis
    * :x-labels-vertical - Turn x labels vertical so more can fit on 
      the axis

    Chart Styling

    * :padding - the number of pixels of white space around various 
      elements of the chart
    * :background-color - color of background, defaults to white
    * :text-color - color of text, defaults to black
    * :color-map - a dictionary mapping columns to colors. By default 
      will hash column name to pseudo-random colors
    * :scatter - set to true to disable lines connecting points
    * :legend - set to true to add a legend to the top of the chart
    * :legend-map - a dictionary mapping column names to pretty text 
      for the chart
    * :point-radius - radius of points when drawing a scatter plot
    * :line-type - how to actually draw lines. Can be one of :stroke, 
      :plot, or :stipple. Default is :plot.
    * :super-sample - Super Sample anti-aliasing for chart lines. Is a 
      bit slow, but makes smooth plots. Works best with :stroke and 
      :bar
    * :stroke-thickness - thickness in pixels of the stroke of the 
      graph when :line-type = :stroke

    Axis Boundaries

    * :x-min - minimum x coordinate on chart
    * :x-max - maximum x coordinate on chart
    * :y-min - minimum y coordinate on chart
    * :y-max - maximum y coordinate on chart


1 exampleSign in to add an example
Loading...
(import spork/charts :as c)
(c/line-chart
  :width 400 :height 200
  :data {:timestamp [1 2 3 5 40 60]
         :temperature-1 [75.1 75.2 75.4 75.5 75.5 75.4]
         :temperature-2 [55.1 55.4 55.7 60.0 60.4 60.9]}
  :save-as "bla.png"
  :x-column :timestamp
  :y-column [:temperature-1 :temperature-2])

# then open bla.png to view
# bakpakin shared this example
veqqqPlayground