Namespace: Highcharts

Highcharts

The Highcharts object is the placeholder for all other members, and various utility functions. The most important member of the namespace would be the chart constructor.

Example

var chart = Highcharts.chart('container', { ... });

Classes

AccessibilityComponent
Axis
Chart
Data
Earcon
Instrument
KeyboardNavigationHandler
Legend
PlotLineOrBand
Point
Pointer
Series
SVGElement
SVGRenderer
Time

属性

<static> charts :Array.<Highcharts.Chart>

An array containing the current chart objects in the page. A chart's position in the array is preserved throughout the page's lifetime. When a chart is destroyed, the array item becomes undefined.

类型:

<static> dateFormats :Highcharts.Dictionary.<Highcharts.TimeFormatCallbackFunction>

A hook for defining additional date format specifiers. New specifiers are defined as key-value pairs by using the specifier as key, and a function which takes the timestamp as value. This function returns the formatted portion of the date.

类型:
在线实例

<static> defaultOptions :Highcharts.Options

Global default settings.

类型:
  • Highcharts.Options

<static> maps :Highcharts.Dictionary.<Highcharts.MapDataObject>

Contains all loaded map data for Highmaps.

类型:

<static> sonification :Highcharts.SonificationObject

Global classes and objects related to sonification.

类型:

<static> time :Highcharts.Time

Global Time object with default options. Since v6.0.5, time settings can be applied individually for each chart. If no individual settings apply, this Time object is shared by all instances.

类型:

方法

<static> addEvent(el, type, fn [, options])

Add an event listener.

参数列表
名字 类型 参数 描述
el T

The element or object to add a listener to. It can be a HTMLDOMElement, an Highcharts.SVGElement or any other object.

type string

The event type.

fn Highcharts.EventCallbackFunction.<T>

The function callback to execute when the event is fired.

options Highcharts.EventOptionsObject <optional>

Options for adding the event.

Returns:
function .

A callback function to remove the added event.

<static> animate(el, params [, opt])

The global animate method, which uses Fx to create individual animators.

参数列表
名字 类型 参数 描述
el Highcharts.HTMLDOMElement | Highcharts.SVGElement

The element to animate.

params Highcharts.HTMLAttributes | Highcharts.SVGAttributes

An object containing key-value pairs of the properties to animate. Supports numeric as pixel-based CSS properties for HTML objects and attributes for SVGElements.

opt Highcharts.AnimationOptionsObject <optional>

Animation options.

<static> animObject(animation)

Get the animation in object form, where a disabled animation is always returned as { duration: 0 }.

参数列表
名字 类型 描述
animation boolean | Highcharts.AnimationOptionsObject

An animation setting. Can be an object with duration, complete and easing properties, or a boolean to enable or disable.

Returns:
Highcharts.AnimationOptionsObject .

An object with at least a duration property.

<static> arrayMax(data)

Non-recursive method to find the lowest member of an array. Math.max raises a maximum call stack size exceeded error in Chrome when trying to apply more than 150.000 points. This method is slightly slower, but safe.

参数列表
名字 类型 描述
data Array

An array of numbers.

Returns:
number .

The highest number.

<static> arrayMin(data)

Non-recursive method to find the lowest member of an array. Math.min raises a maximum call stack size exceeded error in Chrome when trying to apply more than 150.000 points. This method is slightly slower, but safe.

参数列表
名字 类型 描述
data Array

An array of numbers.

Returns:
number .

The lowest number.

<static> attr(elem [, prop] [, value])

Set or get an attribute or an object of attributes. To use as a setter, pass a key and a value, or let the second argument be a collection of keys and values. To use as a getter, pass only a string as the second argument.

参数列表
名字 类型 参数 描述
elem Highcharts.HTMLDOMElement | Highcharts.SVGDOMElement

The DOM element to receive the attribute(s).

prop string | Highcharts.HTMLAttributes | Highcharts.SVGAttributes <optional>

The property or an object of key-value pairs.

value string <optional>

The value if a single property is set.

Returns:
* .

When used as a getter, return the value.

<static> chart( [renderTo], options [, callback])

Factory function for basic charts.

参数列表
名字 类型 参数 描述
renderTo string | Highcharts.HTMLDOMElement <optional>

The DOM element to render to, or its id.

options Highcharts.Options

The chart options structure.

callback Highcharts.ChartCallbackFunction <optional>

Function to run when the chart has loaded and and all external images are loaded. Defining a chart.events.load handler is equivalent.

Returns:
Highcharts.Chart .

Returns the Chart object.

Example
// Render a chart in to div#container
var chart = Highcharts.chart('container', {
    title: {
        text: 'My chart'
    },
    series: [{
        data: [1, 3, 2, 4]
    }]
});

<static> clearTimeout(id)

Internal clear timeout. The function checks that the id was not removed (e.g. by chart.destroy()). For the details see issue #7901.

参数列表
名字 类型 描述
id number

Id of a timeout.

<static> correctFloat(num [, prec])

Fix JS round off float errors.

参数列表
名字 类型 参数 默认值 描述
num number

A float number to fix.

prec number <optional>
14

The precision.

Returns:
number .

The corrected float number.

<static> createElement(tag [, attribs] [, styles] [, parent] [, nopad])

Utility function to create an HTML element with attributes and styles.

参数列表
名字 类型 参数 默认值 描述
tag string

The HTML tag.

attribs Highcharts.HTMLAttributes <optional>

Attributes as an object of key-value pairs.

styles Highcharts.CSSObject <optional>

Styles as an object of key-value pairs.

parent Highcharts.HTMLDOMElement <optional>

The parent HTML object.

nopad boolean <optional>
false

If true, remove all padding, border and margin.

Returns:
Highcharts.HTMLDOMElement .

The created DOM element.

<static> css(el, styles)

Set CSS on a given element.

