Class: module:EsbmePlots

module:EsbmePlots

new module:EsbmePlots()

EsbmePlot is a Constructor for Plots
Version:
  • 1.0
Author:
Source:

Classes

Barplot
Piechart
Scatterplot

Methods

className(valueopt)

Defines a class to be added to all DOM elements within the SVG

If value is specified, sets the class name.
If value is not specified, return the current set value
Parameters:
Name Type Attributes Default Description
value String <optional>
random
Source:

data(valueopt)

Adds / Updates the data bound to the plot

If value is specified, sets the data.
If value is not specified, returns the currently bound data
Parameters:
Name Type Attributes Description
value Array <optional>
Array with data
Source:

duration(valueopt)

Defines the duration for transitions

If value is specified, sets the length of transitions (in ms).
If value is not specified, return the current set value
Parameters:
Name Type Attributes Default Description
value Integer <optional>
300
Source:

events(valueopt)

Defines custom event listeners

Not yet implemented
Parameters:
Name Type Attributes Description
value Object <optional>
Key=>value of events to listen and responding callbacks
Source:

finished()

Defines a callback to be called whenever transitions finish

Not yet implemented
Source:

Defines the header to be printed above the plot

If value is specified, sets the plot header.
If value is not specified, return the current set value
Parameters:
Name Type Attributes Default Description
value String <optional>
"EsbmePlot" Header
Source:

height(valueopt)

Defines the total height of the SVG

If value is specified, sets the height.
If value is not specified, return the currentlt set height
Parameters:
Name Type Attributes Description
value Int <optional>
height in px
Source:

info(valueopt)

Defines extra info that is stored in the DOM

If value is specified, sets the info.
If value is not specified, return the current set value
Parameters:
Name Type Attributes Description
value Array.<Object> <optional>
Must have the same format as data. Final elements can be any kind of object
Source:

margin(valueopt)

Defines the margin of the plot

Margin is used to print labels and axes, so it should either be set large enough or left to be determined automatically. If value is specified, sets the margins.
If value is not specified, return the current set value
Parameters:
Name Type Attributes Default Description
value Int | Array.<Int> | Object <optional>
"auto" Margins in same format as with CSS
Source:
Example
plot.margin(20)
=> {top: 20, right: 20, bottom: 20, left: 20}
plot.margin("auto")
=> {top: "auto", right: "auto", bottom: "auto", left: "auto"}
plot.margin(20,10)
=> {top: 20, right: 10, bottom: 20, left: 10}
plot.margin(5,10,15,20)
=> {top: 5, right: 10, bottom: 15, left: 20}
plot.margin({ top: 5, right: 10, bottom: 15, left: 20 })
=> {top: 5, right: 10, bottom: 15, left: 20}

parent(valueopt)

Defines or returns the parent DOM element onto which the svg will be appended

If value is specified, sets the parent.
If value is not specified, return the current set value
Parameters:
Name Type Attributes Description
value D3Selection <optional>
d3.js Selection
Source:

seriesNames(valueopt)

Defines the class names to be added to each series

If value is specified, sets the series names.
If value is not specified, return the current series names
Parameters:
Name Type Attributes Default Description
value Array.<String> <optional>
["Series1","Series2","Series3","Series4","Series5","Series6","Series7","Series8","Series9","Series10"]
Source:

setCanvas()

Handles the creation of the plot

Takes into account the defined margins.
Source:

svg(valueopt)

Defines the svg element

This value should rarely be used for setting the svg element and mainly used as a getter If value is specified, sets the parent.
If value is not specified, return the current set value
Parameters:
Name Type Attributes Description
value D3Selection <optional>
Source:

width(valueopt)

Defines the total width of the SVG

If value is specified, sets the width.
If value is not specified, return the currently set width
Parameters:
Name Type Attributes Description
value Int <optional>
width in px
Source:

xDomain(valueopt)

Defines the domain for the X-axis

If value is specified, sets the x-axis domain.
If value is not specified, return the current set value
Parameters:
Name Type Attributes Description
value String <optional>
Source:

xLabel(valueopt)

Defines the label to be printed below the X-axis

If value is specified, sets the x-axis label.
If value is not specified, return the current set value
Parameters:
Name Type Attributes Description
value String <optional>
Source:

yDomain(valueopt)

Defines the domain for the y-axis

If value is specified, sets the y-axis domain.
If value is not specified, return the current set value
Parameters:
Name Type Attributes Description
value String <optional>
Source:

yLabel(valueopt)

Defines the label to be printed alongside the Y-axis

If value is specified, sets the y-axis label.
If value is not specified, return the current set value
Parameters:
Name Type Attributes Description
value String <optional>
Source: