app/assets/javascripts/highcharts/modules/exporting.js in highcharts-rails-5.0.14 vs app/assets/javascripts/highcharts/modules/exporting.js in highcharts-rails-6.0.0
- old
+ new
@@ -1,7 +1,7 @@
/**
- * @license Highcharts JS v5.0.14 (2017-07-28)
+ * @license Highcharts JS v6.0.0 (2017-10-04)
* Exporting module
*
* (c) 2010-2017 Torstein Honsi
*
* License: www.highcharts.com/license
@@ -47,40 +47,217 @@
symbols = H.Renderer.prototype.symbols,
isMSBrowser = /Edge\/|Trident\/|MSIE /.test(userAgent),
isFirefoxBrowser = /firefox/i.test(userAgent);
// Add language
- /**
- * @apioption lang
- */
extend(defaultOptions.lang, {
+ /**
+ * Exporting module only. The text for the menu item to print the chart.
+ *
+ * @type {String}
+ * @default Print chart
+ * @since 3.0.1
+ * @apioption lang.printChart
+ */
printChart: 'Print chart',
+ /**
+ * Exporting module only. The text for the PNG download menu item.
+ *
+ * @type {String}
+ * @default Download PNG image
+ * @since 2.0
+ * @apioption lang.downloadPNG
+ */
downloadPNG: 'Download PNG image',
+ /**
+ * Exporting module only. The text for the JPEG download menu item.
+ *
+ * @type {String}
+ * @default Download JPEG image
+ * @since 2.0
+ * @apioption lang.downloadJPEG
+ */
downloadJPEG: 'Download JPEG image',
+ /**
+ * Exporting module only. The text for the PDF download menu item.
+ *
+ * @type {String}
+ * @default Download PDF document
+ * @since 2.0
+ * @apioption lang.downloadPDF
+ */
downloadPDF: 'Download PDF document',
+ /**
+ * Exporting module only. The text for the SVG download menu item.
+ *
+ * @type {String}
+ * @default Download SVG vector image
+ * @since 2.0
+ * @apioption lang.downloadSVG
+ */
downloadSVG: 'Download SVG vector image',
+ /**
+ * Exporting module menu. The tooltip title for the context menu holding
+ * print and export menu items.
+ *
+ * @type {String}
+ * @default Chart context menu
+ * @since 3.0
+ * @apioption lang.contextButtonTitle
+ */
contextButtonTitle: 'Chart context menu'
});
// Buttons and menus are collected in a separate config option set called 'navigation'.
// This can be extended later to add control buttons like zoom and pan right click menus.
-
- /**
- * @apioption navigation
- */
defaultOptions.navigation = {
buttonOptions: {
theme: {},
+
+ /**
+ * Whether to enable buttons.
+ *
+ * @type {Boolean}
+ * @sample {highcharts} highcharts/navigation/buttonoptions-enabled/ Exporting module loaded but buttons disabled
+ * @sample {highstock} highcharts/navigation/buttonoptions-enabled/ Exporting module loaded but buttons disabled
+ * @sample {highmaps} highcharts/navigation/buttonoptions-enabled/ Exporting module loaded but buttons disabled
+ * @default true
+ * @since 2.0
+ * @apioption navigation.buttonOptions.enabled
+ */
+
+ /**
+ * The pixel size of the symbol on the button.
+ *
+ * @type {Number}
+ * @sample {highcharts} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @sample {highstock} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @sample {highmaps} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @default 14
+ * @since 2.0
+ * @apioption navigation.buttonOptions.symbolSize
+ */
symbolSize: 14,
+
+ /**
+ * The x position of the center of the symbol inside the button.
+ *
+ * @type {Number}
+ * @sample {highcharts} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @sample {highstock} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @sample {highmaps} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @default 12.5
+ * @since 2.0
+ * @apioption navigation.buttonOptions.symbolX
+ */
symbolX: 12.5,
+
+ /**
+ * The y position of the center of the symbol inside the button.
+ *
+ * @type {Number}
+ * @sample {highcharts} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @sample {highstock} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @sample {highmaps} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @default 10.5
+ * @since 2.0
+ * @apioption navigation.buttonOptions.symbolY
+ */
symbolY: 10.5,
+
+ /**
+ * Alignment for the buttons.
+ *
+ * @validvalue ["left", "center", "right"]
+ * @type {String}
+ * @sample {highcharts} highcharts/navigation/buttonoptions-align/ Center aligned
+ * @sample {highstock} highcharts/navigation/buttonoptions-align/ Center aligned
+ * @sample {highmaps} highcharts/navigation/buttonoptions-align/ Center aligned
+ * @default right
+ * @since 2.0
+ * @apioption navigation.buttonOptions.align
+ */
align: 'right',
+
+ /**
+ * The pixel spacing between buttons.
+ *
+ * @type {Number}
+ * @default 3
+ * @since 2.0
+ * @apioption navigation.buttonOptions.buttonSpacing
+ */
buttonSpacing: 3,
+
+ /**
+ * Pixel height of the buttons.
+ *
+ * @type {Number}
+ * @sample {highcharts} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @sample {highstock} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @sample {highmaps} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @default 22
+ * @since 2.0
+ * @apioption navigation.buttonOptions.height
+ */
height: 22,
- // text: null,
+
+ /**
+ * A text string to add to the individual button.
+ *
+ * @type {String}
+ * @sample {highcharts} highcharts/exporting/buttons-text/ Full text button
+ * @sample {highcharts} highcharts/exporting/buttons-text-symbol/ Combined symbol and text
+ * @sample {highstock} highcharts/exporting/buttons-text/ Full text button
+ * @sample {highstock} highcharts/exporting/buttons-text-symbol/ Combined symbol and text
+ * @sample {highmaps} highcharts/exporting/buttons-text/ Full text button
+ * @sample {highmaps} highcharts/exporting/buttons-text-symbol/ Combined symbol and text
+ * @default null
+ * @since 3.0
+ * @apioption navigation.buttonOptions.text
+ */
+
+ /**
+ * The vertical alignment of the buttons. Can be one of "top", "middle"
+ * or "bottom".
+ *
+ * @validvalue ["top", "middle", "bottom"]
+ * @type {String}
+ * @sample {highcharts} highcharts/navigation/buttonoptions-verticalalign/ Buttons at lower right
+ * @sample {highstock} highcharts/navigation/buttonoptions-verticalalign/ Buttons at lower right
+ * @sample {highmaps} highcharts/navigation/buttonoptions-verticalalign/ Buttons at lower right
+ * @default top
+ * @since 2.0
+ * @apioption navigation.buttonOptions.verticalAlign
+ */
verticalAlign: 'top',
+
+ /**
+ * The pixel width of the button.
+ *
+ * @type {Number}
+ * @sample {highcharts} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @sample {highstock} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @sample {highmaps} highcharts/navigation/buttonoptions-height/ Bigger buttons
+ * @default 24
+ * @since 2.0
+ * @apioption navigation.buttonOptions.width
+ */
width: 24
+
+ /**
+ * The vertical offset of the button's position relative to its
+ * `verticalAlign`.
+ *
+ * @type {Number}
+ * @sample {highcharts} highcharts/navigation/buttonoptions-verticalalign/ Buttons at lower right
+ * @sample {highstock} highcharts/navigation/buttonoptions-verticalalign/ Buttons at lower right
+ * @sample {highmaps} highcharts/navigation/buttonoptions-verticalalign/ Buttons at lower right
+ * @default 0
+ * @since 2.0
+ * @apioption navigation.buttonOptions.y
+ */
}
};
// Presentational attributes
@@ -96,110 +273,73 @@
/**
* CSS styles for the popup menu appearing by default when the export
* icon is clicked. This menu is rendered in HTML.
*
* @type {CSSObject}
- * @see In [styled mode](http://www.highcharts.com/docs/chart-design-and-
- * style/style-by-css), the menu is styled with the `.highcharts-menu`
+ * @see In styled mode, the menu is styled with the `.highcharts-menu`
* class.
* @sample {highcharts} highcharts/navigation/menustyle/ Light gray menu background
* @sample {highstock} highcharts/navigation/menustyle/ Light gray menu background
* @sample {highmaps} highcharts/navigation/menustyle/ Light gray menu background
* @default { "border": "1px solid #999999", "background": "#ffffff", "padding": "5px 0" }
* @since 2.0
- * @product highcharts highstock highmaps
*/
menuStyle: {
-
- /**
- */
border: '1px solid #999999',
-
- /**
- */
background: '#ffffff',
-
- /**
- */
padding: '5px 0'
},
/**
* CSS styles for the individual items within the popup menu appearing
* by default when the export icon is clicked. The menu items are rendered
* in HTML.
*
* @type {CSSObject}
- * @see In [styled mode](http://www.highcharts.com/docs/chart-design-and-
- * style/style-by-css), the menu items are styled with the `.highcharts-
- * menu-item` class.
+ * @see In styled mode, the menu items are styled with the `.highcharts-menu-item` class.
* @sample {highcharts} highcharts/navigation/menuitemstyle/ Add a grey stripe to the left
* @sample {highstock} highcharts/navigation/menuitemstyle/ Add a grey stripe to the left
* @sample {highmaps} highcharts/navigation/menuitemstyle/ Add a grey stripe to the left
* @default { "padding": "0.5em 1em", "color": "#333333", "background": "none" }
* @since 2.0
- * @product highcharts highstock highmaps
*/
menuItemStyle: {
-
- /**
- */
padding: '0.5em 1em',
-
- /**
- */
background: 'none',
-
- /**
- */
color: '#333333',
-
/**
+ * Defaults to `14px` on touch devices and `11px` on desktop.
+ * @type {String}
*/
fontSize: isTouchDevice ? '14px' : '11px',
-
- /**
- */
transition: 'background 250ms, color 250ms'
},
/**
* CSS styles for the hover state of the individual items within the
* popup menu appearing by default when the export icon is clicked.
* The menu items are rendered in HTML.
*
* @type {CSSObject}
- * @see In [styled mode](http://www.highcharts.com/docs/chart-design-and-
- * style/style-by-css), the menu items are styled with the `.highcharts-
- * menu-item` class.
+ * @see In styled mode, the menu items are styled with the `.highcharts-menu-item` class.
* @sample {highcharts} highcharts/navigation/menuitemhoverstyle/ Bold text on hover
* @sample {highstock} highcharts/navigation/menuitemhoverstyle/ Bold text on hover
* @sample {highmaps} highcharts/navigation/menuitemhoverstyle/ Bold text on hover
* @default { "background": "#335cad", "color": "#ffffff" }
* @since 2.0
- * @product highcharts highstock highmaps
*/
menuItemHoverStyle: {
-
- /**
- */
background: '#335cad',
-
- /**
- */
color: '#ffffff'
},
/**
* A collection of options for buttons appearing in the exporting module.
*
*
- * In [styled mode](http://www.highcharts.com/docs/chart-design-and-
- * style/style-by-css), the buttons are styled with the `.highcharts-
- * contextbutton` and `.highcharts-button-symbol` class.
- *
- * @product highcharts highstock highmaps
+ * In styled mode, the buttons are styled with the `.highcharts-contextbutton` and `.highcharts-button-symbol` class.
+ *
*/
buttonOptions: {
/**
* Fill color for the symbol within the button.
@@ -208,11 +348,10 @@
* @sample {highcharts} highcharts/navigation/buttonoptions-symbolfill/ Blue symbol stroke for one of the buttons
* @sample {highstock} highcharts/navigation/buttonoptions-symbolfill/ Blue symbol stroke for one of the buttons
* @sample {highmaps} highcharts/navigation/buttonoptions-symbolfill/ Blue symbol stroke for one of the buttons
* @default #666666
* @since 2.0
- * @product highcharts highstock highmaps
*/
symbolFill: '#666666',
/**
* The color of the symbol's stroke or line.
@@ -221,11 +360,10 @@
* @sample {highcharts} highcharts/navigation/buttonoptions-symbolstroke/ Blue symbol stroke
* @sample {highstock} highcharts/navigation/buttonoptions-symbolstroke/ Blue symbol stroke
* @sample {highmaps} highcharts/navigation/buttonoptions-symbolstroke/ Blue symbol stroke
* @default #666666
* @since 2.0
- * @product highcharts highstock highmaps
*/
symbolStroke: '#666666',
/**
* The pixel stroke width of the symbol on the button.
@@ -234,11 +372,10 @@
* @sample {highcharts} highcharts/navigation/buttonoptions-height/ Bigger buttons
* @sample {highstock} highcharts/navigation/buttonoptions-height/ Bigger buttons
* @sample {highmaps} highcharts/navigation/buttonoptions-height/ Bigger buttons
* @default 1
* @since 2.0
- * @product highcharts highstock highmaps
*/
symbolStrokeWidth: 3,
/**
* A configuration object for the button theme. The object accepts
@@ -249,23 +386,24 @@
* @type {Object}
* @sample {highcharts} highcharts/navigation/buttonoptions-theme/ Theming the buttons
* @sample {highstock} highcharts/navigation/buttonoptions-theme/ Theming the buttons
* @sample {highmaps} highcharts/navigation/buttonoptions-theme/ Theming the buttons
* @since 3.0
- * @product highcharts highstock highmaps
*/
theme: {
-
/**
+ * The default fill exists only to capture hover events.
+ * @type {String}
*/
- fill: '#ffffff', // capture hover
-
+ fill: '#ffffff',
/**
+ * @type {String}
*/
stroke: 'none',
-
/**
+ * @type {Number}
+ * @default 5
*/
padding: 5
}
}
});
@@ -278,100 +416,261 @@
* Options for the exporting module. For an overview on the matter, see [the docs](http://www.highcharts.com/docs/export-module/export-module-overview).
* @type {Object}
* @optionparent exporting
*/
defaultOptions.exporting = {
- //enabled: true,
- //filename: 'chart',
/**
+ * Experimental setting to allow HTML inside the chart (added through
+ * the `useHTML` options), directly in the exported image. This allows
+ * you to preserve complicated HTML structures like tables or bi-directional
+ * text in exported charts.
+ *
+ * Disclaimer: The HTML is rendered in a `foreignObject` tag in the
+ * generated SVG. The official export server is based on PhantomJS,
+ * which supports this, but other SVG clients, like Batik, does not
+ * support it. This also applies to downloaded SVG that you want to
+ * open in a desktop client.
+ *
+ * @type {Boolean}
+ * @default false
+ * @since 4.1.8
+ * @apioption exporting.allowHTML
+ */
+
+ /**
+ * Additional chart options to be merged into an exported chart. For
+ * example, a common use case is to add data labels to improve readability
+ * of the exported chart, or to add a printer-friendly color scheme.
+ *
+ * @type {Object}
+ * @sample {highcharts} highcharts/exporting/chartoptions-data-labels/
+ * Added data labels
+ * @sample {highstock} highcharts/exporting/chartoptions-data-labels/
+ * Added data labels
+ * @default null
+ * @apioption exporting.chartOptions
+ */
+
+ /**
+ * Whether to enable the exporting module. Disabling the module will
+ * hide the context button, but API methods will still be available.
+ *
+ * @type {Boolean}
+ * @sample {highcharts} highcharts/exporting/enabled-false/
+ * Exporting module is loaded but disabled
+ * @sample {highstock} highcharts/exporting/enabled-false/
+ * Exporting module is loaded but disabled
+ * @default true
+ * @since 2.0
+ * @apioption exporting.enabled
+ */
+
+ /**
+ * Function to call if the offline-exporting module fails to export
+ * a chart on the client side, and [fallbackToExportServer](#exporting.
+ * fallbackToExportServer) is disabled. If left undefined, an exception
+ * is thrown instead.
+ *
+ * @type {Function}
+ * @see [fallbackToExportServer](#exporting.fallbackToExportServer)
+ * @default undefined
+ * @since 5.0.0
+ * @apioption exporting.error
+ */
+
+ /**
+ * Whether or not to fall back to the export server if the offline-exporting
+ * module is unable to export the chart on the client side.
+ *
+ * @type {Boolean}
+ * @default true
+ * @since 4.1.8
+ * @apioption exporting.fallbackToExportServer
+ */
+
+ /**
+ * The filename, without extension, to use for the exported chart.
+ *
+ * @type {String}
+ * @sample {highcharts} highcharts/exporting/filename/ Custom file name
+ * @sample {highstock} highcharts/exporting/filename/ Custom file name
+ * @default chart
+ * @since 2.0
+ * @apioption exporting.filename
+ */
+
+ /**
+ * An object containing additional attributes for the POST form that
+ * sends the SVG to the export server. For example, a `target` can be
+ * set to make sure the generated image is received in another frame,
+ * or a custom `enctype` or `encoding` can be set.
+ *
+ * @type {Object}
+ * @since 3.0.8
+ * @apioption exporting.formAttributes
+ */
+
+ /**
+ * Path where Highcharts will look for export module dependencies to
+ * load on demand if they don't already exist on `window`. Should currently
+ * point to location of [CanVG](https://github.com/canvg/canvg) library,
+ * [RGBColor.js](https://github.com/canvg/canvg), [jsPDF](https://github.
+ * com/yWorks/jsPDF) and [svg2pdf.js](https://github.com/yWorks/svg2pdf.
+ * js), required for client side export in certain browsers.
+ *
+ * @type {String}
+ * @default https://code.highcharts.com/{version}/lib
+ * @since 5.0.0
+ * @apioption exporting.libURL
+ */
+
+ /**
+ * Analogous to [sourceWidth](#exporting.sourceWidth).
+ *
+ * @type {Number}
+ * @since 3.0
+ * @apioption exporting.sourceHeight
+ */
+
+ /**
+ * The width of the original chart when exported, unless an explicit
+ * [chart.width](#chart.width) is set. The width exported raster image
+ * is then multiplied by [scale](#exporting.scale).
+ *
+ * @type {Number}
+ * @sample {highcharts} highcharts/exporting/sourcewidth/ Source size demo
+ * @sample {highstock} highcharts/exporting/sourcewidth/ Source size demo
+ * @sample {highmaps} maps/exporting/sourcewidth/ Source size demo
+ * @since 3.0
+ * @apioption exporting.sourceWidth
+ */
+
+ /**
+ * The pixel width of charts exported to PNG or JPG. As of Highcharts
+ * 3.0, the default pixel width is a function of the [chart.width](#chart.
+ * width) or [exporting.sourceWidth](#exporting.sourceWidth) and the
+ * [exporting.scale](#exporting.scale).
+ *
+ * @type {Number}
+ * @sample {highcharts} highcharts/exporting/width/
+ * Export to 200px wide images
+ * @sample {highstock} highcharts/exporting/width/
+ * Export to 200px wide images
+ * @default undefined
+ * @since 2.0
+ * @apioption exporting.width
+ */
+
+ /**
* Default MIME type for exporting if `chart.exportChart()` is called
* without specifying a `type` option. Possible values are `image/png`,
* `image/jpeg`, `application/pdf` and `image/svg+xml`.
*
* @validvalue ["image/png", "image/jpeg", "application/pdf", "image/svg+xml"]
- * @type {String}
- * @default image/png
* @since 2.0
- * @product highcharts highstock highmaps
*/
type: 'image/png',
/**
* The URL for the server module converting the SVG string to an image
* format. By default this points to Highchart's free web service.
*
* @type {String}
* @default https://export.highcharts.com
* @since 2.0
- * @product highcharts highstock highmaps
*/
url: 'https://export.highcharts.com/',
- //width: undefined,
-
/**
* When printing the chart from the menu item in the burger menu, if
* the on-screen chart exceeds this width, it is resized. After printing
* or cancelled, it is restored. The default width makes the chart
* fit into typical paper format. Note that this does not affect the
* chart when printing the web page as a whole.
*
* @type {Number}
* @default 780
* @since 4.2.5
- * @product highcharts highstock highmaps
*/
printMaxWidth: 780,
/**
* Defines the scale or zoom factor for the exported image compared
* to the on-screen display. While for instance a 600px wide chart
* may look good on a website, it will look bad in print. The default
* scale of 2 makes this chart export to a 1200px PNG or JPG.
*
- * @type {Number}
* @see [chart.width](#chart.width), [exporting.sourceWidth](#exporting.
* sourceWidth)
* @sample {highcharts} highcharts/exporting/scale/ Scale demonstrated
* @sample {highstock} highcharts/exporting/scale/ Scale demonstrated
* @sample {highmaps} maps/exporting/scale/ Scale demonstrated
- * @default 2
* @since 3.0
- * @product highcharts highstock highmaps
*/
scale: 2,
/**
* Options for the export related buttons, print and export. In addition
* to the default buttons listed here, custom buttons can be added.
* See [navigation.buttonOptions](#navigation.buttonOptions) for general
* options.
- *
- * @product highcharts highstock highmaps
+ *
*/
buttons: {
/**
* Options for the export button.
*
- * In [styled mode](http://www.highcharts.com/docs/chart-design-and-
- * style/style-by-css), export button styles can be applied with the
+ * In styled mode, export button styles can be applied with the
* `.highcharts-contextbutton` class.
*
* @extends navigation.buttonOptions
- * @product highcharts highstock highmaps
*/
contextButton: {
/**
+ * A click handler callback to use on the button directly instead of
+ * the popup menu.
+ *
+ * @type {Function}
+ * @sample {highcharts} highcharts/exporting/buttons-contextbutton-onclick/ Skip the menu and export the chart directly
+ * @sample {highstock} highcharts/exporting/buttons-contextbutton-onclick/ Skip the menu and export the chart directly
+ * @sample {highmaps} highcharts/exporting/buttons-contextbutton-onclick/ Skip the menu and export the chart directly
+ * @since 2.0
+ * @apioption exporting.buttons.contextButton.onclick
*/
+
+ /**
+ * See [navigation.buttonOptions.symbolFill](#navigation.buttonOptions.symbolFill).
+ *
+ * @type {Color}
+ * @default #666666
+ * @since 2.0
+ * @apioption exporting.buttons.contextButton.symbolFill
+ */
+
+ /**
+ * The horizontal position of the button relative to the `align`
+ * option.
+ *
+ * @type {Number}
+ * @default -10
+ * @since 2.0
+ * @apioption exporting.buttons.contextButton.x
+ */
+
+ /**
+ * The class name of the context button.
+ * @type {String}
+ */
className: 'highcharts-contextbutton',
/**
+ * The class name of the menu appearing from the button.
+ * @type {String}
*/
menuClassName: 'highcharts-contextmenu',
- //x: -10,
/**
* The symbol for the button. Points to a definition function in
* the `Highcharts.Renderer.symbols` collection. The default `exportIcon`
* function is part of the exporting module.
@@ -381,38 +680,50 @@
* @sample {highcharts} highcharts/exporting/buttons-contextbutton-symbol/ Use a circle for symbol
* @sample {highstock} highcharts/exporting/buttons-contextbutton-symbol/ Use a circle for symbol
* @sample {highmaps} highcharts/exporting/buttons-contextbutton-symbol/ Use a circle for symbol
* @default menu
* @since 2.0
- * @product highcharts highstock highmaps
*/
symbol: 'menu',
/**
+ * The key to a [lang](#lang) option setting that is used for the
+ * button`s title tooltip. When the key is `contextButtonTitle`, it
+ * refers to [lang.contextButtonTitle](#lang.contextButtonTitle)
+ * that defaults to "Chart context menu".
+ * @type {String}
*/
_titleKey: 'contextButtonTitle',
/**
- * A collection of config options for the menu items. Each options
- * object consists of a `text` option which is a string to show in
- * the menu item, as well as an `onclick` parameter which is a callback
- * function to run on click.
+ * A collection of strings pointing to config options for the menu
+ * items. The config options are defined in the
+ * `menuItemDefinitions` option.
*
* By default, there is the "Print" menu item plus one menu item
- * for each of the available export types. Menu items can be customized
- * by defining a new array of items and assigning `null` to unwanted
- * positions (see override example below).
+ * for each of the available export types.
+ *
+ * Defaults to
+ * <pre>
+ * [
+ * 'printChart',
+ * 'separator',
+ * 'downloadPNG',
+ * 'downloadJPEG',
+ * 'downloadPDF',
+ * 'downloadSVG'
+ * ]
+ * </pre>
*
- * @type {Array<Object>}
- * @sample {highcharts} highcharts/exporting/buttons-contextbutton-onclick/ Skip the menu and export the chart directly
- * @sample {highcharts} highcharts/exporting/buttons-contextbutton-menuitems/ Override the menu items
- * @sample {highstock} highcharts/exporting/buttons-contextbutton-onclick/ Skip the menu and export the chart directly
- * @sample {highstock} highcharts/exporting/buttons-contextbutton-menuitems/ Override the menu items
- * @sample {highmaps} highcharts/exporting/buttons-contextbutton-onclick/ Skip the menu and export the chart directly
- * @sample {highmaps} highcharts/exporting/buttons-contextbutton-menuitems/ Override the menu items
+ * @type {Array<String>|Array<Object>}
+ * @sample {highcharts} highcharts/exporting/menuitemdefinitions/
+ * Menu item definitions
+ * @sample {highstock} highcharts/exporting/menuitemdefinitions/
+ * Menu item definitions
+ * @sample {highmaps} highcharts/exporting/menuitemdefinitions/
+ * Menu item definitions
* @since 2.0
- * @product highcharts highstock highmaps
*/
menuItems: [
'printChart',
'separator',
'downloadPNG',
@@ -420,13 +731,10 @@
'downloadPDF',
'downloadSVG'
]
}
},
- // docs. Created API item with since:next. Add information and link to sample
- // from menuItems too.
-
/**
* An object consisting of definitions for the menu items in the context
* menu. Each key value pair has a `key` that is referenced in the
* [menuItems](#exporting.buttons.contextButton.menuItems) setting,
* and a `value`, which is an object with the following properties:
@@ -446,101 +754,76 @@
* <dd>If internationalization is required, the key to a language string</dd>
*
* </dl>
*
* @type {Object}
- * @sample {highcharts} highcharts/exporting/menuitemdefinitions/ Menu item definitions
- * @sample {highstock} highcharts/exporting/menuitemdefinitions/ Menu item definitions
- * @sample {highmaps} highcharts/exporting/menuitemdefinitions/ Menu item definitions
- * @since next
- * @product highcharts highstock highmaps
+ * @sample {highcharts} highcharts/exporting/menuitemdefinitions/
+ * Menu item definitions
+ * @sample {highstock} highcharts/exporting/menuitemdefinitions/
+ * Menu item definitions
+ * @sample {highmaps} highcharts/exporting/menuitemdefinitions/
+ * Menu item definitions
+ * @since 5.0.13
*/
menuItemDefinitions: {
/**
+ * @ignore
*/
printChart: {
-
- /**
- */
textKey: 'printChart',
-
- /**
- */
onclick: function() {
this.print();
}
},
/**
+ * @ignore
*/
separator: {
-
- /**
- */
separator: true
},
/**
+ * @ignore
*/
downloadPNG: {
-
- /**
- */
textKey: 'downloadPNG',
-
- /**
- */
onclick: function() {
this.exportChart();
}
},
/**
+ * @ignore
*/
downloadJPEG: {
-
- /**
- */
textKey: 'downloadJPEG',
-
- /**
- */
onclick: function() {
this.exportChart({
type: 'image/jpeg'
});
}
},
/**
+ * @ignore
*/
downloadPDF: {
-
- /**
- */
textKey: 'downloadPDF',
-
- /**
- */
onclick: function() {
this.exportChart({
type: 'application/pdf'
});
}
},
/**
+ * @ignore
*/
downloadSVG: {
-
- /**
- */
textKey: 'downloadSVG',
-
- /**
- */
onclick: function() {
this.exportChart({
type: 'image/svg+xml'
});
}
@@ -645,34 +928,20 @@
.replace(/\n/, ' ')
// Any HTML added to the container after the SVG (#894)
.replace(/<\/svg>.*?$/, '</svg>')
// Batik doesn't support rgba fills and strokes (#3095)
.replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, '$1="rgb($2)" $1-opacity="$3"')
- /* This fails in IE < 8
- .replace(/([0-9]+)\.([0-9]+)/g, function(s1, s2, s3) { // round off to save weight
- return s2 +'.'+ s3[0];
- })*/
// Replace HTML entities, issue #347
.replace(/ /g, '\u00A0') // no-break space
.replace(/­/g, '\u00AD'); // soft hyphen
- // IE specific
- svg = svg
- .replace(/<IMG /g, '<image ')
- .replace(/<(\/?)TITLE>/g, '<$1title>')
- .replace(/height=([^" ]+)/g, 'height="$1"')
- .replace(/width=([^" ]+)/g, 'width="$1"')
- .replace(/hc-svg-href="([^"]+)">/g, 'xlink:href="$1"/>')
- .replace(/ id=([^" >]+)/g, ' id="$1"') // #4003
- .replace(/class=([^" >]+)/g, 'class="$1"')
- .replace(/ transform /g, ' ')
- .replace(/:(path|rect)/g, '$1')
- .replace(/style="([^"]+)"/g, function(s) {
- return s.toLowerCase();
- });
+ // Further sanitize for oldIE
+ if (this.ieSanitizeSVG) {
+ svg = this.ieSanitizeSVG(svg);
+ }
return svg;
},
@@ -714,17 +983,10 @@
cssWidth,
cssHeight,
options = merge(chart.options, chartOptions); // copy the options and add extra options
- // IE compatibility hack for generating SVG content that it doesn't really understand
- if (!doc.createElementNS) {
- doc.createElementNS = function(ns, tagName) {
- return doc.createElement(tagName);
- };
- }
-
// create a sandbox where a new chart will be generated
sandbox = createElement('div', null, {
position: 'absolute',
top: '-9999em',
width: chart.chartWidth + 'px',
@@ -1246,10 +1508,10 @@
// Destroy the extra buttons added
if (exportSVGElements) {
each(exportSVGElements, function(elem, i) {
- // Destroy and null the svg/vml elements
+ // Destroy and null the svg elements
if (elem) { // #1822
elem.onclick = elem.ontouchstart = null;
cacheName = 'cache-' + elem.menuClassName;
if (chart[cacheName]) {