参数列表
名字 类型 描述
el Highcharts.HTMLDOMElement

An HTML DOM element.

styles Highcharts.CSSObject

Style object with camel case property names.

<static> data(dataOptions [, chartOptions] [, chart])

Creates a data object to parse data for a chart.

参数列表
名字 类型 参数 描述
dataOptions Highcharts.DataOptions
chartOptions Highcharts.Options <optional>
chart Highcharts.Chart <optional>
Returns:

<static> dateFormat(format, timestamp [, capitalize])

Formats a JavaScript date timestamp (milliseconds since Jan 1st 1970) into a human readable date string. The format is a subset of the formats for PHP's strftime function. Additional formats can be given in the Highcharts.dateFormats hook.

Since v6.0.5, all internal dates are formatted through the Highcharts.Chart#time instance to respect chart-level time settings. The Highcharts.dateFormat function only reflects global time settings set with setOptions.

参数列表
名字 类型 参数 默认值 描述
format string

The desired format where various time representations are prefixed with %.

timestamp number

The JavaScript timestamp.

capitalize boolean <optional>
false

Upper case first letter in the return.

Returns:
string .

The formatted date.

<static> defined(obj)

Check if an object is null or undefined.

参数列表
名字 类型 描述
obj *

The object to check.

Returns:
boolean .

False if the object is null or undefined, otherwise true.

<static> destroyObjectProperties(obj [, except])

Utility method that destroys any SVGElement instances that are properties on the given object. It loops all properties and invokes destroy if there is a destroy method. The property is then delete.

参数列表
名字 类型 参数 描述
obj *

The object to destroy properties on.

except * <optional>

Exception, do not destroy this property, only delete it.

<static> discardElement(element)

Discard a HTML element by moving it to the bin and delete.

参数列表
名字 类型 描述
element Highcharts.HTMLDOMElement

The HTML node to discard.

<static> downloadSVGLocal(svg, options, failCallback, successCallback)

Get data URL to an image of an SVG and call download on it options object:

  • filename: Name of resulting downloaded file without extension. Default is chart.

  • type: File type of resulting download. Default is image/png.

  • scale: Scaling factor of downloaded image compared to source. Default is 1.

  • libURL: URL pointing to location of dependency scripts to download on demand. Default is the exporting.libURL option of the global Highcharts options pointing to our server.

参数列表
名字 类型 描述
svg string
options Highcharts.ExportingOptions
failCallback function
successCallback function

<static> each(arr, fn [, ctx])

Iterate over an array.

参数列表
名字 类型 参数 描述
arr Array.<*>

The array to iterate over.

fn function

The iterator callback. It passes three arguments:

   - `item`: The array item.
   - `index`: The item's index in the array.
   - `arr`: The array that each is being applied to.
ctx * <optional>

The context.

Deprecated:
  • Yes

<static> erase(arr, item)

Remove the last occurence of an item from an array.

参数列表
名字 类型 描述
arr Array

The array.

item *

The item to remove.

<static> error(code [, stop] [, chart])

Provide error messages for debugging, with links to online explanation. This function can be overridden to provide custom error handling.

参数列表
名字 类型 参数 默认值 描述
code number | string

The error code. See errors.xml for available codes. If it is a string, the error message is printed directly in the console.

stop boolean <optional>
false

Whether to throw an error or just log a warning in the console.

chart Highcharts.Chart <optional>

Reference to the chart that causes the error. Used in 'debugger' module to display errors directly on the chart. Important note: This argument is undefined for errors that lack access to the Chart instance.

在线示例

<static> extend(a, b)

Utility function to extend an object with the members of another.

参数列表
名字 类型 描述
a Highcharts.Dictionary.<*>

The object to be extended.

b Highcharts.Dictionary.<*>

The object to add to the first one.

Returns:
Highcharts.Dictionary.<*> .

Object a, the original object.

<static> extendClass(parent, members)

Extend a prototyped class by new members.

参数列表
名字 类型 描述
parent *

The parent prototype to inherit.

members Highcharts.Dictionary.<*>

A collection of prototype members to add or override compared to the parent prototype.

Returns:
* .

A new prototype.

<static> find(arr, callback)

Return the value of the first element in the array that satisfies the provided testing function.

参数列表
名字 类型 描述
arr Array

The array to test.

callback function

The callback function. The function receives the item as the first argument. Return true if this item satisfies the condition.

Returns:
* .

The value of the element.

<static> fireEvent(el, type [, eventArguments] [, defaultFunction])

Fire an event that was registered with Highcharts#addEvent.

参数列表
名字 类型 参数 描述
el *

The object to fire the event on. It can be a HTMLDOMElement, an Highcharts.SVGElement or any other object.

type string

The type of event.

eventArguments Highcharts.Dictionary.<*> <optional>

Custom event arguments that are passed on as an argument to the event handler.

defaultFunction function <optional>

The default function to execute if the other listeners haven't returned false.

<static> format(str, ctx [, time])

Format a string according to a subset of the rules of Python's String.format method.

参数列表
名字 类型 参数 描述
str string

The string to format.

ctx *

The context, a collection of key-value pairs where each key is replaced by its value.

time Highcharts.Time <optional>

A Time instance that determines the date formatting, for example for applying time zone corrections to the formatted date.

Returns:
string .

The formatted string.

Example
var s = Highcharts.format(
    'The {color} fox was {len:.2f} feet long',
    { color: 'red', len: Math.PI }
);
// => The red fox was 3.14 feet long

<static> formatSingle(format, val [, time])

Format a single variable. Similar to sprintf, without the % prefix.

参数列表
名字 类型 参数 描述
format string

The format string.

val *

The value.

time Highcharts.Time <optional>

A Time instance that determines the date formatting, for example for applying time zone corrections to the formatted date.

Returns:
string .

The formatted representation of the value.

