API: Stacked-bar

Stacked Area Chart reusable API module that allows us rendering a multi area and configurable chart.

(require("Stacked-bar"))(_selection, _data)

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

Requires

  • module:d3-array,

Methods


module:Stacked-bar(_selection, _data)

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

<static> aspectRatio(_x)

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

<static> betweenBarsPadding(_x)

Gets or Sets the padding of the stacked bar chart The default value is
Parameters:
Name Type Description
_x Number Padding value to get/set
Source:
Returns:
Current padding or Chart module to chain calls
Type
Number | module

<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
Array.<String> | module

<static> exportChart(filename, title)

Chart exported to png and a download action is fired
Parameters:
Name Type Description
filename String File title for the resulting picture
title String Title to add at the top of the exported picture
Source:

<static> grid(_x)

Gets or Sets the grid mode.
Parameters:
Name Type Description
_x String Desired mode for the grid ('vertical'|'horizontal'|'full')
Source:
Returns:
Current mode of the grid or Area Chart module to chain calls
Type
String | module

<static> hasPercentage(_x)

Gets or Sets the hasPercentage status
Parameters:
Name Type Description
_x Boolean Should use percentage as value format
Source:
Returns:
Is percentage used or Chart module to chain calls
Type
Boolean | module

<static> hasReversedStacks(_x)

Gets or Sets the hasReversedStacks property of the chart, reversing the order of stacks.
Parameters:
Name Type Description
_x Boolean Desired hasReversedStacks flag
Source:
Returns:
Current hasReversedStacks or Chart module to chain calls
Type
Boolean | 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 Area Chart module to chain calls
Type
Number | module

<static> isAnimated(_x)

Gets or Sets the isAnimated property of the chart, making it to animate when render. By default this is 'false'
Parameters:
Name Type Description
_x Boolean Desired animation flag
Source:
Returns:
Current isAnimated flag or Chart module
Type
Boolean | module

<static> isHorizontal(_x)

Gets or Sets the horizontal direction of the chart
Parameters:
Name Type Description
_x Boolean Desired horizontal direction for the graph
Source:
Returns:
If it is horizontal or Bar Chart module to chain calls
Type
Boolean | module

<static> loadingState(markup)

Gets or Sets the loading state of the chart
Parameters:
Name Type Description
markup String Desired markup to show when null data
Source:
Returns:
Current loading state markup or Chart module to chain calls
Type
String | module

<static> locale(_x)

Pass language tag for the tooltip to localize the date. Feature uses Intl.DateTimeFormat, for compatability and support, refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
Parameters:
Name Type Description
_x String must be a language tag (BCP 47) like 'en-US' or 'fr-FR'
Source:
Returns:
Current locale or module to chain calls
Type
String | 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 Area Chart module to chain calls
Type
Object | module

<static> nameLabel(_x)

Gets or Sets the nameLabel of the chart
Parameters:
Name Type Description
_x Number Desired dateLabel for the graph
Source:
Returns:
Current nameLabel or Chart module to chain calls
Type
Number | 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, customMouseOut, and customClick
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
Number | module

<static> stackLabel(_x)

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

<static> tooltipThreshold( [_x])

Gets or Sets the minimum width of the graph in order to show the tooltip NOTE: This could also depend on the aspect ratio
Parameters:
Name Type Argument Default Description
_x Number <optional>
480 Minimum width of the graph
Source:
Returns:
Current tooltipThreshold or Area Chart module to chain calls
Type
Number | 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
Number | module

<static> valueLabelFormat(_x)

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

<static> xTicks(_x)

Gets or Sets the number of ticks of the x axis on the chart (Default is 5)
Parameters:
Name Type Description
_x Number Desired horizontal ticks
Source:
Returns:
Current xTicks or Chart module to chain calls
Type
Number | module

<static> yAxisLabel(_x)

Gets or Sets the y-axis label of the chart
Parameters:
Name Type Description
_x String Desired label string
Source:
Returns:
Current yAxisLabel or Chart module to chain calls
Type
String | module
Example
stackedBar.yAxisLabel('Ticket Sales')

<static> yAxisLabelOffset(_x)

Gets or Sets the offset of the yAxisLabel of the chart. The method accepts both positive and negative values. The default value is -60
Parameters:
Name Type Description
_x Number Desired offset for the label
Source:
Returns:
Current yAxisLabelOffset or Chart module to chain calls
Type
Number | module
Example
stackedBar.yAxisLabelOffset(-55)

<static> yTicks(_x)

Gets or Sets the number of vertical ticks of the axis on the chart
Parameters:
Name Type Description
_x Number Desired vertical ticks
Source:
Returns:
Current yTicks or Chart module to chain calls
Type
Number | module