LineChart

line. LineChart

A Line Chart

Extends

new LineChart(optionsopt)

Parameters:

Name Type Description
options LineChartOptions | ChartOptions <optional>
Source: line.mjs, line 38
Emits:

Methods

setSegments(segments, optionsopt)

Description: Set the horizontal segments for this data. A segment is data clipped `rect` that can be stylized independently to give special meaning to a data range.

Parameters:

Name Type Description
segments Array.<Segment>
options object <optional>
Properties
Name Type Default Description
render boolean <optional> true Force a render
Source: line.mjs, line 60

showBrush()

Description: Show the current brush Source: line.mjs, line 429

hideBrush()

Description: Hide the current brush. Any active pointer interaction will be cancelled. Source: line.mjs, line 441

setBrush(options)

Description: Set the brush parameters. I.e. Mark a selection on the chart. Will also show the brush if not currently visible.

Parameters:

Name Type Description
options object
Properties
Name Type Default Description
type "data" | "visual" <optional> "data" Indicate what unit type the x1 and x2 options are
x1 number <optional> Starting x value/coordinate
x2 number <optional> Ending x value/coordinate
Source: line.mjs, line 462

(protected) init(options)

Overrides: common.Chart#init

Parameters:

Name Type Description
options ChartOptions
Source: common.mjs, line 384

addGradient(gradient) → {Gradient}

Description: Add a color gradient which can be used in SVG contexts Inherited: common.Chart#addGradient

Parameters:

Name Type Description
gradient Gradient | GradientOptions
Source: common.mjs, line 393
Returns:
Type
Gradient

removeGradient(gradient)

Inherited: common.Chart#removeGradient

Parameters:

Name Type Description
gradient Gradient
Source: common.mjs, line 406

(protected) adjustSize()

setElement(el)

Description: Set the DOM element to be used by this chart Inherited: common.Chart#setElement

Parameters:

Name Type Description
el Element
Source: common.mjs, line 599

(protected) beforeSetElement()

(protected) afterSetElement()

getColor() → {external:CSS_Color}

Description: Retrieve the computed CSS color for this chart Inherited: common.Chart#getColor Source: common.mjs, line 719
Returns:
Type
external:CSS_Color

(protected) addChart(chart)

Inherited: common.Chart#addChart

Parameters:

Name Type Description
chart Chart
Source: common.mjs, line 730

getAllCharts() → {Array.<Chart>}

Returns:
All the charts sharing this chart's `el` property
Type
Array.<Chart>

addTooltip(id, options)

Description: Add a new tooltip to this chart. Inherited: common.Chart#addTooltip

Parameters:

Name Type Description
id string Identifier for this tooltip
options TooltipOptions Options for this tooltip
Source: common.mjs, line 762

removeTooltip()

Description: Remove a tooltip from this chart Inherited: common.Chart#removeTooltip Source: common.mjs, line 834

(protected) onTooltip(options) → {Element}

Description: The default tooltip formatter Inherited: common.Chart#onTooltip

Parameters:

Name Type Description
options object
Properties
Name Type Description
entry DataEntry Data Entry
tooltip object Tooltip
Source: common.mjs, line 881
Returns:
Tooltip contents
Type
Element

(protected) onAxisLabel(options) → {string}

Description: The default Axis Label formatter Inherited: common.Chart#onAxisLabel

Parameters:

Name Type Description
options object
Properties
Name Type Description
orientation string "vertical" or "horizontal" orientation
percent number Normalized percentage of label, i.e. 0 -> 1
format function <optional> Optional format callback
Source: common.mjs, line 944
Returns:
Label contents
Type
string

hideTooltip(idopt)

Description: Hide tooltip (if visible) Inherited: common.Chart#hideTooltip

Parameters:

Name Type Description
id string <optional> ID of the tooltip to hide
Source: common.mjs, line 1032

showTooltip(idopt)

Description: Show tooltip (if available) Inherited: common.Chart#showTooltip

Parameters:

Name Type Description
id string <optional> ID of the tooltip to show
Source: common.mjs, line 1054

suspendTooltip(idopt)

Description: Increment the tooltip's suspend reference count by 1. While the tooltip suspend reference count is > 0 the tooltip will not be available and thus won't be visible. Inherited: common.Chart#suspendTooltip

Parameters:

Name Type Description
id string <optional> ID of the tooltip to suspend
Source: common.mjs, line 1088

resumeTooltip(idopt)

Description: Decrement the tooltip's suspend reference count by 1 Inherited: common.Chart#resumeTooltip

Parameters:

Name Type Description
id string <optional> ID of the tooltip to suspend
Source: common.mjs, line 1104

isTooltipAvailable(idopt) → {boolean}

Inherited: common.Chart#isTooltipAvailable

Parameters:

Name Type Description
id string <optional> ID of the tooltip to check
Source: common.mjs, line 1120
Returns:
Is the tooltip suspended or disabled
Type
boolean

isTooltipPointing() → {boolean}

Returns:
Is the tooltip actively handling pointer events
Type
boolean

setTooltipPosition(options, idopt)

Description: Place the tooltip at specific data value coordinates or by data index Inherited: common.Chart#setTooltipPosition