Example
formatSingle('.2f', 5); // => '5.00'.

<static> ganttChart( [renderTo], options [, callback])

Factory function for Gantt charts.

参数列表
名字 类型 参数 描述
renderTo string | Highcharts.HTMLDOMElement <optional>

The DOM element to render to, or its id.

options Highcharts.Options

The chart options structure.

callback Highcharts.ChartCallbackFunction <optional>

Function to run when the chart has loaded and and all external images are loaded. Defining a chart.events.load handler is equivalent.

Returns:
Highcharts.Chart .

Returns the Chart object.

Example
// Render a chart in to div#container
var chart = Highcharts.ganttChart('container', {
    title: {
        text: 'My chart'
    },
    series: [{
        data: ...
    }]
});

<static> geojson(geojson [, hType])

Highmaps only. Restructure a GeoJSON object in preparation to be read directly by the series.mapData option. The GeoJSON will be broken down to fit a specific Highcharts type, either map, mapline or mappoint. Meta data in GeoJSON's properties object will be copied directly over to Highcharts.Point.properties in Highmaps.

参数列表
名字 类型 参数 默认值 描述
geojson object

The GeoJSON structure to parse, represented as a JavaScript object rather than a JSON string.

hType string <optional>
map

The Highmaps series type to prepare for. Setting "map" will return GeoJSON polygons and multipolygons. Setting "mapline" will return GeoJSON linestrings and multilinestrings. Setting "mappoint" will return GeoJSON points and multipoints.

Requires:
  • module:modules/map
Returns:
Array.<object> .

An object ready for the mapData option.

在线示例

<static> getMagnitude(number)

Get the magnitude of a number.

参数列表
名字 类型 描述
number number

The number.

Returns:
number .

The magnitude, where 1-9 are magnitude 1, 10-99 magnitude 2 etc.

<static> getOptions()

Get the updated default options. Until 3.0.7, merely exposing defaultOptions for outside modules wasn't enough because the setOptions method created a new object.

Returns:

<static> getStyle(el, prop [, toInt])

Get the computed CSS value for given element and property, only for numerical properties. For width and height, the dimension of the inner box (excluding padding) is returned. Used for fitting the chart within the container.

参数列表
名字 类型 参数 默认值 描述
el Highcharts.HTMLDOMElement

An HTML element.

prop string

The property name.

toInt boolean <optional>
true

Parse to integer.

Returns:
number .

The numeric value.

<static> grep(arr, callback)

Filter an array by a callback.

参数列表
名字 类型 描述
arr Array.<*>

The array to filter.

callback function

The callback function. The function receives the item as the first argument. Return true if the item is to be preserved.

Deprecated:
  • Yes
Returns:
Array.<*> .

A new, filtered array.

<static> i18nFormat(formatString, context, time)

i18n formatting function. Extends Highcharts.format() functionality by also handling arrays and plural conditionals. Arrays can be indexed as follows:

  • Format: 'This is the first index: {myArray[0]}. The last: {myArray[-1]}.'

  • Context: { myArray: [0, 1, 2, 3, 4, 5] }

  • Result: 'This is the first index: 0. The last: 5.'

They can also be iterated using the #each() function. This will repeat the contents of the bracket expression for each element. Example:

  • Format: 'List contains: {#each(myArray)cm }'

  • Context: { myArray: [0, 1, 2] }

  • Result: 'List contains: 0cm 1cm 2cm '

The #each() function optionally takes a length parameter. If positive, this parameter specifies the max number of elements to iterate through. If negative, the function will subtract the number from the length of the array. Use this to stop iterating before the array ends. Example:

  • Format: 'List contains: {#each(myArray, -1), }and {myArray[-1]}.'

  • Context: { myArray: [0, 1, 2, 3] }

  • Result: 'List contains: 0, 1, 2, and 3.'

Use the #plural() function to pick a string depending on whether or not a context object is 1. Arguments are #plural(obj, plural, singular). Example:

  • Format: 'Has {numPoints} {#plural(numPoints, points, point}.'

  • Context: { numPoints: 5 }

  • Result: 'Has 5 points.'

Optionally there are additional parameters for dual and none: #plural(obj, plural, singular, dual, none). Example:

  • Format: 'Has {#plural(numPoints, many points, one point, two points, none}.'

  • Context: { numPoints: 2 }

  • Result: 'Has two points.'

The dual or none parameters will take precedence if they are supplied.

参数列表
名字 类型 描述
formatString string

The string to format.

context Highcharts.Dictionary.<*>

Context to apply to the format string.

time Highcharts.Time

A Time instance for date formatting, passed on to H.format().

Requires:
  • module:a11y-i18n
Returns:
string .

The formatted string.

<static> inArray(item, arr [, fromIndex])

Search for an item in an array.

参数列表
名字 类型 参数 默认值 描述
item *

The item to search for.

arr Array

The array or node collection to search in.

fromIndex number <optional>
0

The index to start searching from.

Deprecated:
  • Yes
Returns:
number .

The index within the array, or -1 if not found.

<static> isArray(obj)

Utility function to check if an item is an array.

参数列表
名字 类型 描述
obj *

The item to check.

Returns:
boolean .

True if the argument is an array.

<static> isClass(obj)

Utility function to check if an Object is an class.

参数列表
名字 类型 描述
obj *

The item to check.

Returns:
boolean .

True if the argument is an class.

<static> isDOMElement(obj)

Utility function to check if an Object is a HTML Element.

参数列表
名字 类型 描述
obj *

The item to check.

Returns:
boolean .

True if the argument is a HTML Element.

<static> isNumber(n)

Utility function to check if an item is a number and it is finite (not NaN, Infinity or -Infinity).

参数列表
名字 类型 描述
n *

The item to check.

Returns:
boolean .

True if the item is a finite number

<static> isObject(obj [, strict])

