Top
You are looking at an outdated 7.4.1 version of this document. Switch to the 7.14.3 version to see the up to date information.

class anychart.charts.Sparkline Improve this Doc

Extends: anychart.core.Chart

Sparkline chart class.
To get the chart use method anychart.sparkline.

Methods Overview

Miscellaneous
clip()Getter for series clip settings.
connectMissingPoints()Getter for connect missing points setting.
data()Getter for series mapping.
fill()Getter for current fill color.
firstFill()Getter for current first fill color.
firstHatchFill()Getter for current first hatch fill settings.
firstLabels()Getter for data first labels.
firstMarkers()Getter for data first markers.
getType()Returns chart type.
hatchFill()Getter for current hatch fill settings.
labels()Getter for data labels.
lastFill()Getter for current last fill color.
lastHatchFill()Getter for current hatch fill settings.
lastLabels()Getter for data last labels.
lastMarkers()Getter for data last markers.
lineMarker()Getter for chart line marker.
markers()Getter for data markers.
maxFill()Getter for current fill color of maximum point value.
maxHatchFill()Getter for current hatch fill settings of maximum point value.
maxLabels()Getter for data labels of maximum point value.
maxMarkers()Getter for data markers of maximum point value.
minFill()Getter for current fill color of minimum point value.
minHatchFill()Getter for current hatch fill settings of minimum point value.
minLabels()Getter for data labels of minimum point value.
minMarkers()Getter for data markers of minimum point value.
negativeFill()Getter for current negative fill color.
negativeHatchFill()Getter for current negative hatch fill settings.
negativeLabels()Getter for data negative labels.
negativeMarkers()Getter for data negative markers.
pointWidth()Getter for current point width settings.
rangeMarker()Getter for chart range marker.
stroke()Getter for current stroke settings.
textMarker()Getter for chart text marker.
type()Getter for sparkline series type.
xScale()Getter for default chart X scale.
yScale()Getter for default chart Y scale.

Methods Description

clip

Getter for series clip settings.

Returns:

boolean anychart.math.Rect - Current clip settings.

Try it:

Setter for series clip settings. Clips visible part of a series by a rectangle (or chart).
False, if series is created manually. True, if created via chart.

Params:

Name Type Default Description
value anychart.math.Rect
true
Enable/disable series clip.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

connectMissingPoints

Getter for connect missing points setting.

Returns:

boolean - Current setting.

Try it:

Setter for connect missing points setting.

Params:

Name Type Default Description
value boolean
false
If set to true, the series will not be interrupted on missing points.
Markers will not be drawn for missing points in both cases.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

data

Getter for series mapping.

Returns:

anychart.data.View - Returns current mapping.

Try it:

Setter for series mapping.

Params:

Name Type Description
value anychart.data.View | anychart.data.Set | Array | string Value to set.
csvSettings Object.<string, (string|boolean)> If CSV string is passed by first param, you can pass CSV parser settings here as a hash map.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

fill

Getter for current fill color.

Returns:

anychart.graphics.vector.Fill - Current fill color.

Try it:

Sets fill settings using an object or a string. Learn more about coloring.

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
'#87CEEB'
Color as an object or a string.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.
Fill color with opacity.
Fill as a string or an object.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Linear gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Radial gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Params:

Name Type Description
imageSettings anychart.graphics.vector.Fill Object with settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

firstFill

Getter for current first fill color.

Returns:

anychart.graphics.vector.Fill - Current first fill color.

Try it:

Sets first fill settings using an object or a string. Learn more about coloring.

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
undefined
Color as an object or a string.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.
Fill color with opacity.
Fill as a string or an object.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Linear gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Radial gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Params:

Name Type Description
imageSettings anychart.graphics.vector.Fill Object with settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

firstHatchFill

Getter for current first hatch fill settings.
Setter for first hatch fill settings. Learn more about coloring.

Params:

Name Type Default Description
patternFillOrType anychart.graphics.vector.PatternFill | anychart.graphics.vector.HatchFill | function | anychart.graphics.vector.HatchFill.HatchFillType | string
undefined
PatternFill or HatchFill instance or type of hatch fill.
color string
Color.
thickness number
Thickness.
size number
Pattern size.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

firstLabels

Getter for data first labels.

Returns:

anychart.core.ui.LabelsFactory.Label - Label instance.

Try it:

Setter for data first labels.

Params:

Name Type Default Description
value Object | boolean | null
false
Data first labels settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

firstMarkers

Getter for data first markers.

Returns:

anychart.core.ui.MarkersFactory.Marker - Marker instance.

Try it:

Setter for data first markers.

Params:

Name Type Default Description
value Object | boolean | null
false
Data first markers settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

getType

Returns chart type.

Returns:

anychart.enums.ChartTypes - Current chart type.

Try it:

hatchFill

Getter for current hatch fill settings.
Getter for current hatch fill settings.
Setter for hatch fill settings. Learn more about coloring.

Params:

Name Type Default Description
patternFillOrType anychart.graphics.vector.PatternFill | anychart.graphics.vector.HatchFill | function | anychart.graphics.vector.HatchFill.HatchFillType | string
undefined
PatternFill or HatchFill instance or type of hatch fill.
color string
Color.
thickness number
Thickness.
size number
Pattern size.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

labels

Getter for data labels.

Returns:

anychart.core.ui.LabelsFactory.Label - Label instance.

Try it:

Setter for series data labels.

Params:

Name Type Default Description
value Object | boolean | null
false
Series data labels settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

lastFill

Getter for current last fill color.

Returns:

anychart.graphics.vector.Fill - Current last fill color.

Try it:

Sets last fill settings using an object or a string. Learn more about coloring.

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
undefined
Color as an object or a string.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.
Fill color with opacity.
Fill as a string or an object.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Linear gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Radial gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Params:

Name Type Description
imageSettings anychart.graphics.vector.Fill Object with settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

lastHatchFill

Getter for current hatch fill settings.
Setter for hatch fill settings. Learn more about coloring.

Params:

Name Type Default Description
patternFillOrType anychart.graphics.vector.PatternFill | anychart.graphics.vector.HatchFill | function | anychart.graphics.vector.HatchFill.HatchFillType | string
undefined
PatternFill or HatchFill instance or type of hatch fill.
color string
Color.
thickness number
Thickness.
size number
Pattern size.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

lastLabels

Getter for data last labels.

Returns:

anychart.core.ui.LabelsFactory.Label - Label instance.

Try it:

Setter for data last labels.

Params:

Name Type Default Description
value Object | boolean | null
false
Data last labels settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

lastMarkers

Getter for data last markers.

Returns:

anychart.core.ui.MarkersFactory.Marker - Marker instance.

Try it:

Setter for data last markers.

Params:

Name Type Default Description
value Object | boolean | null
false
Data last markers settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

lineMarker

Getter for chart line marker.

Params:

Name Type Description
index number Chart line marker index. If not set - creates a new instance and adds it to the end of array.

Returns:

anychart.core.axisMarkers.Line - Line marker instance by index.

Try it:

Setter for chart line marker.

Params:

Name Type Default Description
value Object | boolean | null
false
Chart line marker settings to set.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.
Setter for chart line marker by index.

Params:

Name Type Description
index number Chart line marker index.
value Object | boolean | null Chart line marker settings to set.
Note: pass null or false to disable marker or true to enable it.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

markers

Getter for data markers.

Returns:

anychart.core.ui.MarkersFactory.Marker - Markers instance.

Try it:

Setter for series data markers.

Params:

Name Type Description
false Object | boolean | null opt_value Series data markers settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

maxFill

Getter for current fill color of maximum point value.

Returns:

anychart.graphics.vector.Fill - Current maximum fill color.

Try it:

Sets maximum fill settings using an object or a string. Learn more about coloring.

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
undefined
Color as an object or a string.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.
Fill color with opacity.
Fill as a string or an object.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Linear gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Radial gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Params:

Name Type Description
imageSettings anychart.graphics.vector.Fill Object with settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

maxHatchFill

Getter for current hatch fill settings of maximum point value.
Setter for maximum hatch fill settings. Learn more about coloring.

Params:

Name Type Default Description
patternFillOrType anychart.graphics.vector.PatternFill | anychart.graphics.vector.HatchFill | function | anychart.graphics.vector.HatchFill.HatchFillType | string
undefined
PatternFill or HatchFill instance or type of hatch fill.
color string
Color.
thickness number
Thickness.
size number
Pattern size.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

maxLabels

Getter for data labels of maximum point value.

Returns:

anychart.core.ui.LabelsFactory.Label - Label instance.

Try it:

Setter for data maximum labels.

Params:

Name Type Default Description
value Object | boolean | null
false
Data maximum labels settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

maxMarkers

Getter for data markers of maximum point value.

Returns:

anychart.core.ui.MarkersFactory.Marker - Marker instance.

Try it:

Setter for data maximum markers.

Params:

Name Type Default Description
value Object | boolean | null
false
Data maximum markers settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

minFill

Getter for current fill color of minimum point value.

Returns:

anychart.graphics.vector.Fill - Current minimum fill color.

Try it:

Sets minimum fill settings using an object or a string. Learn more about coloring.

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
undefined
Color as an object or a string.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.
Fill color with opacity.
Fill as a string or an object.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Linear gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Radial gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Params:

Name Type Description
imageSettings anychart.graphics.vector.Fill Object with settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

minHatchFill

Getter for current hatch fill settings of minimum point value.
Setter for minimum hatch fill settings. Learn more about coloring.

Params:

Name Type Default Description
patternFillOrType anychart.graphics.vector.PatternFill | anychart.graphics.vector.HatchFill | function | anychart.graphics.vector.HatchFill.HatchFillType | string
undefined
PatternFill or HatchFill instance or type of hatch fill.
color string
Color.
thickness number
Thickness.
size number
Pattern size.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

minLabels

Getter for data labels of minimum point value.

Returns:

anychart.core.ui.LabelsFactory.Label - Label instance.

Try it:

Setter for data minimum labels.

Params:

Name Type Default Description
value Object | boolean | null
false
Data minimum labels settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

minMarkers

Getter for data markers of minimum point value.

Returns:

anychart.core.ui.MarkersFactory.Marker - Marker instance.

Try it:

Setter for data minimum markers.

Params:

Name Type Default Description
value Object | boolean | null
false
Data minimum markers settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

negativeFill

Getter for current negative fill color.

Returns:

anychart.graphics.vector.Fill - Current negative fill color.

Try it:

Sets negative fill settings using an object or a string. Learn more about coloring.

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
'#cb6762'
Color as an object or a string.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.
Fill color with opacity.
Fill as a string or an object.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Linear gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Radial gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Params:

Name Type Description
imageSettings anychart.graphics.vector.Fill Object with settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

negativeHatchFill

Getter for current negative hatch fill settings.
Setter for negative hatch fill settings. Learn more about coloring.

Params:

Name Type Default Description
patternFillOrType anychart.graphics.vector.PatternFill | anychart.graphics.vector.HatchFill | function | anychart.graphics.vector.HatchFill.HatchFillType | string
undefined
PatternFill or HatchFill instance or type of hatch fill.
color string
Color.
thickness number
Thickness.
size number
Pattern size.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

negativeLabels

Getter for data negative labels.

Returns:

anychart.core.ui.LabelsFactory.Label - Label instance.

Try it:

Setter for data negative labels.

Params:

Name Type Default Description
value Object | boolean | null
false
Data negative labels settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

negativeMarkers

Getter for data negative markers.

Returns:

anychart.core.ui.MarkersFactory.Marker - Marker instance.

Try it:

Setter for data negative markers.

Params:

Name Type Default Description
value Object | boolean | null
false
Data negative markers settings.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

pointWidth

Getter for current point width settings.

Returns:

string number - Point width pixel value.

Try it:

Setter for point width settings.

Params:

Name Type Default Description
value number | string
'95%'
Point width pixel value.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

rangeMarker

Getter for chart range marker.

Params:

Name Type Description
index number Chart range marker index. If not set - creates a new instance and adds it to the end of array.

Returns:

anychart.core.axisMarkers.Range - Range marker instance by index.

Try it:

Setter for chart range marker.

Params:

Name Type Default Description
value Object | boolean | null
false
Chart range marker settings to set.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.
Setter for chart range marker by index.

Params:

Name Type Description
index number Chart range marker index.
value Object | boolean | null Chart range marker settings to set.
Note: pass null or false to disable to disable marker.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

stroke

Getter for current stroke settings.

Returns:

anychart.graphics.vector.Stroke - Current stroke settings.

Try it:

Setter for chart stroke by function.

Params:

Name Type Default Description
strokeOrFill function
function() {
 return anychart.color.darken(this.sourceColor);
}
Function that looks like function(){ // this.index - series index. // this.sourceColor - color returned by fill() getter. // this.iterator - series point iterator. return strokeValue; // type anychart.graphics.vector.Stroke or anychart.graphics.vector.ColoredFill }.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

Setter for stroke settings. Learn more about stroke settings.

Params:

Name Type Default Description
strokeOrFill anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
#4682B4
Fill settings or stroke settings.
thickness number
1
Line thickness.
dashpattern string
Controls the pattern of dashes and gaps used to stroke paths.
lineJoin anychart.graphics.vector.StrokeLineJoin
Line join style.
lineCap anychart.graphics.vector.StrokeLineCap
Line cap style.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

Try it:

textMarker

Getter for chart text marker.

Params:

Name Type Description
index number Chart text marker index. If not set - creates a new instance and adds it to the end of array.

Returns:

anychart.core.axisMarkers.Text - Text marker instance by index.

Try it:

Setter for chart text marker.

Params:

Name Type Default Description
value Object | boolean | null
false
Chart text marker settings to set.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.
Setter for chart text marker by index.

Params:

Name Type Description
index number Chart text marker index.
value Object | boolean | null Chart text marker settings to set.
Note: pass null or false to disable marker or true to enable it.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

type

Getter for sparkline series type.

Returns:

string anychart.enums.SparklineSeriesType - Current sparkline series type.

Try it:

Setter for sparkline series type.

Params:

Name Type Default Description
type string | anychart.enums.SparklineSeriesType
'line'
Series type.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

xScale

Getter for default chart X scale.

Returns:

anychart.scales.Base - Default chart scale value.

Try it:

Setter for default chart X scale.
Note: This scale will be passed to all scale dependent chart elements if they don't have their own scales.

Params:

Name Type Description
value anychart.enums.ScaleTypes | anychart.scales.Base X Scale to set. Default scale ordinal.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.

yScale

Getter for default chart Y scale.

Returns:

anychart.scales.Base - Default chart scale value.

Try it:

Setter for chart Y scale.
Note: This scale will be passed to all scale dependent chart elements if they don't have their own scales.

Params:

Name Type Description
value anychart.enums.ScaleTypes | anychart.scales.Base Y Scale to set. Default scale linear.

Returns:

anychart.charts.Sparkline - Self instance for method chaining.