Line Chart reusable API module that allows us
rendering a multi line and configurable chart.
- Description:
- Line Chart reusable API module that allows us rendering a multi line and configurable chart.
- Source:
- Tutorials:
-
- Tutorial: line
Example
let lineChart = line();
lineChart
.aspectRatio(0.5)
.width(500);
d3Select('.css-selector')
.datum(dataset)
.call(lineChart);
(require("Line"))(_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 |
LineChartData | 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
line.xAxisCustomFormat(line.axisTimeCombinations.HOUR_DAY)
Methods
module:Line(_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 |
LineChartData | The data to attach and generate the chart |
(static) ariaDescription(_xopt) → {String|module}
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}
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}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Desired aspect ratio for the graph |
Returns:
Current aspect ratio or Line Chart module to chain calls
- Type
- Number | Module
(static) autoResize(_xopt) → {Boolean|module}
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) → {colorSchema|module}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Array.<String> | Desired colorSchema for the graph |
Returns:
Current colorSchema or Chart module to chain calls
- Type
- colorSchema | module
(static) dateLabel(_x) → {String|module}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired dateLabel for the graph |
Returns:
Current dateLabel or Chart module to chain calls
- Type
- String | module
(static) exportChart(filename, title)
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}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired mode for the grid ('vertical'|'horizontal'|'full') |
Returns:
Current mode of the grid or Line Chart module to chain calls
- Type
- String | module
(static) height(_x) → {Number|Module}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Desired height for the graph |
Returns:
Current height or Line 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 initialized flag |
Returns:
Current isAnimated flag or Chart module
- Type
- Boolean | module
(static) isAnimated(_x) → {isAnimated|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
- isAnimated | module
(static) isPrintMode(_x) → {boolean|module}
- Description:
- Gets or Sets whether the chart should show go into print mode
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
boolean | flag set to display print mode |
Returns:
do we expand toggles
- Type
- boolean | module
(static) lineCurve(_x) → {curve|Module}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
curve | Desired curve for the lines, default 'linear'. Other options are: basis, natural, monotoneX, monotoneY, step, stepAfter, stepBefore, cardinal, and catmullRom. Visit https://github.com/d3/d3-shape#curves for more information. |
Returns:
Current line curve or Line Chart module to chain calls
- Type
- curve | Module
(static) loadingState(markup) → {loadingState|module}
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
- loadingState | 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}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Object | Margin object to get/set |
Returns:
Current margin or Line Chart module to chain calls
- Type
- Object | Module
(static) numberFormat(_x) → {numberFormat|module}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
string | Desired number format for the line chart |
Returns:
Current numberFormat or Chart module to chain calls
- Type
- numberFormat | 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: customMouseHover, customMouseMove, customMouseOut, customDataEntryClick, and customTouchMove
- Source:
Returns:
Bar Chart
- Type
- module
(static) shouldShowAllDataPoints(_x) → {shouldShowAllDataPoints|module}
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
_x |
Boolean |
false
|
Whether all data points should be drawn |
Returns:
Current shouldShowAllDataPoints or Chart module to chain calls
- Type
- shouldShowAllDataPoints | 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 | Desired tooltip threshold for the graph |
Returns:
Current tooltip threshold or Line Chart module to chain calls
- Type
- Number | Module
(static) topicLabel(_x) → {String|module}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired topicLabel for the graph |
Returns:
Current topicLabel or Chart module to chain calls
- Type
- String | module
(static) valueLabel(_x) → {String|module}
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}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Desired width for the graph |
Returns:
Current width or Line 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
line.xAxisFormat(line.axisTimeCombinations.HOUR_DAY)
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired format |
Returns:
Current format or module to chain calls
- Type
- String | Module
(static) xAxisLabel(_x) → {String|Module}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired label for the X axis |
Returns:
Current label of the X axis or Line Chart 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}
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
String | Desired label for the Y axis |
Returns:
Current label of the Y axis or Line Chart module to chain calls
- Type
- String | Module
(static) yAxisLabelPadding(_x) → {yAxisLabelPadding|module}
- Description:
- Gets or Sets the yAxisLabelPadding of the chart. The default value is -36
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Desired yAxisLabelPadding for the graph |
Returns:
Current yAxisLabelPadding or Chart module to chain calls
- Type
- yAxisLabelPadding | module
(static) yTicks(_x) → {Number|module}
- Description:
- Gets or Sets the number of ticks of the y axis on the chart (Default is 5)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
_x |
Number | Desired yTicks |
Returns:
Current yTicks or Chart module to chain calls
- Type
- Number | module