Utility function to check if an item is of type object.

参数列表
名字 类型 参数 默认值 描述
obj *

The item to check.

strict boolean <optional>
false

Also checks that the object is not an array.

Returns:
boolean .

True if the argument is an object.

<static> isString(s)

Utility function to check for string type.

参数列表
名字 类型 描述
s *

The item to check.

Returns:
boolean .

True if the argument is a string.

<static> keys(obj)

Returns an array of a given object's own properties.

参数列表
名字 类型 描述
obj *

The object of which the properties are to be returned.

Deprecated:
  • Yes
Returns:
Array.<string> .

An array of strings that represents all the properties.

<static> map(arr, fn)

Map an array by a callback.

参数列表
名字 类型 描述
arr Array.<*>

The array to map.

fn function

The callback function. Return the new value for the new array.

Deprecated:
  • Yes
Returns:
Array.<*> .

A new array item with modified items.

<static> mapChart( [renderTo], options [, callback])

The factory function for creating new map charts. Creates a new Chart object with different default options than the basic Chart.

参数列表
名字 类型 参数 描述
renderTo string | Highcharts.HTMLDOMElement <optional>

The DOM element to render to, or its id.

options Highcharts.Options

The chart options structure as described in the options reference.

callback Highcharts.ChartCallbackFunction <optional>

A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread, but in Internet Explorer version 8 or less the chart is sometimes initialized before the document is ready, and in these cases the chart object will not be finished synchronously. As a consequence, code that relies on the newly built Chart object should always run in the callback. Defining a chart.events.load handler is equivalent.

Requires:
  • module:modules/map
Returns:
Highcharts.Chart .

The chart object.

<static> merge(extend, a [, n])

Utility function to deep merge two or more objects and return a third object. If the first argument is true, the contents of the second object is copied into the first object. The merge function can also be used with a single object argument to create a deep copy of an object.

参数列表
名字 类型 参数 描述
extend boolean

Whether to extend the left-side object (a) or return a whole new object.

a *

The first object to extend. When only this is given, the function returns a deep copy.

n * <optional>

An object to merge into the previous one.

Returns:
* .

The merged object. If the first argument is true, the return is the same as the second argument.

<static> merge(a [, n])

Utility function to deep merge two or more objects and return a third object. The merge function can also be used with a single object argument to create a deep copy of an object.

参数列表
名字 类型 参数 描述
a *

The first object to extend. When only this is given, the function returns a deep copy.

n * <optional>

An object to merge into the previous one.

Returns:
* .

The merged object. If the first argument is true, the return is the same as the second argument.

<static> normalizeTickInterval(interval [, multiples] [, magnitude] [, allowDecimals] [, hasTickAmount])

Take an interval and normalize it to multiples of round numbers.

参数列表
名字 类型 参数 描述
interval number

The raw, un-rounded interval.

multiples Array <optional>

Allowed multiples.

magnitude number <optional>

The magnitude of the number.

allowDecimals boolean <optional>

Whether to allow decimals.

hasTickAmount boolean <optional>

If it has tickAmount, avoid landing on tick intervals lower than original.

Deprecated:
  • Yes
To Do:
  • Move this function to the Axis prototype. It is here only for historical reasons.
Returns:
number .

The normalized interval.

<static> numberFormat(number, decimals [, decimalPoint] [, thousandsSep])

Format a number and return a string based on input settings.

参数列表
名字 类型 参数 描述
number number

The input number to format.

decimals number

The amount of decimals. A value of -1 preserves the amount in the input number.

decimalPoint string <optional>

The decimal point, defaults to the one given in the lang options, or a dot.

thousandsSep string <optional>

The thousands separator, defaults to the one given in the lang options, or a space character.

Returns:
string .

The formatted number.

在线示例

<static> objectEach(obj, fn [, ctx])

Iterate over object key pairs in an object.

参数列表
名字 类型 参数 描述
obj *

The object to iterate over.

fn Highcharts.ObjectEachCallbackFunction

The iterator callback. It passes three arguments:

   * value - The property value.
   * key - The property key.
   * obj - The object that objectEach is being applied to.
ctx * <optional>

The context.

<static> offset(el)

Get the element's offset position, corrected for overflow: auto.

参数列表
名字 类型 描述
el Highcharts.HTMLDOMElement

The HTML element.

Returns:
Highcharts.OffsetObject .

An object containing left and top properties for the position in the page.

<static> pad(number, length [, padder])

Left-pad a string to a given length by adding a character repetetively.

参数列表
名字 类型 参数 默认值 描述
number number

The input string or number.

length number

The desired string length.

padder string <optional>
0

The character to pad with.

Returns:
string .

The padded string.

<static> pick(items)

Return the first value that is not null or undefined.

参数列表
名字 类型 参数 描述
items * <repeatable>

Variable number of arguments to inspect.

Returns:
* .

The value of the first argument that is not null or undefined.

<static> reduce(arr, fn, initialValue)

Reduce an array to a single value.

参数列表
名字 类型 描述
arr Array

The array to reduce.

fn function

The callback function. Return the reduced value. Receives 4 arguments: Accumulated/reduced value, current value, current array index, and the array.

initialValue *

The initial value of the accumulator.

Deprecated:
  • Yes
Returns:
* .

The reduced value.

<static> relativeLength(value, base [, offset])

Return a length based on either the integer value, or a percentage of a base.

参数列表
名字 类型 参数 默认值 描述
value Highcharts.RelativeSize

A percentage string or a number.

base number

The full length that represents 100%.

offset number <optional>
0

A pixel offset to apply for percentage values. Used internally in axis positioning.

Returns:
number .

The computed length.

<static> removeEvent(el [, type] [, fn])

Remove an event that was added with Highcharts#addEvent.

参数列表
名字 类型 参数 描述
el T

The element to remove events on.

type string <optional>

