Fork me on GitHub

Serie

Serie class to be extended

Constructor

new Serie( )

Methods

(static) {Number} getMaxX( )

Returns:
{ Number } Highest x value of the serie's data

(static) {Number} getMaxY( )

Returns:
{ Number } Highest y value of the serie's data

(static) {Number} getMinX( )

Returns:
{ Number } Lowest x value of the serie's data

(static) {Number} getMinY( )

Returns:
{ Number } Lowest y value of the serie's data

(static) {Number} getX( Number val )

Returns the x position of a certain value in pixels position, based on the serie's axis
Parameters:
Name Type Description
val Number Value to convert to pixels position
Returns:
{ Number } The x position in px corresponding to the x value

{Serie} allowTrackingLine( Object options )

Allows mouse tracking of the serie
Parameters:
Name Type Description
options Object The tracking line options
Returns:
{ Serie } The current serie

{Serie} autoAxis( )

Assigns axes automatically, based on Graph#getXAxis and Graph#getYAxis.
Returns:
{ Serie } The current serie

axisCheck( )

Checks that axes assigned to the serie have been defined and have proper values

{Serie} clearData( )

Removes all the data from the serie, without redrawing
Returns:
{ Serie } The current serie

{Serie} dataHasChanged( )

Notifies jsGraph that the data of the serie has changed
Returns:
{ Serie } The current serie

getAdditionalData( )

Deprecated:
  • Yes

{Array.<(Float64Array|Int32Array)>} getData( )

Returns the data in its current form
Returns:
{ Array.<(Float64Array|Int32Array)> } An array containing the data chunks. Has only one member if the data has no gaps

getFlip( )

{Boolean} getFlip( )

Returns:
{ Boolean } true if the serie is flipped, false otherwise

{Number} getIndex( )

Returns:
{ Number } The current index of the serie

getInfo( String prop )

Retrives an information value from its key
Parameters:
Name Type Description
prop String The property
See:
Returns:
The value associated to the prop parameter

{String} getLabel( )

Returns:
{ String } The label or, alternatively - the name of the serie

{Nunber} getLayer( )

Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.
Returns:
{ Nunber } The index of the layer into which the serie will be drawn

{Number} getMaxX( )

Returns:
{ Number } Highest x value of the serie's data

{Number} getMaxY( )

Returns:
{ Number } Highest y value of the serie's data

{Number} getMinX( )

Returns:
{ Number } Lowest x value of the serie's data

{Number} getMinY( )

Returns:
{ Number } Lowest y value of the serie's data

{String} getName( )

Getter for the serie name
Returns:
{ String } The serie name

{SVGElement} getSymbolForLegend( )

Computes and returns a line SVG element with the same line style as the serie, or width 20px
Returns:
SVGElement

{SVGElement} getTextForLegend( )

Computes and returns a text SVG element with the label of the serie as a text, translated by 35px
See:
Returns:
SVGElement

{Number} getX( Number val )

Returns the x position of a certain value in pixels position, based on the serie's axis
Parameters:
Name Type Description
val Number Value to convert to pixels position
Returns:
{ Number } The x position in px corresponding to the x value

{GraphAxis} getXAxis( )

Returns:
{ GraphAxis } The x axis assigned to the serie

{Number} getY( Number val )

Returns the y position of a certain value in pixels position, based on the serie's axis
Parameters:
Name Type Description
val Number Value to convert to pixels position
Returns:
{ Number } The y position in px corresponding to the y value

{GraphAxis} getYAxis( )

Returns:
{ GraphAxis } The y axis assigned to the serie

{Serie} hide( [ , Boolean hideShapes ] )

Hides the serie
Parameters:
Name Type Attributes Default Description
hideShapes Boolean <optional>
false true to hide the shapes associated to the serie
Returns:
{ Serie } The current serie

{Boolean} isSelected( )

Returns the selection state of the serie. Generic for most serie types
Returns:
{ Boolean } true if the serie is selected, false otherwise

{Boolean} isShown( )

Determines if the serie is currently visible
Returns:
{ Boolean } The current visibility status of the serie

{Serie} kill( )

Removes the serie from the graph. The method doesn't perform any axis autoscaling or repaint of the graph. This should be done manually.
Returns:
{ Serie } The current serie instance

{Serie} select( )

Flags the serie as selected
Returns:
{ Serie } The current serie

setAdditionalData( )

Deprecated:
  • Yes

