Module RadarChart

RadarChart is a radar/spider chart generator module for LÖVE.

Info:

  • Copyright: 2014
  • License: zlib/libpng
  • Author: Josef N Patoprsty

Functions

new (data) Instansiate a new instance of a radar chart.
draw (x, y, radius) Main draw function.
setData (data) Set the data set.
getData () Return the data set.
setTicks (ticks) Set the number of ticks.
getTicks () Return the number of ticks.
setRadianOffset (radian_offset) Set the radian offset.
getRadianOffset () Returns the radian offset.
setColor (name, color) Sets the color of an element.
getColor (name) Return the color for an element.
setDrawMode (name, drawmode) Sets the drawmode of an element.
getDrawMode (name) Return the DrawMode for an element.
setFont (font) Set the font.
getFont () Return the font.
_point (index, x, y, radius) Determine the point at a specific radius from the objects internals.


Functions

new (data)
Instansiate a new instance of a radar chart.

Parameters:

  • data Required The data set that the radar chart should operate on. See RadarChart.setData for information on the structure of this object.
draw (x, y, radius)
Main draw function. This is the main draw function that is required to be run in love.draw().

Parameters:

  • x Required The X position of the center of the radar chart.
  • y Required The Y position of the center of the radar chart.
  • radius Required The radius of the radar chart from the center defined from X and Y.
setData (data)
Set the data set.

Parameters:

  • data Required The data set that the radar chart should operate on.
    Data is expected to be a table of tables with:
    • A string indexed as label (The label of the data point).
    • A number indexed as value (The value of the data point).
    Example:
    data = {{label="HP",value=45}, {label="Attack",value=49}, {label="Defense",value=49}, {label="Sp. Atk",value=65}, {label="Sp. Def",value=65}, {label="Speed",value=45}}
getData ()
Return the data set.

Returns:

    dataset
setTicks (ticks)
Set the number of ticks. This is the number of horizontal ticks that will be drawn on the chart. Defaults to 1

Parameters:

  • ticks A number greater than or equal to 1
getTicks ()
Return the number of ticks.

Returns:

    number
setRadianOffset (radian_offset)
Set the radian offset. Defaults to -pi/2 (first element on top)

Parameters:

  • radian_offset The offset that the radar chart should draw at.
getRadianOffset ()
Returns the radian offset.

Returns:

    number
setColor (name, color)
Sets the color of an element.

Parameters:

  • name The element in which you want to change.
    The available elements are:
    • htick The horizontal tick color. (Defaults to {63,63,63})
    • vtick The vertical tick color. (Defaults to {31,31,31})
    • integral The integral (area under the dataset) color (Defaults {255,0,0,127})
    • font The font color (Defaults to {255,255,255})
  • color The color as a table in which you want to change the element to. This should be {R,G,B} or {R,G,B,A}.
getColor (name)
Return the color for an element.

Parameters:

  • name The element in which you want to return.

Returns:

    color object
setDrawMode (name, drawmode)
Sets the drawmode of an element.

Parameters:

  • name The element in which you want to change.
    The available elements are:
    • ticks The drawmode type for the ticks. (Defaults to "line")
    • integral The integral (area under the dataset) drawmode type (Defaults "fill")
  • drawmode The drawmode in which you want to change the element to.
getDrawMode (name)
Return the DrawMode for an element.

Parameters:

  • name The element in which you want to return.

Returns:

    DrawMode string
setFont (font)
Set the font. Set the font that the labels will be drawn with.
Default is the default LÖVE font.

Parameters:

  • font The font you want the labels of the chart to be drawn as.
getFont ()
Return the font. Returns the font that is currently set.

Returns:

    Font
_point (index, x, y, radius)
Determine the point at a specific radius from the objects internals. This is an internal function.

Parameters:

  • index Required The index of the data set to be used.
  • x Required The X position of the center of the radar chart.
  • y Required The Y position of the center of the radar chart.
  • radius Required The radius for the calculation.

Returns:

    number,number
generated by LDoc 1.4.2