The type of events to remove. If undefined, all events are removed from the element.

fn Highcharts.EventCallbackFunction.<T> <optional>

The specific callback to remove. If undefined, all events that match the element and optionally the type are removed.

<static> seriesType(type, parent, options, props [, pointProps])

Factory to create new series prototypes.

参数列表
名字 类型 参数 描述
type string

The series type name.

parent string

The parent series type name. Use line to inherit from the basic Highcharts.Series object.

options *

The additional default options that is merged with the parent's options.

props *

The properties (functions and primitives) to set on the new prototype.

pointProps * <optional>

Members for a series-specific extension of the Highcharts.Point prototype if needed.

Returns:
Highcharts.Series .

The newly created prototype as extended from Highcharts.Series or its derivatives.

<static> setAnimation(animation, chart)

Set the global animation to either a given value, or fall back to the given chart's animation option.

参数列表
名字 类型 描述
animation boolean | Highcharts.AnimationOptionsObject

The animation object.

chart Highcharts.Chart

The chart instance.

To Do:
  • This function always relates to a chart, and sets a property on the renderer, so it should be moved to the SVGRenderer.

<static> setOptions(options)

Merge the default options with custom options and return the new options structure. Commonly used for defining reusable templates.

参数列表
名字 类型 描述
options Highcharts.Options

The new custom chart options.

Returns:
Highcharts.Options .

Updated options.

在线示例

<static> some(arr, fn, ctx)

Test whether at least one element in the array passes the test implemented by the provided function.

参数列表
名字 类型 描述
arr Array.<*>

The array to test

fn function

The function to run on each item. Return truty to pass the test. Receives arguments currentValue, index and array.

ctx *

The context.

Deprecated:
  • Yes
Returns:

<static> splat(obj)

Check if an element is an array, and if not, make it into an array.

参数列表
名字 类型 描述
obj *

The object to splat.

Returns:
Array .

The produced or original array.

<static> splitPath(path)

Utility for reading SVG paths directly.

参数列表
名字 类型 描述
path string
Requires:
  • module:modules/map
Returns:

<static> stableSort(arr, sortFunction)

Sort an object array and keep the order of equal items. The ECMAScript standard does not specify the behaviour when items are equal.

参数列表
名字 类型 描述
arr Array

The array to sort.

sortFunction function

The function to sort it with, like with regular Array.prototype.sort.

<static> stockChart( [renderTo], options [, callback])

Factory function for creating new stock charts. Creates a new Chart object with different default options than the basic Chart.

参数列表
名字 类型 参数 描述
renderTo string | Highcharts.HTMLDOMElement <optional>

The DOM element to render to, or its id.

options Highcharts.Options

The chart options structure as described in the options reference.

callback Highcharts.ChartCallbackFunction <optional>

A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread, but in Internet Explorer version 8 or less the chart is sometimes initialized before the document is ready, and in these cases the chart object will not be finished synchronously. As a consequence, code that relies on the newly built Chart object should always run in the callback. Defining a chart.events.load handler is equivalent.

Returns:
Highcharts.Chart .

The chart object.

Example
var chart = Highcharts.stockChart('container', {
    series: [{
        data: [1, 2, 3, 4, 5, 6, 7, 8, 9],
        pointInterval: 24 * 60 * 60 * 1000
    }]
});

<static> stop(el [, prop])

Stop running animation.

参数列表
名字 类型 参数 描述
el Highcharts.SVGElement

The SVGElement to stop animation on.

prop string <optional>

The property to stop animating. If given, the stop method will stop a single property from animating, while others continue.

To Do:
  • A possible extension to this would be to stop a single property, when we want to continue animating others. Then assign the prop to the timer in the Fx.run method, and check for the prop here. This would be an improvement in all cases where we stop the animation from .attr. Instead of stopping everything, we can just stop the actual attributes we're setting.

<static> syncTimeout(fn, delay [, parameter])

Set a timeout if the delay is given, otherwise perform the function synchronously.

参数列表
名字 类型 参数 描述
fn function

The function callback.

delay number

Delay in milliseconds.

parameter * <optional>

An optional parameter to send to the function callback.

Returns:
number .

An identifier for the timeout that can later be cleared with Highcharts.clearTimeout.

<static> uniqueKey()

Get a unique key for using in internal element id's and pointers. The key is composed of a random hash specific to this Highcharts instance, and a counter.

Returns:
string .

A unique key.

Example
var id = H.uniqueKey(); // => 'highcharts-x45f6hp-0'

<static> wrap(obj, method, func)

Wrap a method with extended functionality, preserving the original function.

参数列表
名字 类型 描述
obj *

The context object that the method belongs to. In real cases, this is often a prototype.

method string

The name of the method to extend.

func Highcharts.WrapProceedFunction

A wrapper function callback. This function is called with the same arguments as the original function, except that the original function is unshifted and passed as the first argument.

Type Definitions

AlignValue

The horizontal alignment of an element.

类型:
  • "center" | "left" | "right"

AxisCrosshairOptions

Options for crosshairs on axes.

类型:
  • Highcharts.XAxisCrosshairOptions | Highcharts.YAxisCrosshairOptions

AxisEventCallbackFunction(this)

参数列表
名字 类型 描述
this Highcharts.Axis

AxisExtremesTriggerValue

类型:
  • "navigator" | "pan" | "rangeSelectorButton" | "rangeSelectorInput" | "scrollbar" | "traverseUpButton" | "zoom"

AxisOptions

Options for axes.

类型:
  • Highcharts.XAxisOptions | Highcharts.YAxisOptions | Highcharts.ZAxisOptions

AxisPlotBandsLabelOptions

Options for plot band labels on axes.

类型:
  • Highcharts.XAxisPlotBandsLabelOptions | Highcharts.YAxisPlotBandsLabelOptions | Highcharts.ZAxisPlotBandsLabelOptions

