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 _selectionD3Selection A d3 selection that represents the container(s) where the chart(s) will be rendered _dataBarChartData The data to attach and generate the chart - Source:
-
<static> colorSchema(_x)
-
Gets or Sets the colorSchema of the chart
Parameters:
Name Type Description _xArray.<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 _xBoolean - 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 _xnumber 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 _xnumber 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 _xobject Margin object to get/set - Source:
Returns:
Current margin or Bar Chart module to chain calls- Type
- margin | 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 _xnumber 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 _xnumber percentage margin offset from end of bar - Source:
Returns:
Currnet offset or Bar Chart module to chain calls- Type
- number | module
-
<static> width(_x)
-
Gets or Sets the width of the chart
Parameters:
Name Type Description _xnumber 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 _xnumber space between y axis and chart - Source:
Returns:
Current value of yAxisPaddingBetweenChart or Bar Chart module to chain calls- Type
- number | module