API: Bar

Bar Chart reusable API class that renders a simple and configurable bar chart.

(require("Bar"))(_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 BarChartData The data to attach and generate the chart
Source:

Requires

  • module:d3-array,

Methods


module:Bar(_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 BarChartData The data to attach and generate the chart
Source:

<static> colorSchema(_x)

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

<static> enablePercentageLabels(_x)

Default false. If true, adds percentage labels at the end of the bars
Parameters:
Name Type Description
_x Boolean
Source:
Returns:
Current value of enablePercentageLables or Bar Chart module to chain calls
Type
Boolean | module

<static> exportChart()

Chart exported to png and a download action is fired
Source:

<static> exportChart()

Chart exported to png and a download action is fired
Source:

<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 Bar Chart module to chain calls
Type
height | module

<static> horizontal(_x)

Gets or Sets the horizontal direction of the chart
Parameters:
Name Type Description
_x number Desired horizontal direction for the graph
Source:
Returns:
Current horizontal direction or Bar Chart module to chain calls
Type
horizontal | 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 Bar Chart module to chain calls
Type
margin | module

<static> nameLabel(_x)

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

<static> on()

Exposes an 'on' method that acts as a bridge with the event dispatcher We are going to expose this events: customMouseOver, customMouseMove and customMouseOut
Source:
Returns:
Bar Chart
Type
module

<static> percentageAxisToMaxRatio(_x)

Configurable extension of the x axis if your max point was 50% you might want to show x axis to 60%, pass 1.2
Parameters:
Name Type Description
_x number ratio to max data point to add to the x axis
Source:
Returns:
Current ratio or Bar Chart module to chain calls
Type
ratio | module

<static> percentageLabelMargin(_x)

Default 10px. Offset between end of bar and start of the percentage bars
Parameters:
Name Type Description
_x number percentage margin offset from end of bar
Source:
Returns:
Currnet offset or Bar Chart module to chain calls
Type
number | module

<static> usePercentage(_x)

Gets or Sets the valueLabelFormat to a percentage format if true (default false)
Parameters:
Name Type Description
_x boolean Should use percentage as value format
Source:
Returns:
Is percentage value format used or Chart module to chain calls
Type
valueLabelFormat | module

<static> valueLabel(_x)

Gets or Sets the valueLabel of the chart
Parameters:
Name Type Description
_x Number Desired valueLabel for the graph
Source:
Returns:
Current valueLabel or Chart module to chain calls
Type
valueLabel | 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 Bar Chart module to chain calls
Type
width | module

<static> yAxisPaddingBetweenChart(_x)

Default 10. Space between y axis and chart
Parameters:
Name Type Description
_x number space between y axis and chart
Source:
Returns:
Current value of yAxisPaddingBetweenChart or Bar Chart module to chain calls
Type
number | module