Parameters:

Name Type Description
options object
Properties
Name Type Description
x number <optional>
y number <optional>
index number <optional> Data index
id string <optional> ID of the tooltip to position
Source: common.mjs, line 1182

(protected) updateVisibleTooltips()

findNearestFromXCoord(coord, dataopt) → {DataEntry}

Description: Binary search for nearest data entry using an X coordinate Inherited: common.Chart#findNearestFromXCoord

Parameters:

Name Type Default Description
coord number X coord
data Array.<DataEntry> <optional> this._renderData
Source: common.mjs, line 1385
Returns:
Type
DataEntry

findNearestFromXValue(value, dataopt) → {DataEntry}

Description: Binary search for nearest data entry using an X value Inherited: common.Chart#findNearestFromXValue

Parameters:

Name Type Default Description
value number X value
data Array.<DataEntry> <optional> this._renderData
Source: common.mjs, line 1397
Returns:
Type
DataEntry

findNearestIndexFromXCoord(coord, dataopt) → {number}

Description: Binary search for nearest data index using an X coordinate Inherited: common.Chart#findNearestIndexFromXCoord

Parameters:

Name Type Default Description
coord number X coord
data Array.<DataEntry> <optional> this.normalizedData
Source: common.mjs, line 1409
Returns:
Type
number

findNearestIndexFromXValue(value, dataopt) → {number}

Description: Binary search for nearest data index using an X value Inherited: common.Chart#findNearestIndexFromXValue

Parameters:

Name Type Default Description
value number X value
data Array.<DataEntry> <optional> this.normalizedData
Source: common.mjs, line 1420
Returns:
Type
number

setZoom(options)

Inherited: common.Chart#setZoom

Parameters:

Name Type Description
options object
Properties
Name Type Default Description
type "data" | "visual" <optional> "data" What coordinate scheme to use and how to keep this zoom anchored when data is updated
xRange CoordRange <optional> x axis coordinates (type=data only)
yRange CoordRange <optional> y axis coordinates (type=data only)
translate CoordTuple <optional> [x, y] coordinate offsets (type=visual only)
scale number <optional> Scaling factor (type=visual only)
Source: common.mjs, line 1453

setData(dataopt, optionsopt)

Inherited: common.Chart#setData

Parameters:

Name Type Description
data ChartData <optional>
options object <optional>
Source: common.mjs, line 1490

(protected) normalizeData(data) → {Array.<DataEntry>}

Inherited: common.Chart#normalizeData

Parameters:

Name Type Description
data ChartData
Source: common.mjs, line 1504
Returns:
Type
Array.<DataEntry>

render(optionsopt)

Description: Render the chart Inherited: common.Chart#render

Parameters:

Name Type Description
options object <optional>
Source: common.mjs, line 1534

(protected) applyDataZoom()

(protected) applyVisualZoom()

(protected) beforeRender(optionsopt)

Description: Called before any visual reflow/painting Inherited: common.Chart#beforeRender

Parameters:

Name Type Description
options object <optional> Render options
Source: common.mjs, line 1621

(protected) adjustScale()

(abstract, protected) doLayout()

(protected) afterRender()

xValueScale(value) → {number}

Inherited: common.Chart#xValueScale

Parameters:

Name Type Description
value number
Source: common.mjs, line 1683
Returns:
Type
number

yValueScale(value) → {number}

Inherited: common.Chart#yValueScale

Parameters:

Name Type Description
value number
Source: common.mjs, line 1691
Returns:
Type
number

xValueToCoord(value) → {number}

Inherited: common.Chart#xValueToCoord

Parameters:

Name Type Description
value number
Source: common.mjs, line 1699
Returns:
Type
number

yValueToCoord(value) → {number}

Inherited: common.Chart#yValueToCoord

Parameters:

Name Type Description
value number
Source: common.mjs, line 1707
Returns:
Type
number

xCoordScale(coord) → {number}

Inherited: common.Chart#xCoordScale

Parameters:

Name Type Description
coord number
Source: common.mjs, line 1715
Returns:
Type
number

yCoordScale(coord) → {number}

Inherited: common.Chart#yCoordScale

Parameters:

Name Type Description
coord number
Source: common.mjs, line 1723
Returns:
Type
number

xCoordToValue(coord) → {number}

Inherited: common.Chart#xCoordToValue

Parameters:

Name Type Description
coord number
Source: common.mjs, line 1731
Returns:
Type
number

yCoordToValue(coord) → {number}

Inherited: common.Chart#yCoordToValue

Parameters:

Name Type Description
coord number
Source: common.mjs, line 1739
Returns:
Type
number

reset()

Description: Clear this charts data and rendering Inherited: common.Chart#reset Source: common.mjs, line 1746

(abstract, protected) doReset()

makePath(coords, optionsopt)

Description: Create an SVG or CSS path Inherited: common.Chart#makePath

Parameters:

Name Type Description
coords Array.<CoordTuple>
options object <optional>
Properties
Name Type Description
css boolean <optional> CSS compatible output
closed boolean <optional> Close the Path so it can be filled
Source: common.mjs, line 1769