Class: Exporting

Highcharts. Exporting

new Exporting(chart)

The Exporting class provides methods for exporting charts to images. If the exporting module is loaded, this class is instantiated on the chart and available through the chart.exporting property. Read more about the exporting module.

Parameters:
Name Type Description
chart Highcharts.Chart

The chart instance.

Methods

downloadCSV()

Generates a data URL of CSV for local download in the browser. This is the default action for a click on the 'Download CSV' button.

See Highcharts.Exporting#getCSV to get the CSV data itself.

Requires:
  • module:modules/exporting
  • module:modules/export-data

downloadXLS()

Generates a data URL of an XLS document for local download in the browser. This is the default action for a click on the 'Download XLS' button.

See Highcharts.Exporting#getTable to get the table data itself.

Requires:
  • module:modules/exporting
  • module:modules/export-data

<async> exportChart( [exportingOptions] [, chartOptions])

Submit an SVG version of the chart along with some parameters for local conversion (PNG, JPEG, and SVG) or conversion on a server (PDF).

Parameters:
Name Type Argument Description
exportingOptions Highcharts.ExportingOptions <optional>

Exporting options in addition to those defined in exporting.

chartOptions Highcharts.Options <optional>

Additional chart options for the exported chart. For example a different background color can be added here, or dataLabels for export only.

Requires:
  • module:modules/exporting
Try it

getCSV( [useLocalDecimalPoint])

Returns the current chart data as a CSV string.

Parameters:
Name Type Argument Description
useLocalDecimalPoint boolean <optional>

Whether to use the local decimal point as detected from the browser. This makes it easier to export data to Excel in the same locale as the user is.

Requires:
  • module:modules/exporting
  • module:modules/export-data
Returns:
string .

CSV representation of the data.

getChartHTML( [applyStyleSheets])

Return the unfiltered innerHTML of the chart container. Used as hook for plugins. In styled mode, it also takes care of inlining CSS style rules.

Parameters:
Name Type Argument Description
applyStyleSheets boolean <optional>

whether or not to apply the style sheets.

See also:
  • Highcharts.Chart#getSVG
Requires:
  • module:modules/exporting
Returns:
string .

The unfiltered SVG of the chart.

getDataRows( [multiLevelHeaders])

Returns a two-dimensional array containing the current chart data.

Parameters:
Name Type Argument Description
multiLevelHeaders boolean <optional>

Use multilevel headers for the rows by default. Adds an extra row with top level headers. If a custom columnHeaderFormatter is defined, this can override the behavior.

Requires:
  • module:modules/exporting
  • module:modules/export-data
Fires:
  • Highcharts.Chart#event:exportData
Returns:
Array.<Array.<(number|string)>> .

The current chart data

getFilename()

Get the default file name used for exported charts. By default it creates a file name based on the chart title.

Requires:
  • module:modules/exporting
Returns:
string .

A file name without extension.

getSVG( [chartOptions])

Return an SVG representation of the chart.

Parameters:
Name Type Argument Description
chartOptions Highcharts.Options <optional>

Additional chart options for the generated SVG representation. For collections like xAxis, yAxis or series, the additional options is either merged in to the original item of the same id, or to the first item if a common id is not found.

Requires:
  • module:modules/exporting
Fires:
  • Highcharts.Chart#event:getSVG
Returns:
string .

The SVG representation of the rendered chart.

Try it

getTable( [useLocalDecimalPoint])

Build a HTML table with the chart's current data.

Parameters:
Name Type Argument Description
useLocalDecimalPoint boolean <optional>

Whether to use the local decimal point as detected from the browser. This makes it easier to export data to Excel in the same locale as the user is.

Requires:
  • module:modules/exporting
  • module:modules/export-data
Fires:
  • Highcharts.Chart#event:afterGetTable
Returns:
string .

HTML representation of the data.

Try it

hideData()

Hide the data table when visible.

Requires:
  • module:modules/exporting
  • module:modules/export-data

print()

Clears away other elements in the page and prints the chart as it is displayed. By default, when the exporting module is enabled, a context button with a drop down menu in the upper right corner accesses this function.

Requires:
  • module:modules/exporting
Fires:
  • Highcharts.Chart#event:beforePrint
  • Highcharts.Chart#event:afterPrint
Try it

viewData()

View the data in a table below the chart.

Requires:
  • module:modules/exporting
  • module:modules/export-data
Fires:
  • Highcharts.Chart#event:afterViewData