AxisPlotBandsOptions

Options for plot bands on axes.

类型:
  • Highcharts.XAxisPlotBandsOptions | Highcharts.YAxisPlotBandsOptions | Highcharts.ZAxisPlotBandsOptions

AxisPlotLinesLabelOptions

Options for plot line labels on axes.

类型:
  • Highcharts.XAxisPlotLinesLabelOptions | Highcharts.YAxisPlotLinesLabelOptions | Highcharts.ZAxisPlotLinesLabelOptions

AxisPlotLinesOptions

Options for plot lines on axes.

类型:
  • Highcharts.XAxisPlotLinesOptions | Highcharts.YAxisPlotLinesOptions | Highcharts.ZAxisPlotLinesOptions

AxisPointBreakEventCallbackFunction(this, event)

参数列表
名字 类型 描述
this Highcharts.Axis
event Highcharts.AxisPointBreakEventObject

AxisSetExtremesEventCallbackFunction(this, event)

参数列表
名字 类型 描述
this Highcharts.Axis
event Highcharts.AxisSetExtremesEventObject

AxisTickPositionerCallbackFunction(this)

参数列表
名字 类型 描述
this Highcharts.Axis
Returns:

AxisTitleAlignValue

类型:
  • "high" | "low" | "middle"

AxisTypeValue

类型:
  • "linear" | "logarithmic" | "datetime" | "category" | "treegrid"

ButtonRelativeToValue

类型:
  • "plotBox" | "spacingBox"

ChartAddSeriesCallbackFunction(this, event)

Gets fired when a series is added to the chart after load time, using the addSeries method. Returning false prevents the series from being added.

参数列表
名字 类型 描述
this Highcharts.Chart

The chart on which the event occured.

event Highcharts.ChartAddSeriesEventObject

The event that occured.

ChartCallbackFunction(chart)

Callback for chart constructors.

参数列表
名字 类型 描述
chart Highcharts.Chart

Created chart.

ChartClickCallbackFunction(this, event)

Gets fired when clicking on the plot background.

参数列表
名字 类型 描述
this Highcharts.Chart

The chart on which the event occured.

event Highcharts.PointerEventObject

The event that occured.

ChartLoadCallbackFunction(this, event)

Gets fired when the chart is finished loading.

参数列表
名字 类型 描述
this Highcharts.Chart

The chart on which the event occured.

event global.Event

The event that occured.

ChartRedrawCallbackFunction(this, event)

Fires when the chart is redrawn, either after a call to chart.redraw() or after an axis, series or point is modified with the redraw option set to true.

参数列表
名字 类型 描述
this Highcharts.Chart

The chart on which the event occured.

event global.Event

The event that occured.

ChartRenderCallbackFunction(this, event)

Gets fired after initial load of the chart (directly after the load event), and after each redraw (directly after the redraw event).

参数列表
名字 类型 描述
this Highcharts.Chart

The chart on which the event occured.

event global.Event

The event that occured.

ChartSelectionCallbackFunction(this, event)

Gets fired when an area of the chart has been selected. The default action for the selection event is to zoom the chart to the selected area. It can be prevented by calling event.preventDefault() or return false.

参数列表
名字 类型 描述
this Highcharts.Chart

The chart on which the event occured.

event global.ChartSelectionContextObject

Event informations

Returns:
boolean | undefined .

Return false to prevent the default action, usually zoom.

ClipRectElement

A clipping rectangle that can be applied to one or more Highcharts.SVGElement instances. It is instanciated with the Highcharts.SVGRenderer#clipRect function and applied with the Highcharts.SVGElement#clip function.

类型:
Example
var circle = renderer.circle(100, 100, 100)
    .attr({ fill: 'red' })
    .add();
var clipRect = renderer.clipRect(100, 100, 100, 100);

// Leave only the lower right quarter visible
circle.clip(clipRect);

ColorAxisTypeValue

Color axis types

类型:
  • "linear" | "logarithmic"

ColorString

A valid color to be parsed and handled by Highcharts. Highcharts internally supports hex colors like #ffffff, rgb colors like rgb(255,255,255) and rgba colors like rgba(255,255,255,1). Other colors may be supported by the browsers and displayed correctly, but Highcharts is not able to process them and apply concepts like opacity and brightening.

类型:
  • string

CursorValue

All possible cursor styles.

类型:
  • "alias" | "all-scroll" | "auto" | "cell" | "col-resize" | "context-menu" | "copy" | "crosshair" | "default" | "e-resize" | "ew-resize" | "grab" | "grabbing" | "help" | "move" | "n-resize" | "ne-resize" | "nesw-resize" | "no-drop" | "none" | "not-allowed" | "ns-resize" | "nw-resize" | "nwse-resize" | "pointer" | "progress" | "row-resize" | "s-resize" | "se-resize" | "sw-resize" | "text" | "vertical-text" | "w-resize" | "wait" | "zoom-in" | "zoom-out"

DashStyleValue

All possible dash styles.

类型:
  • "Dash" | "DashDot" | "Dot" | "LongDash" | "LongDashDot" | "LongDashDotDot" | "ShortDash" | "ShortDashDot" | "ShortDashDotDot" | "ShortDot" | "Solid"

DataBeforeParseCallbackFunction(csv)

Callback function to modify the CSV before parsing it by the data module.

参数列表
名字 类型 描述
csv string

The CSV to modify.

Returns:
string .

The CSV to parse.

DataCompleteCallbackFunction(chartOptions)

Callback function that gets called after parsing data.

参数列表
名字 类型 描述
chartOptions Highcharts.ChartOptions

The chart options that were used.

DataDateFormatCallbackFunction(match)

Callback function that returns the correspondig Date object to a match.

参数列表
名字 类型 描述
match Array.<number>
Returns:

DataGroupingApproximationValue

