caseyshields / polar

A simple D3 polar plot component.

Home Page:https://caseyshields.github.io/polar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Functions

createPolarPlot()

Factory method which returns a polar plot component.

Typedefs

d3callback : function

createPolarPlot()

Factory method which returns a polar plot component.

Kind: global function

Param Type Default Description
args.center Array.<number> Screen position of plot originin [x,y] order
[args.radius] number 250 radius of plot in pixels
[args.maxRange] number 256 Maximum input range

createPolarPlot~plot()

Creates/updates both the blips and grid of the polar plot

Kind: inner method of createPolarPlot

plot.drawBlips()

Creates/updates blips on the polar plot.

Kind: static method of plot

plot.drawGrid(n, m)

Draws a polar grid

Kind: static method of plot

Param Type Description
n Integer Number of range graduations
m Integer Number of angle graduations

plot.drawCrosshairs()

Draws polar crosshairs if the range is within the configured maxRange, otherwise clears the crosshairs.

Kind: static method of plot

plot.click(callback) ⇒ plot

Sets the callback for handling blips being clicked, and returns the plot object for chaining.

Kind: static method of plot

Param Type Description
callback d3callback a D3 style event handler

plot.move(callback) ⇒ plot

Sets the callback for handling mouse movement, and returns the plot object for chaining.

Kind: static method of plot

Param Type Description
callback function A no-argument function to be called. use d3.mouse(this) to obtain the current screen coordinates

plot.screen2polar(screen) ⇒ Array.<number>

Convert screen coordinates into the coordinates of the input.

Kind: static method of plot

Param Type Description
screen Array.<number> a two element array holding screen coordinates in [x, y] order

plot.polar2screen(polar) ⇒ Array.<number>

Convert polar coordinates to screen coordinates.

Kind: static method of plot

Param Type Description
polar Array.<number> A two element array holding polar coordinates in [a, r] order. Units are the same as the configured input units.

plot.center(point) ⇒ plot

Sets the screen coordinates of the center of the polar plot and returns the plot object for chaining.

Kind: static method of plot

Param Type Description
point Array.<number> a point in screen coordinates in [x,y] order.

plot.addBlip(classy, range, angle, power) ⇒ plot

Adds a blip to the display using only the required fields.

Kind: static method of plot

Param Type Description
classy string the CSS class to apply to the blip
range number the range as a number between 0 and args.maxRange
angle number the angle as a number between 0 and args.turn
power number the blips power determines is visual size on the display

d3callback : function

Kind: global typedef

Param Type Description
data Object the data object
index number the index of the data
selection Object the D3 selection

About

A simple D3 polar plot component.

https://caseyshields.github.io/polar/


Languages

Language:JavaScript 79.6%Language:HTML 20.4%