API: Brush

Brush Chart reusable API class that renders a simple and configurable brush chart.

(require("Brush"))(_selection, _data)

This function creates the graph using the selection as container
Parameters:
Name Type Description
_selection D3Selection A d3 selection that represents the container(s) where the chart(s) will be rendered
_data BrushChartData The data to attach and generate the chart
Source:

Requires

  • module:d3-array,

Members


<static> axisTimeCombinations

Exposes the constants to be used to force the x axis to respect a certain granularity current options: MINUTE_HOUR, HOUR_DAY, DAY_MONTH, MONTH_YEAR
Source:
Example
brush.forceAxisFormat(brush.axisTimeCombinations.HOUR_DAY)

Methods


module:Brush(_selection, _data)

This function creates the graph using the selection as container
Parameters:
Name Type Description
_selection D3Selection A d3 selection that represents the container(s) where the chart(s) will be rendered
_data BrushChartData The data to attach and generate the chart
Source:

<static> dateRange(_x)

Gets or Sets the dateRange for the selected part of the brush
Parameters:
Name Type Description
_x Array.<String> Desired dateRange for the graph
Source:
Returns:
Current dateRange or Chart module to chain calls
Type
dateRange | module

<static> forceAxisFormat(_x)

Exposes the ability to force the chart to show a certain x axis grouping
Parameters:
Name Type Description
_x String Desired format
Source:
Returns:
Current format or module to chain calls
Type
String | Module
Example
brush.forceAxisFormat(brush.axisTimeCombinations.HOUR_DAY)

<static> forcedXFormat(_x)

Exposes the ability to force the chart to show a certain x format It requires a `forceAxisFormat` of 'custom' in order to work.
Parameters:
Name Type Description
_x String Desired format for x axis
Source:
Returns:
Current format or module to chain calls
Type
String | Module

<static> forcedXTicks(_x)

Exposes the ability to force the chart to show a certain x ticks. It requires a `forceAxisFormat` of 'custom' in order to work. NOTE: This value needs to be a multiple of 2, 5 or 10. They won't always work as expected, as D3 decides at the end how many and where the ticks will appear.
Parameters:
Name Type Description
_x Number Desired number of x axis ticks (multiple of 2, 5 or 10)
Source:
Returns:
Current number or ticks or module to chain calls
Type
Number | Module

<static> gradient(_x)

Gets or Sets the gradient of the chart
Parameters:
Name Type Description
_x Array.<String> Desired gradient for the graph
Source:
Returns:
Current gradient or Chart module to chain calls
Type
gradient | module

<static> height(_x)

Gets or Sets the height of the chart
Parameters:
Name Type Description
_x number Desired width for the graph
Source:
Returns:
Current height or Chart module to chain calls
Type
height | module

<static> margin(_x)

Gets or Sets the margin of the chart
Parameters:
Name Type Description
_x object Margin object to get/set
Source:
Returns:
Current margin or Chart module to chain calls
Type
margin | module

<static> onBrush(_x)

Gets or Sets the callback that will be called when the user brushes over the area
Parameters:
Name Type Description
_x function Callback to call
Source:
Returns:
Current callback function or the Chart Module
Type
function | module

<static> width(_x)

Gets or Sets the width of the chart
Parameters:
Name Type Description
_x number Desired width for the graph
Source:
Returns:
Current width or Chart module to chain calls
Type
width | module