API: Line

Line Chart reusable API module that allows us rendering a multi line and configurable chart.

(require("Line"))(_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 LineChartData The data to attach and generate the chart
Source:

Requires

  • module:d3-array,

Members


<static> axisTimeCombinations

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:
Example
line.forceAxisFormat(line.axisTimeCombinations.HOUR_DAY)

Methods


module:Line(_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 LineChartData 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 Line 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
colorSchema | module

<static> dateLabel(_x)

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

<static> exportChart()

Chart exported to png and a download action is fired
Source:

<static> forceAxisFormat(_x)

Exposes the ability to force the chart to show a certain x axis grouping
Parameters:
Name Type Description
_x String Desired format
Source:
Returns:
Current format or module to chain calls
Type
String | Module
Example
line.forceAxisFormat(line.axisTimeCombinations.HOUR_DAY)

<static> forcedXFormat(_x)

Exposes the ability to force the chart to show a certain x format It requires a `forceAxisFormat` of 'custom' in order to work. NOTE: localization not supported
Parameters:
Name Type Description
_x String Desired format for x axis
Source:
Returns:
Current format or module to chain calls
Type
String | Module

<static> forcedXTicks(_x)

Exposes the ability to force the chart to show a certain x ticks. It requires a `forceAxisFormat` 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.
Parameters:
Name Type Description
_x Number Desired number of x axis ticks (multiple of 2, 5 or 10)
Source:
Returns:
Current number or ticks or module to chain calls
Type
Number | Module

<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 Line Chart module to chain calls
Type
String | 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 Line 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
isAnimated | module

<static> lineGradient(_x)

Gets or Sets the gradient colors of the line chart when there is only one line
Parameters:
Name Type Description
_x Array.<String> Desired color gradient for the line (array of two hexadecimal numbers)
Source:
Returns:
Current color gradient or Line Chart module to chain calls
Type
Number | 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 Line 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: customMouseHover, customMouseMove and customMouseOut
Source:
Returns:
Bar Chart
Type
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 Description
_x Number Desired tooltip threshold for the graph
Source:
Returns:
Current tooltip threshold or Line Chart module to chain calls
Type
Number | Module

<static> topicLabel(_x)

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

<static> verticalTicks(_x)

Gets or Sets the number of verticalTicks of the yAxis on the chart
Parameters:
Name Type Description
_x Number Desired verticalTicks
Source:
Returns:
Current verticalTicks or Chart module to chain calls
Type
verticalTicks | 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 Line Chart module to chain calls
Type
Number | Module