Stacked Area Chart reusable API module that allows us
rendering a multi area and configurable chart.
- Description:
- Stacked Area Chart reusable API module that allows us rendering a multi area and configurable chart.
- Source:
- Tutorials:
-
- Tutorial: stacked-area
Example
let stackedArea = stackedArea();
stackedArea
.width(containerWidth);
d3Select('.css-selector')
.datum(dataset.data)
.call(stackedArea);
(require("Stacked-area"))(_selection, _data)
- Description:
- This function creates the graph using the selection and data provided
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_selection |
D3Selection | A d3 selection that represents the container(s) where the chart(s) will be rendered |
_data |
areaChartData | The data to attach and generate the chart |
Requires
- module:d3-array,
Members
(static) axisTimeCombinations
- Description:
- 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:
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
Example
area.xAxisFormat(area.axisTimeCombinations.HOUR_DAY)
Methods
module:Stacked-area(_selection, _data)
- Description:
- This function creates the graph using the selection and data provided
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_selection |
D3Selection | A d3 selection that represents the container(s) where the chart(s) will be rendered |
_data |
areaChartData | The data to attach and generate the chart |
(static) areaCurve(_xopt) → {String|module}
- Description:
- Gets or Sets the area curve of the stacked area.
- Source:
Example
stackedArea.areaCurve('step')
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
_x |
String |
<optional> |
'monotoneX'
|
Desired curve for the stacked area, default 'monotoneX'. Other options are: basis, natural, linear, monotoneY, step, stepAfter, stepBefore, cardinal, and catmullRom. Visit https://github.com/d3/d3-shape#curves for more information. |
Returns:
Current area curve setting or Chart module to chain calls
- Type
- String | module
(static) areaOpacity(_x) → {Number|module}
- Description:
- Gets or Sets the opacity of the stacked areas in the chart (all of them will have the same opacity)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Opacity to get/set |
Returns:
Current opacity or Area Chart module to chain calls
- Type
- Number | module
(static) ariaDescription(_xopt) → {String|module}
- Description:
- Sets the accessible description announced for the chart.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
_x |
String |
<optional> |
Description rendered in the SVG desc |
Returns:
Current description or the chart for chaining
- Type
- String | module
(static) ariaLabel(_xopt) → {String|module}
- Description:
- Sets the accessible name announced for the chart.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
_x |
String |
<optional> |
Label rendered in the SVG title |
Returns:
Current label or the chart for chaining
- Type
- String | module
(static) aspectRatio(_x) → {Number|Module}
- Description:
- Gets or Sets the aspect ratio of the chart
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Desired aspect ratio for the graph |
Returns:
Current aspect ratio or Area Chart module to chain calls
- Type
- Number | Module
(static) autoResize(_xopt) → {Boolean|module}
- Description:
- Redraw when the parent container changes size.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
_x |
Boolean |
<optional> |
true to follow the container with a ResizeObserver |
Returns:
Current flag or the chart for chaining
- Type
- Boolean | module
(static) colorSchema(_x) → {Array.<String>|module}
- Description:
- Gets or Sets the colorSchema of the chart
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Array.<String> | Desired colorSchema for the graph |
Returns:
Current colorSchema or Chart module to chain calls
- Type
- Array.<String> | module
(static) dateLabel(_x) → {String|module}
- Description:
- Gets or Sets the dateLabel of the chart
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired dateLabel for the graph |
Returns:
Current dateLabel or Chart module to chain calls
- Type
- String | module
(static) emptyDataConfig(_x) → {Object|module}
- Description:
- Gets or Sets the emptyDataConfig of the chart
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Object | emptyDataConfig object to get/set |
Returns:
Current config for when chart data is an empty array
- Type
- Object | module
(static) exportChart(filename, title)
- Description:
- Chart exported to png and a download action is fired
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
filename |
String | File title for the resulting picture |
title |
String | Title to add at the top of the exported picture |
(static) grid(_x) → {String|module}
- Description:
- Gets or Sets the grid mode.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired mode for the grid ('vertical'|'horizontal'|'full') |
Returns:
Current mode of the grid or Area Chart module to chain calls
- Type
- String | module
(static) height(_x) → {Number|module}
- Description:
- Gets or Sets the height of the chart
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Desired width for the graph |
Returns:
Current height or Area Chart module to chain calls
- Type
- Number | module
(static) initializeVerticalMarker(_x) → {Boolean|module}
- Description:
- Gets or Sets the initializeVerticalMarker property of the chart, making vertical marker appear when chart renders. By default this is 'false'
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Boolean | Desired animation flag |
Returns:
Current isAnimated flag or Chart module
- Type
- Boolean | module
(static) isAnimated(_x) → {Boolean|module}
- Description:
- Gets or Sets the isAnimated property of the chart, making it to animate when render. By default this is 'false'
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Boolean | Desired animation flag |
Returns:
Current isAnimated flag or Chart module
- Type
- Boolean | module
(static) isPrintMode(_x) → {boolean|module}
- Description:
- Gets or Sets whether the chart should show the expand toggles/eyeball
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
boolean | Should we show the expand toggles? |
Returns:
do we expand toggles
- Type
- boolean | module
(static) keyLabel(_x) → {Number|module}
- Description:
- Gets or Sets the keyLabel of the chart
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Desired keyLabel for the graph |
Returns:
Current keyLabel or Chart module to chain calls
- Type
- Number | module
(static) loadingState(markup) → {String|module}
- Description:
- Gets or Sets the loading state of the chart
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
markup |
String | Desired markup to show when null data |
Returns:
Current loading state markup or Chart module to chain calls
- Type
- String | module
(static) locale(_x) → {String|Module}
- Description:
- 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
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | must be a language tag (BCP 47) like 'en-US' or 'fr-FR' |
Returns:
Current locale or module to chain calls
- Type
- String | Module
(static) margin(_x) → {Object|module}
- Description:
- Gets or Sets the margin of the chart
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Object | Margin object to get/set |
Returns:
Current margin or Area Chart module to chain calls
- Type
- Object | module
(static) on() → {module}
- Description:
- Exposes an 'on' method that acts as a bridge with the event dispatcher We are going to expose this events: customMouseOver, customMouseMove, customMouseOut, customDataEntryClick and customTouchMove
- Source:
Returns:
Stacked Area
- Type
- module
(static) tooltipThreshold(_x) → {Number|module}
- Description:
- Gets or Sets the minimum width of the graph in order to show the tooltip NOTE: This could also depend on the aspect ratio
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Minimum width of the graph |
Returns:
Current tooltipThreshold or Area Chart module to chain calls
- Type
- Number | module
(static) topicsOrder(_x) → {Array.<String>|module}
- Description:
- Pass an override for the ordering of the topics
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Array.<String> | Array of the names of your tooltip items |
Returns:
Current override order or Chart module to chain calls
- Type
- Array.<String> | module
(static) valueLabel(_x) → {String|module}
- Description:
- Gets or Sets the valueLabel of the chart
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired valueLabel for the graph |
Returns:
Current valueLabel or Chart module to chain calls
- Type
- String | module
(static) width(_x) → {Number|module}
- Description:
- Gets or Sets the width of the chart
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Desired width for the graph |
Returns:
Current width or Area Chart module to chain calls
- Type
- Number | module
(static) xAxisCustomFormat(_x) → {String|Module}
- Description:
- Exposes the ability to force the chart to show a certain x format It requires a `xAxisFormat` of 'custom' in order to work. NOTE: localization not supported
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired format for x axis |
Returns:
Current format or module to chain calls
- Type
- String | Module
(static) xAxisFormat(_x) → {String|Module}
- Description:
- Exposes the ability to force the chart to show a certain x axis grouping
- Source:
Example
area.xAxisFormat(area.axisTimeCombinations.HOUR_DAY)
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired format |
Returns:
Current format or module to chain calls
- Type
- String | Module
(static) xTicks(_x) → {Number|Module}
- Description:
- Exposes the ability to force the chart to show a certain x ticks. It requires a `xAxisFormat` 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.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Desired number of x axis ticks (multiple of 2, 5 or 10) |
Returns:
Current number or ticks or module to chain calls
- Type
- Number | Module
(static) yAxisLabel(_x) → {String|module}
- Description:
- Gets or Sets the y-axis label of the chart
- Source:
Example
stackedArea.yAxisLabel('Ticket Sales')
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired label string |
Returns:
Current yAxisLabel or Chart module to chain calls
- Type
- String | module
(static) yAxisLabelOffset(_xopt) → {Number|module}
- Description:
- Gets or Sets the offset of the yAxisLabel of the chart. The method accepts both positive and negative values. The default value is -60
- Source:
Example
stackedArea.yAxisLabelOffset(-55)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
_x |
Number |
<optional> |
-60
|
Desired offset for the label |
Returns:
Current yAxisLabelOffset or Chart module to chain calls
- Type
- Number | module
(static) yTicks(_xopt) → {Number|module}
- Description:
- Gets or Sets the number of ticks of the y axis on the chart (Default is 5)
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
_x |
Number |
<optional> |
5
|
Desired vertical ticks |
Returns:
Current vertical ticks or Chart module to chain calls
- Type
- Number | module