类型:
  • "average" | "averages" | "open" | "high" | "low" | "close" | "sum"

DataLabelsFilterOperatorValue

The operator to compare by in the filter.

类型:
  • ">" | "<" | ">=" | "<=" | "==" | "==="

DataLabelsFormatterCallbackFunction(this)

Callback JavaScript function to format the data label as a string. Note that if a format is defined, the format takes precedence and the formatter is ignored.

参数列表
名字 类型 描述
this Highcharts.DataLabelsFormatterContextObject

Data label context to format

Returns:
string .

Formatted data label text

DataLabelsOverflowValue

Values for handling data labels that flow outside the plot area.

类型:
  • "allow" | "justify"

DataParseDateCallbackFunction(dateValue)

Callback function to parse string representations of dates into JavaScript timestamps (milliseconds since 1.1.1970).

参数列表
名字 类型 描述
dateValue string
Returns:
number .

Timestamp (milliseconds since 1.1.1970) as integer for Date class.

DataParsedCallbackFunction(columns)

Callback function to access the parsed columns, the two-dimentional input data array directly, before they are interpreted into series data and categories.

参数列表
名字 类型 描述
columns Array.<Array.<*>>

The parsed columns by the data module.

Returns:
boolean | undefined .

Return false to stop completion, or call this.complete() to continue async.

DrilldownCallbackFunction(this, e)

Gets fired when a drilldown point is clicked, before the new series is added. Note that when clicking a category label to trigger multiple series drilldown, one drilldown event is triggered per point in the category.

参数列表
名字 类型 描述
this Highcharts.Chart

The chart where the event occurs.

e Highcharts.DrilldownEventObject

The drilldown event.

DrillupAllCallbackFunction(this, e)

This gets fired after all the series have been drilled up. This is especially usefull in a chart with multiple drilldown series.

参数列表
名字 类型 描述
this Highcharts.Chart

The chart where the event occurs.

e Highcharts.DrillupAllEventObject

The final drillup event.

DrillupCallbackFunction(this, e)

Gets fired when drilling up from a drilldown series.

参数列表
名字 类型 描述
this Highcharts.Chart

The chart where the event occurs.

e Highcharts.DrillupEventObject

The drillup event.

EventCallbackFunction(this [, eventArguments])

The function callback to execute when the event is fired. The this context contains the instance, that fired the event.

参数列表
名字 类型 参数 描述
this T
eventArguments Highcharts.Dictionary.<*> <optional>

Event arguments.

ExportingAfterPrintCallbackFunction(chart, event)

Gets fired after a chart is printed through the context menu item or the Chart.print method.

参数列表
名字 类型 描述
chart Highcharts.Chart

The chart on which the event occured.

event global.Event

The event that occured.

ExportingBeforePrintCallbackFunction(chart, event)

Gets fired before a chart is printed through the context menu item or the Chart.print method.

参数列表
名字 类型 描述
chart Highcharts.Chart

The chart on which the event occured.

event global.Event

The event that occured.

ExportingErrorCallbackFunction(options, err)

Function to call if the offline-exporting module fails to export a chart on the client side.

参数列表
名字 类型 描述
options Highcharts.ExportingOptions

The exporting options.

err global.Error

The error from the module.

ExportingMimeTypeValue

Possible MIME types for exporting.

类型:
  • "image/png" | "image/jpeg" | "application/pdf" | "image/svg+xml"

FormatterCallbackFunction(this)

Formats data as a string. Usually the data is accessible throught the this keyword.

参数列表
名字 类型 描述
this T

Context to format

Returns:
string .

Formatted text

HTMLAttributes

An object of key-value pairs for HTML attributes.

类型:
  • Highcharts.Dictionary.<(boolean|number|string)>

HTMLDOMElement

An HTML DOM element. The type is a reference to the regular HTMLElement in the global scope.

类型:
  • global.HTMLElement
See also:

ObjectEachCallbackFunction(value, key, obj)

The iterator callback.

参数列表
名字 类型 描述
value *

The property value.

key string

The property key.

obj *

The object that objectEach is being applied to.

PlotNetworkDataLabelsFormatterCallbackFunction(this)

Formatter callback function.

参数列表
名字 类型 描述
this Highcharts.PlotNetworkDataLabelsFormatterContextObject | Highcharts.DataLabelsFormatterContextObject

Data label context to format

Returns:
string .

Formatted data label text

PlotPackedBubbleDataLabelsFormatterCallbackFunction(this)

Formatter callback function.

参数列表
名字 类型 描述
this Highcharts.PlotPackedBubbleDataLabelsFormatterContextObject | Highcharts.DataLabelsFormatterContextObject

Data label context to format

Returns:
string .

Formatted data label text

PointLegendItemClickCallbackFunction(this, event)

Gets fired when the legend item belonging to a point is clicked. The default action is to toggle the visibility of the point. This can be prevented by returning false or calling event.preventDefault().

参数列表
名字 类型 描述
this Highcharts.Point

The point on which the event occured.

event Highcharts.PointLegendItemClickEventObject

The event that occured.

RelativeSize

If a number is given, it defines the pixel length. If a percentage string is given, like for example '50%', the setting defines a length relative to a base size, for example the size of a container.

类型:
  • number | string

ScreenReaderClickCallbackFunction(evt)

参数列表
名字 类型 描述
evt global.MouseEvent

Mouse click event

Returns:

ScreenReaderFormatterCallbackFunction(context)

Creates a formatted string for the screen reader module.

参数列表
名字 类型 描述
context T

Context to format

Returns:
string .

Formatted string for the screen reader module.

SeriesAfterAnimateCallbackFunction(this, event)

Function callback when a series has been animated.

参数列表
名字 类型 描述
this Highcharts.Series

The series where the event occured.

event Highcharts.SeriesAfterAnimateEventObject

