@highcharts/grid-pro 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/css/grid-pro.css +1756 -0
- package/es-modules/Accessibility/A11yI18n.d.ts +95 -0
- package/es-modules/Accessibility/A11yI18n.js +290 -0
- package/es-modules/Accessibility/Accessibility.d.ts +116 -0
- package/es-modules/Accessibility/Accessibility.js +402 -0
- package/es-modules/Accessibility/AccessibilityComponent.d.ts +97 -0
- package/es-modules/Accessibility/AccessibilityComponent.js +147 -0
- package/es-modules/Accessibility/Components/AnnotationsA11y.d.ts +43 -0
- package/es-modules/Accessibility/Components/AnnotationsA11y.js +160 -0
- package/es-modules/Accessibility/Components/ContainerComponent.d.ts +48 -0
- package/es-modules/Accessibility/Components/ContainerComponent.js +142 -0
- package/es-modules/Accessibility/Components/InfoRegionsComponent.d.ts +144 -0
- package/es-modules/Accessibility/Components/InfoRegionsComponent.js +555 -0
- package/es-modules/Accessibility/Components/LegendComponent.d.ts +124 -0
- package/es-modules/Accessibility/Components/LegendComponent.js +474 -0
- package/es-modules/Accessibility/Components/MenuComponent.d.ts +93 -0
- package/es-modules/Accessibility/Components/MenuComponent.js +430 -0
- package/es-modules/Accessibility/Components/NavigatorComponent.d.ts +57 -0
- package/es-modules/Accessibility/Components/NavigatorComponent.js +235 -0
- package/es-modules/Accessibility/Components/RangeSelectorComponent.d.ts +126 -0
- package/es-modules/Accessibility/Components/RangeSelectorComponent.js +473 -0
- package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.d.ts +18 -0
- package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +234 -0
- package/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.d.ts +87 -0
- package/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.js +309 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesComponent.d.ts +53 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesComponent.js +130 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.d.ts +28 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.js +415 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.d.ts +114 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.js +721 -0
- package/es-modules/Accessibility/Components/ZoomComponent.d.ts +96 -0
- package/es-modules/Accessibility/Components/ZoomComponent.js +314 -0
- package/es-modules/Accessibility/FocusBorder.d.ts +40 -0
- package/es-modules/Accessibility/FocusBorder.js +301 -0
- package/es-modules/Accessibility/HighContrastMode.d.ts +35 -0
- package/es-modules/Accessibility/HighContrastMode.js +100 -0
- package/es-modules/Accessibility/HighContrastTheme.d.ts +11 -0
- package/es-modules/Accessibility/HighContrastTheme.js +212 -0
- package/es-modules/Accessibility/KeyboardNavigation.d.ts +133 -0
- package/es-modules/Accessibility/KeyboardNavigation.js +450 -0
- package/es-modules/Accessibility/KeyboardNavigationHandler.d.ts +48 -0
- package/es-modules/Accessibility/KeyboardNavigationHandler.js +126 -0
- package/es-modules/Accessibility/Options/A11yDefaults.d.ts +68 -0
- package/es-modules/Accessibility/Options/A11yDefaults.js +971 -0
- package/es-modules/Accessibility/Options/DeprecatedOptions.d.ts +22 -0
- package/es-modules/Accessibility/Options/DeprecatedOptions.js +265 -0
- package/es-modules/Accessibility/Options/LangDefaults.d.ts +4 -0
- package/es-modules/Accessibility/Options/LangDefaults.js +440 -0
- package/es-modules/Accessibility/ProxyElement.d.ts +78 -0
- package/es-modules/Accessibility/ProxyElement.js +223 -0
- package/es-modules/Accessibility/ProxyProvider.d.ts +90 -0
- package/es-modules/Accessibility/ProxyProvider.js +315 -0
- package/es-modules/Accessibility/Utils/Announcer.d.ts +26 -0
- package/es-modules/Accessibility/Utils/Announcer.js +90 -0
- package/es-modules/Accessibility/Utils/ChartUtilities.d.ts +90 -0
- package/es-modules/Accessibility/Utils/ChartUtilities.js +298 -0
- package/es-modules/Accessibility/Utils/DOMElementProvider.d.ts +20 -0
- package/es-modules/Accessibility/Utils/DOMElementProvider.js +69 -0
- package/es-modules/Accessibility/Utils/EventProvider.d.ts +26 -0
- package/es-modules/Accessibility/Utils/EventProvider.js +65 -0
- package/es-modules/Accessibility/Utils/HTMLUtilities.d.ts +108 -0
- package/es-modules/Accessibility/Utils/HTMLUtilities.js +319 -0
- package/es-modules/Core/Animation/AnimationUtilities.d.ts +107 -0
- package/es-modules/Core/Animation/AnimationUtilities.js +200 -0
- package/es-modules/Core/Animation/Fx.d.ts +130 -0
- package/es-modules/Core/Animation/Fx.js +388 -0
- package/es-modules/Core/Chart/Chart.d.ts +1009 -0
- package/es-modules/Core/Chart/Chart.js +3008 -0
- package/es-modules/Core/Chart/Chart3D.d.ts +276 -0
- package/es-modules/Core/Chart/Chart3D.js +1686 -0
- package/es-modules/Core/Chart/ChartDefaults.d.ts +8 -0
- package/es-modules/Core/Chart/ChartDefaults.js +1304 -0
- package/es-modules/Core/Chart/ChartNavigationComposition.d.ts +55 -0
- package/es-modules/Core/Chart/ChartNavigationComposition.js +90 -0
- package/es-modules/Core/Chart/GanttChart.d.ts +74 -0
- package/es-modules/Core/Chart/GanttChart.js +189 -0
- package/es-modules/Core/Chart/MapChart.d.ts +132 -0
- package/es-modules/Core/Chart/MapChart.js +232 -0
- package/es-modules/Core/Chart/StockChart.d.ts +117 -0
- package/es-modules/Core/Chart/StockChart.js +641 -0
- package/es-modules/Core/Color/Color.d.ts +112 -0
- package/es-modules/Core/Color/Color.js +418 -0
- package/es-modules/Core/Color/Palettes.d.ts +84 -0
- package/es-modules/Core/Color/Palettes.js +23 -0
- package/es-modules/Core/Defaults.d.ts +42 -0
- package/es-modules/Core/Defaults.js +2977 -0
- package/es-modules/Core/Foundation.d.ts +19 -0
- package/es-modules/Core/Foundation.js +63 -0
- package/es-modules/Core/Geometry/CircleUtilities.d.ts +189 -0
- package/es-modules/Core/Geometry/CircleUtilities.js +388 -0
- package/es-modules/Core/Geometry/GeometryUtilities.d.ts +48 -0
- package/es-modules/Core/Geometry/GeometryUtilities.js +105 -0
- package/es-modules/Core/Geometry/PolygonClip.d.ts +19 -0
- package/es-modules/Core/Geometry/PolygonClip.js +96 -0
- package/es-modules/Core/Globals.d.ts +110 -0
- package/es-modules/Core/Globals.js +127 -0
- package/es-modules/Core/HttpUtilities.d.ts +61 -0
- package/es-modules/Core/HttpUtilities.js +214 -0
- package/es-modules/Core/MSPointer.d.ts +74 -0
- package/es-modules/Core/MSPointer.js +218 -0
- package/es-modules/Core/Math3D.d.ts +117 -0
- package/es-modules/Core/Math3D.js +250 -0
- package/es-modules/Core/Pointer.d.ts +590 -0
- package/es-modules/Core/Pointer.js +1631 -0
- package/es-modules/Core/Renderer/HTML/AST.d.ts +163 -0
- package/es-modules/Core/Renderer/HTML/AST.js +562 -0
- package/es-modules/Core/Renderer/HTML/HTMLElement.d.ts +76 -0
- package/es-modules/Core/Renderer/HTML/HTMLElement.js +471 -0
- package/es-modules/Core/Renderer/RendererRegistry.d.ts +29 -0
- package/es-modules/Core/Renderer/RendererRegistry.js +76 -0
- package/es-modules/Core/Renderer/RendererUtilities.d.ts +26 -0
- package/es-modules/Core/Renderer/RendererUtilities.js +172 -0
- package/es-modules/Core/Responsive.d.ts +55 -0
- package/es-modules/Core/Responsive.js +260 -0
- package/es-modules/Core/Templating.d.ts +125 -0
- package/es-modules/Core/Templating.js +428 -0
- package/es-modules/Core/Time.d.ts +69 -0
- package/es-modules/Core/Time.js +172 -0
- package/es-modules/Core/Tooltip.d.ts +297 -0
- package/es-modules/Core/Tooltip.js +1377 -0
- package/es-modules/Core/Utilities.d.ts +770 -0
- package/es-modules/Core/Utilities.js +1989 -0
- package/es-modules/Data/ColumnUtils.d.ts +87 -0
- package/es-modules/Data/ColumnUtils.js +140 -0
- package/es-modules/Data/Connectors/CSVConnector.d.ts +63 -0
- package/es-modules/Data/Connectors/CSVConnector.js +149 -0
- package/es-modules/Data/Connectors/CSVConnectorOptions.d.ts +149 -0
- package/es-modules/Data/Connectors/DataConnector.d.ts +204 -0
- package/es-modules/Data/Connectors/DataConnector.js +345 -0
- package/es-modules/Data/Connectors/DataConnectorOptions.d.ts +87 -0
- package/es-modules/Data/Connectors/DataConnectorType.d.ts +45 -0
- package/es-modules/Data/Connectors/GoogleSheetsConnector.d.ts +65 -0
- package/es-modules/Data/Connectors/GoogleSheetsConnector.js +226 -0
- package/es-modules/Data/Connectors/GoogleSheetsConnectorOptions.d.ts +167 -0
- package/es-modules/Data/Connectors/HTMLTableConnector.d.ts +77 -0
- package/es-modules/Data/Connectors/HTMLTableConnector.js +119 -0
- package/es-modules/Data/Connectors/HTMLTableConnectorOptions.d.ts +49 -0
- package/es-modules/Data/Connectors/JSONConnector.d.ts +64 -0
- package/es-modules/Data/Connectors/JSONConnector.js +156 -0
- package/es-modules/Data/Connectors/JSONConnectorOptions.d.ts +185 -0
- package/es-modules/Data/Converters/CSVConverter.d.ts +64 -0
- package/es-modules/Data/Converters/CSVConverter.js +374 -0
- package/es-modules/Data/Converters/CSVConverterOptions.d.ts +53 -0
- package/es-modules/Data/Converters/DataConverter.d.ts +168 -0
- package/es-modules/Data/Converters/DataConverter.js +387 -0
- package/es-modules/Data/Converters/DataConverterType.d.ts +40 -0
- package/es-modules/Data/Converters/DataConverterUtils.d.ts +82 -0
- package/es-modules/Data/Converters/DataConverterUtils.js +216 -0
- package/es-modules/Data/Converters/GoogleSheetsConverter.d.ts +46 -0
- package/es-modules/Data/Converters/GoogleSheetsConverter.js +135 -0
- package/es-modules/Data/Converters/GoogleSheetsConverterOptions.d.ts +52 -0
- package/es-modules/Data/Converters/HTMLTableConverter.d.ts +72 -0
- package/es-modules/Data/Converters/HTMLTableConverter.js +362 -0
- package/es-modules/Data/Converters/HTMLTableConverterOptions.d.ts +51 -0
- package/es-modules/Data/Converters/JSONConverter.d.ts +99 -0
- package/es-modules/Data/Converters/JSONConverter.js +239 -0
- package/es-modules/Data/Converters/JSONConverterOptions.d.ts +52 -0
- package/es-modules/Data/DataCursor.d.ts +176 -0
- package/es-modules/Data/DataCursor.js +379 -0
- package/es-modules/Data/DataEvent.d.ts +81 -0
- package/es-modules/Data/DataEvent.js +14 -0
- package/es-modules/Data/DataPool.d.ts +130 -0
- package/es-modules/Data/DataPool.js +257 -0
- package/es-modules/Data/DataPoolOptions.d.ts +66 -0
- package/es-modules/Data/DataTable.d.ts +563 -0
- package/es-modules/Data/DataTable.js +930 -0
- package/es-modules/Data/DataTableCore.d.ts +165 -0
- package/es-modules/Data/DataTableCore.js +316 -0
- package/es-modules/Data/DataTableOptions.d.ts +25 -0
- package/es-modules/Data/DataTableOptions.js +15 -0
- package/es-modules/Data/Formula/Formula.d.ts +21 -0
- package/es-modules/Data/Formula/Formula.js +54 -0
- package/es-modules/Data/Formula/FormulaParser.d.ts +31 -0
- package/es-modules/Data/Formula/FormulaParser.js +488 -0
- package/es-modules/Data/Formula/FormulaProcessor.d.ts +155 -0
- package/es-modules/Data/Formula/FormulaProcessor.js +529 -0
- package/es-modules/Data/Formula/FormulaTypes.d.ts +138 -0
- package/es-modules/Data/Formula/FormulaTypes.js +135 -0
- package/es-modules/Data/Formula/Functions/ABS.d.ts +19 -0
- package/es-modules/Data/Formula/Functions/ABS.js +67 -0
- package/es-modules/Data/Formula/Functions/AND.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/AND.js +59 -0
- package/es-modules/Data/Formula/Functions/AVERAGE.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/AVERAGE.js +74 -0
- package/es-modules/Data/Formula/Functions/AVERAGEA.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/AVERAGEA.js +90 -0
- package/es-modules/Data/Formula/Functions/COUNT.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/COUNT.js +65 -0
- package/es-modules/Data/Formula/Functions/COUNTA.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/COUNTA.js +71 -0
- package/es-modules/Data/Formula/Functions/IF.d.ts +21 -0
- package/es-modules/Data/Formula/Functions/IF.js +54 -0
- package/es-modules/Data/Formula/Functions/ISNA.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/ISNA.js +52 -0
- package/es-modules/Data/Formula/Functions/MAX.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/MAX.js +69 -0
- package/es-modules/Data/Formula/Functions/MEDIAN.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/MEDIAN.js +78 -0
- package/es-modules/Data/Formula/Functions/MIN.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/MIN.js +69 -0
- package/es-modules/Data/Formula/Functions/MOD.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/MOD.js +63 -0
- package/es-modules/Data/Formula/Functions/MODE.d.ts +41 -0
- package/es-modules/Data/Formula/Functions/MODE.js +149 -0
- package/es-modules/Data/Formula/Functions/NOT.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/NOT.js +60 -0
- package/es-modules/Data/Formula/Functions/OR.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/OR.js +62 -0
- package/es-modules/Data/Formula/Functions/PRODUCT.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/PRODUCT.js +68 -0
- package/es-modules/Data/Formula/Functions/SUM.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/SUM.js +65 -0
- package/es-modules/Data/Formula/Functions/XOR.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/XOR.js +81 -0
- package/es-modules/Data/Modifiers/ChainModifier.d.ts +128 -0
- package/es-modules/Data/Modifiers/ChainModifier.js +231 -0
- package/es-modules/Data/Modifiers/ChainModifierOptions.d.ts +20 -0
- package/es-modules/Data/Modifiers/ChainModifierOptions.js +14 -0
- package/es-modules/Data/Modifiers/DataModifier.d.ts +117 -0
- package/es-modules/Data/Modifiers/DataModifier.js +202 -0
- package/es-modules/Data/Modifiers/DataModifierEvent.d.ts +28 -0
- package/es-modules/Data/Modifiers/DataModifierEvent.js +15 -0
- package/es-modules/Data/Modifiers/DataModifierOptions.d.ts +11 -0
- package/es-modules/Data/Modifiers/DataModifierOptions.js +15 -0
- package/es-modules/Data/Modifiers/DataModifierType.d.ts +44 -0
- package/es-modules/Data/Modifiers/FilterModifier.d.ts +53 -0
- package/es-modules/Data/Modifiers/FilterModifier.js +172 -0
- package/es-modules/Data/Modifiers/FilterModifierOptions.d.ts +110 -0
- package/es-modules/Data/Modifiers/FilterModifierOptions.js +14 -0
- package/es-modules/Data/Modifiers/InvertModifier.d.ts +48 -0
- package/es-modules/Data/Modifiers/InvertModifier.js +116 -0
- package/es-modules/Data/Modifiers/InvertModifierOptions.d.ts +11 -0
- package/es-modules/Data/Modifiers/InvertModifierOptions.js +15 -0
- package/es-modules/Data/Modifiers/MathModifier.d.ts +68 -0
- package/es-modules/Data/Modifiers/MathModifier.js +165 -0
- package/es-modules/Data/Modifiers/MathModifierOptions.d.ts +50 -0
- package/es-modules/Data/Modifiers/MathModifierOptions.js +14 -0
- package/es-modules/Data/Modifiers/RangeModifier.d.ts +46 -0
- package/es-modules/Data/Modifiers/RangeModifier.js +96 -0
- package/es-modules/Data/Modifiers/RangeModifierOptions.d.ts +22 -0
- package/es-modules/Data/Modifiers/RangeModifierOptions.js +15 -0
- package/es-modules/Data/Modifiers/SortModifier.d.ts +54 -0
- package/es-modules/Data/Modifiers/SortModifier.js +144 -0
- package/es-modules/Data/Modifiers/SortModifierOptions.d.ts +44 -0
- package/es-modules/Data/Modifiers/SortModifierOptions.js +14 -0
- package/es-modules/Grid/Core/Accessibility/A11yOptions.d.ts +148 -0
- package/es-modules/Grid/Core/Accessibility/A11yOptions.js +17 -0
- package/es-modules/Grid/Core/Accessibility/Accessibility.d.ts +115 -0
- package/es-modules/Grid/Core/Accessibility/Accessibility.js +231 -0
- package/es-modules/Grid/Core/Credits.d.ts +57 -0
- package/es-modules/Grid/Core/Credits.js +125 -0
- package/es-modules/Grid/Core/Defaults.d.ts +20 -0
- package/es-modules/Grid/Core/Defaults.js +148 -0
- package/es-modules/Grid/Core/Globals.d.ts +103 -0
- package/es-modules/Grid/Core/Globals.js +134 -0
- package/es-modules/Grid/Core/Grid.d.ts +295 -0
- package/es-modules/Grid/Core/Grid.js +730 -0
- package/es-modules/Grid/Core/GridUtils.d.ts +110 -0
- package/es-modules/Grid/Core/GridUtils.js +191 -0
- package/es-modules/Grid/Core/Options.d.ts +599 -0
- package/es-modules/Grid/Core/Options.js +16 -0
- package/es-modules/Grid/Core/Pagination/Icons.d.ts +7 -0
- package/es-modules/Grid/Core/Pagination/Icons.js +7 -0
- package/es-modules/Grid/Core/Pagination/Pagination.d.ts +278 -0
- package/es-modules/Grid/Core/Pagination/Pagination.js +842 -0
- package/es-modules/Grid/Core/Pagination/PaginationOptions.d.ts +228 -0
- package/es-modules/Grid/Core/Querying/FilteringController.d.ts +66 -0
- package/es-modules/Grid/Core/Querying/FilteringController.js +256 -0
- package/es-modules/Grid/Core/Querying/PaginationController.d.ts +50 -0
- package/es-modules/Grid/Core/Querying/PaginationController.js +101 -0
- package/es-modules/Grid/Core/Querying/QueryingController.d.ts +58 -0
- package/es-modules/Grid/Core/Querying/QueryingController.js +127 -0
- package/es-modules/Grid/Core/Querying/SortingController.d.ts +67 -0
- package/es-modules/Grid/Core/Querying/SortingController.js +136 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.d.ts +114 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.js +351 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterCell.d.ts +14 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterCell.js +86 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterRow.d.ts +19 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterRow.js +80 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilteringTypes.d.ts +52 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilteringTypes.js +81 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnSorting.d.ts +56 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnSorting.js +170 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnsResizer.d.ts +55 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnsResizer.js +182 -0
- package/es-modules/Grid/Core/Table/Actions/RowsVirtualizer.d.ts +87 -0
- package/es-modules/Grid/Core/Table/Actions/RowsVirtualizer.js +346 -0
- package/es-modules/Grid/Core/Table/Body/TableCell.d.ts +88 -0
- package/es-modules/Grid/Core/Table/Body/TableCell.js +231 -0
- package/es-modules/Grid/Core/Table/Body/TableRow.d.ts +79 -0
- package/es-modules/Grid/Core/Table/Body/TableRow.js +177 -0
- package/es-modules/Grid/Core/Table/Cell.d.ts +92 -0
- package/es-modules/Grid/Core/Table/Cell.js +223 -0
- package/es-modules/Grid/Core/Table/CellContent/CellContent.d.ts +30 -0
- package/es-modules/Grid/Core/Table/CellContent/CellContent.js +40 -0
- package/es-modules/Grid/Core/Table/CellContent/TextContent.d.ts +19 -0
- package/es-modules/Grid/Core/Table/CellContent/TextContent.js +98 -0
- package/es-modules/Grid/Core/Table/Column.d.ts +136 -0
- package/es-modules/Grid/Core/Table/Column.js +230 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/AdjacentResizingMode.d.ts +7 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/AdjacentResizingMode.js +62 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.d.ts +32 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.js +68 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/DistributedResizingMode.d.ts +7 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/DistributedResizingMode.js +53 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/IndependentResizingMode.d.ts +7 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/IndependentResizingMode.js +63 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/ResizingMode.d.ts +92 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/ResizingMode.js +194 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.d.ts +68 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.js +187 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/FilterPopup.d.ts +29 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/FilterPopup.js +77 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/FilterMenuButton.d.ts +13 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/FilterMenuButton.js +79 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/SortMenuButton.d.ts +12 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/SortMenuButton.js +71 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuPopup.d.ts +12 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuPopup.js +66 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.d.ts +25 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.js +65 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/FilterToolbarButton.d.ts +12 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/FilterToolbarButton.js +81 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/MenuToolbarButton.d.ts +12 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/MenuToolbarButton.js +80 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.d.ts +11 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.js +81 -0
- package/es-modules/Grid/Core/Table/Header/HeaderCell.d.ts +70 -0
- package/es-modules/Grid/Core/Table/Header/HeaderCell.js +225 -0
- package/es-modules/Grid/Core/Table/Header/HeaderRow.d.ts +53 -0
- package/es-modules/Grid/Core/Table/Header/HeaderRow.js +182 -0
- package/es-modules/Grid/Core/Table/Header/TableHeader.d.ts +65 -0
- package/es-modules/Grid/Core/Table/Header/TableHeader.js +159 -0
- package/es-modules/Grid/Core/Table/Row.d.ts +76 -0
- package/es-modules/Grid/Core/Table/Row.js +131 -0
- package/es-modules/Grid/Core/Table/Table.d.ts +181 -0
- package/es-modules/Grid/Core/Table/Table.js +399 -0
- package/es-modules/Grid/Core/UI/Button.d.ts +31 -0
- package/es-modules/Grid/Core/UI/Button.js +16 -0
- package/es-modules/Grid/Core/UI/ContextMenu.d.ts +38 -0
- package/es-modules/Grid/Core/UI/ContextMenu.js +132 -0
- package/es-modules/Grid/Core/UI/ContextMenuButton.d.ts +126 -0
- package/es-modules/Grid/Core/UI/ContextMenuButton.js +183 -0
- package/es-modules/Grid/Core/UI/Popup.d.ts +149 -0
- package/es-modules/Grid/Core/UI/Popup.js +271 -0
- package/es-modules/Grid/Core/UI/SvgIcons.d.ts +53 -0
- package/es-modules/Grid/Core/UI/SvgIcons.js +158 -0
- package/es-modules/Grid/Core/UI/Toolbar.d.ts +16 -0
- package/es-modules/Grid/Core/UI/Toolbar.js +16 -0
- package/es-modules/Grid/Core/UI/ToolbarButton.d.ts +135 -0
- package/es-modules/Grid/Core/UI/ToolbarButton.js +191 -0
- package/es-modules/Grid/Pro/CellEditing/CellEditMode.d.ts +112 -0
- package/es-modules/Grid/Pro/CellEditing/CellEditing.d.ts +80 -0
- package/es-modules/Grid/Pro/CellEditing/CellEditing.js +211 -0
- package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.d.ts +123 -0
- package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.js +198 -0
- package/es-modules/Grid/Pro/CellRendering/CellContentPro.d.ts +23 -0
- package/es-modules/Grid/Pro/CellRendering/CellContentPro.js +45 -0
- package/es-modules/Grid/Pro/CellRendering/CellRenderer.d.ts +50 -0
- package/es-modules/Grid/Pro/CellRendering/CellRenderer.js +41 -0
- package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.d.ts +18 -0
- package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.js +58 -0
- package/es-modules/Grid/Pro/CellRendering/CellRendererType.d.ts +48 -0
- package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.d.ts +18 -0
- package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.js +79 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.d.ts +30 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.js +122 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContent.d.ts +12 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContent.js +39 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.d.ts +66 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.js +145 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateTimeInputContent.d.ts +12 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateTimeInputContent.js +38 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/NumberInputContent.d.ts +58 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/NumberInputContent.js +158 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.d.ts +58 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.js +173 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.d.ts +28 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.js +157 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.d.ts +58 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.js +168 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TimeInputContent.d.ts +13 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TimeInputContent.js +41 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.d.ts +50 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.js +65 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.d.ts +37 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.js +65 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRendererBase.d.ts +26 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRendererBase.js +16 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.d.ts +37 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.js +64 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.d.ts +52 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.js +64 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.d.ts +74 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.js +66 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.d.ts +45 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.js +89 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.d.ts +54 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.js +65 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.d.ts +43 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.js +74 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.d.ts +37 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.js +64 -0
- package/es-modules/Grid/Pro/ColumnTypes/ColumnDataType.d.ts +29 -0
- package/es-modules/Grid/Pro/ColumnTypes/Validator.d.ts +118 -0
- package/es-modules/Grid/Pro/ColumnTypes/Validator.js +270 -0
- package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.d.ts +32 -0
- package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.js +63 -0
- package/es-modules/Grid/Pro/Credits/CreditsPro.d.ts +35 -0
- package/es-modules/Grid/Pro/Credits/CreditsPro.js +112 -0
- package/es-modules/Grid/Pro/Credits/CreditsProComposition.d.ts +28 -0
- package/es-modules/Grid/Pro/Credits/CreditsProComposition.js +61 -0
- package/es-modules/Grid/Pro/Export/Exporting.d.ts +68 -0
- package/es-modules/Grid/Pro/Export/Exporting.js +202 -0
- package/es-modules/Grid/Pro/Export/ExportingComposition.d.ts +68 -0
- package/es-modules/Grid/Pro/Export/ExportingComposition.js +55 -0
- package/es-modules/Grid/Pro/GridEvents.d.ts +119 -0
- package/es-modules/Grid/Pro/GridEvents.js +107 -0
- package/es-modules/Grid/Pro/Pagination/PaginationComposition.d.ts +75 -0
- package/es-modules/Grid/Pro/Pagination/PaginationComposition.js +76 -0
- package/es-modules/Grid/Pro/highcharts.d.ts +7 -0
- package/es-modules/Grid/index.d.ts +5 -0
- package/es-modules/Grid/index.js +19 -0
- package/es-modules/Shared/BaseForm.d.ts +49 -0
- package/es-modules/Shared/BaseForm.js +126 -0
- package/es-modules/Shared/DownloadURL.d.ts +85 -0
- package/es-modules/Shared/DownloadURL.js +198 -0
- package/es-modules/Shared/LangOptionsCore.d.ts +27 -0
- package/es-modules/Shared/TimeBase.d.ts +353 -0
- package/es-modules/Shared/TimeBase.js +830 -0
- package/es-modules/Shared/Types.d.ts +48 -0
- package/es-modules/masters/grid-pro.src.d.ts +99 -0
- package/es-modules/masters/grid-pro.src.js +129 -0
- package/grid-pro.d.ts +50 -0
- package/grid-pro.js +12 -0
- package/grid-pro.js.map +1 -0
- package/grid-pro.src.d.ts +50 -0
- package/grid-pro.src.js +26623 -0
- package/package.json +21 -0
|
@@ -0,0 +1,1377 @@
|
|
|
1
|
+
/* *
|
|
2
|
+
*
|
|
3
|
+
* (c) 2010-2024 Torstein Honsi
|
|
4
|
+
*
|
|
5
|
+
* License: www.highcharts.com/license
|
|
6
|
+
*
|
|
7
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
8
|
+
*
|
|
9
|
+
* */
|
|
10
|
+
'use strict';
|
|
11
|
+
import A from './Animation/AnimationUtilities.js';
|
|
12
|
+
const { animObject } = A;
|
|
13
|
+
import F from './Templating.js';
|
|
14
|
+
const { format } = F;
|
|
15
|
+
import H from './Globals.js';
|
|
16
|
+
const { composed, dateFormats, doc, isSafari } = H;
|
|
17
|
+
import R from './Renderer/RendererUtilities.js';
|
|
18
|
+
const { distribute } = R;
|
|
19
|
+
import RendererRegistry from './Renderer/RendererRegistry.js';
|
|
20
|
+
import U from './Utilities.js';
|
|
21
|
+
const { addEvent, clamp, css, clearTimeout, discardElement, extend, fireEvent, getAlignFactor, isArray, isNumber, isObject, isString, merge, pick, pushUnique, splat, syncTimeout } = U;
|
|
22
|
+
/* *
|
|
23
|
+
*
|
|
24
|
+
* Class
|
|
25
|
+
*
|
|
26
|
+
* */
|
|
27
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
28
|
+
/**
|
|
29
|
+
* Tooltip of a chart.
|
|
30
|
+
*
|
|
31
|
+
* @class
|
|
32
|
+
* @name Highcharts.Tooltip
|
|
33
|
+
*
|
|
34
|
+
* @param {Highcharts.Chart} chart
|
|
35
|
+
* The chart instance.
|
|
36
|
+
*
|
|
37
|
+
* @param {Highcharts.TooltipOptions} options
|
|
38
|
+
* Tooltip options.
|
|
39
|
+
*
|
|
40
|
+
* @param {Highcharts.Pointer} pointer
|
|
41
|
+
* The pointer instance.
|
|
42
|
+
*/
|
|
43
|
+
class Tooltip {
|
|
44
|
+
/* *
|
|
45
|
+
*
|
|
46
|
+
* Constructors
|
|
47
|
+
*
|
|
48
|
+
* */
|
|
49
|
+
constructor(chart, options, pointer) {
|
|
50
|
+
/* *
|
|
51
|
+
*
|
|
52
|
+
* Properties
|
|
53
|
+
*
|
|
54
|
+
* */
|
|
55
|
+
this.allowShared = true;
|
|
56
|
+
this.crosshairs = [];
|
|
57
|
+
this.distance = 0;
|
|
58
|
+
this.isHidden = true;
|
|
59
|
+
this.isSticky = false;
|
|
60
|
+
this.options = {};
|
|
61
|
+
this.outside = false;
|
|
62
|
+
this.chart = chart;
|
|
63
|
+
this.init(chart, options);
|
|
64
|
+
this.pointer = pointer;
|
|
65
|
+
}
|
|
66
|
+
/* *
|
|
67
|
+
*
|
|
68
|
+
* Functions
|
|
69
|
+
*
|
|
70
|
+
* */
|
|
71
|
+
/**
|
|
72
|
+
* Build the body (lines) of the tooltip by iterating over the items and
|
|
73
|
+
* returning one entry for each item, abstracting this functionality allows
|
|
74
|
+
* to easily overwrite and extend it.
|
|
75
|
+
*
|
|
76
|
+
* @private
|
|
77
|
+
* @function Highcharts.Tooltip#bodyFormatter
|
|
78
|
+
*/
|
|
79
|
+
bodyFormatter(points) {
|
|
80
|
+
return points.map((point) => {
|
|
81
|
+
const tooltipOptions = point.series.tooltipOptions, formatPrefix = point.formatPrefix || 'point';
|
|
82
|
+
return (tooltipOptions[formatPrefix + 'Formatter'] ||
|
|
83
|
+
point.tooltipFormatter).call(point, tooltipOptions[formatPrefix + 'Format'] || '');
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Destroy the single tooltips in a split tooltip.
|
|
88
|
+
* If the tooltip is active then it is not destroyed, unless forced to.
|
|
89
|
+
*
|
|
90
|
+
* @private
|
|
91
|
+
* @function Highcharts.Tooltip#cleanSplit
|
|
92
|
+
*
|
|
93
|
+
* @param {boolean} [force]
|
|
94
|
+
* Force destroy all tooltips.
|
|
95
|
+
*/
|
|
96
|
+
cleanSplit(force) {
|
|
97
|
+
this.chart.series.forEach(function (series) {
|
|
98
|
+
const tt = series?.tt;
|
|
99
|
+
if (tt) {
|
|
100
|
+
if (!tt.isActive || force) {
|
|
101
|
+
series.tt = tt.destroy();
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
tt.isActive = false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* In case no user defined formatter is given, this will be used. Note that
|
|
111
|
+
* the context here is an object holding point, series, x, y etc.
|
|
112
|
+
*
|
|
113
|
+
* @function Highcharts.Tooltip#defaultFormatter
|
|
114
|
+
*
|
|
115
|
+
* @param {Highcharts.Tooltip} tooltip
|
|
116
|
+
*
|
|
117
|
+
* @return {string|Array<string>}
|
|
118
|
+
* Returns a string (single tooltip and shared)
|
|
119
|
+
* or an array of strings (split tooltip)
|
|
120
|
+
*/
|
|
121
|
+
defaultFormatter(tooltip) {
|
|
122
|
+
const hoverPoints = this.points || splat(this);
|
|
123
|
+
let s;
|
|
124
|
+
// Build the header
|
|
125
|
+
s = [tooltip.headerFooterFormatter(hoverPoints[0])];
|
|
126
|
+
// Build the values
|
|
127
|
+
s = s.concat(tooltip.bodyFormatter(hoverPoints));
|
|
128
|
+
// Footer
|
|
129
|
+
s.push(tooltip.headerFooterFormatter(hoverPoints[0], true));
|
|
130
|
+
return s;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Removes and destroys the tooltip and its elements.
|
|
134
|
+
*
|
|
135
|
+
* @function Highcharts.Tooltip#destroy
|
|
136
|
+
*/
|
|
137
|
+
destroy() {
|
|
138
|
+
// Destroy and clear local variables
|
|
139
|
+
if (this.label) {
|
|
140
|
+
this.label = this.label.destroy();
|
|
141
|
+
}
|
|
142
|
+
if (this.split) {
|
|
143
|
+
this.cleanSplit(true);
|
|
144
|
+
if (this.tt) {
|
|
145
|
+
this.tt = this.tt.destroy();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (this.renderer) {
|
|
149
|
+
this.renderer = this.renderer.destroy();
|
|
150
|
+
discardElement(this.container);
|
|
151
|
+
}
|
|
152
|
+
clearTimeout(this.hideTimer);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Extendable method to get the anchor position of the tooltip
|
|
156
|
+
* from a point or set of points
|
|
157
|
+
*
|
|
158
|
+
* @private
|
|
159
|
+
* @function Highcharts.Tooltip#getAnchor
|
|
160
|
+
*/
|
|
161
|
+
getAnchor(points, mouseEvent) {
|
|
162
|
+
const { chart, pointer } = this, inverted = chart.inverted, plotTop = chart.plotTop, plotLeft = chart.plotLeft;
|
|
163
|
+
let ret;
|
|
164
|
+
points = splat(points);
|
|
165
|
+
// If reversedStacks are false the tooltip position should be taken from
|
|
166
|
+
// the last point (#17948)
|
|
167
|
+
if (points[0].series?.yAxis &&
|
|
168
|
+
!points[0].series.yAxis.options.reversedStacks) {
|
|
169
|
+
points = points.slice().reverse();
|
|
170
|
+
}
|
|
171
|
+
// When tooltip follows mouse, relate the position to the mouse
|
|
172
|
+
if (this.followPointer && mouseEvent) {
|
|
173
|
+
if (typeof mouseEvent.chartX === 'undefined') {
|
|
174
|
+
mouseEvent = pointer.normalize(mouseEvent);
|
|
175
|
+
}
|
|
176
|
+
ret = [
|
|
177
|
+
mouseEvent.chartX - plotLeft,
|
|
178
|
+
mouseEvent.chartY - plotTop
|
|
179
|
+
];
|
|
180
|
+
// Some series types use a specificly calculated tooltip position for
|
|
181
|
+
// each point
|
|
182
|
+
}
|
|
183
|
+
else if (points[0].tooltipPos) {
|
|
184
|
+
ret = points[0].tooltipPos;
|
|
185
|
+
// Calculate the average position and adjust for axis positions
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
let chartX = 0, chartY = 0;
|
|
189
|
+
points.forEach(function (point) {
|
|
190
|
+
const pos = point.pos(true);
|
|
191
|
+
if (pos) {
|
|
192
|
+
chartX += pos[0];
|
|
193
|
+
chartY += pos[1];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
chartX /= points.length;
|
|
197
|
+
chartY /= points.length;
|
|
198
|
+
// When shared, place the tooltip next to the mouse (#424)
|
|
199
|
+
if (this.shared && points.length > 1 && mouseEvent) {
|
|
200
|
+
if (inverted) {
|
|
201
|
+
chartX = mouseEvent.chartX;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
chartY = mouseEvent.chartY;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Use the average position for multiple points
|
|
208
|
+
ret = [chartX - plotLeft, chartY - plotTop];
|
|
209
|
+
}
|
|
210
|
+
const params = { point: points[0], ret };
|
|
211
|
+
fireEvent(this, 'getAnchor', params);
|
|
212
|
+
return params.ret.map(Math.round);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Get the CSS class names for the tooltip's label. Styles the label
|
|
216
|
+
* by `colorIndex` or user-defined CSS.
|
|
217
|
+
*
|
|
218
|
+
* @function Highcharts.Tooltip#getClassName
|
|
219
|
+
*
|
|
220
|
+
* @return {string}
|
|
221
|
+
* The class names.
|
|
222
|
+
*/
|
|
223
|
+
getClassName(point, isSplit, isHeader) {
|
|
224
|
+
const options = this.options, series = point.series, seriesOptions = series.options;
|
|
225
|
+
return [
|
|
226
|
+
options.className,
|
|
227
|
+
'highcharts-label',
|
|
228
|
+
isHeader && 'highcharts-tooltip-header',
|
|
229
|
+
isSplit ? 'highcharts-tooltip-box' : 'highcharts-tooltip',
|
|
230
|
+
!isHeader && 'highcharts-color-' + pick(point.colorIndex, series.colorIndex),
|
|
231
|
+
seriesOptions?.className
|
|
232
|
+
].filter(isString).join(' ');
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Creates the Tooltip label element if it does not exist, then returns it.
|
|
236
|
+
*
|
|
237
|
+
* @function Highcharts.Tooltip#getLabel
|
|
238
|
+
*
|
|
239
|
+
* @return {Highcharts.SVGElement}
|
|
240
|
+
* Tooltip label
|
|
241
|
+
*/
|
|
242
|
+
getLabel({ anchorX, anchorY } = { anchorX: 0, anchorY: 0 }) {
|
|
243
|
+
const tooltip = this, styledMode = this.chart.styledMode, options = this.options, doSplit = this.split && this.allowShared;
|
|
244
|
+
let container = this.container, renderer = this.chart.renderer;
|
|
245
|
+
// If changing from a split tooltip to a non-split tooltip, we must
|
|
246
|
+
// destroy it in order to get the SVG right. #13868.
|
|
247
|
+
if (this.label) {
|
|
248
|
+
const wasSplit = !this.label.hasClass('highcharts-label');
|
|
249
|
+
if ((!doSplit && wasSplit) || (doSplit && !wasSplit)) {
|
|
250
|
+
this.destroy();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (!this.label) {
|
|
254
|
+
if (this.outside) {
|
|
255
|
+
const chart = this.chart, chartStyle = chart.options.chart.style, Renderer = RendererRegistry.getRendererType();
|
|
256
|
+
/**
|
|
257
|
+
* Reference to the tooltip's container, when
|
|
258
|
+
* [Highcharts.Tooltip#outside] is set to true, otherwise
|
|
259
|
+
* it's undefined.
|
|
260
|
+
*
|
|
261
|
+
* @name Highcharts.Tooltip#container
|
|
262
|
+
* @type {Highcharts.HTMLDOMElement|undefined}
|
|
263
|
+
*/
|
|
264
|
+
this.container = container = H.doc.createElement('div');
|
|
265
|
+
container.className = ('highcharts-tooltip-container ' +
|
|
266
|
+
(chart.renderTo.className.match(/(highcharts[a-zA-Z0-9-]+)\s?/gm) || [].join(' ')));
|
|
267
|
+
// We need to set pointerEvents = 'none' as otherwise it makes
|
|
268
|
+
// the area under the tooltip non-hoverable even after the
|
|
269
|
+
// tooltip disappears, #19035.
|
|
270
|
+
css(container, {
|
|
271
|
+
position: 'absolute',
|
|
272
|
+
top: '1px',
|
|
273
|
+
pointerEvents: 'none',
|
|
274
|
+
zIndex: Math.max(this.options.style.zIndex || 0, (chartStyle?.zIndex || 0) + 3)
|
|
275
|
+
});
|
|
276
|
+
/**
|
|
277
|
+
* Reference to the tooltip's renderer, when
|
|
278
|
+
* [Highcharts.Tooltip#outside] is set to true, otherwise
|
|
279
|
+
* it's undefined.
|
|
280
|
+
*
|
|
281
|
+
* @name Highcharts.Tooltip#renderer
|
|
282
|
+
* @type {Highcharts.SVGRenderer|undefined}
|
|
283
|
+
*/
|
|
284
|
+
this.renderer = renderer = new Renderer(container, 0, 0, chartStyle, void 0, void 0, renderer.styledMode);
|
|
285
|
+
}
|
|
286
|
+
// Create the label
|
|
287
|
+
if (doSplit) {
|
|
288
|
+
this.label = renderer.g('tooltip');
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
this.label = renderer
|
|
292
|
+
.label('', anchorX, anchorY, options.shape || 'callout', void 0, void 0, options.useHTML, void 0, 'tooltip')
|
|
293
|
+
.attr({
|
|
294
|
+
padding: options.padding,
|
|
295
|
+
r: options.borderRadius
|
|
296
|
+
});
|
|
297
|
+
if (!styledMode) {
|
|
298
|
+
this.label
|
|
299
|
+
.attr({
|
|
300
|
+
fill: options.backgroundColor,
|
|
301
|
+
'stroke-width': options.borderWidth || 0
|
|
302
|
+
})
|
|
303
|
+
// #2301, #2657
|
|
304
|
+
.css(options.style)
|
|
305
|
+
.css({
|
|
306
|
+
pointerEvents: (options.style.pointerEvents ||
|
|
307
|
+
(this.shouldStickOnContact() ? 'auto' : 'none'))
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
// Split tooltip use updateTooltipContainer to position the tooltip
|
|
312
|
+
// container.
|
|
313
|
+
if (tooltip.outside) {
|
|
314
|
+
const label = this.label;
|
|
315
|
+
[label.xSetter, label.ySetter].forEach((setter, i) => {
|
|
316
|
+
label[i ? 'ySetter' : 'xSetter'] = (value) => {
|
|
317
|
+
setter.call(label, tooltip.distance);
|
|
318
|
+
label[i ? 'y' : 'x'] = value;
|
|
319
|
+
if (container) {
|
|
320
|
+
container.style[i ? 'top' : 'left'] = `${value}px`;
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
this.label
|
|
326
|
+
.attr({ zIndex: 8 })
|
|
327
|
+
.shadow(options.shadow ?? !options.fixed)
|
|
328
|
+
.add();
|
|
329
|
+
}
|
|
330
|
+
if (container && !container.parentElement) {
|
|
331
|
+
H.doc.body.appendChild(container);
|
|
332
|
+
}
|
|
333
|
+
return this.label;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Get the total area available area to place the tooltip
|
|
337
|
+
*
|
|
338
|
+
* @private
|
|
339
|
+
*/
|
|
340
|
+
getPlayingField() {
|
|
341
|
+
const { body, documentElement } = doc, { chart, distance, outside } = this;
|
|
342
|
+
return {
|
|
343
|
+
width: outside ?
|
|
344
|
+
// Subtract distance to prevent scrollbars
|
|
345
|
+
Math.max(body.scrollWidth, documentElement.scrollWidth, body.offsetWidth, documentElement.offsetWidth, documentElement.clientWidth) - (2 * distance) - 2 :
|
|
346
|
+
chart.chartWidth,
|
|
347
|
+
height: outside ?
|
|
348
|
+
Math.max(body.scrollHeight, documentElement.scrollHeight, body.offsetHeight, documentElement.offsetHeight, documentElement.clientHeight) :
|
|
349
|
+
chart.chartHeight
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Place the tooltip in a chart without spilling over and not covering the
|
|
354
|
+
* point itself.
|
|
355
|
+
*
|
|
356
|
+
* @function Highcharts.Tooltip#getPosition
|
|
357
|
+
*
|
|
358
|
+
* @param {number} boxWidth
|
|
359
|
+
* Width of the tooltip box.
|
|
360
|
+
*
|
|
361
|
+
* @param {number} boxHeight
|
|
362
|
+
* Height of the tooltip box.
|
|
363
|
+
*
|
|
364
|
+
* @param {Highcharts.Point} point
|
|
365
|
+
* Tooltip related point.
|
|
366
|
+
*
|
|
367
|
+
* @return {Highcharts.PositionObject}
|
|
368
|
+
* Recommended position of the tooltip.
|
|
369
|
+
*/
|
|
370
|
+
getPosition(boxWidth, boxHeight, point) {
|
|
371
|
+
const { distance, chart, outside, pointer } = this, { inverted, plotLeft, plotTop, polar } = chart, { plotX = 0, plotY = 0 } = point, ret = {},
|
|
372
|
+
// Don't use h if chart isn't inverted (#7242) ???
|
|
373
|
+
h = (inverted && point.h) || 0, // #4117 ?
|
|
374
|
+
{ height: outerHeight, width: outerWidth } = this.getPlayingField(), chartPosition = pointer.getChartPosition(), scaleX = (val) => (val * chartPosition.scaleX), scaleY = (val) => (val * chartPosition.scaleY),
|
|
375
|
+
// Build parameter arrays for firstDimension()/secondDimension()
|
|
376
|
+
buildDimensionArray = (dim) => {
|
|
377
|
+
const isX = dim === 'x';
|
|
378
|
+
return [
|
|
379
|
+
dim, // Dimension - x or y
|
|
380
|
+
isX ? outerWidth : outerHeight,
|
|
381
|
+
isX ? boxWidth : boxHeight
|
|
382
|
+
].concat(outside ? [
|
|
383
|
+
// If we are using tooltip.outside, we need to scale the
|
|
384
|
+
// position to match scaling of the container in case there
|
|
385
|
+
// is a transform/zoom on the container. #11329
|
|
386
|
+
isX ? scaleX(boxWidth) : scaleY(boxHeight),
|
|
387
|
+
isX ? chartPosition.left - distance +
|
|
388
|
+
scaleX(plotX + plotLeft) :
|
|
389
|
+
chartPosition.top - distance +
|
|
390
|
+
scaleY(plotY + plotTop),
|
|
391
|
+
0,
|
|
392
|
+
isX ? outerWidth : outerHeight
|
|
393
|
+
] : [
|
|
394
|
+
// Not outside, no scaling is needed
|
|
395
|
+
isX ? boxWidth : boxHeight,
|
|
396
|
+
isX ? plotX + plotLeft : plotY + plotTop,
|
|
397
|
+
isX ? plotLeft : plotTop,
|
|
398
|
+
isX ? plotLeft + chart.plotWidth :
|
|
399
|
+
plotTop + chart.plotHeight
|
|
400
|
+
]);
|
|
401
|
+
};
|
|
402
|
+
let first = buildDimensionArray('y'), second = buildDimensionArray('x'), swapped;
|
|
403
|
+
// Handle negative points or reversed axis (#13780)
|
|
404
|
+
let flipped = !!point.negative;
|
|
405
|
+
if (!polar &&
|
|
406
|
+
chart.hoverSeries?.yAxis?.reversed) {
|
|
407
|
+
flipped = !flipped;
|
|
408
|
+
}
|
|
409
|
+
// The far side is right or bottom
|
|
410
|
+
const preferFarSide = !this.followPointer &&
|
|
411
|
+
pick(point.ttBelow, polar ? false : !inverted === flipped), // #4984
|
|
412
|
+
/*
|
|
413
|
+
* Handle the preferred dimension. When the preferred dimension is
|
|
414
|
+
* tooltip on top or bottom of the point, it will look for space
|
|
415
|
+
* there.
|
|
416
|
+
*
|
|
417
|
+
* @private
|
|
418
|
+
*/
|
|
419
|
+
firstDimension = function (dim, outerSize, innerSize, scaledInnerSize, // #11329
|
|
420
|
+
point, min, max) {
|
|
421
|
+
const scaledDist = outside ?
|
|
422
|
+
(dim === 'y' ? scaleY(distance) : scaleX(distance)) :
|
|
423
|
+
distance, scaleDiff = (innerSize - scaledInnerSize) / 2, roomLeft = scaledInnerSize < point - distance, roomRight = point + distance + scaledInnerSize < outerSize, alignedLeft = point - scaledDist - innerSize + scaleDiff, alignedRight = point + scaledDist - scaleDiff;
|
|
424
|
+
if (preferFarSide && roomRight) {
|
|
425
|
+
ret[dim] = alignedRight;
|
|
426
|
+
}
|
|
427
|
+
else if (!preferFarSide && roomLeft) {
|
|
428
|
+
ret[dim] = alignedLeft;
|
|
429
|
+
}
|
|
430
|
+
else if (roomLeft) {
|
|
431
|
+
ret[dim] = Math.min(max - scaledInnerSize, alignedLeft - h < 0 ? alignedLeft : alignedLeft - h);
|
|
432
|
+
}
|
|
433
|
+
else if (roomRight) {
|
|
434
|
+
ret[dim] = Math.max(min, alignedRight + h + innerSize > outerSize ?
|
|
435
|
+
alignedRight :
|
|
436
|
+
alignedRight + h);
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
ret[dim] = 0;
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
/*
|
|
444
|
+
* Handle the secondary dimension. If the preferred dimension is
|
|
445
|
+
* tooltip on top or bottom of the point, the second dimension is to
|
|
446
|
+
* align the tooltip above the point, trying to align center but
|
|
447
|
+
* allowing left or right align within the chart box.
|
|
448
|
+
*
|
|
449
|
+
* @private
|
|
450
|
+
*/
|
|
451
|
+
secondDimension = function (dim, outerSize, innerSize, scaledInnerSize, // #11329
|
|
452
|
+
point) {
|
|
453
|
+
// Too close to the edge, return false and swap dimensions
|
|
454
|
+
if (point < distance || point > outerSize - distance) {
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
// Align left/top
|
|
458
|
+
if (point < innerSize / 2) {
|
|
459
|
+
ret[dim] = 1;
|
|
460
|
+
// Align right/bottom
|
|
461
|
+
}
|
|
462
|
+
else if (point > outerSize - scaledInnerSize / 2) {
|
|
463
|
+
ret[dim] = outerSize - scaledInnerSize - 2;
|
|
464
|
+
// Align center
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
ret[dim] = point - innerSize / 2;
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
/*
|
|
471
|
+
* Swap the dimensions
|
|
472
|
+
*/
|
|
473
|
+
swap = function (count) {
|
|
474
|
+
[first, second] = [second, first];
|
|
475
|
+
swapped = count;
|
|
476
|
+
}, run = () => {
|
|
477
|
+
if (firstDimension.apply(0, first) !== false) {
|
|
478
|
+
if (secondDimension.apply(0, second) === false &&
|
|
479
|
+
!swapped) {
|
|
480
|
+
swap(true);
|
|
481
|
+
run();
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
else if (!swapped) {
|
|
485
|
+
swap(true);
|
|
486
|
+
run();
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
ret.x = ret.y = 0;
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
// Under these conditions, prefer the tooltip on the side of the point
|
|
493
|
+
if ((inverted && !polar) || this.len > 1) {
|
|
494
|
+
swap();
|
|
495
|
+
}
|
|
496
|
+
run();
|
|
497
|
+
return ret;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Place the tooltip when `position.fixed` is true. This is called both for
|
|
501
|
+
* single tooltips, and for partial tooltips when `split`.
|
|
502
|
+
*
|
|
503
|
+
* @private
|
|
504
|
+
*/
|
|
505
|
+
getFixedPosition(boxWidth, boxHeight, point) {
|
|
506
|
+
const series = point.series, { chart, options, split } = this, position = options.position, relativeToOption = position.relativeTo, noPane = options.shared || series?.yAxis?.isRadial &&
|
|
507
|
+
(relativeToOption === 'pane' || !relativeToOption), relativeTo = noPane ? 'plotBox' : relativeToOption, bounds = relativeTo === 'chart' ?
|
|
508
|
+
chart.renderer :
|
|
509
|
+
chart[relativeTo] ||
|
|
510
|
+
chart.getClipBox(series, true);
|
|
511
|
+
return {
|
|
512
|
+
x: bounds.x + (bounds.width - boxWidth) *
|
|
513
|
+
getAlignFactor(position.align) +
|
|
514
|
+
position.x,
|
|
515
|
+
y: bounds.y + (bounds.height - boxHeight) *
|
|
516
|
+
getAlignFactor(position.verticalAlign) +
|
|
517
|
+
(!split && position.y || 0)
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Hides the tooltip with a fade out animation.
|
|
522
|
+
*
|
|
523
|
+
* @function Highcharts.Tooltip#hide
|
|
524
|
+
*
|
|
525
|
+
* @param {number} [delay]
|
|
526
|
+
* The fade out in milliseconds. If no value is provided the value
|
|
527
|
+
* of the tooltip.hideDelay option is used. A value of 0 disables
|
|
528
|
+
* the fade out animation.
|
|
529
|
+
*/
|
|
530
|
+
hide(delay) {
|
|
531
|
+
const tooltip = this;
|
|
532
|
+
// Disallow duplicate timers (#1728, #1766)
|
|
533
|
+
clearTimeout(this.hideTimer);
|
|
534
|
+
delay = pick(delay, this.options.hideDelay);
|
|
535
|
+
if (!this.isHidden) {
|
|
536
|
+
this.hideTimer = syncTimeout(function () {
|
|
537
|
+
const label = tooltip.getLabel();
|
|
538
|
+
// If there is a delay, fade out with the default duration. If
|
|
539
|
+
// the hideDelay is 0, we assume no animation is wanted, so we
|
|
540
|
+
// pass 0 duration. #12994.
|
|
541
|
+
tooltip.getLabel().animate({
|
|
542
|
+
opacity: 0
|
|
543
|
+
}, {
|
|
544
|
+
duration: delay ? 150 : delay,
|
|
545
|
+
complete: () => {
|
|
546
|
+
// #3088, assuming we're only using this for tooltips
|
|
547
|
+
label.hide();
|
|
548
|
+
// Clear the container for outside tooltip (#18490)
|
|
549
|
+
if (tooltip.container) {
|
|
550
|
+
tooltip.container.remove();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
tooltip.isHidden = true;
|
|
555
|
+
}, delay);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Initialize tooltip.
|
|
560
|
+
*
|
|
561
|
+
* @private
|
|
562
|
+
* @function Highcharts.Tooltip#init
|
|
563
|
+
*
|
|
564
|
+
* @param {Highcharts.Chart} chart
|
|
565
|
+
* The chart instance.
|
|
566
|
+
*
|
|
567
|
+
* @param {Highcharts.TooltipOptions} options
|
|
568
|
+
* Tooltip options.
|
|
569
|
+
*/
|
|
570
|
+
init(chart, options) {
|
|
571
|
+
/**
|
|
572
|
+
* Chart of the tooltip.
|
|
573
|
+
*
|
|
574
|
+
* @readonly
|
|
575
|
+
* @name Highcharts.Tooltip#chart
|
|
576
|
+
* @type {Highcharts.Chart}
|
|
577
|
+
*/
|
|
578
|
+
this.chart = chart;
|
|
579
|
+
/**
|
|
580
|
+
* Used tooltip options.
|
|
581
|
+
*
|
|
582
|
+
* @readonly
|
|
583
|
+
* @name Highcharts.Tooltip#options
|
|
584
|
+
* @type {Highcharts.TooltipOptions}
|
|
585
|
+
*/
|
|
586
|
+
this.options = options;
|
|
587
|
+
/**
|
|
588
|
+
* List of crosshairs.
|
|
589
|
+
*
|
|
590
|
+
* @private
|
|
591
|
+
* @readonly
|
|
592
|
+
* @name Highcharts.Tooltip#crosshairs
|
|
593
|
+
* @type {Array<null>}
|
|
594
|
+
*/
|
|
595
|
+
this.crosshairs = [];
|
|
596
|
+
/**
|
|
597
|
+
* Tooltips are initially hidden.
|
|
598
|
+
*
|
|
599
|
+
* @private
|
|
600
|
+
* @readonly
|
|
601
|
+
* @name Highcharts.Tooltip#isHidden
|
|
602
|
+
* @type {boolean}
|
|
603
|
+
*/
|
|
604
|
+
this.isHidden = true;
|
|
605
|
+
/**
|
|
606
|
+
* True, if the tooltip is split into one label per series, with the
|
|
607
|
+
* header close to the axis.
|
|
608
|
+
*
|
|
609
|
+
* @readonly
|
|
610
|
+
* @name Highcharts.Tooltip#split
|
|
611
|
+
* @type {boolean|undefined}
|
|
612
|
+
*/
|
|
613
|
+
this.split = options.split && !chart.inverted && !chart.polar;
|
|
614
|
+
/**
|
|
615
|
+
* When the tooltip is shared, the entire plot area will capture mouse
|
|
616
|
+
* movement or touch events.
|
|
617
|
+
*
|
|
618
|
+
* @readonly
|
|
619
|
+
* @name Highcharts.Tooltip#shared
|
|
620
|
+
* @type {boolean|undefined}
|
|
621
|
+
*/
|
|
622
|
+
this.shared = options.shared || this.split;
|
|
623
|
+
/**
|
|
624
|
+
* Whether to allow the tooltip to render outside the chart's SVG
|
|
625
|
+
* element box. By default (false), the tooltip is rendered within the
|
|
626
|
+
* chart's SVG element, which results in the tooltip being aligned
|
|
627
|
+
* inside the chart area.
|
|
628
|
+
*
|
|
629
|
+
* @readonly
|
|
630
|
+
* @name Highcharts.Tooltip#outside
|
|
631
|
+
* @type {boolean}
|
|
632
|
+
*
|
|
633
|
+
* @todo
|
|
634
|
+
* Split tooltip does not support outside in the first iteration. Should
|
|
635
|
+
* not be too complicated to implement.
|
|
636
|
+
*/
|
|
637
|
+
this.outside = pick(options.outside, Boolean(chart.scrollablePixelsX || chart.scrollablePixelsY));
|
|
638
|
+
}
|
|
639
|
+
shouldStickOnContact(pointerEvent) {
|
|
640
|
+
return !!(!this.followPointer &&
|
|
641
|
+
this.options.stickOnContact &&
|
|
642
|
+
(!pointerEvent || this.pointer.inClass(pointerEvent.target, 'highcharts-tooltip')));
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Moves the tooltip with a soft animation to a new position.
|
|
646
|
+
*
|
|
647
|
+
* @private
|
|
648
|
+
* @function Highcharts.Tooltip#move
|
|
649
|
+
*
|
|
650
|
+
* @param {number} x
|
|
651
|
+
*
|
|
652
|
+
* @param {number} y
|
|
653
|
+
*
|
|
654
|
+
* @param {number} anchorX
|
|
655
|
+
*
|
|
656
|
+
* @param {number} anchorY
|
|
657
|
+
*/
|
|
658
|
+
move(x, y, anchorX, anchorY) {
|
|
659
|
+
const { followPointer, options } = this, animation = animObject(!followPointer &&
|
|
660
|
+
!this.isHidden &&
|
|
661
|
+
!options.fixed &&
|
|
662
|
+
options.animation), skipAnchor = followPointer || (this.len || 0) > 1, attr = { x, y };
|
|
663
|
+
if (!skipAnchor) {
|
|
664
|
+
attr.anchorX = anchorX;
|
|
665
|
+
attr.anchorY = anchorY;
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
// Clear anchor with NaN to prevent animation (#22295)
|
|
669
|
+
attr.anchorX = attr.anchorY = NaN;
|
|
670
|
+
}
|
|
671
|
+
animation.step = () => this.drawTracker();
|
|
672
|
+
this.getLabel().animate(attr, animation);
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Refresh the tooltip's text and position.
|
|
676
|
+
*
|
|
677
|
+
* @function Highcharts.Tooltip#refresh
|
|
678
|
+
*
|
|
679
|
+
* @param {Highcharts.Point|Array<Highcharts.Point>} pointOrPoints
|
|
680
|
+
* Either a point or an array of points.
|
|
681
|
+
*
|
|
682
|
+
* @param {Highcharts.PointerEventObject} [mouseEvent]
|
|
683
|
+
* Mouse event, that is responsible for the refresh and should be
|
|
684
|
+
* used for the tooltip update.
|
|
685
|
+
*/
|
|
686
|
+
refresh(pointOrPoints, mouseEvent) {
|
|
687
|
+
const tooltip = this, { chart, options, pointer, shared } = this, points = splat(pointOrPoints), point = points[0], formatString = options.format, formatter = options.formatter || tooltip.defaultFormatter, styledMode = chart.styledMode;
|
|
688
|
+
let wasShared = tooltip.allowShared;
|
|
689
|
+
if (!options.enabled || !point.series) { // #16820
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
clearTimeout(this.hideTimer);
|
|
693
|
+
// A switch saying if this specific tooltip configuration allows shared
|
|
694
|
+
// or split modes
|
|
695
|
+
tooltip.allowShared = !(!isArray(pointOrPoints) &&
|
|
696
|
+
pointOrPoints.series &&
|
|
697
|
+
pointOrPoints.series.noSharedTooltip);
|
|
698
|
+
wasShared = wasShared && !tooltip.allowShared;
|
|
699
|
+
// Get the reference point coordinates (pie charts use tooltipPos)
|
|
700
|
+
tooltip.followPointer = (!tooltip.split && point.series.tooltipOptions.followPointer);
|
|
701
|
+
const anchor = tooltip.getAnchor(pointOrPoints, mouseEvent), x = anchor[0], y = anchor[1];
|
|
702
|
+
// Shared tooltip, array is sent over
|
|
703
|
+
if (shared && tooltip.allowShared) {
|
|
704
|
+
pointer.applyInactiveState(points);
|
|
705
|
+
// Now set hover state for the chosen ones:
|
|
706
|
+
points.forEach((item) => item.setState('hover'));
|
|
707
|
+
point.points = points;
|
|
708
|
+
}
|
|
709
|
+
this.len = points.length; // #6128
|
|
710
|
+
const text = isString(formatString) ?
|
|
711
|
+
format(formatString, point, chart) :
|
|
712
|
+
formatter.call(point, tooltip);
|
|
713
|
+
// Reset the preliminary circular references
|
|
714
|
+
point.points = void 0;
|
|
715
|
+
// Register the current series
|
|
716
|
+
const currentSeries = point.series;
|
|
717
|
+
this.distance = pick(currentSeries.tooltipOptions.distance, 16);
|
|
718
|
+
// Update the inner HTML
|
|
719
|
+
if (text === false) {
|
|
720
|
+
this.hide();
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
// Update text
|
|
724
|
+
if (tooltip.split && tooltip.allowShared) { // #13868
|
|
725
|
+
this.renderSplit(text, points);
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
let checkX = x;
|
|
729
|
+
let checkY = y;
|
|
730
|
+
if (mouseEvent && pointer.isDirectTouch) {
|
|
731
|
+
checkX = mouseEvent.chartX - chart.plotLeft;
|
|
732
|
+
checkY = mouseEvent.chartY - chart.plotTop;
|
|
733
|
+
}
|
|
734
|
+
// #11493, #13095
|
|
735
|
+
if (chart.polar ||
|
|
736
|
+
currentSeries.options.clip === false ||
|
|
737
|
+
points.some((p) => // #16004
|
|
738
|
+
pointer.isDirectTouch || // ##17929
|
|
739
|
+
p.series.shouldShowTooltip(checkX, checkY))) {
|
|
740
|
+
const label = tooltip.getLabel(wasShared && tooltip.tt || {});
|
|
741
|
+
// Prevent the tooltip from flowing over the chart box
|
|
742
|
+
// (#6659)
|
|
743
|
+
if (!options.style.width || styledMode) {
|
|
744
|
+
label.css({
|
|
745
|
+
width: (this.outside ?
|
|
746
|
+
this.getPlayingField() :
|
|
747
|
+
chart.spacingBox).width + 'px'
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
label.attr({
|
|
751
|
+
// Add class before the label BBox calculation (#21035)
|
|
752
|
+
'class': tooltip.getClassName(point),
|
|
753
|
+
text: text && text.join ?
|
|
754
|
+
text.join('') :
|
|
755
|
+
text
|
|
756
|
+
});
|
|
757
|
+
// When the length of the label has increased, immediately
|
|
758
|
+
// update the x position to prevent tooltip from flowing
|
|
759
|
+
// outside the viewport during animation (#21371)
|
|
760
|
+
if (this.outside) {
|
|
761
|
+
label.attr({
|
|
762
|
+
x: clamp(label.x || 0, 0, this.getPlayingField().width -
|
|
763
|
+
(label.width || 0) -
|
|
764
|
+
1)
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
if (!styledMode) {
|
|
768
|
+
label.attr({
|
|
769
|
+
stroke: (options.borderColor ||
|
|
770
|
+
point.color ||
|
|
771
|
+
currentSeries.color ||
|
|
772
|
+
"#666666" /* Palette.neutralColor60 */)
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
tooltip.updatePosition({
|
|
776
|
+
plotX: x,
|
|
777
|
+
plotY: y,
|
|
778
|
+
negative: point.negative,
|
|
779
|
+
ttBelow: point.ttBelow,
|
|
780
|
+
series: currentSeries,
|
|
781
|
+
h: anchor[2] || 0
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
tooltip.hide();
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
// Show it
|
|
790
|
+
if (tooltip.isHidden && tooltip.label) {
|
|
791
|
+
tooltip.label.attr({
|
|
792
|
+
opacity: 1
|
|
793
|
+
}).show();
|
|
794
|
+
}
|
|
795
|
+
tooltip.isHidden = false;
|
|
796
|
+
}
|
|
797
|
+
fireEvent(this, 'refresh');
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Render the split tooltip. Loops over each point's text and adds
|
|
801
|
+
* a label next to the point, then uses the distribute function to
|
|
802
|
+
* find best non-overlapping positions.
|
|
803
|
+
*
|
|
804
|
+
* @private
|
|
805
|
+
* @function Highcharts.Tooltip#renderSplit
|
|
806
|
+
*
|
|
807
|
+
* @param {string|Array<(boolean|string)>} labels
|
|
808
|
+
*
|
|
809
|
+
* @param {Array<Highcharts.Point>} points
|
|
810
|
+
*/
|
|
811
|
+
renderSplit(labels, points) {
|
|
812
|
+
const tooltip = this;
|
|
813
|
+
const { chart, chart: { chartWidth, chartHeight, plotHeight, plotLeft, plotTop, scrollablePixelsY = 0, scrollablePixelsX, styledMode }, distance, options, options: { fixed, position, positioner }, pointer } = tooltip;
|
|
814
|
+
const { scrollLeft = 0, scrollTop = 0 } = chart.scrollablePlotArea?.scrollingContainer || {};
|
|
815
|
+
// The area which the tooltip should be limited to. Limit to scrollable
|
|
816
|
+
// plot area if enabled, otherwise limit to the chart container. If
|
|
817
|
+
// outside is true it should be the whole viewport
|
|
818
|
+
const bounds = (tooltip.outside &&
|
|
819
|
+
typeof scrollablePixelsX !== 'number') ?
|
|
820
|
+
doc.documentElement.getBoundingClientRect() : {
|
|
821
|
+
left: scrollLeft,
|
|
822
|
+
right: scrollLeft + chartWidth,
|
|
823
|
+
top: scrollTop,
|
|
824
|
+
bottom: scrollTop + chartHeight
|
|
825
|
+
};
|
|
826
|
+
const tooltipLabel = tooltip.getLabel();
|
|
827
|
+
const ren = this.renderer || chart.renderer;
|
|
828
|
+
const headerTop = Boolean(chart.xAxis[0]?.opposite);
|
|
829
|
+
const { left: chartLeft, top: chartTop } = pointer.getChartPosition();
|
|
830
|
+
const hasFixedPosition = positioner || fixed;
|
|
831
|
+
let distributionBoxTop = plotTop + scrollTop;
|
|
832
|
+
let headerHeight = 0;
|
|
833
|
+
let adjustedPlotHeight = plotHeight - scrollablePixelsY;
|
|
834
|
+
/**
|
|
835
|
+
* Calculates the anchor position for the partial tooltip
|
|
836
|
+
*
|
|
837
|
+
* @private
|
|
838
|
+
* @param {Highcharts.Point} point The point related to the tooltip
|
|
839
|
+
* @return {Object} Returns an object with anchorX and anchorY
|
|
840
|
+
*/
|
|
841
|
+
function getAnchor(point) {
|
|
842
|
+
const { isHeader, plotX = 0, plotY = 0, series } = point;
|
|
843
|
+
let anchorX;
|
|
844
|
+
let anchorY;
|
|
845
|
+
if (isHeader) {
|
|
846
|
+
// Set anchorX to plotX
|
|
847
|
+
anchorX = Math.max(plotLeft + plotX, plotLeft);
|
|
848
|
+
// Set anchorY to center of visible plot area.
|
|
849
|
+
anchorY = plotTop + plotHeight / 2;
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
const { xAxis, yAxis } = series;
|
|
853
|
+
// Set anchorX to plotX. Limit to within xAxis.
|
|
854
|
+
anchorX = xAxis.pos + clamp(plotX, -distance, xAxis.len + distance);
|
|
855
|
+
// Set anchorY, limit to the scrollable plot area
|
|
856
|
+
if (series.shouldShowTooltip(0, yAxis.pos - plotTop + plotY, {
|
|
857
|
+
ignoreX: true
|
|
858
|
+
})) {
|
|
859
|
+
anchorY = yAxis.pos + plotY;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
// Limit values to plot area
|
|
863
|
+
anchorX = clamp(anchorX, bounds.left - distance, bounds.right + distance);
|
|
864
|
+
return { anchorX, anchorY };
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Calculate the position of the partial tooltip
|
|
868
|
+
* @private
|
|
869
|
+
*/
|
|
870
|
+
const defaultPositioner = function (boxWidth, boxHeight, point, anchor = [0, 0], alignedLeft = true) {
|
|
871
|
+
let x, y;
|
|
872
|
+
if (point.isHeader) {
|
|
873
|
+
y = headerTop ? 0 : adjustedPlotHeight;
|
|
874
|
+
x = clamp(anchor[0] - (boxWidth / 2), bounds.left, bounds.right - boxWidth - (tooltip.outside ? chartLeft : 0));
|
|
875
|
+
}
|
|
876
|
+
else if (fixed && point) {
|
|
877
|
+
const pos = tooltip.getFixedPosition(boxWidth, boxHeight, point);
|
|
878
|
+
x = pos.x;
|
|
879
|
+
y = pos.y - distributionBoxTop;
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
y = anchor[1] - distributionBoxTop;
|
|
883
|
+
x = alignedLeft ?
|
|
884
|
+
anchor[0] - boxWidth - distance :
|
|
885
|
+
anchor[0] + distance;
|
|
886
|
+
x = clamp(x, alignedLeft ? x : bounds.left, bounds.right);
|
|
887
|
+
}
|
|
888
|
+
// NOTE: y is relative to distributionBoxTop
|
|
889
|
+
return { x, y };
|
|
890
|
+
};
|
|
891
|
+
/**
|
|
892
|
+
* Updates the attributes and styling of the partial tooltip. Creates a
|
|
893
|
+
* new partial tooltip if it does not exists.
|
|
894
|
+
*
|
|
895
|
+
* @private
|
|
896
|
+
* @param {Highcharts.SVGElement|undefined} partialTooltip
|
|
897
|
+
* The partial tooltip to update
|
|
898
|
+
* @param {Highcharts.Point} point
|
|
899
|
+
* The point related to the partial tooltip
|
|
900
|
+
* @param {boolean|string} str The text for the partial tooltip
|
|
901
|
+
* @return {Highcharts.SVGElement} Returns the updated partial tooltip
|
|
902
|
+
*/
|
|
903
|
+
function updatePartialTooltip(partialTooltip, point, str) {
|
|
904
|
+
let tt = partialTooltip;
|
|
905
|
+
const { isHeader, series } = point, ttOptions = series.tooltipOptions || options;
|
|
906
|
+
if (!tt) {
|
|
907
|
+
const attribs = {
|
|
908
|
+
padding: ttOptions.padding,
|
|
909
|
+
r: ttOptions.borderRadius
|
|
910
|
+
};
|
|
911
|
+
if (!styledMode) {
|
|
912
|
+
attribs.fill = ttOptions.backgroundColor;
|
|
913
|
+
attribs['stroke-width'] = ttOptions.borderWidth ?? (fixed && !isHeader ? 0 : 1);
|
|
914
|
+
}
|
|
915
|
+
tt = ren
|
|
916
|
+
.label('', 0, 0, (ttOptions[isHeader ? 'headerShape' : 'shape']) ||
|
|
917
|
+
(fixed && !isHeader ? 'rect' : 'callout'), void 0, void 0, ttOptions.useHTML)
|
|
918
|
+
.addClass(tooltip.getClassName(point, true, isHeader))
|
|
919
|
+
.attr(attribs)
|
|
920
|
+
.add(tooltipLabel);
|
|
921
|
+
}
|
|
922
|
+
tt.isActive = true;
|
|
923
|
+
tt.attr({
|
|
924
|
+
text: str
|
|
925
|
+
});
|
|
926
|
+
if (!styledMode) {
|
|
927
|
+
tt.css(ttOptions.style)
|
|
928
|
+
.attr({
|
|
929
|
+
stroke: (ttOptions.borderColor ||
|
|
930
|
+
point.color ||
|
|
931
|
+
series.color ||
|
|
932
|
+
"#333333" /* Palette.neutralColor80 */)
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
return tt;
|
|
936
|
+
}
|
|
937
|
+
// Graceful degradation for legacy formatters
|
|
938
|
+
if (isString(labels)) {
|
|
939
|
+
labels = [false, labels];
|
|
940
|
+
}
|
|
941
|
+
// Create the individual labels for header and points, ignore footer
|
|
942
|
+
let boxes = labels.slice(0, points.length + 1).reduce(function (boxes, str, i) {
|
|
943
|
+
if (str !== false && str !== '') {
|
|
944
|
+
const point = (points[i - 1] ||
|
|
945
|
+
{
|
|
946
|
+
// Item 0 is the header. Instead of this, we could also
|
|
947
|
+
// use the crosshair label
|
|
948
|
+
isHeader: true,
|
|
949
|
+
plotX: points[0].plotX,
|
|
950
|
+
plotY: plotHeight,
|
|
951
|
+
series: {}
|
|
952
|
+
});
|
|
953
|
+
const isHeader = point.isHeader;
|
|
954
|
+
// Store the tooltip label reference on the series
|
|
955
|
+
const owner = isHeader ? tooltip : point.series;
|
|
956
|
+
const tt = owner.tt = updatePartialTooltip(owner.tt, point, str.toString());
|
|
957
|
+
// Get X position now, so we can move all to the other side in
|
|
958
|
+
// case of overflow
|
|
959
|
+
const bBox = tt.getBBox();
|
|
960
|
+
const boxWidth = bBox.width + tt.strokeWidth();
|
|
961
|
+
if (isHeader) {
|
|
962
|
+
headerHeight = bBox.height;
|
|
963
|
+
adjustedPlotHeight += headerHeight;
|
|
964
|
+
if (headerTop) {
|
|
965
|
+
distributionBoxTop -= headerHeight;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
const { anchorX, anchorY } = getAnchor(point);
|
|
969
|
+
if (typeof anchorY === 'number') {
|
|
970
|
+
const size = bBox.height + 1, boxPosition = (positioner || defaultPositioner).call(tooltip, boxWidth, size, point, [anchorX, anchorY]);
|
|
971
|
+
boxes.push({
|
|
972
|
+
// 0-align to the top, 1-align to the bottom
|
|
973
|
+
align: hasFixedPosition ? 0 : void 0,
|
|
974
|
+
anchorX,
|
|
975
|
+
anchorY,
|
|
976
|
+
boxWidth,
|
|
977
|
+
point,
|
|
978
|
+
rank: pick(boxPosition.rank, isHeader ? 1 : 0),
|
|
979
|
+
size,
|
|
980
|
+
target: boxPosition.y,
|
|
981
|
+
tt,
|
|
982
|
+
x: boxPosition.x
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
else {
|
|
986
|
+
// Hide tooltips which anchorY is outside the visible plot
|
|
987
|
+
// area
|
|
988
|
+
tt.isActive = false;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
return boxes;
|
|
992
|
+
}, []);
|
|
993
|
+
// Realign the tooltips towards the right if there is not enough space
|
|
994
|
+
// to the left and there is space to the right
|
|
995
|
+
if (!hasFixedPosition && boxes.some((box) => {
|
|
996
|
+
// Always realign if the beginning of a label is outside bounds
|
|
997
|
+
const { outside } = tooltip;
|
|
998
|
+
const boxStart = (outside ? chartLeft : 0) + box.anchorX;
|
|
999
|
+
if (boxStart < bounds.left &&
|
|
1000
|
+
boxStart + box.boxWidth < bounds.right) {
|
|
1001
|
+
return true;
|
|
1002
|
+
}
|
|
1003
|
+
// Otherwise, check if there is more space available to the right
|
|
1004
|
+
return boxStart < (chartLeft - bounds.left) + box.boxWidth &&
|
|
1005
|
+
bounds.right - boxStart > boxStart;
|
|
1006
|
+
})) {
|
|
1007
|
+
boxes = boxes.map((box) => {
|
|
1008
|
+
const { x, y } = defaultPositioner.call(this, box.boxWidth, box.size, box.point, [box.anchorX, box.anchorY], false);
|
|
1009
|
+
return extend(box, {
|
|
1010
|
+
target: y,
|
|
1011
|
+
x
|
|
1012
|
+
});
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
// Clean previous run (for missing points)
|
|
1016
|
+
tooltip.cleanSplit();
|
|
1017
|
+
// Distribute and put in place
|
|
1018
|
+
distribute(boxes, adjustedPlotHeight);
|
|
1019
|
+
const boxExtremes = {
|
|
1020
|
+
left: chartLeft,
|
|
1021
|
+
right: chartLeft
|
|
1022
|
+
};
|
|
1023
|
+
// Get the extremes from series tooltips
|
|
1024
|
+
boxes.forEach(function (box) {
|
|
1025
|
+
const { x, boxWidth, isHeader } = box;
|
|
1026
|
+
if (!isHeader) {
|
|
1027
|
+
if (tooltip.outside && chartLeft + x < boxExtremes.left) {
|
|
1028
|
+
boxExtremes.left = chartLeft + x;
|
|
1029
|
+
}
|
|
1030
|
+
if (!isHeader &&
|
|
1031
|
+
tooltip.outside &&
|
|
1032
|
+
boxExtremes.left + boxWidth > boxExtremes.right) {
|
|
1033
|
+
boxExtremes.right = chartLeft + x;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
boxes.forEach(function (box) {
|
|
1038
|
+
const { x, anchorX, anchorY, pos, point: { isHeader } } = box;
|
|
1039
|
+
const attributes = {
|
|
1040
|
+
visibility: typeof pos === 'undefined' ? 'hidden' : 'inherit',
|
|
1041
|
+
x,
|
|
1042
|
+
/* NOTE: y should equal pos to be consistent with !split
|
|
1043
|
+
* tooltip, but is currently relative to plotTop. Is left as is
|
|
1044
|
+
* to avoid breaking change. Remove distributionBoxTop to make
|
|
1045
|
+
* it consistent.
|
|
1046
|
+
*/
|
|
1047
|
+
y: (pos || 0) + distributionBoxTop + (fixed && position.y || 0),
|
|
1048
|
+
anchorX,
|
|
1049
|
+
anchorY
|
|
1050
|
+
};
|
|
1051
|
+
// Handle left-aligned tooltips overflowing the chart area
|
|
1052
|
+
if (tooltip.outside && x < anchorX) {
|
|
1053
|
+
const offset = chartLeft - boxExtremes.left;
|
|
1054
|
+
// Skip this if there is no overflow
|
|
1055
|
+
if (offset > 0) {
|
|
1056
|
+
if (!isHeader) {
|
|
1057
|
+
attributes.x = x + offset;
|
|
1058
|
+
attributes.anchorX = anchorX + offset;
|
|
1059
|
+
}
|
|
1060
|
+
if (isHeader) {
|
|
1061
|
+
attributes.x = (boxExtremes.right - boxExtremes.left) / 2;
|
|
1062
|
+
attributes.anchorX = anchorX + offset;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
// Put the label in place
|
|
1067
|
+
box.tt.attr(attributes);
|
|
1068
|
+
});
|
|
1069
|
+
/* If we have a separate tooltip container, then update the necessary
|
|
1070
|
+
* container properties.
|
|
1071
|
+
* Test that tooltip has its own container and renderer before executing
|
|
1072
|
+
* the operation.
|
|
1073
|
+
*/
|
|
1074
|
+
const { container, outside, renderer } = tooltip;
|
|
1075
|
+
if (outside && container && renderer) {
|
|
1076
|
+
// Set container size to fit the bounds
|
|
1077
|
+
const { width, height, x, y } = tooltipLabel.getBBox();
|
|
1078
|
+
renderer.setSize(width + x, height + y, false);
|
|
1079
|
+
// Position the tooltip container to the chart container
|
|
1080
|
+
container.style.left = boxExtremes.left + 'px';
|
|
1081
|
+
container.style.top = chartTop + 'px';
|
|
1082
|
+
}
|
|
1083
|
+
// Workaround for #18927, artefacts left by the shadows of split
|
|
1084
|
+
// tooltips in Safari v16 (2023). Check again with later versions if we
|
|
1085
|
+
// can remove this.
|
|
1086
|
+
if (isSafari) {
|
|
1087
|
+
tooltipLabel.attr({
|
|
1088
|
+
// Force a redraw of the whole group by chaining the opacity
|
|
1089
|
+
// slightly
|
|
1090
|
+
opacity: tooltipLabel.opacity === 1 ? 0.999 : 1
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* If the `stickOnContact` option is active, this will add a tracker shape.
|
|
1096
|
+
*
|
|
1097
|
+
* @private
|
|
1098
|
+
* @function Highcharts.Tooltip#drawTracker
|
|
1099
|
+
*/
|
|
1100
|
+
drawTracker() {
|
|
1101
|
+
const tooltip = this;
|
|
1102
|
+
if (!this.shouldStickOnContact()) {
|
|
1103
|
+
if (tooltip.tracker) {
|
|
1104
|
+
tooltip.tracker = tooltip.tracker.destroy();
|
|
1105
|
+
}
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
const chart = tooltip.chart;
|
|
1109
|
+
const label = tooltip.label;
|
|
1110
|
+
const points = tooltip.shared ? chart.hoverPoints : chart.hoverPoint;
|
|
1111
|
+
if (!label || !points) {
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
const box = {
|
|
1115
|
+
x: 0,
|
|
1116
|
+
y: 0,
|
|
1117
|
+
width: 0,
|
|
1118
|
+
height: 0
|
|
1119
|
+
};
|
|
1120
|
+
// Combine anchor and tooltip
|
|
1121
|
+
const anchorPos = this.getAnchor(points);
|
|
1122
|
+
const labelBBox = label.getBBox();
|
|
1123
|
+
anchorPos[0] += chart.plotLeft - (label.translateX || 0);
|
|
1124
|
+
anchorPos[1] += chart.plotTop - (label.translateY || 0);
|
|
1125
|
+
// When the mouse pointer is between the anchor point and the label,
|
|
1126
|
+
// the label should stick.
|
|
1127
|
+
box.x = Math.min(0, anchorPos[0]);
|
|
1128
|
+
box.y = Math.min(0, anchorPos[1]);
|
|
1129
|
+
box.width = (anchorPos[0] < 0 ?
|
|
1130
|
+
Math.max(Math.abs(anchorPos[0]), labelBBox.width - anchorPos[0]) :
|
|
1131
|
+
Math.max(Math.abs(anchorPos[0]), labelBBox.width));
|
|
1132
|
+
box.height = (anchorPos[1] < 0 ?
|
|
1133
|
+
Math.max(Math.abs(anchorPos[1]), labelBBox.height - Math.abs(anchorPos[1])) :
|
|
1134
|
+
Math.max(Math.abs(anchorPos[1]), labelBBox.height));
|
|
1135
|
+
if (tooltip.tracker) {
|
|
1136
|
+
tooltip.tracker.attr(box);
|
|
1137
|
+
}
|
|
1138
|
+
else {
|
|
1139
|
+
tooltip.tracker = label.renderer
|
|
1140
|
+
.rect(box)
|
|
1141
|
+
.addClass('highcharts-tracker')
|
|
1142
|
+
.add(label);
|
|
1143
|
+
// For a rapid move going outside of the elements keeping the
|
|
1144
|
+
// tooltip visible, cancel the hide (#23512).
|
|
1145
|
+
addEvent(tooltip.tracker.element, 'mouseenter', () => {
|
|
1146
|
+
clearTimeout(tooltip.hideTimer);
|
|
1147
|
+
});
|
|
1148
|
+
if (!chart.styledMode) {
|
|
1149
|
+
tooltip.tracker.attr({
|
|
1150
|
+
fill: 'rgba(0,0,0,0)'
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* @private
|
|
1157
|
+
*/
|
|
1158
|
+
styledModeFormat(formatString) {
|
|
1159
|
+
return formatString
|
|
1160
|
+
.replace('style="font-size: 0.8em"', 'class="highcharts-header"')
|
|
1161
|
+
.replace(/style="color:{(point|series)\.color}"/g, 'class="highcharts-color-{$1.colorIndex} ' +
|
|
1162
|
+
'{series.options.className} ' +
|
|
1163
|
+
'{point.options.className}"');
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Format the footer/header of the tooltip
|
|
1167
|
+
* #3397: abstraction to enable formatting of footer and header
|
|
1168
|
+
*
|
|
1169
|
+
* @private
|
|
1170
|
+
* @function Highcharts.Tooltip#headerFooterFormatter
|
|
1171
|
+
*/
|
|
1172
|
+
headerFooterFormatter(point, isFooter) {
|
|
1173
|
+
const series = point.series, tooltipOptions = series.tooltipOptions, xAxis = series.xAxis, dateTime = xAxis?.dateTime, e = {
|
|
1174
|
+
isFooter,
|
|
1175
|
+
point
|
|
1176
|
+
};
|
|
1177
|
+
let xDateFormat = tooltipOptions.xDateFormat || '', formatString = tooltipOptions[isFooter ? 'footerFormat' : 'headerFormat'];
|
|
1178
|
+
fireEvent(this, 'headerFormatter', e, function (e) {
|
|
1179
|
+
// Guess the best date format based on the closest point distance
|
|
1180
|
+
// (#568, #3418)
|
|
1181
|
+
if (dateTime && !xDateFormat && isNumber(point.key)) {
|
|
1182
|
+
xDateFormat = dateTime.getXDateFormat(point.key, tooltipOptions.dateTimeLabelFormats);
|
|
1183
|
+
}
|
|
1184
|
+
// Insert the footer date format if any
|
|
1185
|
+
if (dateTime && xDateFormat) {
|
|
1186
|
+
if (isObject(xDateFormat)) {
|
|
1187
|
+
const format = xDateFormat;
|
|
1188
|
+
dateFormats[0] = (timestamp) => series.chart.time.dateFormat(format, timestamp);
|
|
1189
|
+
xDateFormat = '%0';
|
|
1190
|
+
}
|
|
1191
|
+
(point.tooltipDateKeys || ['key']).forEach((key) => {
|
|
1192
|
+
formatString = formatString.replace(new RegExp('point\\.' + key + '([ \\)}])'), `(point.${key}:${xDateFormat})$1`);
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
// Replace default header style with class name
|
|
1196
|
+
if (series.chart.styledMode) {
|
|
1197
|
+
formatString = this.styledModeFormat(formatString);
|
|
1198
|
+
}
|
|
1199
|
+
e.text = format(formatString, point, this.chart);
|
|
1200
|
+
});
|
|
1201
|
+
return e.text || '';
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Updates the tooltip with the provided tooltip options.
|
|
1205
|
+
*
|
|
1206
|
+
* @function Highcharts.Tooltip#update
|
|
1207
|
+
*
|
|
1208
|
+
* @param {Highcharts.TooltipOptions} options
|
|
1209
|
+
* The tooltip options to update.
|
|
1210
|
+
*/
|
|
1211
|
+
update(options) {
|
|
1212
|
+
this.destroy();
|
|
1213
|
+
this.init(this.chart, merge(true, this.options, options));
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Find the new position and perform the move
|
|
1217
|
+
*
|
|
1218
|
+
* @private
|
|
1219
|
+
* @function Highcharts.Tooltip#updatePosition
|
|
1220
|
+
*
|
|
1221
|
+
* @param {Highcharts.Point} point
|
|
1222
|
+
*/
|
|
1223
|
+
updatePosition(point) {
|
|
1224
|
+
const { chart, container, distance, options, pointer, renderer } = this, label = this.getLabel(), { height = 0, width = 0 } = label, { fixed, positioner } = options,
|
|
1225
|
+
// Needed for outside: true (#11688)
|
|
1226
|
+
{ left, top, scaleX, scaleY } = pointer.getChartPosition(), pos = (positioner ||
|
|
1227
|
+
(fixed && this.getFixedPosition) ||
|
|
1228
|
+
this.getPosition).call(this, width, height, point), doc = H.doc;
|
|
1229
|
+
let anchorX = (point.plotX || 0) + chart.plotLeft, anchorY = (point.plotY || 0) + chart.plotTop, pad;
|
|
1230
|
+
// Set the renderer size dynamically to prevent document size to change.
|
|
1231
|
+
// Renderer only exists when tooltip is outside.
|
|
1232
|
+
if (renderer && container) {
|
|
1233
|
+
// Corrects positions, occurs with tooltip positioner (#16944)
|
|
1234
|
+
if (positioner || fixed) {
|
|
1235
|
+
const { scrollLeft = 0, scrollTop = 0 } = chart
|
|
1236
|
+
.scrollablePlotArea?.scrollingContainer || {};
|
|
1237
|
+
pos.x += scrollLeft + left - distance;
|
|
1238
|
+
pos.y += scrollTop + top - distance;
|
|
1239
|
+
}
|
|
1240
|
+
// Pad it by the border width and distance. Add 2 to make room for
|
|
1241
|
+
// the default shadow (#19314).
|
|
1242
|
+
pad = (options.borderWidth || 0) + 2 * distance + 2;
|
|
1243
|
+
renderer.setSize(
|
|
1244
|
+
// Clamp width to keep tooltip in viewport (#21698)
|
|
1245
|
+
// and subtract one since tooltip container has 'left: 1px;'
|
|
1246
|
+
clamp(width + pad, 0, doc.documentElement.clientWidth) - 1, height + pad, false);
|
|
1247
|
+
// Anchor and tooltip container need scaling if chart container has
|
|
1248
|
+
// scale transform/css zoom. #11329.
|
|
1249
|
+
if (scaleX !== 1 || scaleY !== 1) {
|
|
1250
|
+
css(container, {
|
|
1251
|
+
transform: `scale(${scaleX}, ${scaleY})`
|
|
1252
|
+
});
|
|
1253
|
+
anchorX *= scaleX;
|
|
1254
|
+
anchorY *= scaleY;
|
|
1255
|
+
}
|
|
1256
|
+
anchorX += left - pos.x;
|
|
1257
|
+
anchorY += top - pos.y;
|
|
1258
|
+
}
|
|
1259
|
+
// Do the move
|
|
1260
|
+
this.move(Math.round(pos.x), Math.round(pos.y || 0), // Can be undefined (#3977)
|
|
1261
|
+
anchorX, anchorY);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
/* *
|
|
1265
|
+
*
|
|
1266
|
+
* Class namespace
|
|
1267
|
+
*
|
|
1268
|
+
* */
|
|
1269
|
+
(function (Tooltip) {
|
|
1270
|
+
/* *
|
|
1271
|
+
*
|
|
1272
|
+
* Declarations
|
|
1273
|
+
*
|
|
1274
|
+
* */
|
|
1275
|
+
/* *
|
|
1276
|
+
*
|
|
1277
|
+
* Functions
|
|
1278
|
+
*
|
|
1279
|
+
* */
|
|
1280
|
+
/**
|
|
1281
|
+
* @private
|
|
1282
|
+
*/
|
|
1283
|
+
function compose(PointerClass) {
|
|
1284
|
+
if (pushUnique(composed, 'Core.Tooltip')) {
|
|
1285
|
+
addEvent(PointerClass, 'afterInit', function () {
|
|
1286
|
+
const chart = this.chart;
|
|
1287
|
+
if (chart.options.tooltip) {
|
|
1288
|
+
/**
|
|
1289
|
+
* Tooltip object for points of series.
|
|
1290
|
+
*
|
|
1291
|
+
* @name Highcharts.Chart#tooltip
|
|
1292
|
+
* @type {Highcharts.Tooltip}
|
|
1293
|
+
*/
|
|
1294
|
+
chart.tooltip = new Tooltip(chart, chart.options.tooltip, this);
|
|
1295
|
+
}
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
Tooltip.compose = compose;
|
|
1300
|
+
})(Tooltip || (Tooltip = {}));
|
|
1301
|
+
/* *
|
|
1302
|
+
*
|
|
1303
|
+
* Default export
|
|
1304
|
+
*
|
|
1305
|
+
* */
|
|
1306
|
+
export default Tooltip;
|
|
1307
|
+
/* *
|
|
1308
|
+
*
|
|
1309
|
+
* API Declarations
|
|
1310
|
+
*
|
|
1311
|
+
* */
|
|
1312
|
+
/**
|
|
1313
|
+
* Callback function to format the text of the tooltip from scratch.
|
|
1314
|
+
*
|
|
1315
|
+
* In case of single or shared tooltips, a string should be returned. In case
|
|
1316
|
+
* of split tooltips, it should return an array where the first item is the
|
|
1317
|
+
* header, and subsequent items are mapped to the points. Return `false` to
|
|
1318
|
+
* disable tooltip for a specific point on series.
|
|
1319
|
+
*
|
|
1320
|
+
* @callback Highcharts.TooltipFormatterCallbackFunction
|
|
1321
|
+
*
|
|
1322
|
+
* @param {Highcharts.Point} this
|
|
1323
|
+
* The formatter's context is the hovered `Point` instance. In case of shared or
|
|
1324
|
+
* split tooltips, all points are available in `this.points`.
|
|
1325
|
+
*
|
|
1326
|
+
* @param {Highcharts.Tooltip} tooltip
|
|
1327
|
+
* The tooltip instance
|
|
1328
|
+
*
|
|
1329
|
+
* @return {false|string|Array<(string|null|undefined)>|null|undefined}
|
|
1330
|
+
* Formatted text or false
|
|
1331
|
+
*/
|
|
1332
|
+
/**
|
|
1333
|
+
* A callback function to place the tooltip in a specific position.
|
|
1334
|
+
*
|
|
1335
|
+
* @callback Highcharts.TooltipPositionerCallbackFunction
|
|
1336
|
+
*
|
|
1337
|
+
* @param {Highcharts.Tooltip} this
|
|
1338
|
+
* Tooltip context of the callback.
|
|
1339
|
+
*
|
|
1340
|
+
* @param {number} labelWidth
|
|
1341
|
+
* Width of the tooltip.
|
|
1342
|
+
*
|
|
1343
|
+
* @param {number} labelHeight
|
|
1344
|
+
* Height of the tooltip.
|
|
1345
|
+
*
|
|
1346
|
+
* @param {Highcharts.TooltipPositionerPointObject} point
|
|
1347
|
+
* Point information for positioning a tooltip.
|
|
1348
|
+
*
|
|
1349
|
+
* @return {Highcharts.PositionObject}
|
|
1350
|
+
* New position for the tooltip.
|
|
1351
|
+
*/
|
|
1352
|
+
/**
|
|
1353
|
+
* Point information for positioning a tooltip.
|
|
1354
|
+
*
|
|
1355
|
+
* @interface Highcharts.TooltipPositionerPointObject
|
|
1356
|
+
* @extends Highcharts.Point
|
|
1357
|
+
*/ /**
|
|
1358
|
+
* If `tooltip.split` option is enabled and positioner is called for each of the
|
|
1359
|
+
* boxes separately, this property indicates the call on the xAxis header, which
|
|
1360
|
+
* is not a point itself.
|
|
1361
|
+
* @name Highcharts.TooltipPositionerPointObject#isHeader
|
|
1362
|
+
* @type {boolean}
|
|
1363
|
+
*/ /**
|
|
1364
|
+
* The reference point relative to the plot area. Add chart.plotLeft to get the
|
|
1365
|
+
* full coordinates.
|
|
1366
|
+
* @name Highcharts.TooltipPositionerPointObject#plotX
|
|
1367
|
+
* @type {number}
|
|
1368
|
+
*/ /**
|
|
1369
|
+
* The reference point relative to the plot area. Add chart.plotTop to get the
|
|
1370
|
+
* full coordinates.
|
|
1371
|
+
* @name Highcharts.TooltipPositionerPointObject#plotY
|
|
1372
|
+
* @type {number}
|
|
1373
|
+
*/
|
|
1374
|
+
/**
|
|
1375
|
+
* @typedef {"callout"|"circle"|"rect"} Highcharts.TooltipShapeValue
|
|
1376
|
+
*/
|
|
1377
|
+
''; // Keeps doclets above in JS file
|