{Serie} setAxes( GraphAxis axis1 , GraphAxis axis2 )

Assigns two axes to the serie
Parameters:
Name Type Description
axis1 GraphAxis First axis to assign to the serie (x or y)
axis2 GraphAxis Second axis to assign to the serie (y or x)
Returns:
{ Serie } The current serie

setData( Object, Array, Array.<Array> data [ , Boolean oneDimensional ] )

Sets data to the serie
Parameters:
Name Type Attributes Default Description
data Object | Array | Array.<Array> The data of the serie
oneDimensional Boolean <optional>
false In some cases you may need to force the 1D type. This is required when one uses an array or array to define the data (see examples)
Examples
serie.setData( [ [ x1, y1 ], [ x2, y2 ], ... ] );
serie.setData( [ x1, y1, x2, y2, ... ] ); // Faster
serie.setData( [ [ x1, y1, x2, y2, ..., xn, yn ] , [ xm, ym, x(m + 1), y(m + 1), ...] ], true ) // 1D array with a gap in the middle
serie.setData( { x: x0, dx: spacing, y: [ y1, y2, y3, y4 ] } ); // Data with equal x separation. Fastest way

{Serie} setFlip( [ , Boolean flipped ] )

Assigns the flipping value of the serie. A flipped serie will have inverted axes. However this method does not automatically re-assigns the axes of the serie. Call Serie#autoAxis to re-assign the axes automatically, or any other axis setting method.
Parameters:
Name Type Attributes Default Description
flipped Boolean <optional>
false true to flip the serie
Returns:
{ Serie } The current serie

{Serie} setInfo( String prop , value )

Set a key/value arbitrary information to the serie. It is particularly useful if you have this serie has a reference through an event for instance, and you want to retrieve data associated to it
Parameters:
Name Type Description
prop String The property
value The value
See:
Returns:
{ Serie } The current serie

{Serie} setLabel( String label )

Sets the label of the serie. Note that this does not automatically updates the legend
Parameters:
Name Type Description
label String The new label of the serie
Returns:
{ Serie } The current serie

{Serie} setLayer( Number layerIndex )

Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.
Parameters:
Name Type Default Description
layerIndex Number 1 The index of the layer into which the serie will be drawn
Returns:
{ Serie } The current serie

setLegendSymbolStyle( )

{SVGElement} setLegendSymbolStyle( )

Explicitely applies the line style to the SVG element returned by Serie#getSymbolForLegend
See:
Returns:
SVGElement

setOption( String name , value )

Sets the options of the serie (no extension of default options)
Parameters:
Name Type Description
name String The option name
value The option value
Example
serie.setOption('selectableOnClick', true );

setOptions( Object options )

Sets the options of the serie (no extension of default options)
Parameters:
Name Type Description
options Object The options of the serie

{Serie} setXAxis( Axis, Number axis )

Assigns an x axis to the serie
Parameters:
Name Type Description
axis Axis | Number The axis to use as an x axis. If an integer, Graph#getXAxis or Graph#getYAxis will be used
Returns:
{ Serie } The current serie
Example
serie.setXAxis( graph.getTopAxis( 1 ) ); // Assigns the second top axis to the serie

{Serie} setYAxis( Axis, Number axis )

Assigns an y axis to the serie
Parameters:
Name Type Description
axis Axis | Number The axis to use as an y axis. If an integer, Graph#getXAxis or Graph#getYAxis will be used
Returns:
{ Serie } The current serie
Example
serie.setYAxis( graph.getLeftAxis( 4 ) ); // Assigns the 5th left axis to the serie

{Serie} show( [ , Boolean showShapes ] )

Shows the serie
Parameters:
Name Type Attributes Default Description
showShapes Boolean <optional>
false true to show the shapes associated to the serie
Returns:
{ Serie } The current serie

{Serie} styleHasChanged( String selectionType )

Notifies jsGraph that the style of the serie has changed and needs to be redrawn on the next repaint
Parameters:
Name Type Default Description
selectionType String unselected The selection for which the style may have changed
Returns:
{ Serie } The current serie

{Serie} toggleDisplay( [ , Boolean hideShapes ] )

Toggles the display of the serie (effectively, calls .show() and .hide() alternatively on each call)
Parameters:
Name Type Attributes Default Description
hideShapes Boolean <optional>
false true to hide the shapes associated to the serie
Returns:
{ Serie } The current serie

{Serie} unselect( )

Flags the serie as unselected
Returns:
{ Serie } The current serie