Carga
Carga
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,846 @@
|
||||
/* *
|
||||
*
|
||||
* (c) 2010-2021 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*
|
||||
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
||||
*
|
||||
* */
|
||||
'use strict';
|
||||
import H from '../../Core/Globals.js';
|
||||
var isTouchDevice = H.isTouchDevice;
|
||||
/* *
|
||||
*
|
||||
* API Options
|
||||
*
|
||||
* */
|
||||
// Add the export related options
|
||||
/**
|
||||
* Options for the exporting module. For an overview on the matter, see
|
||||
* [the docs](https://www.highcharts.com/docs/export-module/export-module-overview).
|
||||
*
|
||||
* @requires modules/exporting
|
||||
* @optionparent exporting
|
||||
*/
|
||||
var exporting = {
|
||||
/**
|
||||
* 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 the chart before exporting to
|
||||
* an image format. This does not apply to printing the chart via the export
|
||||
* menu.
|
||||
*
|
||||
* 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 to exported PDFs.
|
||||
*
|
||||
* @sample {highcharts} highcharts/exporting/chartoptions-data-labels/
|
||||
* Added data labels
|
||||
* @sample {highstock} highcharts/exporting/chartoptions-data-labels/
|
||||
* Added data labels
|
||||
*
|
||||
* @type {Highcharts.Options}
|
||||
* @apioption exporting.chartOptions
|
||||
*/
|
||||
/**
|
||||
* Whether to enable the exporting module. Disabling the module will
|
||||
* hide the context button, but API methods will still be available.
|
||||
*
|
||||
* @sample {highcharts} highcharts/exporting/enabled-false/
|
||||
* Exporting module is loaded but disabled
|
||||
* @sample {highstock} highcharts/exporting/enabled-false/
|
||||
* Exporting module is loaded but disabled
|
||||
*
|
||||
* @type {boolean}
|
||||
* @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. Receives two parameters, the exporting
|
||||
* options, and the error from the module.
|
||||
*
|
||||
* @see [fallbackToExportServer](#exporting.fallbackToExportServer)
|
||||
*
|
||||
* @type {Highcharts.ExportingErrorCallbackFunction}
|
||||
* @since 5.0.0
|
||||
* @requires modules/exporting
|
||||
* @requires modules/offline-exporting
|
||||
* @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. This happens for
|
||||
* certain browsers, and certain features (e.g.
|
||||
* [allowHTML](#exporting.allowHTML)), depending on the image type exporting
|
||||
* to. For very complex charts, it is possible that export can fail in
|
||||
* browsers that don't support Blob objects, due to data URL length limits.
|
||||
* It is recommended to define the [exporting.error](#exporting.error)
|
||||
* handler if disabling fallback, in order to notify users in case export
|
||||
* fails.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @default true
|
||||
* @since 4.1.8
|
||||
* @requires modules/exporting
|
||||
* @requires modules/offline-exporting
|
||||
* @apioption exporting.fallbackToExportServer
|
||||
*/
|
||||
/**
|
||||
* The filename, without extension, to use for the exported chart.
|
||||
*
|
||||
* @sample {highcharts} highcharts/exporting/filename/
|
||||
* Custom file name
|
||||
* @sample {highstock} highcharts/exporting/filename/
|
||||
* Custom file name
|
||||
*
|
||||
* @type {string}
|
||||
* @default chart
|
||||
* @since 2.0
|
||||
* @apioption exporting.filename
|
||||
*/
|
||||
/**
|
||||
* An object containing additional key value data 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 {Highcharts.HTMLAttributes}
|
||||
* @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,
|
||||
* [jsPDF](https://github.com/parallax/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, or a pixel width is set on the
|
||||
* container. The width exported raster image is then multiplied by
|
||||
* [scale](#exporting.scale).
|
||||
*
|
||||
* @sample {highcharts} highcharts/exporting/sourcewidth/
|
||||
* Source size demo
|
||||
* @sample {highstock} highcharts/exporting/sourcewidth/
|
||||
* Source size demo
|
||||
* @sample {highmaps} maps/exporting/sourcewidth/
|
||||
* Source size demo
|
||||
*
|
||||
* @type {number}
|
||||
* @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).
|
||||
*
|
||||
* @sample {highcharts} highcharts/exporting/width/
|
||||
* Export to 200px wide images
|
||||
* @sample {highstock} highcharts/exporting/width/
|
||||
* Export to 200px wide images
|
||||
*
|
||||
* @type {number}
|
||||
* @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`.
|
||||
*
|
||||
* @type {Highcharts.ExportingMimeTypeValue}
|
||||
* @since 2.0
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
url: 'https://export.highcharts.com/',
|
||||
/**
|
||||
* Settings for a custom font for the exported PDF, when using the
|
||||
* `offline-exporting` module. This is used for languages containing
|
||||
* non-ASCII characters, like Chinese, Russian, Japanese etc.
|
||||
*
|
||||
* As described in the [jsPDF
|
||||
* docs](https://github.com/parallax/jsPDF#use-of-unicode-characters--utf-8),
|
||||
* the 14 standard fonts in PDF are limited to the ASCII-codepage.
|
||||
* Therefore, in order to support other text in the exported PDF, one or
|
||||
* more TTF font files have to be passed on to the exporting module.
|
||||
*
|
||||
* See more in [the
|
||||
* docs](https://www.highcharts.com/docs/export-module/client-side-export).
|
||||
*
|
||||
* @sample {highcharts} highcharts/exporting/offline-download-pdffont/
|
||||
* Download PDF in a language containing non-Latin characters.
|
||||
*
|
||||
* @since 10.0.0
|
||||
* @requires modules/offline-exporting
|
||||
*/
|
||||
pdfFont: {
|
||||
/**
|
||||
* The TTF font file for normal `font-style`. If font variations like
|
||||
* `bold` or `italic` are not defined, the `normal` font will be used
|
||||
* for those too.
|
||||
*
|
||||
* @type string|undefined
|
||||
*/
|
||||
normal: void 0,
|
||||
/**
|
||||
* The TTF font file for bold text.
|
||||
*
|
||||
* @type string|undefined
|
||||
*/
|
||||
bold: void 0,
|
||||
/**
|
||||
* The TTF font file for bold and italic text.
|
||||
*
|
||||
* @type string|undefined
|
||||
*/
|
||||
bolditalic: void 0,
|
||||
/**
|
||||
* The TTF font file for italic text.
|
||||
*
|
||||
* @type string|undefined
|
||||
*/
|
||||
italic: void 0
|
||||
},
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @since 4.2.5
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @see [chart.width](#chart.width)
|
||||
* @see [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
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @type {Highcharts.Dictionary<*>}
|
||||
* @requires modules/exporting
|
||||
*/
|
||||
buttons: {
|
||||
/**
|
||||
* Options for the export button.
|
||||
*
|
||||
* In styled mode, export button styles can be applied with the
|
||||
* `.highcharts-contextbutton` class.
|
||||
*
|
||||
* @declare Highcharts.ExportingButtonsOptionsObject
|
||||
* @extends navigation.buttonOptions
|
||||
* @requires modules/exporting
|
||||
*/
|
||||
contextButton: {
|
||||
/**
|
||||
* A click handler callback to use on the button directly instead of
|
||||
* the popup menu.
|
||||
*
|
||||
* @sample highcharts/exporting/buttons-contextbutton-onclick/
|
||||
* Skip the menu and export the chart directly
|
||||
*
|
||||
* @type {Function}
|
||||
* @since 2.0
|
||||
* @apioption exporting.buttons.contextButton.onclick
|
||||
*/
|
||||
/**
|
||||
* See [navigation.buttonOptions.symbolFill](
|
||||
* #navigation.buttonOptions.symbolFill).
|
||||
*
|
||||
* @type {Highcharts.ColorString}
|
||||
* @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.
|
||||
*/
|
||||
className: 'highcharts-contextbutton',
|
||||
/**
|
||||
* The class name of the menu appearing from the button.
|
||||
*/
|
||||
menuClassName: 'highcharts-contextmenu',
|
||||
/**
|
||||
* The symbol for the button. Points to a definition function in
|
||||
* the `Highcharts.Renderer.symbols` collection. The default
|
||||
* `menu` function is part of the exporting module. Possible
|
||||
* values are "circle", "square", "diamond", "triangle",
|
||||
* "triangle-down", "menu", "menuball" or custom shape.
|
||||
*
|
||||
* @sample highcharts/exporting/buttons-contextbutton-symbol/
|
||||
* Use a circle for symbol
|
||||
* @sample highcharts/exporting/buttons-contextbutton-symbol-custom/
|
||||
* Custom shape as symbol
|
||||
*
|
||||
* @type {Highcharts.SymbolKeyValue|"menu"|"menuball"|string}
|
||||
* @since 2.0
|
||||
*/
|
||||
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".
|
||||
*
|
||||
* @since 6.1.4
|
||||
*/
|
||||
titleKey: 'contextButtonTitle',
|
||||
/**
|
||||
* This option is deprecated, use
|
||||
* [titleKey](#exporting.buttons.contextButton.titleKey) instead.
|
||||
*
|
||||
* @deprecated
|
||||
* @type {string}
|
||||
* @apioption exporting.buttons.contextButton._titleKey
|
||||
*/
|
||||
/**
|
||||
* 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 "View in full screen" and "Print" menu
|
||||
* items, plus one menu item for each of the available export types.
|
||||
*
|
||||
* @sample {highcharts} highcharts/exporting/menuitemdefinitions/
|
||||
* Menu item definitions
|
||||
* @sample {highstock} highcharts/exporting/menuitemdefinitions/
|
||||
* Menu item definitions
|
||||
* @sample {highmaps} highcharts/exporting/menuitemdefinitions/
|
||||
* Menu item definitions
|
||||
*
|
||||
* @type {Array<string>}
|
||||
* @default ["viewFullscreen", "printChart", "separator", "downloadPNG", "downloadJPEG", "downloadPDF", "downloadSVG"]
|
||||
* @since 2.0
|
||||
*/
|
||||
menuItems: [
|
||||
'viewFullscreen',
|
||||
'printChart',
|
||||
'separator',
|
||||
'downloadPNG',
|
||||
'downloadJPEG',
|
||||
'downloadPDF',
|
||||
'downloadSVG'
|
||||
]
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 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:
|
||||
*
|
||||
* - **onclick:** The click handler for the menu item
|
||||
*
|
||||
* - **text:** The text for the menu item
|
||||
*
|
||||
* - **textKey:** If internationalization is required, the key to a language
|
||||
* string
|
||||
*
|
||||
* Custom text for the "exitFullScreen" can be set only in lang options
|
||||
* (it is not a separate button).
|
||||
*
|
||||
* @sample {highcharts} highcharts/exporting/menuitemdefinitions/
|
||||
* Menu item definitions
|
||||
* @sample {highstock} highcharts/exporting/menuitemdefinitions/
|
||||
* Menu item definitions
|
||||
* @sample {highmaps} highcharts/exporting/menuitemdefinitions/
|
||||
* Menu item definitions
|
||||
*
|
||||
*
|
||||
* @type {Highcharts.Dictionary<Highcharts.ExportingMenuObject>}
|
||||
* @default {"viewFullscreen": {}, "printChart": {}, "separator": {}, "downloadPNG": {}, "downloadJPEG": {}, "downloadPDF": {}, "downloadSVG": {}}
|
||||
* @since 5.0.13
|
||||
*/
|
||||
menuItemDefinitions: {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
viewFullscreen: {
|
||||
textKey: 'viewFullscreen',
|
||||
onclick: function () {
|
||||
if (this.fullscreen) {
|
||||
this.fullscreen.toggle();
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @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'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// Add language
|
||||
/**
|
||||
* @optionparent lang
|
||||
*/
|
||||
var lang = {
|
||||
/**
|
||||
* Exporting module only. The text for the menu item to view the chart
|
||||
* in full screen.
|
||||
*
|
||||
* @since 8.0.1
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
viewFullscreen: 'View in full screen',
|
||||
/**
|
||||
* Exporting module only. The text for the menu item to exit the chart
|
||||
* from full screen.
|
||||
*
|
||||
* @since 8.0.1
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
exitFullscreen: 'Exit from full screen',
|
||||
/**
|
||||
* Exporting module only. The text for the menu item to print the chart.
|
||||
*
|
||||
* @since 3.0.1
|
||||
* @requires modules/exporting
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
printChart: 'Print chart',
|
||||
/**
|
||||
* Exporting module only. The text for the PNG download menu item.
|
||||
*
|
||||
* @since 2.0
|
||||
* @requires modules/exporting
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
downloadPNG: 'Download PNG image',
|
||||
/**
|
||||
* Exporting module only. The text for the JPEG download menu item.
|
||||
*
|
||||
* @since 2.0
|
||||
* @requires modules/exporting
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
downloadJPEG: 'Download JPEG image',
|
||||
/**
|
||||
* Exporting module only. The text for the PDF download menu item.
|
||||
*
|
||||
* @since 2.0
|
||||
* @requires modules/exporting
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
downloadPDF: 'Download PDF document',
|
||||
/**
|
||||
* Exporting module only. The text for the SVG download menu item.
|
||||
*
|
||||
* @since 2.0
|
||||
* @requires modules/exporting
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
downloadSVG: 'Download SVG vector image',
|
||||
/**
|
||||
* Exporting module menu. The tooltip title for the context menu holding
|
||||
* print and export menu items.
|
||||
*
|
||||
* @since 3.0
|
||||
* @requires modules/exporting
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
contextButtonTitle: 'Chart context menu'
|
||||
};
|
||||
var navigation = {
|
||||
/**
|
||||
* A collection of options for buttons appearing in the exporting
|
||||
* module.
|
||||
*
|
||||
* In styled mode, the buttons are styled with the
|
||||
* `.highcharts-contextbutton` and `.highcharts-button-symbol` classes.
|
||||
*
|
||||
* @requires modules/exporting
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
buttonOptions: {
|
||||
/**
|
||||
* Whether to enable buttons.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-enabled/
|
||||
* Exporting module loaded but buttons disabled
|
||||
*
|
||||
* @type {boolean}
|
||||
* @default true
|
||||
* @since 2.0
|
||||
* @apioption navigation.buttonOptions.enabled
|
||||
*/
|
||||
/**
|
||||
* The pixel size of the symbol on the button.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-height/
|
||||
* Bigger buttons
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
symbolSize: 14,
|
||||
/**
|
||||
* The x position of the center of the symbol inside the button.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-height/
|
||||
* Bigger buttons
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
symbolX: 12.5,
|
||||
/**
|
||||
* The y position of the center of the symbol inside the button.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-height/
|
||||
* Bigger buttons
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
symbolY: 10.5,
|
||||
/**
|
||||
* Alignment for the buttons.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-align/
|
||||
* Center aligned
|
||||
*
|
||||
* @type {Highcharts.AlignValue}
|
||||
* @since 2.0
|
||||
*/
|
||||
align: 'right',
|
||||
/**
|
||||
* The pixel spacing between buttons.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
buttonSpacing: 3,
|
||||
/**
|
||||
* Pixel height of the buttons.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-height/
|
||||
* Bigger buttons
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
height: 22,
|
||||
/**
|
||||
* A text string to add to the individual button.
|
||||
*
|
||||
* @sample highcharts/exporting/buttons-text/
|
||||
* Full text button
|
||||
* @sample highcharts/exporting/buttons-text-symbol/
|
||||
* Combined symbol and text
|
||||
*
|
||||
* @type {string}
|
||||
* @default null
|
||||
* @since 3.0
|
||||
* @apioption navigation.buttonOptions.text
|
||||
*/
|
||||
/**
|
||||
* The vertical offset of the button's position relative to its
|
||||
* `verticalAlign`.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-verticalalign/
|
||||
* Buttons at lower right
|
||||
*
|
||||
* @type {number}
|
||||
* @default 0
|
||||
* @since 2.0
|
||||
* @apioption navigation.buttonOptions.y
|
||||
*/
|
||||
/**
|
||||
* The vertical alignment of the buttons. Can be one of `"top"`,
|
||||
* `"middle"` or `"bottom"`.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-verticalalign/
|
||||
* Buttons at lower right
|
||||
*
|
||||
* @type {Highcharts.VerticalAlignValue}
|
||||
* @since 2.0
|
||||
*/
|
||||
verticalAlign: 'top',
|
||||
/**
|
||||
* The pixel width of the button.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-height/
|
||||
* Bigger buttons
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
width: 24,
|
||||
/**
|
||||
* Fill color for the symbol within the button.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-symbolfill/
|
||||
* Blue symbol stroke for one of the buttons
|
||||
*
|
||||
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
|
||||
* @since 2.0
|
||||
*/
|
||||
symbolFill: "#666666" /* Palette.neutralColor60 */,
|
||||
/**
|
||||
* The color of the symbol's stroke or line.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-symbolstroke/
|
||||
* Blue symbol stroke
|
||||
*
|
||||
* @type {Highcharts.ColorString}
|
||||
* @since 2.0
|
||||
*/
|
||||
symbolStroke: "#666666" /* Palette.neutralColor60 */,
|
||||
/**
|
||||
* The pixel stroke width of the symbol on the button.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-height/
|
||||
* Bigger buttons
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
symbolStrokeWidth: 3,
|
||||
/**
|
||||
* A configuration object for the button theme. The object accepts
|
||||
* SVG properties like `stroke-width`, `stroke` and `fill`.
|
||||
* Tri-state button styles are supported by the `states.hover` and
|
||||
* `states.select` objects.
|
||||
*
|
||||
* @sample highcharts/navigation/buttonoptions-theme/
|
||||
* Theming the buttons
|
||||
*
|
||||
* @requires modules/exporting
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
theme: {
|
||||
/**
|
||||
* The default fill exists only to capture hover events.
|
||||
*
|
||||
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
|
||||
* @default #ffffff
|
||||
* @apioption navigation.buttonOptions.theme.fill
|
||||
*/
|
||||
/**
|
||||
* Default stroke for the buttons.
|
||||
* @type {Highcharts.ColorString}
|
||||
* @default none
|
||||
* @apioption navigation.buttonOptions.theme.stroke
|
||||
*/
|
||||
/**
|
||||
* Padding for the button.
|
||||
*/
|
||||
padding: 5
|
||||
}
|
||||
},
|
||||
/**
|
||||
* CSS styles for the popup menu appearing by default when the export
|
||||
* icon is clicked. This menu is rendered in HTML.
|
||||
*
|
||||
* @see In styled mode, the menu is styled with the `.highcharts-menu`
|
||||
* class.
|
||||
*
|
||||
* @sample highcharts/navigation/menustyle/
|
||||
* Light gray menu background
|
||||
*
|
||||
* @type {Highcharts.CSSObject}
|
||||
* @default {"border": "1px solid #999999", "background": "#ffffff", "padding": "5px 0"}
|
||||
* @since 2.0
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
menuStyle: {
|
||||
/** @ignore-option */
|
||||
border: "1px solid ".concat("#999999" /* Palette.neutralColor40 */),
|
||||
/** @ignore-option */
|
||||
background: "#ffffff" /* Palette.backgroundColor */,
|
||||
/** @ignore-option */
|
||||
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. Font size defaults to `11px` on desktop and `14px`
|
||||
* on touch devices.
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @type {Highcharts.CSSObject}
|
||||
* @default {"padding": "0.5em 1em", "color": "#333333", "background": "none", "fontSize": "11px/14px", "transition": "background 250ms, color 250ms"}
|
||||
* @since 2.0
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
menuItemStyle: {
|
||||
/** @ignore-option */
|
||||
padding: '0.5em 1em',
|
||||
/** @ignore-option */
|
||||
color: "#333333" /* Palette.neutralColor80 */,
|
||||
/** @ignore-option */
|
||||
background: 'none',
|
||||
/** @ignore-option */
|
||||
fontSize: isTouchDevice ? '14px' : '11px',
|
||||
/** @ignore-option */
|
||||
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.
|
||||
*
|
||||
* @see In styled mode, the menu items are styled with the
|
||||
* `.highcharts-menu-item` class.
|
||||
*
|
||||
* @sample highcharts/navigation/menuitemhoverstyle/
|
||||
* Bold text on hover
|
||||
*
|
||||
* @type {Highcharts.CSSObject}
|
||||
* @default {"background": "#335cad", "color": "#ffffff"}
|
||||
* @since 2.0
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
menuItemHoverStyle: {
|
||||
/** @ignore-option */
|
||||
background: "#335cad" /* Palette.highlightColor80 */,
|
||||
/** @ignore-option */
|
||||
color: "#ffffff" /* Palette.backgroundColor */
|
||||
}
|
||||
};
|
||||
/* *
|
||||
*
|
||||
* Default Export
|
||||
*
|
||||
* */
|
||||
var ExportingDefaults = {
|
||||
exporting: exporting,
|
||||
lang: lang,
|
||||
navigation: navigation
|
||||
};
|
||||
export default ExportingDefaults;
|
||||
@@ -0,0 +1,73 @@
|
||||
/* *
|
||||
*
|
||||
* Exporting module
|
||||
*
|
||||
* (c) 2010-2021 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*
|
||||
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
||||
*
|
||||
* */
|
||||
'use strict';
|
||||
/* *
|
||||
*
|
||||
* Composition
|
||||
*
|
||||
* */
|
||||
var ExportingSymbols;
|
||||
(function (ExportingSymbols) {
|
||||
/* *
|
||||
*
|
||||
* Constants
|
||||
*
|
||||
* */
|
||||
var modifiedClasses = [];
|
||||
/* *
|
||||
*
|
||||
* Functions
|
||||
*
|
||||
* */
|
||||
/* eslint-disable valid-jsdoc */
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function compose(SVGRendererClass) {
|
||||
if (modifiedClasses.indexOf(SVGRendererClass) === -1) {
|
||||
modifiedClasses.push(SVGRendererClass);
|
||||
var symbols = SVGRendererClass.prototype.symbols;
|
||||
symbols.menu = menu;
|
||||
symbols.menuball = menuball.bind(symbols);
|
||||
}
|
||||
}
|
||||
ExportingSymbols.compose = compose;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function menu(x, y, width, height) {
|
||||
var arr = [
|
||||
['M', x, y + 2.5],
|
||||
['L', x + width, y + 2.5],
|
||||
['M', x, y + height / 2 + 0.5],
|
||||
['L', x + width, y + height / 2 + 0.5],
|
||||
['M', x, y + height - 1.5],
|
||||
['L', x + width, y + height - 1.5]
|
||||
];
|
||||
return arr;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function menuball(x, y, width, height) {
|
||||
var h = (height / 3) - 2;
|
||||
var path = [];
|
||||
path = path.concat(this.circle(width - h, y, h, h), this.circle(width - h, y + h + 4, h, h), this.circle(width - h, y + 2 * (h + 4), h, h));
|
||||
return path;
|
||||
}
|
||||
})(ExportingSymbols || (ExportingSymbols = {}));
|
||||
/* *
|
||||
*
|
||||
* Default Export
|
||||
*
|
||||
* */
|
||||
export default ExportingSymbols;
|
||||
@@ -0,0 +1,352 @@
|
||||
/* *
|
||||
*
|
||||
* (c) 2009-2021 Rafal Sebestjanski
|
||||
*
|
||||
* Full screen for Highcharts
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*
|
||||
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
||||
*
|
||||
* */
|
||||
/**
|
||||
* The module allows user to enable display chart in full screen mode.
|
||||
* Used in StockTools too.
|
||||
* Based on default solutions in browsers.
|
||||
*/
|
||||
'use strict';
|
||||
/* *
|
||||
*
|
||||
* Imports
|
||||
*
|
||||
* */
|
||||
import AST from '../../Core/Renderer/HTML/AST.js';
|
||||
import U from '../../Core/Utilities.js';
|
||||
var addEvent = U.addEvent, fireEvent = U.fireEvent;
|
||||
/* *
|
||||
*
|
||||
* Constants
|
||||
*
|
||||
* */
|
||||
var composedClasses = [];
|
||||
/* *
|
||||
*
|
||||
* Functions
|
||||
*
|
||||
* */
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function onChartBeforeRender() {
|
||||
/**
|
||||
* @name Highcharts.Chart#fullscreen
|
||||
* @type {Highcharts.Fullscreen}
|
||||
* @requires modules/full-screen
|
||||
*/
|
||||
this.fullscreen = new Fullscreen(this);
|
||||
}
|
||||
/* *
|
||||
*
|
||||
* Class
|
||||
*
|
||||
* */
|
||||
/**
|
||||
* Handles displaying chart's container in the fullscreen mode.
|
||||
*
|
||||
* **Note**: Fullscreen is not supported on iPhone due to iOS limitations.
|
||||
*
|
||||
* @class
|
||||
* @name Highcharts.Fullscreen
|
||||
*
|
||||
* @requires modules/exporting
|
||||
*/
|
||||
var Fullscreen = /** @class */ (function () {
|
||||
/* *
|
||||
*
|
||||
* Constructors
|
||||
*
|
||||
* */
|
||||
function Fullscreen(chart) {
|
||||
/**
|
||||
* Chart managed by the fullscreen controller.
|
||||
* @name Highcharts.Fullscreen#chart
|
||||
* @type {Highcharts.Chart}
|
||||
*/
|
||||
this.chart = chart;
|
||||
/**
|
||||
* The flag is set to `true` when the chart is displayed in
|
||||
* the fullscreen mode.
|
||||
*
|
||||
* @name Highcharts.Fullscreen#isOpen
|
||||
* @type {boolean|undefined}
|
||||
* @since 8.0.1
|
||||
*/
|
||||
this.isOpen = false;
|
||||
var container = chart.renderTo;
|
||||
// Hold event and methods available only for a current browser.
|
||||
if (!this.browserProps) {
|
||||
if (typeof container.requestFullscreen === 'function') {
|
||||
this.browserProps = {
|
||||
fullscreenChange: 'fullscreenchange',
|
||||
requestFullscreen: 'requestFullscreen',
|
||||
exitFullscreen: 'exitFullscreen'
|
||||
};
|
||||
}
|
||||
else if (container.mozRequestFullScreen) {
|
||||
this.browserProps = {
|
||||
fullscreenChange: 'mozfullscreenchange',
|
||||
requestFullscreen: 'mozRequestFullScreen',
|
||||
exitFullscreen: 'mozCancelFullScreen'
|
||||
};
|
||||
}
|
||||
else if (container.webkitRequestFullScreen) {
|
||||
this.browserProps = {
|
||||
fullscreenChange: 'webkitfullscreenchange',
|
||||
requestFullscreen: 'webkitRequestFullScreen',
|
||||
exitFullscreen: 'webkitExitFullscreen'
|
||||
};
|
||||
}
|
||||
else if (container.msRequestFullscreen) {
|
||||
this.browserProps = {
|
||||
fullscreenChange: 'MSFullscreenChange',
|
||||
requestFullscreen: 'msRequestFullscreen',
|
||||
exitFullscreen: 'msExitFullscreen'
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
/* *
|
||||
*
|
||||
* Static Functions
|
||||
*
|
||||
* */
|
||||
/**
|
||||
* Prepares the chart class to support fullscreen.
|
||||
*
|
||||
* @param {typeof_Highcharts.Chart} ChartClass
|
||||
* The chart class to decorate with fullscreen support.
|
||||
*/
|
||||
Fullscreen.compose = function (ChartClass) {
|
||||
if (composedClasses.indexOf(ChartClass) === -1) {
|
||||
composedClasses.push(ChartClass);
|
||||
// Initialize fullscreen
|
||||
addEvent(ChartClass, 'beforeRender', onChartBeforeRender);
|
||||
}
|
||||
};
|
||||
/* *
|
||||
*
|
||||
* Functions
|
||||
*
|
||||
* */
|
||||
/**
|
||||
* Stops displaying the chart in fullscreen mode.
|
||||
* Exporting module required.
|
||||
*
|
||||
* @since 8.0.1
|
||||
*
|
||||
* @function Highcharts.Fullscreen#close
|
||||
* @return {void}
|
||||
* @requires modules/full-screen
|
||||
*/
|
||||
Fullscreen.prototype.close = function () {
|
||||
var fullscreen = this, chart = fullscreen.chart, optionsChart = chart.options.chart;
|
||||
fireEvent(chart, 'fullscreenClose', null, function () {
|
||||
// Don't fire exitFullscreen() when user exited
|
||||
// using 'Escape' button.
|
||||
if (fullscreen.isOpen &&
|
||||
fullscreen.browserProps &&
|
||||
chart.container.ownerDocument instanceof Document) {
|
||||
chart.container.ownerDocument[fullscreen.browserProps.exitFullscreen]();
|
||||
}
|
||||
// Unbind event as it's necessary only before exiting
|
||||
// from fullscreen.
|
||||
if (fullscreen.unbindFullscreenEvent) {
|
||||
fullscreen.unbindFullscreenEvent = fullscreen
|
||||
.unbindFullscreenEvent();
|
||||
}
|
||||
chart.setSize(fullscreen.origWidth, fullscreen.origHeight, false);
|
||||
fullscreen.origWidth = void 0;
|
||||
fullscreen.origHeight = void 0;
|
||||
optionsChart.width = fullscreen.origWidthOption;
|
||||
optionsChart.height = fullscreen.origHeightOption;
|
||||
fullscreen.origWidthOption = void 0;
|
||||
fullscreen.origHeightOption = void 0;
|
||||
fullscreen.isOpen = false;
|
||||
fullscreen.setButtonText();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Displays the chart in fullscreen mode.
|
||||
* When fired customly by user before exporting context button is created,
|
||||
* button's text will not be replaced - it's on the user side.
|
||||
* Exporting module required.
|
||||
*
|
||||
* @since 8.0.1
|
||||
*
|
||||
* @function Highcharts.Fullscreen#open
|
||||
* @return {void}
|
||||
* @requires modules/full-screen
|
||||
*/
|
||||
Fullscreen.prototype.open = function () {
|
||||
var fullscreen = this, chart = fullscreen.chart, optionsChart = chart.options.chart;
|
||||
fireEvent(chart, 'fullscreenOpen', null, function () {
|
||||
if (optionsChart) {
|
||||
fullscreen.origWidthOption = optionsChart.width;
|
||||
fullscreen.origHeightOption = optionsChart.height;
|
||||
}
|
||||
fullscreen.origWidth = chart.chartWidth;
|
||||
fullscreen.origHeight = chart.chartHeight;
|
||||
// Handle exitFullscreen() method when user clicks 'Escape' button.
|
||||
if (fullscreen.browserProps) {
|
||||
var unbindChange_1 = addEvent(chart.container.ownerDocument, // chart's document
|
||||
fullscreen.browserProps.fullscreenChange, function () {
|
||||
// Handle lack of async of browser's
|
||||
// fullScreenChange event.
|
||||
if (fullscreen.isOpen) {
|
||||
fullscreen.isOpen = false;
|
||||
fullscreen.close();
|
||||
}
|
||||
else {
|
||||
chart.setSize(null, null, false);
|
||||
fullscreen.isOpen = true;
|
||||
fullscreen.setButtonText();
|
||||
}
|
||||
});
|
||||
var unbindDestroy_1 = addEvent(chart, 'destroy', unbindChange_1);
|
||||
fullscreen.unbindFullscreenEvent = function () {
|
||||
unbindChange_1();
|
||||
unbindDestroy_1();
|
||||
};
|
||||
var promise = chart.renderTo[fullscreen.browserProps.requestFullscreen]();
|
||||
if (promise) {
|
||||
// No dot notation because of IE8 compatibility
|
||||
promise['catch'](function () {
|
||||
alert(// eslint-disable-line no-alert
|
||||
'Full screen is not supported inside a frame.');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Replaces the exporting context button's text when toogling the
|
||||
* fullscreen mode.
|
||||
*
|
||||
* @private
|
||||
*
|
||||
* @since 8.0.1
|
||||
*
|
||||
* @requires modules/full-screen
|
||||
*/
|
||||
Fullscreen.prototype.setButtonText = function () {
|
||||
var chart = this.chart, exportDivElements = chart.exportDivElements, exportingOptions = chart.options.exporting, menuItems = (exportingOptions &&
|
||||
exportingOptions.buttons &&
|
||||
exportingOptions.buttons.contextButton.menuItems), lang = chart.options.lang;
|
||||
if (exportingOptions &&
|
||||
exportingOptions.menuItemDefinitions &&
|
||||
lang &&
|
||||
lang.exitFullscreen &&
|
||||
lang.viewFullscreen &&
|
||||
menuItems &&
|
||||
exportDivElements) {
|
||||
var exportDivElement = exportDivElements[menuItems.indexOf('viewFullscreen')];
|
||||
if (exportDivElement) {
|
||||
AST.setElementHTML(exportDivElement, !this.isOpen ?
|
||||
(exportingOptions.menuItemDefinitions.viewFullscreen
|
||||
.text ||
|
||||
lang.viewFullscreen) : lang.exitFullscreen);
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Toggles displaying the chart in fullscreen mode.
|
||||
* By default, when the exporting module is enabled, a context button with
|
||||
* a drop down menu in the upper right corner accesses this function.
|
||||
* Exporting module required.
|
||||
*
|
||||
* @since 8.0.1
|
||||
*
|
||||
* @sample highcharts/members/chart-togglefullscreen/
|
||||
* Toggle fullscreen mode from a HTML button
|
||||
*
|
||||
* @function Highcharts.Fullscreen#toggle
|
||||
* @requires modules/full-screen
|
||||
*/
|
||||
Fullscreen.prototype.toggle = function () {
|
||||
var fullscreen = this;
|
||||
if (!fullscreen.isOpen) {
|
||||
fullscreen.open();
|
||||
}
|
||||
else {
|
||||
fullscreen.close();
|
||||
}
|
||||
};
|
||||
return Fullscreen;
|
||||
}());
|
||||
/* *
|
||||
*
|
||||
* Default Export
|
||||
*
|
||||
* */
|
||||
export default Fullscreen;
|
||||
/* *
|
||||
*
|
||||
* API Declarations
|
||||
*
|
||||
* */
|
||||
/**
|
||||
* Gets fired when closing the fullscreen
|
||||
*
|
||||
* @callback Highcharts.FullScreenfullscreenCloseCallbackFunction
|
||||
*
|
||||
* @param {Highcharts.Chart} chart
|
||||
* The chart on which the event occured.
|
||||
*
|
||||
* @param {global.Event} event
|
||||
* The event that occured.
|
||||
*/
|
||||
/**
|
||||
* Gets fired when opening the fullscreen
|
||||
*
|
||||
* @callback Highcharts.FullScreenfullscreenOpenCallbackFunction
|
||||
*
|
||||
* @param {Highcharts.Chart} chart
|
||||
* The chart on which the event occured.
|
||||
*
|
||||
* @param {global.Event} event
|
||||
* The event that occured.
|
||||
*/
|
||||
(''); // keeps doclets above separated from following code
|
||||
/* *
|
||||
*
|
||||
* API Options
|
||||
*
|
||||
* */
|
||||
/**
|
||||
* Fires when a fullscreen is closed through the context menu item,
|
||||
* or a fullscreen is closed on the `Escape` button click,
|
||||
* or the `Chart.fullscreen.close` method.
|
||||
*
|
||||
* @sample highcharts/chart/events-fullscreen
|
||||
* Title size change on fullscreen open
|
||||
*
|
||||
* @type {Highcharts.FullScreenfullscreenCloseCallbackFunction}
|
||||
* @since 10.1.0
|
||||
* @context Highcharts.Chart
|
||||
* @requires modules/full-screen
|
||||
* @apioption chart.events.fullscreenClose
|
||||
*/
|
||||
/**
|
||||
* Fires when a fullscreen is opened through the context menu item,
|
||||
* or the `Chart.fullscreen.open` method.
|
||||
*
|
||||
* @sample highcharts/chart/events-fullscreen
|
||||
* Title size change on fullscreen open
|
||||
*
|
||||
* @type {Highcharts.FullScreenfullscreenOpenCallbackFunction}
|
||||
* @since 10.1.0
|
||||
* @context Highcharts.Chart
|
||||
* @requires modules/full-screen
|
||||
* @apioption chart.events.fullscreenOpen
|
||||
*/
|
||||
(''); // keeps doclets above in transpiled file
|
||||
Reference in New Issue
Block a user