Create a Bar Chart
Parameters: Name Type Argument Descriptionparent
String | node | d3.selection | CompositeChart
Any valid d3 single selector specifying a dom block element such as a div; or a dom element or d3 selection. If the bar chart is a sub-chart in a Composite Chart then pass in the parent composite chart instance instead.
chartGroup
String <optional>
The name of the chart group this chart instance should be placed in. Interaction with a chart will only trigger events and redraws within the chart's group.
// create a bar chart under #chart-container1 element using the default global chart group var chart1 = new BarChart('#chart-container1'); // create a bar chart under #chart-container2 element using chart group A var chart2 = new BarChart('#chart-container2', 'chartGroupA'); // create a sub-chart under a composite parent chart var chart3 = new BarChart(compositeChart);
Set or get whether rounding is enabled when bars are centered. If false, using rounding with centered bars will result in a warning and rounding will be ignored. This flag has no effect if bars are not centered. When using standard d3.js rounding methods, the brush often doesn't align correctly with centered bars since the bars are offset. The rounding function must add an offset to compensate, such as in the following example.
Parameters: Name Type Argument Default DescriptionalwaysUseRounding
Boolean <optional>
chart.round(function(n) { return Math.floor(n) + 0.5; });
Get or set the spacing between bars as a fraction of bar size. Valid values are between 0-1. Setting this value will also remove any previously set gap. See the d3 docs for a visual description of how the padding is applied.
Parameters: Name Type Argument Default DescriptionbarPadding
Number <optional>
Whether the bar chart will render each bar centered around the data position on the x-axis.
Parameters: Name Type Argument Default DescriptioncenterBar
Boolean <optional>
Manually set fixed gap (in px) between bars instead of relying on the default auto-generated gap. By default the bar chart implementation will calculate and set the gap automatically based on the number of data points and the length of the x axis.
Parameters: Name Type Argument Default Descriptiongap
Number <optional>
Get or set the outer padding on an ordinal bar chart. This setting has no effect on non-ordinal charts. Will pad the width by padding * barWidth
on each side of the chart.
padding
Number <optional>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4