Event arguments.

SeriesCheckboxClickCallbackFunction(this, event)

Function callback when the checkbox next to the series' name in the legend is clicked.

参数列表
名字 类型 描述
this Highcharts.Series

The series where the event occured.

event Highcharts.SeriesCheckboxClickEventObject

Event arguments.

SeriesClickCallbackFunction(this, event)

Function callback when a series is clicked. Return false to cancel toogle actions.

参数列表
名字 类型 描述
this Highcharts.Series

The series where the event occured.

event Highcharts.SeriesClickEventObject

Event arguments.

SeriesHideCallbackFunction(this, event)

Gets fired when the series is hidden after chart generation time, either by clicking the legend item or by calling .hide().

参数列表
名字 类型 描述
this Highcharts.Series

The series where the event occured.

event global.Event

The event that occured.

SeriesLegendItemClickCallbackFunction(this, event)

Gets fired when the legend item belonging to the series is clicked. The default action is to toggle the visibility of the series. This can be prevented by returning false or calling event.preventDefault().

参数列表
名字 类型 描述
this Highcharts.Series

The series where the event occured.

event Highcharts.SeriesLegendItemClickEventObject

The event that occured.

SeriesLegendItemClickCallbackFunction(this, event)

Gets fired when the legend item belonging to a series is clicked. The default action is to toggle the visibility of the series. This can be prevented by returning false or calling event.preventDefault().

参数列表
名字 类型 描述
this Highcharts.Series

The series where the event occured.

event Highcharts.SeriesLegendItemClickEventObject

The event that occured.

SeriesLinecapValue

The SVG value used for the stroke-linecap and stroke-linejoin of a line graph.

类型:
  • "butt" | "round" | "square" | string

SeriesMouseOutCallbackFunction(this, event)

Gets fired when the mouse leaves the graph.

参数列表
名字 类型 描述
this Highcharts.Series

Series where the event occured.

event global.Event

Event that occured.

SeriesMouseOverCallbackFunction(this, event)

Gets fired when the mouse enters the graph.

参数列表
名字 类型 描述
this Highcharts.Series

Series where the event occured.

event global.Event

Event that occured.

SeriesPointClickCallbackFunction(this, event)

Function callback when a series point is clicked. Return false to cancel the action.

参数列表
名字 类型 描述
this Highcharts.Point

The point where the event occured.

event Highcharts.SeriesPointClickEventObject

Event arguments.

SeriesPointMouseOutCallbackFunction(this, event)

Gets fired when the mouse leaves the area close to the point.

参数列表
名字 类型 描述
this Highcharts.Point

Point where the event occured.

event global.Event

Event that occured.

SeriesPointMouseOverCallbackFunction(this, event)

Gets fired when the mouse enters the area close to the point.

参数列表
名字 类型 描述
this Highcharts.Point

Point where the event occured.

event global.Event

Event that occured.

SeriesPointRemoveCallbackFunction(this, event)

Gets fired when the point is removed using the .remove() method.

参数列表
名字 类型 描述
this Highcharts.Point

Point where the event occured.

event global.Event

Event that occured.

SeriesPointSelectCallbackFunction(this, event)

Gets fired when the point is selected either programmatically or following a click on the point.

参数列表
名字 类型 描述
this Highcharts.Point

Point where the event occured.

event Highcharts.SeriesPointSelectEventObject

Event that occured.

SeriesPointUnselectCallbackFunction(this, event)

Fires when the point is unselected either programmatically or following a click on the point.

参数列表
名字 类型 描述
this Highcharts.Point

Point where the event occured.

event Highcharts.SeriesPointUnselectEventObject

Event that occured.

SeriesPointUpdateCallbackFunction(this, event)

Gets fired when the point is updated programmatically through the .update() method.

参数列表
名字 类型 描述
this Highcharts.Point

Point where the event occured.

event Highcharts.SeriesPointUpdateEventObject

Event that occured.

SeriesShowCallbackFunction(this, event)

Gets fired when the series is shown after chart generation time, either by clicking the legend item or by calling .show().

参数列表
名字 类型 描述
this Highcharts.Series

Series where the event occured.

event global.Event

Event that occured.

SVGDOMElement

An SVG DOM element. The type is a reference to the regular SVGElement in the global scope.

类型:
  • globals.GlobalSVGElement
See also:

SVGPathArray

Array of path commands, that will go into the d attribute of an SVG element.

类型:

SVGPathCommand

Possible path commands in a SVG path array.

类型:
  • string

SymbolKeyValue

Can be one of arc, callout, circle, diamond, square, triangle, and triangle-down. Symbols are used internally for point markers, button and label borders and backgrounds, or custom shapes. Extendable by adding to Highcharts.SVGRenderer#symbols.

类型:
  • "arc" | "callout" | "circle" | "diamond" | "square" | "triangle" | "triangle-down"

TimeFormatCallbackFunction(timestamp)

Function of an additional date format specifier.

参数列表
名字 类型 描述
timestamp number

The time to format.

Returns:
string .

The formatted portion of the date.

VerticalAlignValue

The vertical alignment of an element.

类型:
  • "bottom" | "middle" | "top"

WrapProceedFunction( [arg1] [, arg2] [, arg3])

Proceed function to call original (wrapped) function.

参数列表
名字 类型 参数 描述
arg1 * <optional>

Optional argument. Without any arguments defaults to first argument of the wrapping function.

arg2 * <optional>

Optional argument. Without any arguments defaults to second argument of the wrapping function.

arg3 * <optional>

Optional argument. Without any arguments defaults to third argument of the wrapping function.

Returns:
* .

Return value of the original function.

XAxisCrosshairLabelFormatterCallbackFunction(this, value)

Formatter function for the text of a crosshair label.

参数列表
名字 类型 描述
this Highcharts.Axis

Axis context

value number

Y value of the data point