teechart.js 4.0.5 → 5.0.0-beta.1
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/3D-COMPATIBILITY.md +45 -0
- package/README.md +463 -27
- package/dist/chunks/chart-p639xVyw.js +16 -0
- package/dist/chunks/chart-p639xVyw.js.map +1 -0
- package/dist/chunks/palette-series-DfyYptK1.js +16 -0
- package/dist/chunks/palette-series-DfyYptK1.js.map +1 -0
- package/dist/chunks/series-DeozLXIv.js +16 -0
- package/dist/chunks/series-DeozLXIv.js.map +1 -0
- package/dist/teechart.3d.esm.js +27 -0
- package/dist/teechart.3d.esm.js.map +1 -0
- package/dist/teechart.auto.esm.js +16 -0
- package/dist/teechart.auto.esm.js.map +1 -0
- package/dist/teechart.core.esm.js +16 -0
- package/dist/teechart.core.esm.js.map +1 -0
- package/dist/teechart.esm.js +3 -3
- package/dist/teechart.esm.js.map +1 -1
- package/dist/teechart.js +14 -3
- package/dist/teechart.js.map +1 -1
- package/dist/teechart.maps.esm.js +16 -0
- package/dist/teechart.maps.esm.js.map +1 -0
- package/dist/types/accessibility.d.ts +29 -0
- package/dist/types/accessibility.d.ts.map +1 -0
- package/dist/types/auto.d.ts +4 -0
- package/dist/types/auto.d.ts.map +1 -0
- package/dist/types/chart-options.d.ts +826 -0
- package/dist/types/chart-options.d.ts.map +1 -0
- package/dist/types/chart.d.ts +252 -0
- package/dist/types/chart.d.ts.map +1 -0
- package/dist/types/checkbox.d.ts +12 -0
- package/dist/types/checkbox.d.ts.map +1 -0
- package/dist/types/core/elements/axes.d.ts +17 -0
- package/dist/types/core/elements/axes.d.ts.map +1 -0
- package/dist/types/core/elements/axis-grid.d.ts +20 -0
- package/dist/types/core/elements/axis-grid.d.ts.map +1 -0
- package/dist/types/core/elements/axis-labels.d.ts +54 -0
- package/dist/types/core/elements/axis-labels.d.ts.map +1 -0
- package/dist/types/core/elements/axis-ticks.d.ts +19 -0
- package/dist/types/core/elements/axis-ticks.d.ts.map +1 -0
- package/dist/types/core/elements/axis-title.d.ts +16 -0
- package/dist/types/core/elements/axis-title.d.ts.map +1 -0
- package/dist/types/core/elements/axis.d.ts +125 -0
- package/dist/types/core/elements/axis.d.ts.map +1 -0
- package/dist/types/core/elements/chart-image.d.ts +13 -0
- package/dist/types/core/elements/chart-image.d.ts.map +1 -0
- package/dist/types/core/elements/font.d.ts +28 -0
- package/dist/types/core/elements/font.d.ts.map +1 -0
- package/dist/types/core/elements/format.d.ts +125 -0
- package/dist/types/core/elements/format.d.ts.map +1 -0
- package/dist/types/core/elements/gradient.d.ts +23 -0
- package/dist/types/core/elements/gradient.d.ts.map +1 -0
- package/dist/types/core/elements/legend-symbol.d.ts +49 -0
- package/dist/types/core/elements/legend-symbol.d.ts.map +1 -0
- package/dist/types/core/elements/legend.d.ts +131 -0
- package/dist/types/core/elements/legend.d.ts.map +1 -0
- package/dist/types/core/elements/margins.d.ts +9 -0
- package/dist/types/core/elements/margins.d.ts.map +1 -0
- package/dist/types/core/elements/panel.d.ts +13 -0
- package/dist/types/core/elements/panel.d.ts.map +1 -0
- package/dist/types/core/elements/scroll.d.ts +14 -0
- package/dist/types/core/elements/scroll.d.ts.map +1 -0
- package/dist/types/core/elements/shadow.d.ts +14 -0
- package/dist/types/core/elements/shadow.d.ts.map +1 -0
- package/dist/types/core/elements/stroke.d.ts +19 -0
- package/dist/types/core/elements/stroke.d.ts.map +1 -0
- package/dist/types/core/elements/wall.d.ts +13 -0
- package/dist/types/core/elements/wall.d.ts.map +1 -0
- package/dist/types/core/elements/zoom.d.ts +33 -0
- package/dist/types/core/elements/zoom.d.ts.map +1 -0
- package/dist/types/core/primitives.d.ts +33 -0
- package/dist/types/core/primitives.d.ts.map +1 -0
- package/dist/types/core.d.ts +96 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/data/data-engine.d.ts +245 -0
- package/dist/types/data/data-engine.d.ts.map +1 -0
- package/dist/types/date.format.d.ts +5 -0
- package/dist/types/date.format.d.ts.map +1 -0
- package/dist/types/declarative-tools.d.ts +6 -0
- package/dist/types/declarative-tools.d.ts.map +1 -0
- package/dist/types/do-http-request.d.ts +2 -0
- package/dist/types/do-http-request.d.ts.map +1 -0
- package/dist/types/dom-tip.d.ts +41 -0
- package/dist/types/dom-tip.d.ts.map +1 -0
- package/dist/types/events.d.ts +82 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/extras.d.ts +18 -0
- package/dist/types/extras.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/interaction.d.ts +67 -0
- package/dist/types/interaction.d.ts.map +1 -0
- package/dist/types/map-series-definition.d.ts +5 -0
- package/dist/types/map-series-definition.d.ts.map +1 -0
- package/dist/types/maps/africa-map.d.ts +10 -0
- package/dist/types/maps/africa-map.d.ts.map +1 -0
- package/dist/types/maps/asia-map.d.ts +10 -0
- package/dist/types/maps/asia-map.d.ts.map +1 -0
- package/dist/types/maps/australia-map.d.ts +10 -0
- package/dist/types/maps/australia-map.d.ts.map +1 -0
- package/dist/types/maps/europe-map.d.ts +10 -0
- package/dist/types/maps/europe-map.d.ts.map +1 -0
- package/dist/types/maps/europe27-map.d.ts +10 -0
- package/dist/types/maps/europe27-map.d.ts.map +1 -0
- package/dist/types/maps/layout-map.d.ts +51 -0
- package/dist/types/maps/layout-map.d.ts.map +1 -0
- package/dist/types/maps/map-types.d.ts +19 -0
- package/dist/types/maps/map-types.d.ts.map +1 -0
- package/dist/types/maps/south-america-map.d.ts +10 -0
- package/dist/types/maps/south-america-map.d.ts.map +1 -0
- package/dist/types/maps/spain-map.d.ts +11 -0
- package/dist/types/maps/spain-map.d.ts.map +1 -0
- package/dist/types/maps/svg-map.d.ts +37 -0
- package/dist/types/maps/svg-map.d.ts.map +1 -0
- package/dist/types/maps/usa-map.d.ts +12 -0
- package/dist/types/maps/usa-map.d.ts.map +1 -0
- package/dist/types/maps/world-map.d.ts +14 -0
- package/dist/types/maps/world-map.d.ts.map +1 -0
- package/dist/types/maps.d.ts +15 -0
- package/dist/types/maps.d.ts.map +1 -0
- package/dist/types/marks-animation.d.ts +16 -0
- package/dist/types/marks-animation.d.ts.map +1 -0
- package/dist/types/modern-theme.d.ts +14 -0
- package/dist/types/modern-theme.d.ts.map +1 -0
- package/dist/types/optional-options.d.ts +6 -0
- package/dist/types/optional-options.d.ts.map +1 -0
- package/dist/types/palette.d.ts +11 -0
- package/dist/types/palette.d.ts.map +1 -0
- package/dist/types/platform.d.ts +27 -0
- package/dist/types/platform.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +80 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/quadrants-plugin.d.ts +45 -0
- package/dist/types/quadrants-plugin.d.ts.map +1 -0
- package/dist/types/register-all.d.ts +3 -0
- package/dist/types/register-all.d.ts.map +1 -0
- package/dist/types/rendering/canvas-graphics.d.ts +65 -0
- package/dist/types/rendering/canvas-graphics.d.ts.map +1 -0
- package/dist/types/rendering/graphics.d.ts +59 -0
- package/dist/types/rendering/graphics.d.ts.map +1 -0
- package/dist/types/rendering/renderer.d.ts +58 -0
- package/dist/types/rendering/renderer.d.ts.map +1 -0
- package/dist/types/rendering/three-graphics.d.ts +22 -0
- package/dist/types/rendering/three-graphics.d.ts.map +1 -0
- package/dist/types/responsive.d.ts +8 -0
- package/dist/types/responsive.d.ts.map +1 -0
- package/dist/types/series/activity-gauge.d.ts +18 -0
- package/dist/types/series/activity-gauge.d.ts.map +1 -0
- package/dist/types/series/arc-gauge.d.ts +74 -0
- package/dist/types/series/arc-gauge.d.ts.map +1 -0
- package/dist/types/series/area.d.ts +24 -0
- package/dist/types/series/area.d.ts.map +1 -0
- package/dist/types/series/bar.d.ts +17 -0
- package/dist/types/series/bar.d.ts.map +1 -0
- package/dist/types/series/box-plot.d.ts +140 -0
- package/dist/types/series/box-plot.d.ts.map +1 -0
- package/dist/types/series/bubble.d.ts +25 -0
- package/dist/types/series/bubble.d.ts.map +1 -0
- package/dist/types/series/bullet.d.ts +86 -0
- package/dist/types/series/bullet.d.ts.map +1 -0
- package/dist/types/series/candle.d.ts +27 -0
- package/dist/types/series/candle.d.ts.map +1 -0
- package/dist/types/series/circular-gauge.d.ts +100 -0
- package/dist/types/series/circular-gauge.d.ts.map +1 -0
- package/dist/types/series/color-series.d.ts +59 -0
- package/dist/types/series/color-series.d.ts.map +1 -0
- package/dist/types/series/composed-series.d.ts +76 -0
- package/dist/types/series/composed-series.d.ts.map +1 -0
- package/dist/types/series/custom-bar.d.ts +63 -0
- package/dist/types/series/custom-bar.d.ts.map +1 -0
- package/dist/types/series/custom-series.d.ts +74 -0
- package/dist/types/series/custom-series.d.ts.map +1 -0
- package/dist/types/series/donut.d.ts +17 -0
- package/dist/types/series/donut.d.ts.map +1 -0
- package/dist/types/series/gantt.d.ts +47 -0
- package/dist/types/series/gantt.d.ts.map +1 -0
- package/dist/types/series/high-low-bar.d.ts +24 -0
- package/dist/types/series/high-low-bar.d.ts.map +1 -0
- package/dist/types/series/histogram.d.ts +36 -0
- package/dist/types/series/histogram.d.ts.map +1 -0
- package/dist/types/series/horiz-area.d.ts +11 -0
- package/dist/types/series/horiz-area.d.ts.map +1 -0
- package/dist/types/series/horiz-bar.d.ts +23 -0
- package/dist/types/series/horiz-bar.d.ts.map +1 -0
- package/dist/types/series/line.d.ts +22 -0
- package/dist/types/series/line.d.ts.map +1 -0
- package/dist/types/series/linear-gauge.d.ts +73 -0
- package/dist/types/series/linear-gauge.d.ts.map +1 -0
- package/dist/types/series/map-series.d.ts +82 -0
- package/dist/types/series/map-series.d.ts.map +1 -0
- package/dist/types/series/numeric-gauge.d.ts +96 -0
- package/dist/types/series/numeric-gauge.d.ts.map +1 -0
- package/dist/types/series/palette-series.d.ts +39 -0
- package/dist/types/series/palette-series.d.ts.map +1 -0
- package/dist/types/series/pie.d.ts +81 -0
- package/dist/types/series/pie.d.ts.map +1 -0
- package/dist/types/series/point-xy.d.ts +13 -0
- package/dist/types/series/point-xy.d.ts.map +1 -0
- package/dist/types/series/polar.d.ts +37 -0
- package/dist/types/series/polar.d.ts.map +1 -0
- package/dist/types/series/sankey.d.ts +90 -0
- package/dist/types/series/sankey.d.ts.map +1 -0
- package/dist/types/series/series-list.d.ts +127 -0
- package/dist/types/series/series-list.d.ts.map +1 -0
- package/dist/types/series/series-list.types.d.ts +43 -0
- package/dist/types/series/series-list.types.d.ts.map +1 -0
- package/dist/types/series/sliced.d.ts +13 -0
- package/dist/types/series/sliced.d.ts.map +1 -0
- package/dist/types/series/surface.d.ts +24 -0
- package/dist/types/series/surface.d.ts.map +1 -0
- package/dist/types/series/treemap.d.ts +107 -0
- package/dist/types/series/treemap.d.ts.map +1 -0
- package/dist/types/series/violin.d.ts +105 -0
- package/dist/types/series/violin.d.ts.map +1 -0
- package/dist/types/series/volume.d.ts +11 -0
- package/dist/types/series/volume.d.ts.map +1 -0
- package/dist/types/series-definitions.d.ts +30 -0
- package/dist/types/series-definitions.d.ts.map +1 -0
- package/dist/types/series-registry.d.ts +37 -0
- package/dist/types/series-registry.d.ts.map +1 -0
- package/dist/types/series-utils.d.ts +29 -0
- package/dist/types/series-utils.d.ts.map +1 -0
- package/dist/types/series.d.ts +342 -0
- package/dist/types/series.d.ts.map +1 -0
- package/dist/types/slider.d.ts +49 -0
- package/dist/types/slider.d.ts.map +1 -0
- package/dist/types/spline.d.ts +2 -0
- package/dist/types/spline.d.ts.map +1 -0
- package/dist/types/table/chart-table.d.ts +27 -0
- package/dist/types/table/chart-table.d.ts.map +1 -0
- package/dist/types/teechart-3d.d.ts +4 -0
- package/dist/types/teechart-3d.d.ts.map +1 -0
- package/dist/types/theme.d.ts +41 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/three/chart-3d.d.ts +77 -0
- package/dist/types/three/chart-3d.d.ts.map +1 -0
- package/dist/types/three/chart-options-3d.d.ts +5 -0
- package/dist/types/three/chart-options-3d.d.ts.map +1 -0
- package/dist/types/three/teechart-3d.d.ts +25 -0
- package/dist/types/three/teechart-3d.d.ts.map +1 -0
- package/dist/types/three-context.d.ts +184 -0
- package/dist/types/three-context.d.ts.map +1 -0
- package/dist/types/three-context.types.d.ts +177 -0
- package/dist/types/three-context.types.d.ts.map +1 -0
- package/dist/types/three-parametric-geometry.d.ts +7 -0
- package/dist/types/three-parametric-geometry.d.ts.map +1 -0
- package/dist/types/three.d.ts +6 -0
- package/dist/types/three.d.ts.map +1 -0
- package/dist/types/tools/animate-hover.d.ts +13 -0
- package/dist/types/tools/animate-hover.d.ts.map +1 -0
- package/dist/types/tools/annotation.d.ts +169 -0
- package/dist/types/tools/annotation.d.ts.map +1 -0
- package/dist/types/tools/base-animation.d.ts +83 -0
- package/dist/types/tools/base-animation.d.ts.map +1 -0
- package/dist/types/tools/cursor-tool.d.ts +51 -0
- package/dist/types/tools/cursor-tool.d.ts.map +1 -0
- package/dist/types/tools/drag-tool.d.ts +28 -0
- package/dist/types/tools/drag-tool.d.ts.map +1 -0
- package/dist/types/tools/index.d.ts +8 -0
- package/dist/types/tools/index.d.ts.map +1 -0
- package/dist/types/tools/tool.d.ts +27 -0
- package/dist/types/tools/tool.d.ts.map +1 -0
- package/dist/types/tools/tools.d.ts +33 -0
- package/dist/types/tools/tools.d.ts.map +1 -0
- package/dist/types/utils.d.ts +23 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/worker.d.ts +92 -0
- package/dist/types/worker.d.ts.map +1 -0
- package/package.json +73 -26
- package/dist/Tween.js +0 -13
- package/dist/date.format.js +0 -145
- package/dist/excanvas/canvas.text.js +0 -489
- package/dist/excanvas/excanvas.compiled.js +0 -35
- package/dist/excanvas/excanvas.js +0 -924
- package/dist/excanvas/excanvas_text.js +0 -1416
- package/dist/three.js +0 -990
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-p639xVyw.js","sources":["../../../../src/modern-theme.ts","../../../../src/theme.ts","../../../../src/quadrants-plugin.ts","../../../../src/plugin.ts","../../../../src/series-registry.ts","../../../../src/spline.ts","../../../../src/series/custom-series.ts","../../../../src/series/area.ts","../../../../src/series/custom-bar.ts","../../../../src/series/bar.ts","../../../../src/series/point-xy.ts","../../../../src/series/bubble.ts","../../../../src/series/pie.ts","../../../../src/series/donut.ts","../../../../src/series/line.ts","../../../../src/chart-options.ts","../../../../src/core/elements/axes.ts","../../../../src/core/elements/legend-symbol.ts","../../../../src/core/elements/legend.ts","../../../../src/core/elements/panel.ts","../../../../src/core/elements/scroll.ts","../../../../src/core/elements/wall.ts","../../../../src/core/elements/zoom.ts","../../../../src/interaction.ts","../../../../src/series/series-list.ts","../../../../src/tools/tools.ts","../../../../src/chart.ts"],"sourcesContent":["import type { Chart } from \"./chart.js\"\nimport type { Format } from \"./core/elements/format.js\"\nimport { pointerOf } from \"./series-utils.js\"\nimport type { Series } from \"./series.js\"\n\n/** Colors and strokes that make up one flat, low-contrast look. */\ninterface ModernTokens {\n\tpalette: string[]\n\t/** Background of the panel; also the separator drawn between pie slices. */\n\tsurface: string\n\t/** Axis labels, axis titles and legend text. */\n\tink: string\n\t/** Title text. */\n\tstrong: string\n\tgrid: string\n\taxisLine: string\n\tmarkBorder: string\n}\n\nconst FONT = \"12px system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif\"\n\nexport const modernPalette = [\n\t\"#3b82f6\",\n\t\"#fb923c\",\n\t\"#14b8a6\",\n\t\"#8b5cf6\",\n\t\"#ec4899\",\n\t\"#38bdf8\",\n\t\"#eab308\",\n\t\"#64748b\",\n\t\"#84cc16\",\n\t\"#f43f5e\"\n]\n\nexport const modernDarkPalette = [\n\t\"#60a5fa\",\n\t\"#fb923c\",\n\t\"#2dd4bf\",\n\t\"#a78bfa\",\n\t\"#f472b6\",\n\t\"#38bdf8\",\n\t\"#facc15\",\n\t\"#94a3b8\",\n\t\"#a3e635\",\n\t\"#fb7185\"\n]\n\nconst light: ModernTokens = {\n\tpalette: modernPalette,\n\tsurface: \"#ffffff\",\n\tink: \"#64748b\",\n\tstrong: \"#0f172a\",\n\tgrid: \"#e2e8f0\",\n\taxisLine: \"#cbd5e1\",\n\tmarkBorder: \"#e2e8f0\"\n}\n\nconst dark: ModernTokens = {\n\tpalette: modernDarkPalette,\n\tsurface: \"#1c1c21\",\n\tink: \"#a1a1aa\",\n\tstrong: \"#f4f4f5\",\n\tgrid: \"rgba(255,255,255,0.09)\",\n\taxisLine: \"rgba(255,255,255,0.18)\",\n\tmarkBorder: \"rgba(255,255,255,0.14)\"\n}\n\n/** Flat legend: roomier items, small rounded flat swatches and faded hidden series. */\nfunction styleLegend(legend: Chart[\"legend\"], tokens: ModernTokens): void {\n\tlegend.format.shadow.visible = false\n\tlegend.itemGap = 18\n\tlegend.edgeInset = 10\n\tlegend.rowGap = 4\n\tlegend.symbolOffsetY = -2\n\tlegend.hoverBackground = \"\"\n\tlegend.hover.font.fill = \"\"\n\tlegend.dimHidden = true\n\n\tconst symbol = legend.symbol\n\tsymbol.width = 10\n\tsymbol.height = 10\n\tsymbol.padding = 8\n\tsymbol.format.round.x = 3\n\tsymbol.format.round.y = 3\n\tsymbol.format.shadow.visible = false\n\tsymbol.format.stroke.fill = \"\"\n}\n\n/** Returns `color` (hex or rgb) with the given alpha, or the color untouched when it cannot be parsed. */\nfunction withAlpha(color: string, alpha: number): string {\n\tconst hex = /^#([0-9a-f]{6})$/i.exec(color)\n\tif (!hex) return color\n\tconst value = Number.parseInt(hex[1], 16)\n\treturn `rgba(${(value >> 16) & 255},${(value >> 8) & 255},${value & 255},${alpha})`\n}\n\n/** Drops the `.00` of whole numbers so that axes read `5`, not `5.00`. */\nfunction trimZeros(_value: number, text: string): string {\n\treturn /^-?\\d+\\.\\d+$/.test(text) ? text.replace(/\\.?0+$/, \"\") : text\n}\n\n/** The parts of a dial gauge (CircularGauge) the theme restyles. */\ninterface DialParts {\n\tback: Format\n\tticks: Format\n\tminor: Format\n\tcenter: Format\n\thand: Format\n\tformatValue: ((value: number) => string) | undefined\n\tunits: { format: { font: { fill: string } } }\n}\n\n/** The colors of a flat radial gauge (ArcGauge). */\ninterface ArcParts {\n\ttrackColor: string\n\ttextColor: string\n\tmutedColor: string\n\tsurfaceColor: string\n}\n\nfunction styleDial(series: Series, color: string, tokens: ModernTokens): void {\n\tconst dial = series as Series & DialParts\n\tconst format = series.format\n\tformat.visible = false\n\tformat.font.fill = tokens.ink\n\tformat.font.style = FONT\n\n\tdial.back.gradient.visible = false\n\tdial.back.shadow.visible = false\n\tdial.back.fill = tokens.surface\n\tdial.back.stroke.fill = tokens.axisLine\n\tdial.back.stroke.size = 2\n\n\tdial.ticks.stroke.fill = tokens.ink\n\tdial.minor.stroke.fill = tokens.axisLine\n\n\tdial.hand.gradient.visible = false\n\tdial.hand.shadow.visible = false\n\tdial.hand.fill = color\n\n\tdial.center.gradient.visible = false\n\tdial.center.shadow.visible = false\n\tdial.center.fill = tokens.strong\n\tif (dial.center.top) dial.center.top.visible = false\n\n\tconst marks = series.marks\n\tmarks.format.gradient.visible = false\n\tmarks.format.shadow.visible = false\n\tmarks.format.fill = tokens.surface\n\tmarks.format.stroke.fill = \"\"\n\tmarks.format.font.fill = tokens.strong\n\tmarks.format.font.style = `bold 16px ${FONT.slice(FONT.indexOf(\" \") + 1)}`\n\n\tdial.units.format.font.fill = tokens.ink\n\tdial.formatValue ??= value => String(Math.round(value * 100) / 100)\n}\n\n/** Gives one series the flat look of the theme: no bevel, shadow, gloss or outline. */\nfunction styleSeries(series: Series, index: number, tokens: ModernTokens): void {\n\tconst color = tokens.palette[index % tokens.palette.length]\n\tconst format = series.format\n\tconst pointer = pointerOf(series)\n\tconst marks = series.marks\n\n\tmarks.format.gradient.visible = false\n\tmarks.format.shadow.visible = false\n\tmarks.format.fill = tokens.surface\n\tmarks.format.stroke.fill = tokens.markBorder\n\tmarks.format.stroke.size = 1\n\tmarks.format.round.x = 6\n\tmarks.format.round.y = 6\n\tmarks.format.font.style = FONT\n\tmarks.format.font.fill = tokens.strong\n\tObject.assign(marks.margins, { left: 6, right: 6, top: 3, bottom: 3 })\n\tmarks.arrow.stroke.fill = tokens.axisLine\n\tmarks.arrow.stroke.size = 1\n\n\t// The readout of a dial is its marks, which the series options decide.\n\tif (!(\"hands\" in series)) series.marks.visible = false\n\tseries.hover.shadow.visible = false\n\tformat.gradient.visible = false\n\tformat.shadow.visible = false\n\tformat.beveled = false\n\tformat.depth = 0\n\n\tif (pointer) {\n\t\tpointer.format.gradient.visible = false\n\t\tpointer.format.shadow.visible = false\n\t\tpointer.colorEach = false\n\t}\n\n\t// Pie, donut and the other series that paint one slice per point.\n\tif (\"explode\" in series) {\n\t\tformat.stroke.fill = tokens.surface\n\t\tformat.stroke.size = 2\n\t\treturn\n\t}\n\n\tformat.fill = color\n\n\tif (\"hands\" in series) {\n\t\tstyleDial(series, color, tokens)\n\t\treturn\n\t}\n\n\tif (\"medianColor\" in series) {\n\t\t// Violin: translucent shapes with a solid outline and a dark median over the surface color.\n\t\tconst violin = series as Series & { medianColor: string; dotStroke: string }\n\t\tviolin.medianColor = tokens.strong\n\t\tviolin.dotStroke = tokens.surface\n\t\treturn\n\t}\n\n\tif (\"trackColor\" in series) {\n\t\tconst arc = series as Series & ArcParts\n\t\tarc.trackColor = tokens.grid\n\t\tarc.textColor = tokens.strong\n\t\tarc.mutedColor = tokens.ink\n\t\tarc.surfaceColor = tokens.surface\n\t\treturn\n\t}\n\n\tif (\"barSize\" in series) {\n\t\tif (\"rebin\" in series) {\n\t\t\t// Histogram bars touch, a thin outline in the surface color separates them.\n\t\t\tformat.stroke.fill = tokens.surface\n\t\t\tformat.stroke.size = 1\n\t\t\tformat.round.x = 0\n\t\t\tformat.round.y = 0\n\t\t} else {\n\t\t\tformat.stroke.fill = \"\"\n\t\t\tformat.round.x = 6\n\t\t\tformat.round.y = 6\n\t\t\t;(series as Series & { barSize: number }).barSize = 60\n\t\t}\n\t\tseries.colorEach = \"no\"\n\t} else if (\"closeArea\" in series) {\n\t\t// The area draws its own last gradient stop with the fill color.\n\t\tformat.stroke.fill = color\n\t\tformat.stroke.size = 2.5\n\t\tformat.gradient.visible = true\n\t\tformat.gradient.direction = \"bottomtop\"\n\t\tformat.gradient.colors = [withAlpha(color, 0.02), color]\n\t} else if (pointer && \"inflate\" in series) {\n\t\t// Bubble: translucent disc with a solid outline.\n\t\tformat.stroke.fill = color\n\t\tformat.stroke.size = 1.5\n\t\tpointer.format.fill = withAlpha(color, 0.65)\n\t\tpointer.format.stroke.fill = color\n\t} else {\n\t\tformat.stroke.fill = color\n\t\tformat.stroke.size = 3\n\t\tif (pointer) {\n\t\t\tpointer.format.fill = color\n\t\t\tpointer.format.stroke.fill = tokens.surface\n\t\t}\n\t}\n}\n\nfunction applyModern(chart: Chart, tokens: ModernTokens): void {\n\tconst panel = chart.panel\n\tconst panelFormat = panel.format\n\tpanel.transparent = true\n\tpanelFormat.gradient.visible = false\n\tpanelFormat.shadow.visible = false\n\tpanelFormat.stroke.fill = \"\"\n\tpanelFormat.round.x = 0\n\tpanelFormat.round.y = 0\n\tpanelFormat.fill = tokens.surface\n\t// A little air so lines, bubbles and the last label are not cut by the canvas edge.\n\tObject.assign(panel.margins, { left: 3, right: 6, top: 5, bottom: 3 })\n\tchart.walls.visible = false\n\n\tchart.palette.colors = [...tokens.palette]\n\n\tfor (const axis of chart.axes.items) {\n\t\taxis.labels.format.font.style = FONT\n\t\taxis.labels.format.font.fill = tokens.ink\n\t\taxis.labels.ongetlabel = trimZeros\n\t\taxis.title.format.font.style = `bold ${FONT}`\n\t\taxis.title.format.font.fill = tokens.ink\n\t\taxis.format.stroke.fill = axis.horizontal ? tokens.axisLine : \"\"\n\t\taxis.format.stroke.size = 1\n\t\taxis.grid.visible = !axis.horizontal\n\t\taxis.grid.format.stroke.fill = tokens.grid\n\t\taxis.grid.format.stroke.size = 1\n\t\taxis.ticks.visible = false\n\t\taxis.integerSteps = true\n\t\tif (!axis.horizontal) {\n\t\t\taxis.headroom = 8\n\t\t\t// Fewer grid lines: leave room for about two labels between each pair of lines.\n\t\t\taxis.labels.separation = 60\n\t\t}\n\t}\n\n\tchart.title.transparent = true\n\tchart.title.format.shadow.visible = false\n\tchart.title.format.font.style = \"bold 16px system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif\"\n\tchart.title.format.font.fill = tokens.strong\n\tchart.title.format.font.shadow.visible = false\n\tchart.footer.transparent = true\n\n\tchart.legend.transparent = true\n\tchart.legend.format.font.style = FONT\n\tchart.legend.format.font.fill = tokens.ink\n\tchart.legend.fontColor = false\n\tstyleLegend(chart.legend, tokens)\n\n\tfor (const [index, series] of chart.series.items.entries()) styleSeries(series, index, tokens)\n}\n\nexport interface ModernTheme {\n\tapply: (chart: Chart) => void\n\t/** Styles a series added after the theme was applied. */\n\tstyleSeries: (series: Series, index: number) => void\n}\n\n/** Flat look on a white surface: soft grid, clean marks, no shadows or gloss, and a balanced blue/orange/teal palette. */\nexport const modernLightTheme: ModernTheme = {\n\tapply: chart => applyModern(chart, light),\n\tstyleSeries: (series, index) => styleSeries(series, index, light)\n}\n\n/** The `modern` look for dark surfaces, with brighter colors and a faint grid. */\nexport const modernDarkTheme: ModernTheme = {\n\tapply: chart => applyModern(chart, dark),\n\tstyleSeries: (series, index) => styleSeries(series, index, dark)\n}\n","import { modernDarkTheme, modernLightTheme, type ModernTheme } from \"./modern-theme.js\"\nimport { pointerOf } from \"./series-utils.js\"\nimport type { Series } from \"./series.js\"\nimport type { Chart } from \"./chart.js\"\nimport type { Palette } from \"./palette.js\"\nimport type { ChartTheme } from \"./chart-options.js\"\n\nexport type ChartWithTheme = Chart & { paletteName?: string; themeName?: string }\ntype ThemeColor = string\nexport interface ThemeRegistry {\n\tdefault: true\n\tmodern: true\n\tmodernDark: true\n\tminimal: true\n\texcel: true\n\tdark: true\n\ttwilight: true\n\tdaybreak: true\n}\n\nexport type ThemeName = keyof ThemeRegistry\nexport type PaletteInput = string | Palette | string[]\nexport type ThemeApplier = (chart: ChartWithTheme) => void\n\ninterface PluginThemeResources {\n\tthemes?: Record<string, ThemeApplier>\n\tpalettes?: Record<string, Palette | string[]>\n}\n\ninterface ChartPluginResources {\n\tthemes: Map<string, ThemeApplier>\n\tpalettes: Map<string, string[]>\n}\n\nconst chartPluginResources = new WeakMap<Chart, ChartPluginResources>()\n\n/** @internal Keeps plugin resource names consistent with the public theme and palette registries. */\nexport function validatePluginResources(\n\tpluginThemes: Record<string, ThemeApplier> = {},\n\tpluginPalettes: Record<string, Palette | string[]> = {}\n): void {\n\tfor (const name of Object.keys(pluginThemes)) {\n\t\tif (!name.trim()) throw new Error(\"Theme name cannot be empty\")\n\t}\n\tfor (const name of Object.keys(pluginPalettes)) {\n\t\tif (!name.trim()) throw new Error(\"Palette name cannot be empty\")\n\t}\n}\n\n/** @internal Sets the resources visible to one chart from its resolved plugin list. */\nexport function setChartPluginResources(chart: Chart, plugins: Iterable<PluginThemeResources>): void {\n\tconst themes = new Map<string, ThemeApplier>()\n\tconst palettes = new Map<string, string[]>()\n\tfor (const plugin of plugins) {\n\t\tvalidatePluginResources(plugin.themes, plugin.palettes)\n\t\tfor (const [name, apply] of Object.entries(plugin.themes ?? {})) {\n\t\t\tthemes.set(name, apply)\n\t\t}\n\t\tfor (const [name, colors] of Object.entries(plugin.palettes ?? {})) {\n\t\t\tpalettes.set(name, Array.isArray(colors) ? [...colors] : [...colors.colors])\n\t\t}\n\t}\n\tchartPluginResources.set(chart, { themes, palettes })\n}\n\n/** @internal Releases the chart's plugin resource snapshot. */\nexport function clearChartPluginResources(chart: Chart): void {\n\tchartPluginResources.delete(chart)\n}\n\n/** Fills a series, and the marker of its points, with the palette color of its position. */\nfunction paintWithPalette(chart: ChartWithTheme, series: Series, index: number, pointerStroke: string): void {\n\tconst color = chart.palette.get(index)\n\tif (color !== undefined) series.format.fill = color\n\n\tconst pointer = pointerOf(series)\n\tif (pointer) {\n\t\tif (color !== undefined) pointer.format.fill = color\n\t\tpointer.format.stroke.fill = pointerStroke\n\t}\n}\n\nfunction modCustomAxes(chart: ChartWithTheme, featureColor: ThemeColor, defaultStrokeColor: ThemeColor): void {\n\tfor (let i = 0; i < chart.axes.items.length; i++) {\n\t\tif (i > 3) {\n\t\t\tchart.axes.items[i].labels.format.font.setSize(11)\n\t\t\tchart.axes.items[i].format.stroke.fill = defaultStrokeColor\n\t\t\tchart.axes.items[i].labels.format.font.fill = featureColor\n\t\t\tchart.axes.items[i].title.format.font.fill = featureColor\n\t\t\tchart.axes.items[i].title.format.font.setSize(20)\n\t\t\tchart.axes.items[i].grid.visible = false\n\t\t\tchart.axes.items[i].grid.format.stroke.size = 0.6\n\t\t\tchart.axes.items[i].grid.format.stroke.fill = \"silver\"\n\t\t}\n\t}\n}\nfunction defaultTheme(chart: ChartWithTheme): void {\n\tconst featureColor = \"rgba(0,0,0,1)\"\n\tconst defaultStrokeColor = \"rgba(39,79,105,0.8)\"\n\tconst backBlendColor = \"white\"\n\n\tchart.title.format.font.style = \"18px Verdana\"\n\tchart.walls.visible = true\n\tchart.panel.format.shadow.visible = false\n\tchart.panel.format.round.x = 8\n\tchart.panel.format.round.y = 8\n\tchart.panel.format.gradient.visible = true\n\tchart.panel.format.gradient.colors = [\"rgba(224,224,224,1.0)\", \"white\"]\n\tchart.panel.format.gradient.direction = \"diagonalup\"\n\tchart.panel.format.stroke.fill = \"rgba(204,204,204,1.0)\"\n\tchart.panel.format.stroke.size = 1\n\n\tapplyInternalPalette(chart, \"opera\")\n\n\tif (chart.series.items.length > 0) {\n\t\tfor (let i = 0; i < chart.series.items.length; i++) {\n\t\t\tpaintWithPalette(chart, chart.series.items[i], i, backBlendColor)\n\t\t}\n\t}\n\n\tchart.axes.left.labels.format.font.setSize(11)\n\tchart.axes.bottom.labels.format.font.setSize(11)\n\tchart.axes.left.format.stroke.fill = defaultStrokeColor\n\tchart.axes.bottom.format.stroke.fill = defaultStrokeColor\n\tchart.axes.left.labels.format.font.fill = featureColor\n\tchart.axes.bottom.labels.format.font.fill = featureColor\n\tchart.axes.left.title.format.font.fill = featureColor\n\tchart.axes.left.title.format.font.setSize(20)\n\tchart.axes.bottom.title.format.font.fill = featureColor\n\tchart.axes.bottom.title.format.font.setSize(20)\n\tchart.axes.left.grid.visible = true\n\tchart.axes.bottom.grid.visible = false\n\n\tchart.axes.left.grid.format.stroke.size = 0.6\n\tchart.axes.bottom.grid.format.stroke.size = 0.6\n\tchart.axes.left.grid.format.stroke.fill = \"silver\"\n\tchart.axes.bottom.grid.format.stroke.fill = \"silver\"\n\n\tchart.axes.left.grid.visible = true\n\tchart.axes.top.grid.visible = true\n\tchart.axes.right.grid.visible = true\n\tchart.axes.bottom.grid.visible = true\n\n\tif (chart.axes.items.length > 0) {\n\t\tmodCustomAxes(chart, featureColor, defaultStrokeColor)\n\t}\n\n\t// legend\n\tchart.legend.transparent = false\n\tchart.legend.format.fill = \"white\"\n\tchart.legend.format.font.setSize(11)\n\tchart.legend.format.font.fill = featureColor\n\tchart.legend.fontColor = false\n\n\t// title\n\tchart.title.format.font.fill = featureColor\n\n\tchart.walls.visible = false\n}\n\nfunction twilightTheme(chart: ChartWithTheme): void {\n\tconst featureColor = \"rgba(224,224,224,0.6)\"\n\tconst defaultStrokeColor = \"rgba(39,79,105,0.8)\"\n\tconst backBlendColor = \"rgba(82,82,82,1)\"\n\n\tchart.title.format.font.style = \"18px Verdana\"\n\tchart.walls.visible = true\n\tchart.panel.format.shadow.visible = false\n\tchart.panel.format.round.x = 8\n\tchart.panel.format.round.y = 8\n\tchart.panel.format.gradient.visible = true\n\tchart.panel.format.gradient.colors = [\"rgba(99,99,99,1.0)\", \"rgba(19,19,19,1.0)\"]\n\tchart.panel.format.gradient.direction = \"topbottom\"\n\tchart.panel.format.stroke.fill = \"rgba(204,204,204,1.0)\"\n\tchart.panel.format.stroke.size = 1\n\n\tapplyInternalPalette(chart, \"redRiver\")\n\n\tif (chart.series.items.length > 0) {\n\t\tfor (let i = 0; i < chart.series.items.length; i++) {\n\t\t\tpaintWithPalette(chart, chart.series.items[i], i, backBlendColor)\n\t\t}\n\t}\n\n\t//axes\n\tchart.axes.left.format.stroke.fill = featureColor\n\tchart.axes.bottom.format.stroke.fill = featureColor\n\tchart.axes.left.labels.format.font.setSize(11)\n\tchart.axes.bottom.labels.format.font.setSize(11)\n\tchart.axes.left.labels.format.font.fill = featureColor\n\tchart.axes.bottom.labels.format.font.fill = featureColor\n\tchart.axes.left.title.format.font.fill = featureColor\n\tchart.axes.left.title.format.font.setSize(20)\n\tchart.axes.bottom.title.format.font.fill = featureColor\n\tchart.axes.bottom.title.format.font.setSize(20)\n\tchart.axes.bottom.grid.visible = false\n\tchart.axes.left.grid.visible = true\n\tchart.axes.left.grid.format.stroke.fill = \"silver\"\n\tchart.axes.bottom.grid.format.stroke.fill = \"silver\"\n\n\tif (chart.axes.items.length > 0) {\n\t\tmodCustomAxes(chart, featureColor, defaultStrokeColor)\n\t}\n\n\t//legend\n\tchart.legend.transparent = true\n\tchart.legend.format.font.setSize(14)\n\tchart.legend.format.font.fill = featureColor\n\tchart.legend.format.fill = \"rgba(0,0,0,0.1)\"\n\n\t//title\n\tchart.title.format.shadow.visible = false\n\tconst baseFontStyle = \"18px Arial\"\n\tchart.title.format.font.style = baseFontStyle\n\tchart.title.format.font.style = `bold ${baseFontStyle}`\n\tchart.title.format.font.fill = featureColor\n\tchart.title.format.font.shadow.visible = false\n\n\tchart.walls.visible = false\n}\n\nfunction daybreakTheme(chart: ChartWithTheme): void {\n\tconst darkContrastColor = \"rgba(14,14,54,0.6)\"\n\tconst featureColor = \"rgba(224,224,224,0.6)\"\n\tconst backBlendColor = \"rgba(82,82,82,1)\"\n\n\tchart.title.format.font.style = \"18px Verdana\"\n\tchart.walls.visible = true\n\tchart.panel.format.shadow.visible = false\n\tchart.panel.format.round.x = 8\n\tchart.panel.format.round.y = 8\n\tchart.panel.format.gradient.visible = true\n\tchart.panel.format.gradient.colors = [\"rgba(201,204,242,1.0)\", \"rgba(255,252,255,1.0)\", \"rgba(21,21,23,1.0)\"]\n\tchart.panel.format.gradient.direction = \"topbottom\"\n\tchart.panel.format.stroke.fill = \"rgba(204,204,204,1.0)\"\n\tchart.panel.format.stroke.size = 1\n\n\tapplyInternalPalette(chart, \"redRiver\")\n\n\tfor (const [index, series] of chart.series.items.entries()) {\n\t\tpaintWithPalette(chart, series, index, backBlendColor)\n\t}\n\n\t// axes\n\tfor (const [index, axis] of chart.axes.items.entries()) {\n\t\tconst a = axis\n\t\ta.format.stroke.fill = darkContrastColor\n\t\ta.labels.format.font.setSize(11)\n\t\ta.labels.format.font.fill = featureColor\n\t\ta.title.format.font.setSize(20)\n\t\ta.title.format.font.fill = featureColor\n\t\ta.grid.visible = index < 3\n\t\ta.grid.format.stroke.fill = \"silver\"\n\t}\n\n\t// legend\n\tchart.legend.transparent = true\n\tchart.legend.format.font.setSize(14)\n\tchart.legend.format.font.fill = \"silver\"\n\n\t// title\n\tchart.title.format.shadow.visible = false\n\tconst baseFontStyle = \"18px Arial\"\n\tchart.title.format.font.style = baseFontStyle\n\tchart.title.format.font.style = `bold ${baseFontStyle}`\n\tchart.title.format.font.fill = darkContrastColor\n\tchart.title.format.font.shadow.visible = false\n\n\tchart.walls.visible = false\n}\n\nfunction minimalTheme(chart: ChartWithTheme): void {\n\t//designed with white background in mind\n\tchart.title.transparent = true\n\tchart.walls.visible = false\n\tchart.footer.transparent = true\n\tchart.panel.format.shadow.visible = false\n\tchart.panel.format.stroke.fill = \"\"\n\tchart.panel.format.round.x = 0\n\tchart.panel.format.round.y = 0\n\tchart.panel.format.gradient.visible = false\n\tchart.panel.format.fill = \"white\"\n\n\tconst featureColor = \"rgba(124,124,144,0.9)\"\n\tconst defaultStrokeColor = \"rgba(39,79,105,0.8)\"\n\tconst backBlendColor = \"white\"\n\n\tapplyInternalPalette(chart, \"seaWash\")\n\n\tfor (const [index, series] of chart.series.items.entries()) {\n\t\tpaintWithPalette(chart, series, index, backBlendColor)\n\t}\n\n\t// axes\n\tfor (const a of chart.axes.items) {\n\t\ta.format.stroke.fill = defaultStrokeColor\n\t\ta.labels.format.font.setSize(14)\n\t\ta.labels.format.font.fill = featureColor\n\t\ta.title.format.font.setSize(20)\n\t\ta.title.format.font.fill = featureColor\n\t}\n\n\t/*c.series.each(function(series) {\n\tseries.notmandatory.grid.visible=false;\n});*/\n\n\tfor (const axis of chart.axes.items) {\n\t\tif (!axis.horizontal) {\n\t\t\taxis.grid.visible = true\n\t\t\taxis.grid.format.stroke.size = 0.6\n\t\t\taxis.grid.format.stroke.fill = \"silver\"\n\t\t} else {\n\t\t\taxis.grid.visible = false\n\t\t\taxis.grid.format.stroke.size = 0.6\n\t\t\taxis.grid.format.stroke.fill = \"silver\"\n\t\t}\n\t}\n\n\t/*if (c.axes.items.length > 0) {\n\tmodCustomAxes(c,featureColor,defaultStrokeColor)\n}*/\n\n\t// legend\n\tchart.legend.transparent = true\n\tchart.legend.format.font.setSize(14)\n\tchart.legend.format.font.fill = featureColor\n\n\t// title\n\tchart.title.format.shadow.visible = false\n\tconst baseFontStyle = \"18px Arial\"\n\tchart.title.format.font.style = baseFontStyle\n\tchart.title.format.font.style = `bold ${baseFontStyle}`\n\tchart.title.format.font.fill = featureColor\n\tchart.title.format.font.shadow.visible = false\n}\n\nfunction excelTheme(chart: ChartWithTheme): void {\n\tminimalTheme(chart)\n\n\tconst featureColor = \"rgba(0,0,0,0.9)\"\n\tconst backBlendColor = \"white\"\n\n\tapplyInternalPalette(chart, \"excel\")\n\n\tchart.axes.left.grid.format.stroke.fill = featureColor\n\tchart.axes.bottom.grid.format.stroke.fill = featureColor\n\n\tif (chart.series.items.length > 0) {\n\t\tfor (let i = 0; i < chart.series.items.length; i++) {\n\t\t\tpaintWithPalette(chart, chart.series.items[i], i, backBlendColor)\n\t\t}\n\t}\n}\n\nfunction darkTheme(chart: ChartWithTheme): void {\n\tapplyInternalPalette(chart, \"onBlack\")\n\n\tconst featureColor = \"rgba(224,224,224,0.6)\"\n\tconst defaultStrokeColor = \"rgba(39,79,105,0.8)\"\n\tconst backBlendColor = \"rgba(82,82,82,1)\"\n\n\tchart.title.transparent = true\n\tchart.legend.transparent = true\n\tchart.footer.transparent = true\n\n\t//panel\n\tchart.panel.format.shadow.visible = false\n\tchart.panel.format.stroke.fill = \"\"\n\tchart.panel.format.round.x = 0\n\tchart.panel.format.round.y = 0\n\tchart.panel.format.gradient.colors = [\"rgba(0,0,0,1)\", \"rgba(0,0,0,1)\"]\n\tchart.panel.format.gradient.visible = true\n\n\tif (chart.series.items.length > 0) {\n\t\tfor (let i = 0; i < chart.series.items.length; i++) {\n\t\t\tpaintWithPalette(chart, chart.series.items[i], i, backBlendColor)\n\t\t}\n\t}\n\n\t// axes\n\tchart.axes.left.format.stroke.fill = featureColor //defaultStrokeColor;\n\tchart.axes.bottom.format.stroke.fill = featureColor //defaultStrokeColor;\n\tchart.axes.left.labels.format.font.setSize(14)\n\tchart.axes.bottom.labels.format.font.setSize(14)\n\tchart.axes.left.labels.format.font.fill = featureColor\n\tchart.axes.bottom.labels.format.font.fill = featureColor\n\tchart.axes.left.title.format.font.fill = featureColor\n\tchart.axes.left.title.format.font.setSize(20)\n\tchart.axes.bottom.title.format.font.fill = featureColor\n\tchart.axes.bottom.title.format.font.setSize(20)\n\tchart.axes.bottom.grid.visible = false\n\tchart.axes.left.grid.visible = true\n\tchart.axes.left.grid.format.stroke.fill = \"silver\"\n\tchart.axes.bottom.grid.format.stroke.fill = \"silver\"\n\n\tif (chart.axes.items.length > 0) {\n\t\tmodCustomAxes(chart, featureColor, defaultStrokeColor)\n\t}\n\n\t// walls\n\tchart.walls.visible = false\n\n\t// legend\n\tchart.legend.transparent = true\n\tchart.legend.format.font.setSize(14)\n\tchart.legend.format.font.fill = featureColor\n\n\t// title\n\tchart.title.format.shadow.visible = false\n\tconst baseFontStyle = \"18px Arial\"\n\tchart.title.format.font.style = baseFontStyle\n\tchart.title.format.font.style = `bold ${baseFontStyle}`\n\tchart.title.format.font.fill = featureColor\n\tchart.title.format.font.shadow.visible = false\n}\n\nfunction applyInternalPalette(chart: ChartWithTheme, paletteName: string): void {\n\t//default (Opera)\n\tlet colorList: string[] = [\n\t\t\"#4466a3\",\n\t\t\"#f39c35\",\n\t\t\"#f14c14\",\n\t\t\"#4e97a8\",\n\t\t\"#2b406b\",\n\t\t\"#1d7b63\",\n\t\t\"#b3080e\",\n\t\t\"#f2c05d\",\n\t\t\"#5db79e\",\n\t\t\"#707070\",\n\t\t\"#f3ea8d\",\n\t\t\"#b4b4b4\"\n\t]\n\n\t/*Castaway*/\n\tif (paletteName === \"castaway\")\n\t\tcolorList = [\"#4466a3\", \"#E8D0A9\", \"#B7AFA3\", \"#C1DAD6\", \"#F5FAFA\", \"#ACD1E9\", \"#6D929B\"]\n\t/*ClassicPalette*/ else if (paletteName === \"classic\")\n\t\tcolorList = [\n\t\t\t\"#0000FF\",\n\t\t\t\"#00FF00\",\n\t\t\t\"#00FFFF\",\n\t\t\t\"#FF0000\",\n\t\t\t\"#FF00FF\",\n\t\t\t\"#FFFF00\",\n\t\t\t\"#000080\",\n\t\t\t\"#008000\",\n\t\t\t\"#008080\",\n\t\t\t\"#800000\",\n\t\t\t\"#808000\",\n\t\t\t\"#808080\"\n\t\t]\n\t/*Cool*/ else if (paletteName === \"cool\")\n\t\tcolorList = [\n\t\t\t\"rgba(43,64,107,1.0)\",\n\t\t\t\"rgba(59,84,140,1.0)\",\n\t\t\t\"rgba(68,102,163,1.0)\",\n\t\t\t\"rgba(78,151,168,1.0)\",\n\t\t\t\"rgba(93,183,158,1.0)\",\n\t\t\t\"rgba(65,160,138,1.0)\",\n\t\t\t\"rgba(43,146,125,1.0)\",\n\t\t\t\"rgba(29,123,99)\"\n\t\t]\n\t/*Excel*/ else if (paletteName === \"excel\")\n\t\tcolorList = [\n\t\t\t\"#FF9999\",\n\t\t\t\"#663399\",\n\t\t\t\"#CCFFFF\",\n\t\t\t\"#FFFFCC\",\n\t\t\t\"#660066\",\n\t\t\t\"#8080FF\",\n\t\t\t\"#CC6600\",\n\t\t\t\"#FFCCCC\",\n\t\t\t\"#800000\",\n\t\t\t\"#FF00FF\",\n\t\t\t\"#00FFFF\",\n\t\t\t\"#FFFF00\",\n\t\t\t\"#800080\",\n\t\t\t\"#000080\",\n\t\t\t\"#808000\",\n\t\t\t\"#FF0000\",\n\t\t\t\"#FFCC00\",\n\t\t\t\"#FFFFCC\",\n\t\t\t\"#CCFFCC\",\n\t\t\t\"#00FFFF\",\n\t\t\t\"#FFCC99\",\n\t\t\t\"#CC99FF\"\n\t\t]\n\t/*GrayscalePalette*/ else if (paletteName === \"grayscale\")\n\t\tcolorList = [\n\t\t\t\"#F0F0F0\",\n\t\t\t\"#E0E0E0\",\n\t\t\t\"#D0D0D0\",\n\t\t\t\"#C0C0C0\",\n\t\t\t\"#B0B0B0\",\n\t\t\t\"#A0A0A0\",\n\t\t\t\"#909090\",\n\t\t\t\"#808080\",\n\t\t\t\"#707070\",\n\t\t\t\"#606060\",\n\t\t\t\"#505050\",\n\t\t\t\"#404040\",\n\t\t\t\"#303030\",\n\t\t\t\"#202020\",\n\t\t\t\"#101010\"\n\t\t]\n\t/*MacOSPalette*/ else if (paletteName === \"macOS\")\n\t\tcolorList = [\n\t\t\t\"#FFFFFF\",\n\t\t\t\"#FCF305\",\n\t\t\t\"#FF6402\",\n\t\t\t\"#DD0806\",\n\t\t\t\"#F20884\",\n\t\t\t\"#4600A5\",\n\t\t\t\"#0000D4\",\n\t\t\t\"#02ABEA\",\n\t\t\t\"#1FB714\",\n\t\t\t\"#006411\",\n\t\t\t\"#562C05\",\n\t\t\t\"#90713A\",\n\t\t\t\"#C0C0C0\",\n\t\t\t\"#808080\",\n\t\t\t\"#404040\",\n\t\t\t\"#000000\"\n\t\t]\n\t/*ModernPalette*/ else if (paletteName === \"modern\")\n\t\tcolorList = [\n\t\t\t\"#FF9966\",\n\t\t\t\"#FF6666\",\n\t\t\t\"#99CCFF\",\n\t\t\t\"#669966\",\n\t\t\t\"#CCCC99\",\n\t\t\t\"#9966CC\",\n\t\t\t\"#CC6666\",\n\t\t\t\"#FFCC99\",\n\t\t\t\"#9966FF\",\n\t\t\t\"#CCCCCC\",\n\t\t\t\"#66FFCC\",\n\t\t\t\"#6699FF\",\n\t\t\t\"#996699\",\n\t\t\t\"#CCCCFF\"\n\t\t]\n\t/*OnBlack*/ else if (paletteName === \"onBlack\")\n\t\tcolorList = [\"rgba(200,230,90,1.0)\", \"rgba(90,150,220,1.0)\", \"rgba(230,90,40,1.0)\", \"rgba(230,160,15)\"]\n\t/*PastelsPalette*/ else if (paletteName === \"pastels\")\n\t\tcolorList = [\n\t\t\t\"#CCFFFF\",\n\t\t\t\"#FFFFCC\",\n\t\t\t\"#CCCCFF\",\n\t\t\t\"#00CCCC\",\n\t\t\t\"#CCCCCC\",\n\t\t\t\"#009999\",\n\t\t\t\"#999999\",\n\t\t\t\"#DDCCCC\",\n\t\t\t\"#FFCC66\",\n\t\t\t\"#CCCCFF\",\n\t\t\t\"#FF9999\",\n\t\t\t\"#FFFF99\",\n\t\t\t\"#99CCFF\",\n\t\t\t\"#CCFFCC\"\n\t\t]\n\t/*Rainbow*/ else if (paletteName === \"rainbow\")\n\t\tcolorList = [\"#FF0000\", \"#FF7F00\", \"#FFFF00\", \"#00FF00\", \"#0000FF\", \"#6600FF\", \"#8B00FF\"]\n\t/*RedRiver*/ else if (paletteName === \"redRiver\")\n\t\tcolorList = [\"#DC5C05\", \"#FFC519\", \"#6EC5B8\", \"#FF9000\", \"#978B7D\", \"#C7BAA7\"] //#FFAC00\n\t/*Rust*/\n\telse if (paletteName === \"rust\")\n\t\tcolorList = [\n\t\t\t\"#CBFFFA\",\n\t\t\t\"#7F3D17\",\n\t\t\t\"#7F5E17\",\n\t\t\t\"#22287F\",\n\t\t\t\"#DD1E2F\",\n\t\t\t\"#EBB035\",\n\t\t\t\"#06A2CB\",\n\t\t\t\"#218559\",\n\t\t\t\"#D0C6B1\",\n\t\t\t\"#B67721\",\n\t\t\t\"#68819E\",\n\t\t\t\"#747E80\",\n\t\t\t\"#D5E1DD\",\n\t\t\t\"#F7F3E8\",\n\t\t\t\"#F2583E\",\n\t\t\t\"#77BED2\"\n\t\t]\n\t/*SeaWash*/ else if (paletteName === \"seaWash\")\n\t\tcolorList = [\n\t\t\t\"#DC5C05\",\n\t\t\t\"#FFAC00\",\n\t\t\t\"#6EC5B8\",\n\t\t\t\"#E8D0A9\",\n\t\t\t\"#978B7D\",\n\t\t\t\"#C7BAA7\",\n\t\t\t\"#C1DAD6\",\n\t\t\t\"#FFC99F\",\n\t\t\t\"#ACD1E9\",\n\t\t\t\"#6D929B\",\n\t\t\t\"#D3E397\",\n\t\t\t\"#FFF5C3\"\n\t\t]\n\t/*SolidPalette*/ else if (paletteName === \"solid\")\n\t\tcolorList = [\"#0000FF\", \"#FF0000\", \"#00FF00\", \"#FFCC00\", \"#404040\", \"#FFFF00\", \"#FF00C0\", \"#FFFFFF\"]\n\t/*TeeChart*/ else if (paletteName === \"teechart\")\n\t\tcolorList = [\n\t\t\t\"rgba(255,0,0,1.0)\",\n\t\t\t\"rgba(0,128,0,1.0)\",\n\t\t\t\"rgba(255,255,0,1.0)\",\n\t\t\t\"rgba(0,0,255,1.0)\",\n\t\t\t\"rgba(255,255,255,1.0)\",\n\t\t\t\"rgba(128,128,128,1.0)\",\n\t\t\t\"rgba(255,0,255,1.0)\",\n\t\t\t\"rgba(0,128,128,1.0)\",\n\t\t\t\"rgba(0,0,128,1.0)\",\n\t\t\t\"rgba(128,0,0,1.0)\",\n\t\t\t\"rgba(0,255,0,1.0)\",\n\t\t\t\"rgba(128,128,0,1.0)\",\n\t\t\t\"rgba(128,0,128,1.0)\",\n\t\t\t\"rgba(192,192,192,1.0)\",\n\t\t\t\"rgba(0,255,255,1.0)\",\n\t\t\t\"rgba(0,0,0,1.0)\",\n\t\t\t\"rgba(173,255,47,1.0)\",\n\t\t\t\"rgba(135,206,235,1.0)\",\n\t\t\t\"rgba(255,228,196,1.0)\",\n\t\t\t\"rgba(75,0,130,1.0)\"\n\t\t]\n\t/*Warm*/ else if (paletteName === \"warm\")\n\t\tcolorList = [\n\t\t\t\"rgba(243,234,141,1.0)\",\n\t\t\t\"rgba(242,192,93,1.0)\",\n\t\t\t\"rgba(243,156,53,1.0)\",\n\t\t\t\"rgba(245,129,28,1.0)\",\n\t\t\t\"rgba(243,107,21,1.0)\",\n\t\t\t\"rgba(241,76,20,1.0)\",\n\t\t\t\"rgba(230,24,10,1.0)\",\n\t\t\t\"rgba(179,8,14)\"\n\t\t]\n\t/*WebPalette*/ else if (paletteName === \"web\")\n\t\tcolorList = [\"#FFA500\", \"#0000CE\", \"#00CE00\", \"#FFFF40\", \"#40FFFF\", \"#FF40FF\", \"#FF4000\", \"#8080A5\", \"#808040\"]\n\t/*RainbowWidePalette*/ else if (paletteName === \"rainbowWide\")\n\t\tcolorList = [\n\t\t\t\"#990000\",\n\t\t\t\"#C30000\",\n\t\t\t\"#EE0000\",\n\t\t\t\"#FF1A00\",\n\t\t\t\"#FF4600\",\n\t\t\t\"#FF7300\",\n\t\t\t\"#FF9F00\",\n\t\t\t\"#FFCB00\",\n\t\t\t\"#FFF700\",\n\t\t\t\"#E3F408\",\n\t\t\t\"#C3E711\",\n\t\t\t\"#A3DA1B\",\n\t\t\t\"#83CD25\",\n\t\t\t\"#63C02E\",\n\t\t\t\"#42B338\",\n\t\t\t\"#22A642\",\n\t\t\t\"#029A4B\",\n\t\t\t\"#0C876A\",\n\t\t\t\"#1A758A\",\n\t\t\t\"#2863AA\",\n\t\t\t\"#3650CB\",\n\t\t\t\"#443EEB\",\n\t\t\t\"#612AFF\",\n\t\t\t\"#9615FF\",\n\t\t\t\"#CC00FF\"\n\t\t]\n\t/*WindowsVistaPalette*/ else if (paletteName === \"windowsVista\")\n\t\tcolorList = [\n\t\t\t\"#001FD2\",\n\t\t\t\"#E00201\",\n\t\t\t\"#1E6602\",\n\t\t\t\"#E8CD7E\",\n\t\t\t\"#AFABAC\",\n\t\t\t\"#A4D0D9\",\n\t\t\t\"#3D3B3C\",\n\t\t\t\"#95DD31\",\n\t\t\t\"#9E0001\",\n\t\t\t\"#DCF774\",\n\t\t\t\"#45FDFD\",\n\t\t\t\"#D18E74\",\n\t\t\t\"#A0D891\",\n\t\t\t\"#D57A65\",\n\t\t\t\"#9695D9\"\n\t\t]\n\t/*WindowsXPPalette*/ else if (paletteName === \"windowsxp\")\n\t\tcolorList = [\n\t\t\t\"rgba(130,155,254,1.0)\",\n\t\t\t\"rgba(252,209,36,1.0)\",\n\t\t\t\"rgba(124,188,13,1.0)\",\n\t\t\t\"rgba(253,133,47,1.0)\",\n\t\t\t\"rgba(253,254,252,1.0)\",\n\t\t\t\"rgba(226,78,33,1.0)\",\n\t\t\t\"rgba(41,56,214,1.0)\",\n\t\t\t\"rgba(183,148,0,1.0)\",\n\t\t\t\"rgba(90,134,0,1.0)\",\n\t\t\t\"rgba(210,70,0,1.0)\",\n\t\t\t\"rgba(211,229,250,1.0)\",\n\t\t\t\"rgba(216,216,216,1.0)\",\n\t\t\t\"rgba(95,113,123,1.0)\"\n\t\t]\n\t/*VictorianPalette*/ else if (paletteName === \"victorian\")\n\t\tcolorList = [\n\t\t\t\"#5DA5A1\",\n\t\t\t\"#C45331\",\n\t\t\t\"#E79609\",\n\t\t\t\"#F6E84A\",\n\t\t\t\"#B1A2A7\",\n\t\t\t\"#C9A784\",\n\t\t\t\"#8C7951\",\n\t\t\t\"#D8CDB7\",\n\t\t\t\"#086553\",\n\t\t\t\"#F7D87B\",\n\t\t\t\"#016484\"\n\t\t]\n\n\tchart.paletteName = paletteName\n\tchart.palette.colors = colorList\n\n\tif (chart.series.items.length > 0) {\n\t\tfor (let i = 0; i < chart.series.items.length; i++) {\n\t\t\tconst color = chart.palette.get(i)\n\t\t\tif (color === undefined) continue\n\n\t\t\tchart.series.items[i].format.fill = color\n\t\t\tconst pointer = pointerOf(chart.series.items[i])\n\t\t\tif (pointer) pointer.format.fill = color\n\t\t}\n\t}\n}\n\nexport function registerTheme(name: string, apply: ThemeApplier): void {\n\tif (!name.trim()) throw new Error(\"Theme name cannot be empty\")\n\tthemes[name] = apply\n}\n\nexport function registerPalette(name: string, colors: Palette | string[]): void {\n\tif (!name.trim()) throw new Error(\"Palette name cannot be empty\")\n\tpalettes[name] = Array.isArray(colors) ? [...colors] : [...colors.colors]\n}\n\nexport function unregisterTheme(name: string): boolean {\n\tif (Object.hasOwn(builtInThemes, name)) return false\n\tif (!Object.hasOwn(themes, name)) return false\n\treturn delete themes[name]\n}\n\nexport function unregisterPalette(name: string): boolean {\n\tif (!Object.hasOwn(palettes, name)) return false\n\treturn delete palettes[name]\n}\n\nexport function applyTheme(chart: ChartWithTheme, theme?: ChartTheme): void {\n\tconst themeName: ChartTheme = theme || \"default\"\n\tconst apply = chartPluginResources.get(chart)?.themes.get(themeName) ?? themes[themeName] ?? themes.default\n\n\tchart.legend.resetDesign()\n\tapply(chart)\n\tif (Object.hasOwn(modernThemes, themeName) && themes[themeName] === builtInThemes[themeName])\n\t\tseriesStylers.set(chart, modernThemes[themeName])\n\telse seriesStylers.delete(chart)\n\tchart.themeName = themeName\n\tchart.draw()\n}\n\nexport function applyPalette(chart: ChartWithTheme, paletteName: PaletteInput): void {\n\tif (typeof paletteName === \"string\") {\n\t\tconst registeredColors = chartPluginResources.get(chart)?.palettes.get(paletteName) ?? palettes[paletteName]\n\t\tif (registeredColors) chart.palette.colors = [...registeredColors]\n\t\telse applyInternalPalette(chart, paletteName)\n\t} else {\n\t\tchart.palette.colors = Array.isArray(paletteName) ? paletteName : paletteName.colors\n\t}\n\n\tchart.draw()\n}\n\n/** @internal Styles a series added after a theme with series styling was applied. */\nexport function styleAddedSeries(chart: Chart, series: Series, index: number): void {\n\tseriesStylers.get(chart)?.styleSeries(series, index)\n}\n\nconst seriesStylers = new WeakMap<Chart, ModernTheme>()\nconst modernThemes: Record<string, ModernTheme> = { modern: modernLightTheme, modernDark: modernDarkTheme }\n\nconst builtInThemes: Record<string, ThemeApplier> = {\n\tdefault: defaultTheme,\n\tmodern: modernLightTheme.apply,\n\tmodernDark: modernDarkTheme.apply,\n\tminimal: minimalTheme,\n\texcel: excelTheme,\n\tdark: darkTheme,\n\ttwilight: twilightTheme,\n\tdaybreak: daybreakTheme\n}\n\nconst themes: Record<string, ThemeApplier> = { ...builtInThemes }\nconst palettes: Record<string, string[]> = {}\n","import type { Chart } from \"./chart.js\"\nimport type { Axis } from \"./core/elements/axis.js\"\nimport type { ChartPlugin } from \"./plugin.js\"\n\nexport type QuadrantName = \"topLeft\" | \"topRight\" | \"bottomLeft\" | \"bottomRight\"\n\nexport type QuadrantArea = {\n\t/** Background color of the area. */\n\tbackgroundColor?: string\n\t/** Caption drawn in the outer corner of the area. */\n\ttext?: string\n\t/** Caption color. */\n\tcolor?: string\n\t/** CSS font of the caption. */\n\tfont?: string\n}\n\nexport type QuadrantSplitValue = number | \"mean\" | \"median\"\n\nexport type QuadrantsOptions = {\n\t/** Where the areas meet: an axis value, or the mean / median of the chart data. */\n\tsplit: { x: QuadrantSplitValue; y: QuadrantSplitValue }\n\t/** Axes that the split is measured on. */\n\taxes: { x: \"bottom\" | \"top\"; y: \"left\" | \"right\" }\n\t/** Pixels between a caption and the plot area edge. */\n\tinset: number\n\t/** Lines drawn along the split. Set `width` to 0 to hide them. */\n\tdivider: { color: string; width: number }\n\t/** The four areas, named by the corner of the plot area they touch. */\n\tareas: Record<QuadrantName, QuadrantArea>\n}\n\ndeclare module \"./plugin.js\" {\n\tinterface PluginOptionsRegistry {\n\t\tquadrants: QuadrantsOptions\n\t}\n}\n\ntype Split = { left: number; right: number; top: number; bottom: number; x: number; y: number }\n\nconst defaultStyle: QuadrantArea = { color: \"rgba(0,0,0,0.55)\", font: \"14px sans-serif\" }\n\nfunction statistic(chart: Chart, horizontal: boolean, mode: \"mean\" | \"median\"): number | undefined {\n\tconst values: number[] = []\n\tfor (const series of chart.series.items) {\n\t\tconst data = series.data\n\t\tif (!data) continue\n\t\tconst list: Array<number | Date> | undefined = horizontal ? (data.x ?? data.values.map((_, i) => i)) : data.values\n\t\tfor (const item of list) {\n\t\t\tconst value = item instanceof Date ? item.getTime() : item\n\t\t\tif (Number.isFinite(value)) values.push(value)\n\t\t}\n\t}\n\tif (!values.length) return undefined\n\tif (mode === \"mean\") return values.reduce((sum, value) => sum + value, 0) / values.length\n\tvalues.sort((a, b) => a - b)\n\tconst middle = values.length >> 1\n\treturn values.length % 2 ? values[middle] : (values[middle - 1] + values[middle]) / 2\n}\n\nfunction resolveValue(chart: Chart, option: QuadrantSplitValue, horizontal: boolean): number | undefined {\n\treturn typeof option === \"number\" ? option : statistic(chart, horizontal, option)\n}\n\nfunction computeSplit(chart: Chart, options: QuadrantsOptions): Split | undefined {\n\tconst xAxis: Axis = chart.axes[options.axes.x]\n\tconst yAxis: Axis = chart.axes[options.axes.y]\n\tconst xValue = resolveValue(chart, options.split.x, true)\n\tconst yValue = resolveValue(chart, options.split.y, false)\n\tif (xValue === undefined || yValue === undefined) return undefined\n\n\tconst left = Math.min(xAxis.startPos, xAxis.endPos)\n\tconst right = Math.max(xAxis.startPos, xAxis.endPos)\n\tconst top = Math.min(yAxis.startPos, yAxis.endPos)\n\tconst bottom = Math.max(yAxis.startPos, yAxis.endPos)\n\tif (!(right > left) || !(bottom > top)) return undefined\n\n\tconst clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value))\n\treturn {\n\t\tleft,\n\t\tright,\n\t\ttop,\n\t\tbottom,\n\t\tx: clamp(xAxis.calc(xValue), left, right),\n\t\ty: clamp(yAxis.calc(yValue), top, bottom)\n\t}\n}\n\nfunction drawFills(ctx: CanvasRenderingContext2D, options: QuadrantsOptions, split: Split): void {\n\tconst { left, right, top, bottom, x, y } = split\n\tconst cells: [QuadrantName, number, number, number, number][] = [\n\t\t[\"topLeft\", left, top, x - left, y - top],\n\t\t[\"topRight\", x, top, right - x, y - top],\n\t\t[\"bottomLeft\", left, y, x - left, bottom - y],\n\t\t[\"bottomRight\", x, y, right - x, bottom - y]\n\t]\n\tfor (const [name, cx, cy, width, height] of cells) {\n\t\tconst fill = options.areas[name]?.backgroundColor\n\t\tif (!fill || width <= 0 || height <= 0) continue\n\t\tctx.fillStyle = fill\n\t\tctx.fillRect(cx, cy, width, height)\n\t}\n}\n\nfunction drawLabels(ctx: CanvasRenderingContext2D, options: QuadrantsOptions, split: Split): void {\n\tconst { left, right, top, bottom, x, y } = split\n\tconst pad = options.inset\n\tconst cells: [QuadrantName, number, number, CanvasTextAlign, CanvasTextBaseline][] = [\n\t\t[\"topLeft\", left + pad, top + pad, \"left\", \"top\"],\n\t\t[\"topRight\", right - pad, top + pad, \"right\", \"top\"],\n\t\t[\"bottomLeft\", left + pad, bottom - pad, \"left\", \"bottom\"],\n\t\t[\"bottomRight\", right - pad, bottom - pad, \"right\", \"bottom\"]\n\t]\n\tconst visible: Record<QuadrantName, boolean> = {\n\t\ttopLeft: x > left && y > top,\n\t\ttopRight: x < right && y > top,\n\t\tbottomLeft: x > left && y < bottom,\n\t\tbottomRight: x < right && y < bottom\n\t}\n\tfor (const [name, px, py, align, baseline] of cells) {\n\t\tconst style = options.areas[name]\n\t\tif (!style?.text || !visible[name]) continue\n\t\tctx.fillStyle = style.color ?? defaultStyle.color ?? \"#000\"\n\t\tctx.font = style.font ?? defaultStyle.font ?? \"14px sans-serif\"\n\t\tctx.textAlign = align\n\t\tctx.textBaseline = baseline\n\t\tctx.fillText(style.text, px, py)\n\t}\n}\n\nfunction drawLines(ctx: CanvasRenderingContext2D, options: QuadrantsOptions, split: Split): void {\n\tif (!options.divider.color || options.divider.width <= 0) return\n\tconst { left, right, top, bottom, x, y } = split\n\tctx.strokeStyle = options.divider.color\n\tctx.lineWidth = options.divider.width\n\tctx.beginPath()\n\tctx.moveTo(x, top)\n\tctx.lineTo(x, bottom)\n\tctx.moveTo(left, y)\n\tctx.lineTo(right, y)\n\tctx.stroke()\n}\n\n/**\n * Built-in plugin that splits the plot area into four colored quadrants around a point.\n * It does nothing until `pluginOptions.quadrants` is set on the chart.\n */\nexport const quadrantsPlugin: ChartPlugin<QuadrantsOptions> = {\n\tid: \"quadrants\",\n\tdefaults: {\n\t\tsplit: { x: 0, y: 0 },\n\t\taxes: { x: \"bottom\", y: \"left\" },\n\t\tinset: 6,\n\t\tdivider: { color: \"rgba(0,0,0,0.35)\", width: 1 },\n\t\tareas: { topLeft: {}, topRight: {}, bottomLeft: {}, bottomRight: {} }\n\t},\n\tafterAxesDraw: (chart, ctx, _series, options) => {\n\t\tif (!chart.pluginOptions.quadrants) return\n\t\tconst split = computeSplit(chart, options as QuadrantsOptions)\n\t\tif (!split) return\n\t\tctx.save()\n\t\tctx.beginPath()\n\t\tctx.rect(split.left, split.top, split.right - split.left, split.bottom - split.top)\n\t\tctx.clip()\n\t\tdrawFills(ctx, options as QuadrantsOptions, split)\n\t\tctx.restore()\n\t},\n\tafterAllSeriesDraw: (chart, ctx, options) => {\n\t\tif (!chart.pluginOptions.quadrants) return\n\t\tconst split = computeSplit(chart, options as QuadrantsOptions)\n\t\tif (!split) return\n\t\tctx.save()\n\t\tdrawLines(ctx, options as QuadrantsOptions, split)\n\t\tdrawLabels(ctx, options as QuadrantsOptions, split)\n\t\tctx.restore()\n\t}\n}\n","import type { Chart } from \"./chart.js\"\nimport { clearChartPluginResources, setChartPluginResources, validatePluginResources } from \"./theme.js\"\nimport type { Palette } from \"./palette.js\"\nimport type { ThemeApplier } from \"./theme.js\"\nimport type { Series } from \"./series.js\"\nimport { quadrantsPlugin } from \"./quadrants-plugin.js\"\n\nexport type ChartPluginEvent = {\n\ttype?: string\n\tchanged?: boolean\n\t[key: string]: unknown\n}\n\n/** Extend with declaration merging to type options supplied for known plugin ids. */\n// biome-ignore lint/suspicious/noEmptyInterface: This interface is the declaration-merging extension point.\nexport interface PluginOptionsRegistry {}\n\n/** Per-chart options keyed by plugin id. Set an id to `false` to disable that plugin. */\nexport type ChartPluginOptions = {\n\t[Id in keyof PluginOptionsRegistry]?: false | Partial<PluginOptionsRegistry[Id]>\n} & Record<string, false | Record<string, unknown>>\n\nexport type ChartPluginHook =\n\t| \"beforeInit\"\n\t| \"afterInit\"\n\t| \"beforeUpdate\"\n\t| \"afterUpdate\"\n\t| \"beforeResize\"\n\t| \"afterResize\"\n\t| \"beforeScaleUpdate\"\n\t| \"afterScaleUpdate\"\n\t| \"beforeRender\"\n\t| \"afterRender\"\n\t| \"beforeDraw\"\n\t| \"afterPanelDraw\"\n\t| \"afterAxesDraw\"\n\t| \"beforeSeriesDraw\"\n\t| \"afterSeriesDraw\"\n\t| \"afterAllSeriesDraw\"\n\t| \"afterDraw\"\n\t| \"beforeEvent\"\n\t| \"afterEvent\"\n\t| \"beforeDestroy\"\n\t| \"afterDestroy\"\n\ntype PluginHookResult = boolean | undefined\ntype PluginHook = (chart: Chart, ...args: unknown[]) => unknown\nexport type PluginOptions = Record<string, unknown>\ntype TypedPluginHook<Options, Args extends unknown[], Result = void> = {\n\tbivarianceHack(...args: [...Args, Options]): Result\n}[\"bivarianceHack\"]\ntype BivariantFunction<Args extends unknown[], Result> = {\n\tbivarianceHack(...args: Args): Result\n}[\"bivarianceHack\"]\n\nexport type ChartPlugin<Options extends PluginOptions = PluginOptions, State = unknown> = {\n\tid: string\n\t/** Lower values run first. Plugins with equal values keep their registration order. */\n\torder?: number\n\tdefaults?: Partial<Options>\n\tthemes?: Record<string, ThemeApplier>\n\tpalettes?: Record<string, Palette | string[]>\n\tcreate?: BivariantFunction<[Chart, Partial<Options>], State>\n\tdestroy?: BivariantFunction<[Chart, Partial<Options>, State], void>\n\tbeforeInit?: TypedPluginHook<State, [Chart, Partial<Options>]>\n\tafterInit?: TypedPluginHook<State, [Chart, Partial<Options>], undefined | (() => void)>\n\tbeforeUpdate?: TypedPluginHook<State, [Chart, Partial<Options>], PluginHookResult>\n\tafterUpdate?: TypedPluginHook<State, [Chart, Partial<Options>]>\n\tbeforeResize?: TypedPluginHook<State, [Chart, number, number, Partial<Options>], PluginHookResult>\n\tafterResize?: TypedPluginHook<State, [Chart, number, number, Partial<Options>]>\n\tbeforeScaleUpdate?: TypedPluginHook<State, [Chart, Partial<Options>], PluginHookResult>\n\tafterScaleUpdate?: TypedPluginHook<State, [Chart, Partial<Options>]>\n\tbeforeRender?: TypedPluginHook<State, [Chart, CanvasRenderingContext2D, Partial<Options>], PluginHookResult>\n\tafterRender?: TypedPluginHook<State, [Chart, CanvasRenderingContext2D, Partial<Options>]>\n\tbeforeDraw?: TypedPluginHook<\n\t\tState,\n\t\t[Chart, CanvasRenderingContext2D, Series | undefined, Partial<Options>],\n\t\tPluginHookResult\n\t>\n\tafterPanelDraw?: TypedPluginHook<State, [Chart, CanvasRenderingContext2D, Series | undefined, Partial<Options>]>\n\tafterAxesDraw?: TypedPluginHook<State, [Chart, CanvasRenderingContext2D, Series | undefined, Partial<Options>]>\n\tbeforeSeriesDraw?: TypedPluginHook<\n\t\tState,\n\t\t[Chart, CanvasRenderingContext2D, Series, number, Partial<Options>],\n\t\tPluginHookResult\n\t>\n\tafterSeriesDraw?: TypedPluginHook<State, [Chart, CanvasRenderingContext2D, Series, number, Partial<Options>]>\n\tafterAllSeriesDraw?: TypedPluginHook<State, [Chart, CanvasRenderingContext2D, Partial<Options>]>\n\tafterDraw?: TypedPluginHook<State, [Chart, CanvasRenderingContext2D, Series | undefined, Partial<Options>]>\n\tbeforeEvent?: TypedPluginHook<State, [Chart, ChartPluginEvent, Partial<Options>], PluginHookResult>\n\tafterEvent?: TypedPluginHook<State, [Chart, ChartPluginEvent, Partial<Options>]>\n\tbeforeDestroy?: TypedPluginHook<State, [Chart, Partial<Options>]>\n\tafterDestroy?: TypedPluginHook<State, [Chart, Partial<Options>]>\n}\n\nfunction isPlainObject(value: unknown): value is PluginOptions {\n\tif (!value || typeof value !== \"object\") return false\n\tconst prototype = Object.getPrototypeOf(value)\n\treturn prototype === Object.prototype || prototype === null\n}\n\nfunction clonePluginValue(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(clonePluginValue)\n\tif (isPlainObject(value)) {\n\t\treturn Object.fromEntries(Object.entries(value).map(([key, item]) => [key, clonePluginValue(item)]))\n\t}\n\treturn value\n}\n\nfunction mergePluginOptions(\n\tdefaults: PluginOptions | undefined,\n\toptions: PluginOptions | false | undefined\n): PluginOptions {\n\tconst result = clonePluginValue(defaults ?? {}) as PluginOptions\n\tif (!options) return result\n\n\tfor (const [key, value] of Object.entries(options)) {\n\t\tconst previous = result[key]\n\t\tif (isPlainObject(previous) && isPlainObject(value)) result[key] = mergePluginOptions(previous, value)\n\t\telse result[key] = clonePluginValue(value)\n\t}\n\n\treturn result\n}\n\nfunction invokePluginHook(\n\tchart: Chart,\n\tplugin: ChartPlugin,\n\thook: ChartPluginHook,\n\targs: unknown[] = [],\n\tconfiguredOptions = chart.pluginOptions[plugin.id]\n): unknown {\n\tconst options = mergePluginOptions(plugin.defaults, configuredOptions)\n\tconst state = pluginStatesByChart.get(chart)?.get(plugin)\n\tconst callback = plugin[hook] as PluginHook | undefined\n\tconst result = callback?.(chart, ...args, options, state)\n\n\tif (hook === \"afterInit\" && typeof result === \"function\") {\n\t\tlet cleanups = pluginCleanupsByChart.get(chart)\n\t\tif (!cleanups) {\n\t\t\tcleanups = new Map()\n\t\t\tpluginCleanupsByChart.set(chart, cleanups)\n\t\t}\n\t\tcleanups.set(plugin, result as () => void)\n\t}\n\n\treturn result\n}\n\nfunction cleanupPlugin(chart: Chart, plugin: ChartPlugin, configuredOptions = chart.pluginOptions[plugin.id]): void {\n\tconst options = mergePluginOptions(plugin.defaults, configuredOptions)\n\tconst state = pluginStatesByChart.get(chart)?.get(plugin)\n\tlet failure: unknown\n\tlet failed = false\n\ttry {\n\t\tplugin.destroy?.(chart, options, state)\n\t} catch (error) {\n\t\tfailure = error\n\t\tfailed = true\n\t}\n\ttry {\n\t\tpluginCleanupsByChart.get(chart)?.get(plugin)?.()\n\t} catch (error) {\n\t\tif (!failed) failure = error\n\t\tfailed = true\n\t}\n\tpluginCleanupsByChart.get(chart)?.delete(plugin)\n\tpluginStatesByChart.get(chart)?.delete(plugin)\n\tif (failed) throw failure\n}\n\n// Built-in plugins are inert until configured through `pluginOptions`.\nconst plugins = new Map<string, ChartPlugin>([[quadrantsPlugin.id, quadrantsPlugin as ChartPlugin]])\nconst activePluginsByChart = new WeakMap<Chart, Map<string, ChartPlugin>>()\nconst pluginStatesByChart = new WeakMap<Chart, Map<ChartPlugin, unknown>>()\nconst pluginCleanupsByChart = new WeakMap<Chart, Map<ChartPlugin, () => void>>()\n\nfunction resolveChartPlugins(localPlugins: ChartPlugin[]): Map<string, ChartPlugin> {\n\tconst activePlugins = new Map(plugins)\n\tfor (const plugin of localPlugins) {\n\t\tvalidatePlugin(plugin)\n\t\tactivePlugins.delete(plugin.id)\n\t\tactivePlugins.set(plugin.id, plugin)\n\t}\n\tconst orderedPlugins = [...activePlugins.values()].map((plugin, index) => ({ plugin, index }))\n\torderedPlugins.sort((a, b) => (a.plugin.order ?? 0) - (b.plugin.order ?? 0) || a.index - b.index)\n\treturn new Map(orderedPlugins.map(({ plugin }) => [plugin.id, plugin]))\n}\nconst disabledPluginOptionsByChart = new WeakMap<Chart, Map<string, PluginOptions>>()\n\nfunction validatePlugin(plugin: ChartPlugin): void {\n\tif (!plugin.id.trim()) throw new Error(\"Plugin id cannot be empty\")\n\tif (plugin.order !== undefined && !Number.isFinite(plugin.order)) {\n\t\tthrow new Error(`Plugin ${JSON.stringify(plugin.id)} order must be a finite number`)\n\t}\n\tvalidatePluginResources(plugin.themes, plugin.palettes)\n}\n\nexport function registerPlugin(plugin: ChartPlugin): void {\n\tvalidatePlugin(plugin)\n\tconst current = plugins.get(plugin.id)\n\tif (current === plugin) return\n\tplugins.delete(plugin.id)\n\tplugins.set(plugin.id, plugin)\n}\n\nexport function unregisterPlugin(plugin: ChartPlugin): void {\n\tif (plugins.get(plugin.id) !== plugin) return\n\tplugins.delete(plugin.id)\n}\n\n/** @internal Captures global and local plugins before chart options resolve plugin resources. */\nexport function prepareChartPlugins(chart: Chart, localPlugins: ChartPlugin[] = []): void {\n\tif (activePluginsByChart.has(chart)) return\n\tconst activePlugins = resolveChartPlugins(localPlugins)\n\tactivePluginsByChart.set(chart, activePlugins)\n\tsetChartPluginResources(chart, activePlugins.values())\n}\n\nexport function drawPluginHooks(\n\tchart: Chart,\n\thook: ChartPluginHook,\n\tctx: CanvasRenderingContext2D,\n\tlocalPlugins: ChartPlugin[] = [],\n\tseries?: Series,\n\tindex?: number\n): boolean {\n\treturn notifyPluginHooks(chart, hook, index === undefined ? [ctx, series] : [ctx, series, index], localPlugins)\n}\n\nexport function notifyPluginHooks(\n\tchart: Chart,\n\thook: ChartPluginHook,\n\targs: unknown[] = [],\n\tlocalPlugins: ChartPlugin[] = []\n): boolean {\n\tlet activePlugins = activePluginsByChart.get(chart)\n\tif (!activePlugins) {\n\t\tactivePlugins = resolveChartPlugins(localPlugins)\n\t\tif (hook === \"beforeInit\") {\n\t\t\tactivePluginsByChart.set(chart, activePlugins)\n\t\t\tsetChartPluginResources(chart, activePlugins.values())\n\t\t}\n\t}\n\tif (hook === \"beforeInit\") {\n\t\tconst states = new Map<ChartPlugin, unknown>()\n\t\tpluginStatesByChart.set(chart, states)\n\t\tfor (const plugin of activePlugins.values()) {\n\t\t\tconst configuredOptions = chart.pluginOptions[plugin.id]\n\t\t\tif (configuredOptions !== false) {\n\t\t\t\tstates.set(plugin, plugin.create?.(chart, mergePluginOptions(plugin.defaults, configuredOptions)))\n\t\t\t}\n\t\t}\n\t}\n\n\tlet failure: unknown\n\tlet failed = false\n\tfor (const plugin of activePlugins.values()) {\n\t\tconst configuredOptions = chart.pluginOptions[plugin.id]\n\t\tif (configuredOptions === false) continue\n\t\tlet result: unknown\n\t\ttry {\n\t\t\tresult = invokePluginHook(chart, plugin, hook, args)\n\t\t} catch (error) {\n\t\t\tif (hook !== \"afterDestroy\") throw error\n\t\t\tif (!failed) failure = error\n\t\t\tfailed = true\n\t\t}\n\n\t\tif (hook === \"afterDestroy\") {\n\t\t\ttry {\n\t\t\t\tcleanupPlugin(chart, plugin)\n\t\t\t} catch (error) {\n\t\t\t\tif (!failed) failure = error\n\t\t\t\tfailed = true\n\t\t\t}\n\t\t}\n\t\tif (result === false && hook !== \"afterDestroy\") return false\n\t}\n\tif (hook === \"afterDestroy\") {\n\t\tactivePluginsByChart.delete(chart)\n\t\tpluginStatesByChart.delete(chart)\n\t\tpluginCleanupsByChart.delete(chart)\n\t\tclearChartPluginResources(chart)\n\t}\n\tif (failed) throw failure\n\n\treturn true\n}\n\n/** Applies per-chart plugin enable/disable changes without rebuilding the chart. */\nexport function updatePluginActivation(chart: Chart, before: ChartPluginOptions, after: ChartPluginOptions): void {\n\tconst activePlugins = activePluginsByChart.get(chart)\n\tif (!activePlugins) return\n\n\tfor (const plugin of activePlugins.values()) {\n\t\tconst wasEnabled = before[plugin.id] !== false\n\t\tconst isEnabled = after[plugin.id] !== false\n\t\tif (wasEnabled === isEnabled) continue\n\n\t\tif (isEnabled) {\n\t\t\tlet states = pluginStatesByChart.get(chart)\n\t\t\tif (!states) {\n\t\t\t\tstates = new Map()\n\t\t\t\tpluginStatesByChart.set(chart, states)\n\t\t\t}\n\t\t\tstates.set(plugin, plugin.create?.(chart, mergePluginOptions(plugin.defaults, after[plugin.id])))\n\t\t\tdisabledPluginOptionsByChart.get(chart)?.delete(plugin.id)\n\t\t\tinvokePluginHook(chart, plugin, \"beforeInit\")\n\t\t\tinvokePluginHook(chart, plugin, \"afterInit\")\n\t\t\tcontinue\n\t\t}\n\n\t\tlet disabledOptions = disabledPluginOptionsByChart.get(chart)\n\t\tif (!disabledOptions) {\n\t\t\tdisabledOptions = new Map()\n\t\t\tdisabledPluginOptionsByChart.set(chart, disabledOptions)\n\t\t}\n\t\tconst previousOptions = before[plugin.id]\n\t\tif (previousOptions) disabledOptions.set(plugin.id, previousOptions)\n\n\t\tlet failure: unknown\n\t\tlet failed = false\n\t\ttry {\n\t\t\tinvokePluginHook(chart, plugin, \"beforeDestroy\", [], previousOptions)\n\t\t} catch (error) {\n\t\t\tfailure = error\n\t\t\tfailed = true\n\t\t}\n\t\ttry {\n\t\t\tinvokePluginHook(chart, plugin, \"afterDestroy\", [], previousOptions)\n\t\t} catch (error) {\n\t\t\tif (!failed) failure = error\n\t\t\tfailed = true\n\t\t}\n\t\ttry {\n\t\t\tcleanupPlugin(chart, plugin, previousOptions)\n\t\t} catch (error) {\n\t\t\tif (!failed) failure = error\n\t\t\tfailed = true\n\t\t}\n\t\tif (failed) throw failure\n\t}\n}\n\n/** Enables or disables a plugin already attached to this chart. */\nexport function setChartPluginEnabled(chart: Chart, id: string, enabled: boolean): void {\n\tconst plugin = activePluginsByChart.get(chart)?.get(id)\n\tif (!plugin) throw new Error(`Plugin \"${id}\" is not attached to this chart`)\n\tif ((chart.pluginOptions[id] !== false) === enabled) return\n\n\tconst options = enabled ? (disabledPluginOptionsByChart.get(chart)?.get(id) ?? {}) : false\n\tchart.setOptions({ pluginOptions: { [id]: options } })\n}\n","import type { Series } from \"./series.js\"\n\n/**\n * Describes how a declarative series type is created and filled with data.\n *\n * `create` returns an empty series. `setData` receives the raw `data` value of the series options and the chart\n * level labels; when omitted, the data must be an iterable of numbers and is passed to `Series.setData`.\n * `configure` runs afterwards and receives the complete series options, for type specific properties.\n */\nexport interface SeriesTypeDefinition<TData = unknown, TOptions extends { data: TData } = { data: TData }> {\n\tcreate(): Series\n\tsetData?(series: Series, data: TData, labels: readonly string[] | undefined): void\n\tconfigure?(series: Series, options: TOptions): void\n}\n\nexport type SeriesTypeConstructor = new () => Series\n\nconst seriesTypes = new Map<string, SeriesTypeDefinition>()\nconst builtInSeriesTypes = new Set<string>()\n\nfunction toDefinition<TData, TOptions extends { data: TData }>(\n\tdefinition: SeriesTypeDefinition<TData, TOptions> | SeriesTypeConstructor\n): SeriesTypeDefinition<TData, TOptions> {\n\tif (typeof definition === \"function\") {\n\t\tconst SeriesClass = definition\n\t\treturn { create: () => new SeriesClass() }\n\t}\n\treturn definition\n}\n\n/**\n * Registers a series type usable as `type` in declarative chart options.\n * Registering an existing name replaces its definition.\n */\nexport function registerSeriesType<TData = unknown, TOptions extends { data: TData } = { data: TData }>(\n\tname: string,\n\tdefinition: SeriesTypeDefinition<TData, TOptions> | SeriesTypeConstructor\n): void {\n\tif (!name.trim()) throw new Error(\"Series type name cannot be empty\")\n\tseriesTypes.set(name, toDefinition(definition) as unknown as SeriesTypeDefinition)\n}\n\n/** Registers a series type shipped with the library; it cannot be removed with `unregisterSeriesType`. */\nexport function registerBuiltInSeriesType<TData = unknown, TOptions extends { data: TData } = { data: TData }>(\n\tname: string,\n\tdefinition: SeriesTypeDefinition<TData, TOptions> | SeriesTypeConstructor\n): void {\n\tregisterSeriesType(name, definition)\n\tbuiltInSeriesTypes.add(name)\n}\n\nexport function unregisterSeriesType(name: string): boolean {\n\tif (builtInSeriesTypes.has(name)) return false\n\treturn seriesTypes.delete(name)\n}\n\nexport function getSeriesType(name: string): SeriesTypeDefinition | undefined {\n\treturn seriesTypes.get(name)\n}\n\nexport function hasSeriesType(name: unknown): name is string {\n\treturn typeof name === \"string\" && seriesTypes.has(name)\n}\n","export function drawSpline(\n\tctx: CanvasRenderingContext2D,\n\tpts: number[],\n\tt: number,\n\tmove = false,\n\tclosed = false\n): void {\n\tlet cp: number[] = []\n\tconst n = pts.length\n\n\tfunction point(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, tension: number): number[] {\n\t\tconst square = (x: number) => x * x\n\t\tconst d = Math.sqrt(square(x1 - x0) + square(y1 - y0))\n\t\tconst a = (tension * d) / (d + Math.sqrt(square(x2 - x1) + square(y2 - y1)))\n\t\tconst b = tension - a\n\t\treturn [x1 + a * (x0 - x2), y1 + a * (y0 - y2), x1 - b * (x0 - x2), y1 - b * (y0 - y2)]\n\t}\n\n\tif (closed) {\n\t\tif (move) ctx.moveTo(pts[0], pts[1])\n\t\tpts.push(pts[0], pts[1], pts[2], pts[3])\n\t\tpts.unshift(pts[n - 1], pts[n - 1])\n\t\tfor (let i = 0; i < n; i += 2)\n\t\t\tcp = cp.concat(point(pts[i], pts[i + 1], pts[i + 2], pts[i + 3], pts[i + 4], pts[i + 5], t))\n\t\tcp = cp.concat(cp[0], cp[1])\n\t\tfor (let i = 2; i < n + 2; i += 2)\n\t\t\tctx.bezierCurveTo(cp[2 * i - 2], cp[2 * i - 1], cp[2 * i], cp[2 * i + 1], pts[i + 2], pts[i + 3])\n\t} else {\n\t\tfor (let i = 0; i < n - 4; i += 2)\n\t\t\tcp = cp.concat(point(pts[i], pts[i + 1], pts[i + 2], pts[i + 3], pts[i + 4], pts[i + 5], t))\n\t\tif (move) ctx.moveTo(pts[0], pts[1])\n\t\tctx.quadraticCurveTo(cp[0], cp[1], pts[2], pts[3])\n\t\tfor (let i = 2; i < n - 5; i += 2)\n\t\t\tctx.bezierCurveTo(cp[2 * i - 2], cp[2 * i - 1], cp[2 * i], cp[2 * i + 1], pts[i + 2], pts[i + 3])\n\t\tctx.quadraticCurveTo(cp[2 * n - 10], cp[2 * n - 9], pts[n - 2], pts[n - 1])\n\t}\n}\n","import type { Chart } from \"../chart.js\"\nimport { Format } from \"../core/elements/format.js\"\nimport { Point, Rectangle } from \"../core/primitives.js\"\nimport { Series } from \"../series.js\"\nimport type { SeriesInput, SeriesLabels } from \"../series.js\"\nimport { isAscending } from \"../series-utils.js\"\nimport { pointInLine } from \"../utils.js\"\n\nexport class Pointer {\n\tchart: Chart | null\n\tseries: CustomSeries\n\tformat: Format\n\tx: number | undefined\n\ty: number | undefined\n\ttransform: ((x: number, y: number, index: number) => void) | undefined\n\tinflateMargins = true\n\tvisible = false\n\tcolorEach = false\n\tstyle = \"rectangle\"\n\twidth = 12\n\theight = 12\n\n\tconstructor(chart: Chart | null, series: CustomSeries) {\n\t\tthis.series = series\n\t\tthis.chart = chart\n\t\tthis.inflateMargins = true\n\n\t\tconst f = (this.format = new Format(chart ?? undefined))\n\t\tf.shadow.visible = false\n\t\tf.fill = \"\"\n\t\tf.gradient.colors = [\"white\", \"white\", \"white\"]\n\t\tf.gradient.visible = true\n\t\tf.shadow.visible = true\n\n\t\tthis.visible = false\n\t\tthis.colorEach = false\n\t\tthis.style = \"rectangle\"\n\t\tthis.width = 12\n\t\tthis.height = 12\n\t}\n\n\tsetChart(chart: Chart): void {\n\t\tthis.chart = chart\n\t\tthis.format.setChart(chart)\n\t}\n\n\tdraw(p: Point, index: number, f: Format, fill: string): void {\n\t\t// The pointer is only drawn by a series that belongs to a chart.\n\t\tconst c = (this.chart as Chart).drawContext\n\t\tconst series = this.series\n\n\t\tf.z = series.format.z\n\n\t\tif (this.transform) {\n\t\t\tc.save()\n\t\t\tthis.transform(p.x, p.y, index)\n\t\t}\n\n\t\tconst w = this.width * 0.5\n\t\tconst h = this.height * 0.5\n\t\tlet rectangle: Rectangle\n\n\t\tif (this.style === \"cube\") {\n\t\t\trectangle = new Rectangle(p.x - w, p.y - h, this.width, this.height)\n\n\t\t\tconst wh = Math.max(w, h) / 50 // 50=totalDepth !\n\n\t\t\tf.z = (series.format.z + series.format.depth) * 0.5 - wh * 0.5\n\t\t\tf.depth = wh\n\n\t\t\tf.cube(rectangle)\n\t\t\tf.draw(c, null, rectangle)\n\t\t} else if (this.style === \"rectangle\") f.rectangle(p.x - w, p.y - h, this.width, this.height)\n\t\telse if (this.style === \"ellipse\") f.ellipse(p.x, p.y, this.width, this.height)\n\t\telse if (this.style === \"sphere\") {\n\t\t\tf.depth = series.format.depth\n\t\t\tf.sphere(p.x, p.y, this.width, this.height)\n\t\t} else if (this.style === \"cylinder\") {\n\t\t\trectangle = new Rectangle(p.x - w, p.y - h, this.width, this.height)\n\n\t\t\tconst g = f.gradient\n\t\t\tconst oldDir = g.direction\n\t\t\tconst oldColors = g.colors.slice(0)\n\n\t\t\tg.direction = \"leftright\"\n\t\t\tg.colors = [g.colors[1], g.colors[0], g.colors[1]]\n\n\t\t\tf.cylinder(rectangle, 1, true, false)\n\t\t\tf.draw(c, null, rectangle)\n\n\t\t\tg.direction = oldDir\n\t\t\tg.colors = oldColors\n\t\t} else if (this.style === \"cone\") {\n\t\t\trectangle = new Rectangle(p.x - w, p.y - h, this.width, this.height)\n\n\t\t\tf.cylinder(rectangle, 0, true, false)\n\t\t\tf.draw(c, null, rectangle)\n\t\t} else if (this.style === \"triangle\")\n\t\t\tf.polygon([new Point(p.x, p.y - h), new Point(p.x - w, p.y + h), new Point(p.x + w, p.y + h)])\n\t\telse if (this.style === \"downtriangle\")\n\t\t\tf.polygon([new Point(p.x, p.y + h), new Point(p.x - w, p.y - h), new Point(p.x + w, p.y - h)])\n\t\telse if (this.style === \"diamond\")\n\t\t\tf.polygon([new Point(p.x, p.y - h), new Point(p.x - w, p.y), new Point(p.x, p.y + h), new Point(p.x + w, p.y)])\n\t\telse {\n\t\t\tc.beginPath()\n\n\t\t\tif (this.style === \"cross\") {\n\t\t\t\tc.moveTo(p.x - w, p.y)\n\t\t\t\tc.lineTo(p.x + w, p.y)\n\t\t\t\tc.moveTo(p.x, p.y - h)\n\t\t\t\tc.lineTo(p.x, p.y + h)\n\t\t\t}\n\t\t\tif (this.style === \"x\") {\n\t\t\t\tc.moveTo(p.x - w, p.y - h)\n\t\t\t\tc.lineTo(p.x + w, p.y + h)\n\t\t\t\tc.moveTo(p.x - w, p.y + h)\n\t\t\t\tc.lineTo(p.x + w, p.y - h)\n\t\t\t}\n\n\t\t\tf.stroke.prepare(fill)\n\t\t\tc.stroke()\n\t\t}\n\n\t\tif (this.transform) c.restore()\n\t}\n\n\tsetSize(size: number): void {\n\t\tthis.width = size\n\t\tthis.height = size\n\t}\n}\n\n/**\n * @constructor\n * @augments Tee.Series\n * @class Base abstract class for line, area, scatter plots\n * @property {Tee.CustomSeries-Pointer} pointer Paints a visual representation at each point position.\n * @property {String} stacked Defines if multiple series are displayed one on top of each other.\n * @property {Number} smooth Draws lines between points as diagonals (value 0) or smooth curves (value > 0 < 1).\n * @property {Boolean} [stairs=false] Draws lines between points in stairs mode instead of diagonals.\n * @property {Boolean} [invertedStairs=false] Draws lines between points in inverted stairs mode instead of diagonals.\n */\nexport class CustomSeries extends Series {\n\tdeclare pointer: Pointer\n\tdeclare stairs: boolean\n\tdeclare invertedStairs: boolean\n\tdeclare continuous: boolean\n\tdeclare clickTolerance: number\n\tdeclare isStacked: boolean\n\tdeclare smooth: number\n\tdeclare drawLine: boolean\n\tonbeforedrawpointer: ((index: number, pointer: Pointer) => void) | undefined\n\n\tconstructor(o?: SeriesInput | null, o2?: SeriesLabels | null) {\n\t\tsuper(o, o2)\n\n\t\tthis.stacked = \"no\" // \"yes\", \"100\"\n\t\tthis.stairs = false\n\t\tthis.invertedStairs = false\n\n\t\tthis.continuous = true //allows tooltip interpolation between points\n\t\tthis.clickTolerance = 3 //distance for click sensitivity\n\n\t\tthis.hover.enabled = true\n\t\tthis.hover.line = false\n\n\t\tthis.isStacked = false\n\t\tthis.isStack100 = false\n\t\tthis.smooth = 0\n\t\tthis.pointer = new Pointer(this.chart, this)\n\t}\n\n\tmaxYValue(): number {\n\t\treturn this.stackMaxValue()\n\t}\n\n\tcalc(index: number, p: Point): void {\n\t\tthis.isStacked ? this.calcStack(index, p, this.data.values[index]) : super.calc(index, p)\n\t}\n\n\tcalcColorEach(): void {\n\t\tthis.isColorEach =\n\t\t\tthis.colorEach === \"yes\" || this.pointer.colorEach || this.colorEachLine === \"yes\" || this.colorEachLine === true\n\t}\n\n\tinitZ(index?: number, total?: number): void {\n\t\tlet series: Series | undefined\n\t\tconst f = this.format\n\n\t\tif (this.stacked !== \"no\") {\n\t\t\tf.z = 0\n\t\t\tf.depth = 1\n\n\t\t\tlet at = Number(index)\n\t\t\twhile (at > 1) {\n\t\t\t\tat--\n\t\t\t\tseries = this.chart.series.items[at]\n\n\t\t\t\tif (series?.visible && series.constructor === this.constructor) {\n\t\t\t\t\tf.z = series.format.z\n\t\t\t\t\tf.depth = series.format.depth\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else super.initZ(index, total)\n\n\t\tthis.marks.z = f.z + f.depth * 0.5\n\t}\n\n\t/**\n\t * Adds the polyline to the current path keeping, for every pixel column, the first, lowest, highest\n\t * and last point in drawing order. A one pixel wide stroke looks the same as with every point, but the\n\t * path has a few segments per column instead of one per point.\n\t */\n\t_traceDecimated(\n\t\tc: Pick<CanvasRenderingContext2D, \"moveTo\" | \"lineTo\">,\n\t\tp: Point,\n\t\tbegin: number,\n\t\tend: number,\n\t\tnoNulls: boolean\n\t): void {\n\t\tconst horizontal = this.yMandatory\n\t\tlet needMove = true\n\t\tlet column = Number.NaN\n\t\t// The points of the current column, in drawing order, and their position along the value axis.\n\t\tconst xs: number[] = []\n\t\tconst ys: number[] = []\n\t\tconst values: number[] = []\n\t\tlet minIndex = 0\n\t\tlet maxIndex = 0\n\n\t\tconst emit = (index: number): void => {\n\t\t\tif (needMove) {\n\t\t\t\tc.moveTo(xs[index], ys[index])\n\t\t\t\tneedMove = false\n\t\t\t} else c.lineTo(xs[index], ys[index])\n\t\t}\n\n\t\tconst flush = (): void => {\n\t\t\tif (xs.length === 0) return\n\n\t\t\t// The first and last point keep the line connected to the neighbouring columns.\n\t\t\tconst slots = [0, minIndex, maxIndex, xs.length - 1].sort((a, b) => a - b)\n\t\t\tlet previous = -1\n\t\t\tfor (const slot of slots) {\n\t\t\t\tif (slot === previous) continue\n\t\t\t\temit(slot)\n\t\t\t\tprevious = slot\n\t\t\t}\n\t\t\txs.length = ys.length = values.length = 0\n\t\t\tminIndex = maxIndex = 0\n\t\t}\n\n\t\tfor (let t = begin; t < end; t++) {\n\t\t\tif (this.isNull(t)) {\n\t\t\t\tflush()\n\t\t\t\tif (noNulls) needMove = true\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tthis.calc(t, p)\n\t\t\tconst pixel = Math.round(horizontal ? p.x : p.y)\n\t\t\tconst along = horizontal ? p.y : p.x\n\n\t\t\tif (pixel !== column) {\n\t\t\t\tflush()\n\t\t\t\tcolumn = pixel\n\t\t\t} else {\n\t\t\t\tif (along < values[minIndex]) minIndex = xs.length\n\t\t\t\tif (along > values[maxIndex]) maxIndex = xs.length\n\t\t\t}\n\n\t\t\txs.push(p.x)\n\t\t\tys.push(p.y)\n\t\t\tvalues.push(along)\n\t\t}\n\t\tflush()\n\t}\n\n\tdrawPointers(): void {\n\t\tconst len = this.data.values.length\n\t\tconst f = this.pointer.format\n\t\tconst isEach = this.colorEach === \"yes\" || this.pointer.colorEach\n\n\t\tif (!isEach) if (f.fill === \"\") f.fill = this.format.fill\n\n\t\tconst p = new Point()\n\t\tconst g = f.gradient\n\t\tlet fill = f.fill\n\t\tlet old = fill\n\n\t\tif (!isEach && g.visible) g.setEndColor(fill)\n\n\t\tfor (let index = 0; index < len; index++)\n\t\t\tif (!this.isNull(index)) {\n\t\t\t\tthis.calc(index, p)\n\n\t\t\t\tfill = this.getFill(index, f)\n\n\t\t\t\tif (fill !== old) {\n\t\t\t\t\tg.visible ? g.setEndColor(fill) : (f.fill = fill)\n\t\t\t\t\told = fill\n\t\t\t\t}\n\n\t\t\t\tthis.getSize(index)\n\n\t\t\t\tif (this.onbeforedrawpointer) this.onbeforedrawpointer(index, this.pointer)\n\n\t\t\t\tthis.pointer.draw(p, index, f, fill)\n\n\t\t\t\tif (this.hover.enabled && this.over === index) this.pointer.draw(p, index, this.hover, fill)\n\t\t\t}\n\n\t\tif (isEach) f.fill = old\n\t}\n\n\t/**\n\t * @public\n\t */\n\tsetChart(series: Series, chart: Chart): void {\n\t\tsuper.setChart(series, chart)\n\t\t;(series as CustomSeries).pointer.setChart(chart)\n\t}\n\n\t/**\n\t * For series whose points sit at their index along the category axis, returns the first and last point\n\t * that can be within `margin` pixels of `p`, found by binary search. Returns null when every point has\n\t * to be checked (explicit x values, or too few points for a search to pay off).\n\t */\n\tprivate _pointWindow(p: Point, margin: number): [number, number] | null {\n\t\tconst len = this.data.values.length\n\t\tif (len < 64) return null\n\t\t// Explicit x values are only usable for the search when they ascend like the indices do.\n\t\tif (this.data.x && (this.data.x.length !== len || !isAscending(this.data.x))) return null\n\n\t\tconst probe = new Point()\n\t\tconst across = (index: number): number => {\n\t\t\tthis.calc(index, probe)\n\t\t\treturn this.yMandatory ? probe.x : probe.y\n\t\t}\n\n\t\t// Positions grow with the index, or shrink when the category axis is inverted.\n\t\tconst sign = across(len - 1) >= across(0) ? 1 : -1\n\t\tconst target = sign * (this.yMandatory ? p.x : p.y)\n\n\t\t// First index whose signed position is at least `limit`; `strict` makes it \"greater than\".\n\t\tconst search = (limit: number, strict: boolean): number => {\n\t\t\tlet low = 0\n\t\t\tlet high = len\n\t\t\twhile (low < high) {\n\t\t\t\tconst middle = (low + high) >>> 1\n\t\t\t\tconst value = sign * across(middle)\n\t\t\t\tif (strict ? value > limit : value >= limit) high = middle\n\t\t\t\telse low = middle + 1\n\t\t\t}\n\t\t\treturn low\n\t\t}\n\n\t\tconst first = search(target - margin, false)\n\t\tconst after = search(target + margin, true)\n\t\t// One extra point on each side keeps the segments that cross the window.\n\t\treturn [Math.max(0, first - 1), Math.min(len - 1, after)]\n\t}\n\n\t/**\n\t * @returns {Number} Returns the index of the series point that contains p {@link Point} parameter.\n\t */\n\tclicked(p: Point): number {\n\t\tconst p1 = new Point()\n\t\tconst p2 = new Point()\n\t\tconst len = this.data.values.length\n\t\tlet pointIndex: number\n\n\t\tif (this.drawLine && len > 0 && (this.hover.line || !this.pointer.visible)) {\n\t\t\tconst lineWindow = this._pointWindow(p, this.clickTolerance + 1)\n\t\t\tconst firstPoint = lineWindow ? lineWindow[0] : 0\n\t\t\tconst lastPoint = lineWindow ? lineWindow[1] : len - 1\n\t\t\tthis.calc(firstPoint, p1)\n\n\t\t\tfor (pointIndex = firstPoint + 1; pointIndex <= lastPoint; pointIndex++) {\n\t\t\t\tthis.calc(pointIndex, p2)\n\n\t\t\t\tif (this.stairs) {\n\t\t\t\t\tlet p1a: Point\n\n\t\t\t\t\tif (this.invertedStairs) p1a = new Point(p2.x, p1.y)\n\t\t\t\t\telse p1a = new Point(p1.x, p2.y)\n\n\t\t\t\t\tif (pointInLine(p, p1, p1a, this.clickTolerance) || pointInLine(p, p1a, p2, this.clickTolerance))\n\t\t\t\t\t\treturn pointIndex\n\t\t\t\t} else if (pointInLine(p, p1, p2, this.clickTolerance)) return pointIndex\n\n\t\t\t\tp1.x = p2.x\n\t\t\t\tp1.y = p2.y\n\t\t\t}\n\t\t}\n\n\t\tif (this.pointer.visible) {\n\t\t\tconst r = new Rectangle()\n\t\t\tconst po = this.pointer\n\t\t\t// Pointers that change size per point (Bubble) cannot be bounded by a fixed margin.\n\t\t\tconst fixedSize = this.getSize === CustomSeries.prototype.getSize\n\t\t\tconst pointerWindow = fixedSize ? this._pointWindow(p, Math.max(po.width, po.height) * 0.5 + 1) : null\n\t\t\tconst lowest = pointerWindow ? pointerWindow[0] : 0\n\t\t\tconst highest = pointerWindow ? pointerWindow[1] : len - 1\n\n\t\t\tfor (pointIndex = highest; pointIndex >= lowest; pointIndex--)\n\t\t\t\tif (!this.isNull(pointIndex)) {\n\t\t\t\t\tthis.calc(pointIndex, r)\n\t\t\t\t\tthis.getSize(pointIndex)\n\t\t\t\t\tr.x -= po.width * 0.5\n\t\t\t\t\tr.width = po.width\n\t\t\t\t\tr.y -= po.height * 0.5\n\t\t\t\t\tr.height = po.height\n\n\t\t\t\t\tif (r.contains(p)) return pointIndex\n\t\t\t\t}\n\t\t}\n\n\t\treturn -1\n\t}\n\n\thorizMargins(p?: Point): void {\n\t\tif (!p) return\n\t\tconst po = this.pointer\n\t\tconst s = po.format.stroke\n\t\tif (po.visible && po.inflateMargins) p.x = p.y = (s.fill !== \"\" ? s.size : 0) + 1 + po.width * 0.5\n\t}\n\n\tvertMargins(p?: Point): void {\n\t\tif (!p) return\n\t\tconst po = this.pointer\n\t\tconst s = po.format.stroke\n\t\tif (po.visible && po.inflateMargins) p.x = p.y = (s.fill !== \"\" ? s.size : 0) + 1 + po.height * 0.5\n\t}\n\n\tgetSize(_index: number): void {}\n}\n","import { visiblePointRange } from \"../series-utils.js\"\nimport { Point, Rectangle } from \"../core/primitives.js\"\nimport type { SeriesInput, SeriesLabels } from \"../series.js\"\nimport { drawSpline } from \"../spline.js\"\nimport { trunc } from \"../utils.js\"\nimport { CustomSeries } from \"./custom-series.js\"\n\n/**\n * @constructor\n * @augments Tee.CustomSeries\n * @class Draws series data as filled mountain segments between points\n * @property {Boolean} [useOrigin=false] Determines if {Tee.Area#origin} value is used as area minimum.\n * @property {Number} [origin=0] Defines the value to use as area minimum.\n */\nexport class Area extends CustomSeries {\n\tdeclare useOrigin: boolean\n\tdeclare origin: number\n\tdeclare closeArea: boolean\n\tconstructor(o?: SeriesInput | null, o2?: SeriesLabels | null) {\n\t\tsuper(o, o2)\n\n\t\tthis.useOrigin = false\n\t\tthis.origin = 0\n\t\tthis.drawLine = true\n\t\tthis.closeArea = true\n\n\t\tconst f = this.format\n\t\tf.shadow.visible = true\n\t\tf.stroke.fill = \"black\"\n\t\tf.fill = \"\"\n\t\tf.beveled = true\n\t\tf.depth = 1\n\t\tf.z = 0.5\n\t}\n\n\tdraw() {\n\t\tconst len = this.data.values.length\n\t\tconst f = this.format\n\n\t\tif (len > 0) {\n\t\t\tconst a = this.mandatoryAxis\n\t\t\tconst nm = this.notmandatory\n\t\t\tlet originPos: number\n\t\t\tconst isY = this.yMandatory\n\n\t\t\tif (this.useOrigin) originPos = a.calc(this.origin)\n\t\t\telse if ((isY && a.inverted) || (!isY && !a.inverted)) originPos = a.startPos\n\t\t\telse originPos = a.endPos\n\n\t\t\tthis.isStacked = this.stacked !== \"no\"\n\t\t\tthis.isStack100 = this.stacked === \"100\"\n\n\t\t\tlet start: number\n\t\t\tconst p = new Point()\n\t\t\tlet old = Number.NaN\n\t\t\tlet smop: number[]\n\t\t\tconst c = this.chart.drawContext\n\t\t\tconst r = new Rectangle()\n\t\t\tconst doStack = this.isStacked\n\t\t\tlet begin = 0\n\t\t\tlet end = len\n\t\t\tlet closePoint = new Point(Number.NaN, Number.NaN)\n\t\t\tlet tmpStrokeFill = \"\"\n\n\t\t\tif (!this.smooth) {\n\t\t\t\tif (!this.data.x) {\n\t\t\t\t\tbegin = Math.max(0, trunc(nm.minimum) - 1)\n\t\t\t\t\tend = Math.min(len, trunc(nm.maximum) + 2)\n\t\t\t\t} else {\n\t\t\t\t\t// Ascending x values (time series): only the points that can be visible.\n\t\t\t\t\tconst visible = visiblePointRange(this.data.x, len, nm.minimum, nm.maximum)\n\t\t\t\t\tif (visible) [begin, end] = visible\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.depth = f.depth\n\t\t\tc.z = f.z\n\n\t\t\tc.beginPath()\n\n\t\t\tif (this.smooth > 0) {\n\t\t\t\tsmop = new Array(2 * len)\n\n\t\t\t\tfor (let t = 0; t < len; t++) {\n\t\t\t\t\tthis.calc(t, p)\n\n\t\t\t\t\tsmop[2 * t] = p.x\n\t\t\t\t\tsmop[2 * t + 1] = p.y\n\t\t\t\t}\n\n\t\t\t\tstart = isY ? smop[0] : smop[1]\n\n\t\t\t\tif (c.spline) c.spline(smop, true)\n\t\t\t\telse drawSpline(c, smop, this.smooth, true)\n\n\t\t\t\tif (doStack) {\n\t\t\t\t\tlet tmp = 0\n\n\t\t\t\t\tfor (let t = len - 1; t >= 0; t--) {\n\t\t\t\t\t\tthis.calcStack(t, p, 0)\n\t\t\t\t\t\tsmop[tmp++] = p.x\n\t\t\t\t\t\tsmop[tmp++] = p.y\n\t\t\t\t\t}\n\n\t\t\t\t\tc.lineTo(smop[0], smop[1])\n\n\t\t\t\t\tif (c.spline) c.spline(smop, true)\n\t\t\t\t\telse drawSpline(c, smop, this.smooth, false)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.calc(begin, p)\n\t\t\t\tstart = isY ? p.x : p.y\n\n\t\t\t\t// With more than two points per pixel column the outline only needs each column's envelope.\n\t\t\t\tconst axisSize = nm.axisSize\n\t\t\t\tif (!this.stairs && !doStack && axisSize > 0 && end - begin > 2 * axisSize) {\n\t\t\t\t\tthis._traceDecimated(c, p, begin, end, false)\n\t\t\t\t} else {\n\t\t\t\t\tc.moveTo(p.x, p.y)\n\t\t\t\t\told = isY ? p.y : p.x\n\n\t\t\t\t\tif (this.stairs)\n\t\t\t\t\t\tfor (let t = begin + 1; t < end; t++) {\n\t\t\t\t\t\t\tthis.calc(t, p)\n\t\t\t\t\t\t\tc.lineTo(p.x, old)\n\t\t\t\t\t\t\tc.lineTo(p.x, p.y)\n\t\t\t\t\t\t\told = isY ? p.y : p.x\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tfor (let t = begin + 1; t < end; t++) {\n\t\t\t\t\t\t\tthis.calc(t, p)\n\t\t\t\t\t\t\tc.lineTo(p.x, p.y)\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (doStack) {\n\t\t\t\tif (this.smooth === 0)\n\t\t\t\t\tfor (let t = end - 1; t >= begin; t--) {\n\t\t\t\t\t\tthis.calcStack(t, p, 0)\n\t\t\t\t\t\tif (this.stairs) {\n\t\t\t\t\t\t\tc.lineTo(p.x, old)\n\t\t\t\t\t\t\tc.lineTo(p.x, p.y)\n\t\t\t\t\t\t\told = isY ? p.y : p.x\n\t\t\t\t\t\t} else c.lineTo(p.x, p.y)\n\t\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (isY) {\n\t\t\t\t\tif (this.closeArea) {\n\t\t\t\t\t\tc.lineTo(p.x, originPos)\n\t\t\t\t\t\tc.lineTo(start, originPos)\n\t\t\t\t\t} else closePoint = p\n\t\t\t\t} else {\n\t\t\t\t\tc.lineTo(originPos, p.y)\n\t\t\t\t\tc.lineTo(originPos, start)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!this.closeArea) {\n\t\t\t\tconst st = f.stroke\n\t\t\t\tconst s = st.fill\n\t\t\t\tst.prepare(s)\n\t\t\t\tc.stroke()\n\t\t\t\tc.lineTo(closePoint.x, originPos)\n\t\t\t\tc.lineTo(start, originPos)\n\t\t\t\ttmpStrokeFill = f.stroke.fill\n\t\t\t\tf.stroke.fill = \"#00FF0000\"\n\t\t\t}\n\n\t\t\tc.closePath()\n\n\t\t\tconst g = f.gradient\n\t\t\tif (g.visible) g.colors[g.colors.length - 1] = f.fill\n\n\t\t\tthis.bounds(r)\n\n\t\t\tif (c.__webgl) c.beveled = f.beveled\n\n\t\t\tf.draw(c, null, r)\n\n\t\t\tif (!this.closeArea) f.stroke.fill = tmpStrokeFill\n\n\t\t\tif (this.pointer.visible) this.drawPointers()\n\t\t}\n\t}\n\n\tminYValue() {\n\t\tconst v = this.yMandatory ? this._baseMinYValue() : this._baseMinXValue()\n\t\treturn this.yMandatory ? (this.useOrigin ? Math.min(v, this.origin) : v) : v\n\t}\n\n\tminXValue() {\n\t\tconst v = this.yMandatory ? this._baseMinXValue() : this._baseMinYValue()\n\t\treturn this.yMandatory ? v : this.useOrigin ? Math.min(v, this.origin) : v\n\t}\n\n\tmaxYValue() {\n\t\tconst v = this.yMandatory ? this.stackMaxValue() : this._baseMaxXValue()\n\t\treturn this.yMandatory ? (this.useOrigin ? Math.max(v, this.origin) : v) : v\n\t}\n\n\tmaxXValue() {\n\t\tconst v = this.yMandatory ? this._baseMaxXValue() : this.stackMaxValue()\n\t\treturn this.yMandatory ? v : this.useOrigin ? Math.max(v, this.origin) : v\n\t}\n\n\tvertMargins(p: Point) {\n\t\tconst f = this.format\n\t\tif (this.yMandatory && f.stroke.fill !== \"\") p.y += f.stroke.size + 2\n\t}\n\n\thorizMargins(p: Point) {\n\t\tconst f = this.format\n\t\tif (!this.yMandatory && f.stroke.fill !== \"\") p.y += f.stroke.size + 2\n\t}\n}\n","/* biome-ignore-all lint: legacy CustomBar implementation extracted verbatim from series.js */\nimport { Point, Rectangle } from \"../core/primitives.js\"\nimport { Series } from \"../series.js\"\nimport type { SeriesInput, SeriesLabels } from \"../series.js\"\n\n/**\n * @constructor\n * @augments Tee.Series\n * @class Base abstract class to draw data as vertical or horizontal bars\n * @property {Number} [sideMargins=100] Defines the percent of bar size to use as spacing between axes.\n * @property {Boolean} [useOrigin=true] Determines if {Tee.CustomBar#origin} value is used as bar minimum.\n * @property {Number} [origin=0] Defines the value to use as bar minimum.\n * @property {Number} [barSize=70] Defines the percent size of bars on available space.\n * @property {Number} [customBarSize=0] Defines the custom bar size in pixels.\n * @property {Number} [offset=0] Defines the percent bar size to offset each bar.\n * @property {String} [barStyle=\"bar\"] Which shape to draw (\"bar\", \"ellipse\", \"line\").\n * @property {Boolean} [stacked=\"no\"] Use \"no\", \"yes\", \"100\", \"sideAll\", \"self\", \"side\" to define stack behaviour with other BarSeries.\n */\nexport class CustomBar extends Series {\n\tdeclare isStacked: boolean\n\tdeclare countall: number\n\tdeclare image: unknown\n\tdeclare onbeforedrawPoint: ((index: number) => void) | undefined\n\tdeclare barRectangle: Rectangle\n\tcalcBarBounds?(p: Point, bar: Rectangle, offset: Point, originPos: number): void\n\tsideMargins = 100\n\tuseOrigin = true\n\torigin = 0\n\tcontinuous = false\n\toffset = 0 // %\n\tbarSize = 70 // %\n\tcustomBarSize = 0\n\tbarStyle = \"bar\" // \"ellipse\"\n\tstacked = \"no\" // \"yes\", \"100\", \"sideAll\", \"self\", \"side\"\n\tpercent = 1\n\toffsetPoint = new Point()\n\toriginPos: number | number[] | undefined = undefined\n\tbar = new Rectangle()\n\tvisibleBar = { total: 0, index: 0 }\n\t_margin = 0\n\thasPaintedOver = false\n\n\tconstructor(o?: SeriesInput | null, o2?: SeriesLabels | null) {\n\t\tsuper(o, o2)\n\n\t\tthis.marks.visible = true\n\t\tthis.marks.location = \"end\"\n\n\t\tthis.hover.enabled = true\n\n\t\tvar f = this.format\n\t\tf.fill = \"\"\n\t\tf.stroke.fill = \"black\"\n\t\tf.shadow.visible = true\n\t\tf.round.x = 4\n\t\tf.round.y = 4\n\t\tf.gradient.visible = true\n\n\t\tf.depth = 1\n\t}\n\n\tdrawBar(r: Rectangle, barStyle?: string): boolean {\n\t\tconst f = this.format\n\t\tvar old = f.depth,\n\t\t\toldz = f.z,\n\t\t\tctx = this.chart.drawContext\n\n\t\tif (!barStyle) barStyle = this.barStyle\n\n\t\tf.depth = (0.5 * Math.min(this.yMandatory ? r.width : r.height, 200)) / 100 // 200=Three.totalDepth !!\n\n\t\tif (r.width > 0 && r.height > 0) {\n\t\t\tif (this.stacked !== \"side\") f.z = f.z + 0.5 * (1 - f.depth)\n\n\t\t\tif (barStyle === \"bar\") {\n\t\t\t\tf.cube(r)\n\t\t\t} else if (barStyle === \"line\") {\n\t\t\t\tvar pos\n\n\t\t\t\tctx.beginPath()\n\t\t\t\tctx.z = f.z + f.depth * 0.5\n\n\t\t\t\tif (this.yMandatory) {\n\t\t\t\t\tpos = r.x + 0.5 * r.width\n\n\t\t\t\t\tctx.moveTo(pos, r.y)\n\t\t\t\t\tctx.lineTo(pos, r.y + r.height)\n\n\t\t\t\t\t//f.rectPath(pos,r.y,1,r.height);\n\t\t\t\t} else {\n\t\t\t\t\tpos = r.y + 0.5 * r.height\n\n\t\t\t\t\tctx.moveTo(r.x, pos)\n\t\t\t\t\tctx.lineTo(r.x + r.width, pos)\n\n\t\t\t\t\t//f.rectPath(r.x,pos,r.width,1);\n\t\t\t\t}\n\t\t\t} else if (barStyle === \"cylinder\") f.cylinder(r, 1, this.yMandatory, false)\n\t\t\telse if (barStyle === \"cone\") f.cylinder(r, 0, this.yMandatory, false)\n\t\t\telse if (barStyle === \"ellipsoid\" && this.chart.__webgl) {\n\t\t\t\tctx.depth = f.depth\n\t\t\t\tctx.z = f.z\n\t\t\t\tctx.image = this.image\n\t\t\t\tctx.ellipsoid?.(r, this.yMandatory)\n\t\t\t} else {\n\t\t\t\tf.z += 0.5 * f.depth\n\t\t\t\tf.ellipsePath(this.chart.drawContext, r.x + r.width * 0.5, r.y + r.height * 0.5, r.width, r.height)\n\t\t\t}\n\n\t\t\tf.depth = old\n\t\t\tf.z = oldz\n\n\t\t\treturn true\n\t\t} else return false\n\t}\n\n\t/**\n\t * @returns {Number} Returns the number of visible Tee.CustomBar series that are displayed before this series.\n\t */\n\tcountAll(upToThis = false): number {\n\t\tvar i = this.chart.series.items,\n\t\t\tres = 0,\n\t\t\tlen = i.length,\n\t\t\tt,\n\t\t\ts\n\n\t\tfor (t = 0; t < len; t++) {\n\t\t\ts = i[t]\n\n\t\t\tif (s == this && upToThis) break\n\t\t\telse if (s.visible && s.constructor == this.constructor) res += s.data.values.length\n\t\t}\n\n\t\treturn res\n\t}\n\n\tcalcBarOffset(axisSize: number): void {\n\t\tvar barSize = axisSize,\n\t\t\tall = this.stacked == \"sideAll\"\n\n\t\tthis.countall = all ? this.countAll(true) : 0\n\n\t\tvar tmpLen,\n\t\t\tlen = all ? this.countAll() : this.data.values.length,\n\t\t\toffset = this.offsetPoint,\n\t\t\tvisibleBar = this.visibleBar\n\n\t\tif (len > 1) barSize /= len\n\n\t\tif (this.stacked == \"no\") {\n\t\t\tbarSize /= visibleBar.total\n\t\t\toffset.x =\n\t\t\t\t(this.customBarSize > 0 ? this.customBarSize : barSize * this.barSize * 0.01) *\n\t\t\t\t(visibleBar.total == 1 ? -0.5 : visibleBar.index - visibleBar.total * 0.5)\n\t\t\ttmpLen = visibleBar.total\n\t\t} else {\n\t\t\toffset.x = -barSize * 0.5\n\t\t\ttmpLen = 1\n\t\t}\n\n\t\toffset.y = this.customBarSize > 0 ? this.customBarSize : barSize * this.barSize * 0.01\n\n\t\tthis._margin = 0.5 * tmpLen * offset.y + this.sideMargins * (tmpLen * (barSize - offset.y)) * 0.005\n\n\t\tif (this.stacked != \"no\") offset.x += this.offset * barSize * 0.01 + (barSize - offset.y) * 0.5\n\t}\n\n\tcalcStackPos(t: number, p: Point): void {\n\t\tvar v, tmp, a\n\n\t\tif (this.isStacked) {\n\t\t\tthis.calcStack(t, p, this.data.values[t])\n\t\t\tv = this.pointOrigin(t, false)\n\t\t\ta = this.mandatoryAxis\n\n\t\t\tif (this.isStack100) {\n\t\t\t\ttmp = this.pointOrigin(t, true)\n\t\t\t\tthis.originPos = tmp === 0 ? a.endPos : a.calc((v * 100.0) / tmp)\n\t\t\t} else this.originPos = a.calc(v)\n\t\t} else {\n\t\t\tthis.calc(t, p)\n\n\t\t\tif (this.stacked == \"sideAll\") {\n\t\t\t\ttmp = this.notmandatory.calc(this.countall + t)\n\t\t\t\tif (this.yMandatory) p.x = tmp\n\t\t\t\telse p.y = tmp\n\t\t\t}\n\t\t}\n\t}\n\n\tdrawSortedValues(sorted: boolean | number[]): void {\n\t\tconst sortedState = typeof sorted === \"boolean\" ? sorted : sorted.length > 0\n\t\tvar animation = this.sortedOptions.sortedDrawAnimation\n\t\tif (this.sortedOptions.sorted != sortedState && !this.sortedOptions.sorting && animation && !animation.running) {\n\t\t\tthis.sortedOptions.sorted = sortedState\n\t\t\tif (this.sortedOptions.sorted) this.sortValues()\n\n\t\t\tvar prevValues = this.sortedOptions.sorted\n\t\t\t\t? this.sortedOptions.originalValues.slice()\n\t\t\t\t: this.sortedOptions.sortedValues.slice()\n\t\t\tvar values = this.data.values\n\t\t\tvar endValues = this.sortedOptions.sorted\n\t\t\t\t? this.sortedOptions.sortedValues.slice()\n\t\t\t\t: this.sortedOptions.originalValues.slice()\n\n\t\t\tvar sortedOptions = this.sortedOptions\n\t\t\tanimation.chart = this.chart\n\t\t\tif (sortedOptions.sortingAnimationType == \"horizontalchange\") {\n\t\t\t\tanimation.doStep = f => {\n\t\t\t\t\t//do with draw\n\t\t\t\t\tif (f < 1) {\n\t\t\t\t\t\tthis.percent = f\n\t\t\t\t\t\tthis.draw()\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tanimation.onstop = () => {\n\t\t\t\t\tthis.percent = 1\n\t\t\t\t\tif (sortedOptions.sorted)\n\t\t\t\t\t\tfor (var i = 0; i < prevValues.length; i++) {\n\t\t\t\t\t\t\tvalues[i] = endValues[i]\n\t\t\t\t\t\t}\n\t\t\t\t\t//animation.running = false;\n\t\t\t\t}\n\t\t\t\tanimation.onstart = () => {\n\t\t\t\t\tif (!sortedOptions.sorted)\n\t\t\t\t\t\tfor (var i = 0; i < prevValues.length; i++) {\n\t\t\t\t\t\t\tvalues[i] = endValues[i]\n\t\t\t\t\t\t}\n\t\t\t\t\t//animation.running = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tanimation.doStep = f => {\n\t\t\t\t\t//do with draw\n\t\t\t\t\tif (f < 1) {\n\t\t\t\t\t\tfor (var i = 0; i < prevValues.length; i++) {\n\t\t\t\t\t\t\tvalues[i] = prevValues[i] + (endValues[i] - prevValues[i]) * f\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tanimation.onstop = () => {\n\t\t\t\t\tthis.percent = 1\n\t\t\t\t\tfor (var i = 0; i < prevValues.length; i++) {\n\t\t\t\t\t\tvalues[i] = endValues[i]\n\t\t\t\t\t}\n\t\t\t\t\tanimation.running = false\n\t\t\t\t}\n\t\t\t\tanimation.onstart = () => {\n\t\t\t\t\tanimation.running = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tanimation.animate()\n\n\t\t\tthis.data.labels = this.sortedOptions.sorted\n\t\t\t\t? this.sortedOptions.sortedLabels.slice()\n\t\t\t\t: this.sortedOptions.originalLabels.slice()\n\n\t\t\tthis.chart.draw()\n\t\t}\n\t}\n\n\tdraw(): void {\n\t\tvar len = this.data.values.length\n\t\tconst f = this.format\n\n\t\tif (len > 0) {\n\t\t\tthis.initOffsets()\n\n\t\t\tvar p = new Point(),\n\t\t\t\tc = this.chart.drawContext\n\n\t\t\tif (!this.hover.enabled) {\n\t\t\t\tf.stroke.prepare()\n\t\t\t\tf.shadow.prepare(c)\n\t\t\t}\n\n\t\t\tvar hover = this.hover.enabled,\n\t\t\t\tisLine = this.barStyle === \"line\",\n\t\t\t\t_styles = this.data.styles\n\n\t\t\tif (hover && this.format.image.url != null) {\n\t\t\t\tthis.hover.image.url = this.format.image.url\n\t\t\t\tthis.hover.image.repeat = this.format.image.repeat\n\t\t\t\tthis.hover.image.backFill = this.format.image.backFill\n\t\t\t}\n\n\t\t\tf.z = 0 //B407 init\n\t\t\tfor (var t = 0; t < len; t++)\n\t\t\t\tif (!this.isNull(t)) {\n\t\t\t\t\tthis.calcStackPos(t, p)\n\n\t\t\t\t\tvar sortedP = new Point()\n\n\t\t\t\t\tif (this.percent < 1) {\n\t\t\t\t\t\tthis.calcStackPos(\n\t\t\t\t\t\t\tthis.sortedOptions.sortedValuesIndices.findIndex(x => x == t),\n\t\t\t\t\t\t\tsortedP\n\t\t\t\t\t\t)\n\t\t\t\t\t\tif (this.sortedOptions.sorted) p.x = (-p.x + sortedP.x) * this.percent + p.x\n\t\t\t\t\t\telse p.x = (p.x - sortedP.x) * this.percent + sortedP.x\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.onbeforedrawPoint) this.onbeforedrawPoint(t)\n\n\t\t\t\t\tthis.calcBarBounds?.(\n\t\t\t\t\t\tp,\n\t\t\t\t\t\tthis.bar,\n\t\t\t\t\t\tthis.offsetPoint,\n\t\t\t\t\t\tNumber(this.originPos instanceof Array ? this.originPos[t] : this.originPos)\n\t\t\t\t\t)\n\n\t\t\t\t\tthis.barRectangle = this.bar\n\t\t\t\t\tvar pointPainted = this.drawBar(this.bar, _styles ? _styles[t] : undefined)\n\n\t\t\t\t\tvar isover = hover && this.over == t,\n\t\t\t\t\t\tff = isover ? this.hover : f\n\n\t\t\t\t\tc.fillStyle = this.getFillStyle(this.bar, this.getFill(t, ff.fill === \"\" ? f : ff))\n\n\t\t\t\t\t// The gradient is stored in the fill as the canvas accepts it.\n\t\t\t\t\tif (!this.format.gradient.visible) ff.fill = c.fillStyle as string\n\n\t\t\t\t\tif (hover) ff.shadow.prepare(c)\n\n\t\t\t\t\tif (isover) {\n\t\t\t\t\t\tif (this.format.image.url != null && !this.hasPaintedOver) {\n\t\t\t\t\t\t\t//prevent fill flicker for first hover\n\t\t\t\t\t\t\tthis.hasPaintedOver = true\n\t\t\t\t\t\t\tf.draw(c, null, this.bar)\n\t\t\t\t\t\t} else c.fill()\n\t\t\t\t\t}\n\n\t\t\t\t\tif (pointPainted) {\n\t\t\t\t\t\tff.draw(c, null, this.bar)\n\n\t\t\t\t\t\tif (isLine || ff.stroke.fill !== \"\") {\n\t\t\t\t\t\t\tif (hover) ff.stroke.prepare()\n\n\t\t\t\t\t\t\tif (!isover && isLine) c.strokeStyle = c.fillStyle\n\n\t\t\t\t\t\t\tc.shadowColor = \"transparent\"\n\n\t\t\t\t\t\t\tc.stroke()\n\n\t\t\t\t\t\t\tif (ff.shadow.visible) c.shadowColor = ff.shadow.color\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t}\n\n\tcalcColorEach(): void {\n\t\tthis.chart.series.visibleCount(this, CustomBar, this.visibleBar)\n\t\tthis.isColorEach = this.colorEach == \"yes\" || (this.colorEach == \"auto\" && this.visibleBar.total == 1)\n\t}\n\n\tinitOffsets(): void {\n\t\tvar nomand = this.notmandatory,\n\t\t\tmand = this.mandatoryAxis,\n\t\t\trange = this.yMandatory ? this.maxXValue() - this.minXValue() : this.maxYValue() - this.minYValue()\n\n\t\tif (this.stacked == \"sideAll\") this.calcBarOffset(nomand.axisSize)\n\t\telse this.calcBarOffset(range === 0 ? nomand.axisSize : nomand.calcSize(range))\n\n\t\tif (this.useOrigin) {\n\t\t\tif (Array.isArray(this.origin)) {\n\t\t\t\tthis.originPos = []\n\t\t\t\tfor (var t = 0; t < this.origin.length; t++) {\n\t\t\t\t\tthis.originPos[t] = mand.calc(this.origin[t])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.originPos = mand.calc(this.origin)\n\t\t\t}\n\t\t} else if (this.yMandatory) this.originPos = mand.inverted ? mand.startPos : mand.endPos\n\t\telse this.originPos = mand.inverted ? mand.endPos : mand.startPos\n\n\t\tvar st = this.stacked\n\n\t\tthis.isStacked = st !== \"no\" && st !== \"sideAll\" && st !== \"side\"\n\t\tthis.isStack100 = st === \"100\"\n\t}\n\n\t/**\n\t * @returns {Number} Returns the index of series bar that contains {@link Point} p parameter.\n\t */\n\tclicked(p: Point): number {\n\t\tthis.initOffsets()\n\n\t\tvar p2 = new Point(),\n\t\t\tlen = this.data.values.length,\n\t\t\tt\n\n\t\tfor (t = 0; t < len; t++)\n\t\t\tif (!this.isNull(t)) {\n\t\t\t\tthis.calcStackPos(t, p2)\n\t\t\t\tthis.calcBarBounds?.(\n\t\t\t\t\tp2,\n\t\t\t\t\tthis.bar,\n\t\t\t\t\tthis.offsetPoint,\n\t\t\t\t\tNumber(this.originPos instanceof Array ? this.originPos[t] : this.originPos)\n\t\t\t\t)\n\n\t\t\t\tif (this.bar.contains(p)) return t\n\t\t\t}\n\n\t\treturn -1\n\t}\n\n\tmarkPos(t: number, p: Point): boolean {\n\t\tvar yMand = this.yMandatory,\n\t\t\top = this.offsetPoint.x + this.offsetPoint.y * 0.5,\n\t\t\tm = this.marks\n\n\t\tthis.calcStackPos(t, p)\n\n\t\tif (this.stacked == \"sideAll\") {\n\t\t\tvar tmp = this.notmandatory.calc(this.countall + t)\n\t\t\tyMand ? (p.x = tmp) : (p.y = tmp)\n\t\t}\n\n\t\tvar inv = this.useOrigin && this.data.values[t] < (Array.isArray(this.origin) ? this.origin[t] : this.origin)\n\t\tif (this.mandatoryAxis.inverted) inv = !inv\n\n\t\t// Marks location\n\n\t\tif (m.location == \"center\") {\n\t\t\tthis.calcBarBounds?.(\n\t\t\t\tp,\n\t\t\t\tthis.bar,\n\t\t\t\tthis.offsetPoint,\n\t\t\t\tNumber(this.originPos instanceof Array ? this.originPos[t] : this.originPos)\n\t\t\t)\n\n\t\t\tif (m.canDraw(p.x, p.y, t, inv)) {\n\t\t\t\tif (yMand) p.y = this.bar.y + this.bar.height * 0.5 + m.bounds.height * 0.5\n\t\t\t\telse p.x = this.bar.x + this.bar.width * 0.5 - m.bounds.width * 0.5\n\t\t\t}\n\t\t}\n\n\t\tvar a = this.chart.aspect,\n\t\t\tis3d = a.view3d,\n\t\t\twx = 0,\n\t\t\twy = 0\n\n\t\tif (is3d && a.orthogonal) {\n\t\t\twx = a._orthox * 0.5\n\t\t\twy = a._orthoy * 0.5\n\t\t}\n\n\t\tif (yMand) {\n\t\t\tp.x += is3d ? op + wx : op\n\t\t\tif (is3d) p.y -= wy\n\t\t} else {\n\t\t\tp.y += is3d ? op - wy : op\n\t\t\tif (is3d) p.x += wx\n\t\t}\n\n\t\treturn inv\n\t}\n\n\t/*\ndrawMarks() {\n\tvar len=this.data.values.length, m=this.marks, p=new Point(), inv;\n\n\tif (len>0)\n\t\tfor(var t=0; t<len; t+=m.drawEvery)\n\t\t\tif (!this.isNull(t)) {\n\t\t\t\tinv=this.markPos(t,p);\n\t\t\t\tm.drawMark(p.x, p.y, t, inv);\n\t\t\t}\n}\n*/\n\n\tlabelOrTitle(index: number): string {\n\t\tvar s = this.title,\n\t\t\tl = this.data.labels[index]\n\t\treturn this.visibleBar.total > 1 ? s || l : super.labelOrTitle(index)\n\t}\n\n\tinitZ(index: number, total: number): void {\n\t\tlet series: Series | undefined\n\t\tconst f = this.format\n\n\t\tif (this.stacked !== \"side\") {\n\t\t\tf.z = 0\n\t\t\tf.depth = 1\n\n\t\t\twhile (index > 1) {\n\t\t\t\tindex--\n\t\t\t\tseries = this.chart.series.items[index]\n\n\t\t\t\tif (series.visible && series.constructor == this.constructor) {\n\t\t\t\t\tf.z = series.format.z\n\t\t\t\t\tf.depth = series.format.depth\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else super.initZ(index, total)\n\n\t\tthis.marks.format.z = f.z + f.depth * 0.5\n\t}\n}\n","import type { Point, Rectangle } from \"../core/primitives.js\"\nimport { ArrayMin } from \"../series-utils.js\"\nimport { CustomBar } from \"./custom-bar.js\"\n\n/**\n * @constructor\n * @augments CustomBar\n * @class Draws data as vertical bars\n */\nexport class Bar extends CustomBar {\n\tcalc(index: number, p: Point): void {\n\t\tthis.isStacked ? this.calcStack(index, p, this.data.values[index]) : super.calc(index, p)\n\t}\n\n\thorizMargins(p: Point): void {\n\t\tthis.initOffsets()\n\t\tp.x = this._margin\n\t\tp.y = this._margin\n\t}\n\n\tvertMargins(p: Point): void {\n\t\tconst m = this.marks\n\t\tlet st = this.format.stroke\n\t\tconst hasNeg = this.minYValue() < (Array.isArray(this.origin) ? ArrayMin(this.origin) : this.origin)\n\n\t\tif (m.visible && m.location !== \"center\") {\n\t\t\tp.y = (m.arrow.length ?? 0) + m.format.textHeight(\"Wj\") + m.margins.top + m.margins.bottom\n\t\t\tst = m.format.stroke\n\t\t}\n\n\t\tif (st.fill !== \"\") p.y += 2 * st.size + 1\n\n\t\tif (hasNeg) p.x = p.y\n\t}\n\n\tmaxXValue() {\n\t\treturn this.stacked === \"sideAll\" ? this.countAll() - 1 : super.maxXValue()\n\t}\n\n\tminYValue() {\n\t\tconst res = super.minYValue()\n\t\treturn this.useOrigin ? Math.min(Array.isArray(this.origin) ? ArrayMin(this.origin) : this.origin, res) : res\n\t}\n\n\tmaxYValue() {\n\t\tlet res = 0\n\t\tlet s: Bar\n\t\tconst ss = this.chart.series.items\n\t\tconst l = ss.length\n\t\tlet t: number\n\t\tlet val: number\n\n\t\tif (this.stacked === \"sideAll\" || this.stacked === \"side\") {\n\t\t\tfor (t = 0; t < l; t++) {\n\t\t\t\ts = ss[t] as Bar\n\t\t\t\tif (s.visible && s.constructor === this.constructor) {\n\t\t\t\t\tval = s._baseMaxYValue()\n\t\t\t\t\tif (val > res) res = val\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res\n\t\t}\n\n\t\treturn this.stackMaxValue()\n\t}\n\n\tcalcBarBounds(p: Point, bar: Rectangle, offset: Point, originPos: number): void {\n\t\tbar.x = p.x + offset.x\n\t\tbar.width = offset.y\n\n\t\tif (this._vertAxis.inverted) {\n\t\t\tbar.y = originPos\n\t\t\tbar.height = p.y - bar.y\n\t\t} else {\n\t\t\tbar.y = p.y\n\t\t\tbar.height = originPos - p.y\n\t\t}\n\n\t\tif (bar.height < 0) {\n\t\t\tbar.y += bar.height\n\t\t\tbar.height = -bar.height\n\t\t}\n\t}\n}\n","import type { SeriesInput, SeriesLabels } from \"../series.js\"\nimport { CustomSeries } from \"./custom-series.js\"\n\n/**\n * @constructor\n * @augments CustomSeries\n * @class Draws series data as points at vertical and horizontal axes positions. It has no connecting line:\n * use a {@link Line} series with `pointer.visible` for points joined by a line.\n */\nexport class PointXY extends CustomSeries {\n\tconstructor(o?: SeriesInput | null, o2?: SeriesLabels | null) {\n\t\tsuper(o, o2)\n\t\tthis.hover.enabled = true\n\t\tthis.pointer.visible = true\n\t\tthis.drawLine = false\n\t\t// With no line between the points there is nothing to interpolate: the tooltip needs the cursor over a point.\n\t\tthis.continuous = false\n\t}\n\n\tdraw(): void {\n\t\tif (this.data.values.length === 0) return\n\n\t\tthis.isStacked = this.stacked !== \"no\"\n\t\tthis.isStack100 = this.stacked === \"100\"\n\n\t\tif (this.pointer.visible) this.drawPointers()\n\t}\n}\n","import type { SeriesInput, SeriesLabels } from \"../series.js\"\nimport type { Point } from \"../core/primitives.js\"\nimport { PointXY } from \"./point-xy.js\"\n\n/**\n * @constructor\n * @augments PointXY\n * @class Draws data as points, each one with a different size or radius\n * @property {Object} data Contains each bubble x, value and radius.\n * @property {Number[]} data.radius Defines each bubble radius value.\n */\nexport class Bubble extends PointXY {\n\tdeclare calcWidth: (index: number) => number\n\tdeclare calcHeight: (index: number) => number\n\t/**\n\t * When true, horizontal and vertical edge margins are calculated.\n\t */\n\tinflate = true\n\n\tconstructor(o?: SeriesInput | null, o2?: SeriesLabels | null) {\n\t\tsuper(o, o2)\n\n\t\tthis.pointer.colorEach = true\n\t\tthis.pointer.style = \"sphere\"\n\t\tthis.pointer.format.gradient.visible = true\n\t\tthis.pointer.format.gradient.direction = \"radial\"\n\n\t\tthis.data.radius = []\n\t}\n\n\taddRandom(count = 5): Bubble {\n\t\tif (!count) count = 5\n\n\t\tthis.data.values.length = count\n\n\t\tthis.data.x = undefined\n\t\tthis.data.radius = []\n\t\tthis.data.radius.length = count\n\n\t\tif (count > 0) {\n\t\t\tfor (let t = 0; t < count; t++) {\n\t\t\t\tthis.data.values[t] = Math.random() * 1000\n\t\t\t\tthis.data.radius[t] = 50 + Math.random() * 150\n\t\t\t}\n\t\t}\n\n\t\treturn this\n\t}\n\n\tinitZ(): void {\n\t\tsuper.initZ()\n\t}\n\n\tgetSize(index: number): void {\n\t\tconst s = this.data.radius ? this._vertAxis.calcSize(this.data.radius[index]) : 0\n\t\tthis.pointer.width = s\n\t\tthis.pointer.height = s\n\t}\n\n\thorizMargins(_p: Point): void {\n\t\tthis.calcWidth = function (index) {\n\t\t\tthis.getSize(index)\n\t\t\tlet res = 1 + this.pointer.width * 0.5,\n\t\t\t\ts = this.pointer.format.stroke\n\t\t\tif (s.fill !== \"\") res += s.size\n\t\t\treturn res\n\t\t}\n\n\t\tif (this.pointer.visible && this.inflate) {\n\t\t\tthis.pointer.x = this.calcWidth(0)\n\t\t\tthis.pointer.y = this.calcWidth(this.count() - 1)\n\t\t}\n\t}\n\n\tvertMargins(p: Point): void {\n\t\tthis.calcHeight = function (index) {\n\t\t\tthis.getSize(index)\n\t\t\tlet res = 1 + this.pointer.height * 0.5,\n\t\t\t\ts = this.pointer.format.stroke\n\t\t\tif (s.fill !== \"\") res += s.size\n\t\t\treturn res\n\t\t}\n\n\t\tif (this.pointer.visible && this.inflate) {\n\t\t\tlet low: number,\n\t\t\t\thigh: number,\n\t\t\t\tlowIndex = 0,\n\t\t\t\thighIndex = 0,\n\t\t\t\tl = this.count(),\n\t\t\t\tpos = { x: 0, y: 0 }\n\n\t\t\tif (l > 0) {\n\t\t\t\tthis.calc(0, pos)\n\t\t\t\tlow = high = pos.y\n\n\t\t\t\tfor (let t = 1; t < l; t++) {\n\t\t\t\t\tthis.calc(t, pos)\n\n\t\t\t\t\tif (pos.y < low) lowIndex = t\n\t\t\t\t\telse if (pos.y > high) highIndex = t\n\t\t\t\t}\n\n\t\t\t\tp.x = this.calcHeight(highIndex)\n\t\t\t\tp.y = this.calcHeight(lowIndex)\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Point, Rectangle } from \"../core/primitives.js\"\nimport { getWindow, requestAnimationFrame } from \"../platform.js\"\nimport { Series } from \"../series.js\"\nimport type { SeriesInput, SeriesLabels } from \"../series.js\"\n\ninterface PieContext extends CanvasRenderingContext2D {\n\tz?: number\n\tdepth?: number\n\tslice(\n\t\tpoint: Point,\n\t\tcenter: Point,\n\t\tradius: number,\n\t\tangle: number,\n\t\tendAngle: number,\n\t\tdonutRadius: number,\n\t\ttube: unknown,\n\t\tbeveled: unknown\n\t): void\n}\n\n/**\n * @constructor\n * @augments Series\n * @class Draws series data as slices of a circle\n * @property {Number} [rotation=0] Rotates all slices by specified degree from 0 to 360.\n * @property {Number[]} explode Determines percent of separation from each slice to pie center.\n * @property {Boolean} [clockwise = true] Direction of Values.\n */\nexport class Pie extends Series {\n\t/** @type {((index: number) => void)|undefined} */\n\tonbeforedrawPoint: ((index: number) => void) | undefined\n\n\tdonut = 0\n\trotation = 0\n\tcolorEach = \"yes\"\n\tuseAxes = false\n\tcontinuous = false\n\tangleWidth = 360\n\tmaxRadius = 100\n\tsort = \"values\"\n\torderAscending = false\n\texplode: number[] | null = null\n\tconcentric = false\n\tclockwise = true\n\ttotal = Number.NaN\n\tpiex = Number.NaN\n\tpiey = Number.NaN\n\tradius = Number.NaN\n\tdonutRadius = Number.NaN\n\tcenter = { x: 0, y: 0 }\n\tsorted: number[] | undefined\n\tangle = Number.NaN\n\tendAngle = Number.NaN\n\thoverang = Number.NaN\n\t/**\n\t * Percent of the pie radius, measured from the center along the slice's middle angle, where tooltips point at.\n\t * NaN (default) anchors on the outer edge, with the tooltip placed outside the pie.\n\t */\n\tanchorPosition = Number.NaN\n\t/** Percent of the pie radius the hovered slice moves away from the center. Set to 0 to disable. */\n\thoverExplode = 6\n\t/** Milliseconds the hovered slice takes to move out (and back). */\n\thoverDuration = 150\n\tprivate hoverProgress: number[] = []\n\tprivate hoverFrame: number | null = null\n\tprivate hitTesting = false\n\tr = new Rectangle()\n\n\tconstructor(o?: SeriesInput | null, o2?: SeriesLabels | null) {\n\t\tsuper(o, o2)\n\n\t\tthis.marks.style = \"percent\"\n\t\tthis.marks.visible = true\n\n\t\tconst f = this.format\n\t\tf.stroke.fill = \"black\"\n\t\tf.shadow.visible = true\n\t\tf.gradient.visible = true\n\t\tf.gradient.direction = \"radial\"\n\t\tf.gradient.colors = [\"white\", \"white\", \"white\"]\n\n\t\tthis.hover.enabled = true\n\t\t// Hover highlights the slice with a light overlay; a stroke is only drawn when the user asks for one.\n\t\tthis.hover.stroke.fill = \"\"\n\t}\n\n\t/**\n\t * @returns {Number} Returns the index'th pie slice value.\n\t */\n\tgetValue(index: number): number {\n\t\treturn this.data.values[index]\n\t}\n\n\tcalcCenter(t: number, radius: number, mid: number, center: Point): void {\n\t\tlet v = this.explode?.[t] ?? 0\n\t\tif (!this.hitTesting) v += this.hoverExplode * (this.hoverProgress[t] ?? 0)\n\t\tif (v) {\n\t\t\tv = radius * v * 0.01\n\t\t\tcenter.x += v * Math.cos(mid)\n\t\t\tcenter.y += v * Math.sin(mid)\n\t\t}\n\t}\n\n\tdoHover(index: number): void {\n\t\tconst changed = index !== this.over\n\t\tsuper.doHover(index)\n\t\tif (changed) this.animateHover()\n\t}\n\n\t/** Eases each slice's hover offset toward its target (1 for the hovered slice, 0 for the rest). */\n\tprivate animateHover(): void {\n\t\tif (this.hoverFrame !== null || this.hoverExplode <= 0) return\n\t\tconst reduced = getWindow()?.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches ?? false\n\t\tconst duration = reduced ? 0 : this.hoverDuration\n\t\tlet last = Date.now()\n\t\tconst tick = () => {\n\t\t\tthis.hoverFrame = null\n\t\t\tif (this.chart.destroyed) return\n\t\t\tconst now = Date.now()\n\t\t\tconst step = duration > 0 ? (now - last) / duration : 1\n\t\t\tlast = now\n\t\t\tlet moving = false\n\t\t\tfor (let i = 0; i < this.data.values.length; i++) {\n\t\t\t\tconst target = i === this.over ? 1 : 0\n\t\t\t\tconst current = this.hoverProgress[i] ?? 0\n\t\t\t\tif (current === target) continue\n\t\t\t\tconst next = target > current ? Math.min(target, current + step) : Math.max(target, current - step)\n\t\t\t\tthis.hoverProgress[i] = next\n\t\t\t\tif (next !== target) moving = true\n\t\t\t}\n\t\t\tthis.chart._scheduleDraw()\n\t\t\tif (moving) this.hoverFrame = requestAnimationFrame(tick)\n\t\t}\n\t\tthis.hoverFrame = requestAnimationFrame(tick)\n\t}\n\n\tclicked(p: Point): number {\n\t\tconst context = this.chart.ctx as PieContext | null\n\t\tif (!context) return -1\n\t\tconst pointCount = this.data.values.length\n\t\tlet index: number\n\n\t\tif (context.isPointInPath) {\n\t\t\tthis.endAngle = this.angle = (Math.PI * this.rotation) / 180.0\n\n\t\t\t// Hit-test the resting slices so the hover offset cannot make the hovered slice flicker at its edge.\n\t\t\tthis.hitTesting = true\n\t\t\ttry {\n\t\t\t\tfor (let pointIndex = 0; pointIndex < pointCount; pointIndex++) {\n\t\t\t\t\tindex = this.sorted ? this.sorted[pointIndex] : pointIndex\n\n\t\t\t\t\tif (!this.isNull(index)) {\n\t\t\t\t\t\tthis.slice(context, index)\n\n\t\t\t\t\t\tif (context.isPointInPath(p.x, p.y)) return index\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.hitTesting = false\n\t\t\t}\n\t\t}\n\n\t\treturn -1\n\t}\n\n\t/** Places `p` on the outer edge of the index'th slice, at its middle angle (and exploded offset). */\n\tcalc(index: number, p: Point): void {\n\t\tconst count = this.data.values.length\n\t\tconst turn = (Math.PI * 2) / (360 / this.angleWidth)\n\t\tconst total = this.total || this.data.values.reduce((sum, value) => sum + Math.abs(value || 0), 0)\n\t\tlet angle = (Math.PI * this.rotation) / 180.0\n\t\tlet mid = angle\n\t\tfor (let pointIndex = 0; pointIndex < count; pointIndex++) {\n\t\t\tconst current = this.sorted ? this.sorted[pointIndex] : pointIndex\n\t\t\tif (this.isNull(current)) continue\n\t\t\tconst sweep = total ? turn * (Math.abs(this.data.values[current]) / total) : 0\n\t\t\tconst next = angle + (this.clockwise ? sweep : -sweep)\n\t\t\tif (current === index) {\n\t\t\t\tmid = (angle + next) * 0.5\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tangle = next\n\t\t}\n\t\tconst center = new Point()\n\t\tcenter.x = this.piex\n\t\tcenter.y = this.piey\n\t\tthis.calcCenter(index, this.radius, mid, center)\n\t\tconst anchor = Number.isFinite(this.anchorPosition) ? (this.radius * this.anchorPosition) / 100 : this.radius\n\t\tp.x = center.x + Math.cos(mid) * anchor\n\t\tp.y = center.y + Math.sin(mid) * anchor\n\t}\n\n\t/** Tooltips sit outside the pie, on the side the slice faces, with the arrow pointing back at it. */\n\ttooltipSide(index: number): \"top\" | \"bottom\" | \"left\" | \"right\" | undefined {\n\t\tconst p = new Point()\n\t\tthis.calc(index, p)\n\t\tconst dx = p.x - this.piex\n\t\tconst dy = p.y - this.piey\n\t\tif (dx === 0 && dy === 0) return undefined\n\t\tif (Math.abs(dx) > Math.abs(dy)) return dx > 0 ? \"right\" : \"left\"\n\t\treturn dy > 0 ? \"bottom\" : \"top\"\n\t}\n\n\tcalcPos(angle: number, p: Point): void {\n\t\tp.x = this.center.x + Math.cos(angle) * this.donutRadius\n\t\tp.y = this.center.y + Math.sin(angle) * this.donutRadius\n\t}\n\n\t// Return Pie radius, and returns pie center xy at \"c\" parameter\n\tgetCenter(c: Point): number | undefined {\n\t\tc.x = this.center.x\n\t\tc.y = this.center.y\n\t\treturn this.radius\n\t}\n\n\tslice(c: PieContext, index: number): void {\n\t\tconst point = new Point()\n\n\t\tconst angle = (Math.PI * 2 * (Math.abs(this.data.values[index]) / this.total)) / (360 / this.angleWidth)\n\t\tthis.endAngle += this.clockwise ? angle : -angle\n\t\tthis.center.x = this.piex\n\t\tthis.center.y = this.piey\n\t\tthis.calcCenter(index, this.radius, (this.angle + this.endAngle) * 0.5, this.center)\n\n\t\tif (this.donut === 0) {\n\t\t\tpoint.x = this.center.x\n\t\t\tpoint.y = this.center.y\n\t\t} else this.calcPos(this.angle, point)\n\n\t\tconst isWebGL = this.chart.__webgl\n\n\t\tif (isWebGL) {\n\t\t\tthis.calcPos(2 * Math.PI - this.angle, point)\n\t\t\tc.slice(\n\t\t\t\tpoint,\n\t\t\t\tthis.center,\n\t\t\t\tthis.radius,\n\t\t\t\tthis.angle,\n\t\t\t\tthis.endAngle,\n\t\t\t\tthis.donutRadius,\n\t\t\t\tthis.format.tube,\n\t\t\t\tthis.format.beveled\n\t\t\t)\n\t\t} else {\n\t\t\tc.beginPath()\n\t\t\tc.moveTo(point.x, point.y)\n\t\t\tc.arc(this.center.x, this.center.y, this.radius, this.angle, this.endAngle, !this.clockwise)\n\n\t\t\tif (this.donut !== 0) {\n\t\t\t\tthis.calcPos(this.endAngle, point)\n\t\t\t\tc.lineTo(point.x, point.y)\n\t\t\t\tc.arc(this.center.x, this.center.y, this.donutRadius, this.endAngle, this.angle, this.clockwise)\n\t\t\t}\n\n\t\t\tc.closePath()\n\t\t}\n\n\t\tif (index === this.over) this.hoverang = this.angle\n\n\t\tthis.angle = this.endAngle\n\t}\n\n\tfill(i: number) {\n\t\treturn this.getFillStyle(\n\t\t\tnew Rectangle(this.center.x - this.radius, this.center.y - this.radius, this.radius * 2, this.radius * 2),\n\t\t\tthis.getFill(i)\n\t\t)\n\t}\n\n\tslices(shadow: boolean): void {\n\t\tconst context = this.chart.ctx as PieContext | null\n\t\tif (!context) return\n\n\t\tconst length = this.data.values.length\n\n\t\tthis.endAngle = this.angle = (Math.PI * this.rotation) / 180.0\n\n\t\t// TODO: Replace with overriden Format.slice\n\t\tcontext.z = 0.5\n\t\tcontext.depth = 1\n\n\t\tfor (let pointIndex = 0; pointIndex < length; pointIndex++) {\n\t\t\tconst index = this.sorted ? this.sorted[pointIndex] : pointIndex\n\n\t\t\tif (this.onbeforedrawPoint) this.onbeforedrawPoint(index)\n\n\t\t\tif (!this.isNull(index)) {\n\t\t\t\tthis.slice(context, index)\n\n\t\t\t\tif (shadow) this.format.shadow.prepare(context)\n\t\t\t\telse context.fillStyle = this.fill(index)\n\n\t\t\t\tcontext.fill()\n\n\t\t\t\tif (!shadow) {\n\t\t\t\t\tconst st = this.format.stroke\n\n\t\t\t\t\tif (st.fill !== \"\") {\n\t\t\t\t\t\tst.prepare()\n\t\t\t\t\t\tcontext.stroke()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdraw() {\n\t\tconst length = this.data.values.length\n\n\t\tif (length > 0) {\n\t\t\tlet h = 0\n\t\t\tconst m = this.marks\n\n\t\t\tif (this.format.shadow.visible) h += 2 * this.format.shadow.height\n\n\t\t\tif (m.visible) {\n\t\t\t\tm.format.font.prepare()\n\t\t\t\th += m.format.textHeight(\"Wj\") + Math.max(0, m.arrow.length ?? 0) * 0.5\n\t\t\t}\n\n\t\t\tthis.cellRect(this.r, !this.concentric, Pie)\n\n\t\t\tthis.piex = this.r.x + this.r.width * 0.5\n\t\t\tthis.piey = this.r.y + this.r.height * 0.5\n\n\t\t\tthis.radius = this.r.width * 0.5\n\t\t\tlet r2 = (this.r.height - 2 * h) * 0.5\n\n\t\t\tif (r2 < 0) r2 = 0\n\t\t\tif (r2 < this.radius) this.radius = r2\n\n\t\t\tthis.donutRadius = this.radius * this.donut * 0.01\n\t\t\tthis.radius = this.radius / (100 / this.maxRadius)\n\t\t\tthis.total = this.data.values.reduce(\n\t\t\t\t(total, value, index) => total + (this.isNull(index) ? 0 : Math.abs(value)),\n\t\t\t\t0\n\t\t\t)\n\n\t\t\tthis.sorted = this.doSort(this.sort, this.orderAscending) ?? undefined\n\n\t\t\tif (!this.chart.__webgl) this.slices(true)\n\n\t\t\tthis.slices(false)\n\n\t\t\tif (this.hover.enabled && this.over !== -1) {\n\t\t\t\tconst st = this.hover\n\t\t\t\tconst c = this.chart.ctx as PieContext | null\n\t\t\t\tif (!c || Number.isNaN(this.hoverang)) return\n\t\t\t\tthis.endAngle = this.angle = this.hoverang\n\t\t\t\tthis.slice(c, this.over)\n\t\t\t\tif (!this.chart.__webgl) {\n\t\t\t\t\tc.save()\n\t\t\t\t\tc.fillStyle = st.fill !== \"\" ? st.fill : \"rgba(255,255,255,0.18)\"\n\t\t\t\t\tc.fill()\n\t\t\t\t\tif (st.stroke.fill !== \"\") {\n\t\t\t\t\t\tst.stroke.prepare()\n\t\t\t\t\t\tc.stroke()\n\t\t\t\t\t}\n\t\t\t\t\tc.restore()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdrawMarks(): void {\n\t\tlet endAngle = (Math.PI * this.rotation) / 180.0\n\t\tlet angle = endAngle\n\t\tlet mid: number\n\t\tconst values = this.data.values\n\t\tconst length = values.length\n\n\t\tthis.marks.format.z = 0.5\n\n\t\tfor (let pointIndex = 0; pointIndex < length; pointIndex += this.marks.drawEvery) {\n\t\t\tconst index = this.sorted ? this.sorted[pointIndex] : pointIndex\n\n\t\t\tif (!this.isNull(index)) {\n\t\t\t\tconst sliceAngle = Math.PI * 2 * (Math.abs(values[index]) / this.total)\n\t\t\t\tendAngle += this.clockwise ? sliceAngle : -sliceAngle\n\t\t\t\tmid = (angle + endAngle) * 0.5\n\t\t\t\tthis.center.x = this.piex\n\t\t\t\tthis.center.y = this.piey\n\t\t\t\tthis.calcCenter(index, this.radius, mid, this.center)\n\t\t\t\tthis.marks.drawPolar(this.center, this.radius, mid, index)\n\t\t\t\tangle = endAngle\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { SeriesInput, SeriesLabels } from \"../series.js\"\nimport { Pie } from \"./pie.js\"\n\n/**\n * @constructor\n * @augments Pie\n * @class Draws series data as slices of a circle, with a center hole\n * @property {Number} [donut=50] Percent of hole size relative to pie radius. From 0 to 100.\n */\nexport class Donut extends Pie {\n\tlessDonutWidth = 100\n\tdonutArray: Donut[] = []\n\tdonut = 50\n\n\tconstructor(o?: SeriesInput | null, o2?: SeriesLabels | null) {\n\t\tsuper(o, o2)\n\n\t\tthis.donut = 50\n\t}\n\n\trefreshWidth(): void {\n\t\tif (this.concentric) {\n\t\t\tthis.donutArray = this.chart.series.items as Donut[]\n\t\t\tlet nVisibleDonuts = 0\n\t\t\tlet n = 0\n\t\t\tfor (let i = 0; i < this.donutArray.length; i++) {\n\t\t\t\tif (this.donutArray[i].visible) nVisibleDonuts++\n\t\t\t}\n\t\t\tif (this.lessDonutWidth === 100) this.getLessDonutWidth()\n\t\t\tfor (let i = 0; i < this.donutArray.length; i++) {\n\t\t\t\tif (this.donutArray[i].visible) {\n\t\t\t\t\tthis.donutArray[i].donut = this.lessDonutWidth + n * ((100 - this.lessDonutWidth) / nVisibleDonuts)\n\t\t\t\t\tn++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tgetLessDonutWidth(): void {\n\t\tfor (let i = 0; i < this.donutArray.length; i++) {\n\t\t\tif (this.donutArray[i].donut < this.lessDonutWidth) this.lessDonutWidth = this.donutArray[i].donut\n\t\t}\n\t}\n}\n","import type { SeriesInput, SeriesLabels } from \"../series.js\"\nimport { Point } from \"../core/primitives.js\"\nimport { visiblePointRange } from \"../series-utils.js\"\nimport { drawSpline } from \"../spline.js\"\nimport { trunc } from \"../utils.js\"\nimport { CustomSeries } from \"./custom-series.js\"\n\ninterface LineContext extends CanvasRenderingContext2D {\n\tz?: number\n\tdepth?: number\n\tspline?: (points: number[], closed?: boolean) => void\n}\n\n/**\n * @constructor\n * @augments CustomSeries\n * @class Draws series data as a contiguous polyline between points\n * @property {Boolean} [stairs=false] Determines if lines between points are direct (diagonals) or as stairs (horizontal and vertical).\n */\nexport class Line extends CustomSeries {\n\tdeclare treatNulls: string\n\tcolorEachLine: string | boolean | undefined = undefined\n\n\tconstructor(o?: SeriesInput | null, o2?: SeriesLabels | null) {\n\t\tsuper(o, o2)\n\n\t\tthis.drawLine = true\n\t\tthis.treatNulls = \"dontPaint\"\n\t\tthis.colorEachLine = \"no\"\n\n\t\tconst f = this.format\n\t\tf.shadow.visible = true\n\t\tf.shadow.blur = 10\n\t}\n\n\tdoDrawLine(c: LineContext): void {\n\t\tconst p = new Point()\n\t\tlet oldX = Number.NaN\n\t\tlet oldY = Number.NaN\n\t\tconst len = this.data.values.length\n\t\tlet t: number\n\t\tlet smop: number[]\n\t\tlet s: string\n\t\tlet begin = 0\n\t\tlet end = len\n\t\tconst no = this.notmandatory\n\t\tconst f = this.format\n\n\t\tif (!this.smooth) {\n\t\t\tif (!this.data.x) {\n\t\t\t\tbegin = Math.max(0, trunc(no.minimum) - 1)\n\t\t\t\tend = Math.min(len, trunc(no.maximum) + 2)\n\t\t\t} else {\n\t\t\t\t// Ascending x values (time series): draw only the points that can be visible.\n\t\t\t\tconst visible = visiblePointRange(this.data.x, len, no.minimum, no.maximum)\n\t\t\t\tif (visible) [begin, end] = visible\n\t\t\t}\n\t\t}\n\n\t\tconst a = this.chart.aspect\n\t\tconst is3d = a.view3d\n\n\t\tconst isEach = this.colorEachLine === \"yes\" || this.colorEachLine === true\n\n\t\tf.fill = this.getFill(0, f)\n\n\t\tif (!isEach) if (f.fill === \"\") f.fill = this.format.fill\n\n\t\tc.beginPath()\n\n\t\tif (this.smooth > 0) {\n\t\t\tsmop = new Array(2 * len)\n\n\t\t\tfor (t = 0; t < len; t++) {\n\t\t\t\tthis.calc(t, p)\n\n\t\t\t\tsmop[2 * t] = p.x\n\t\t\t\tsmop[2 * t + 1] = p.y\n\t\t\t}\n\n\t\t\tif (c.spline) c.spline(smop)\n\t\t\telse drawSpline(c, smop, this.smooth, true)\n\t\t} else {\n\t\t\tconst noNulls = this.treatNulls !== \"skip\"\n\n\t\t\tconst g = f.gradient\n\t\t\tlet fill = f.stroke.fill\n\t\t\tlet old = fill\n\n\t\t\tif (!isEach && g.visible) g.setEndColor(f.stroke.fill)\n\n\t\t\tconst stSeg = f.stroke\n\t\t\tstSeg.prepare(stSeg.fill)\n\n\t\t\t// With more than two points per pixel column the path only needs each column's envelope.\n\t\t\tconst axisSize = no.axisSize\n\t\t\tif (!isEach && !this.stairs && axisSize > 0 && end - begin > 2 * axisSize) {\n\t\t\t\tthis._traceDecimated(c, p, begin, end, noNulls)\n\t\t\t} else\n\t\t\t\tfor (t = begin; t < end; t++)\n\t\t\t\t\tif (this.isNull(t)) {\n\t\t\t\t\t\tif (noNulls) begin = -1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.calc(t, p)\n\n\t\t\t\t\t\tif (isEach) {\n\t\t\t\t\t\t\tif (isEach && t !== begin) c.beginPath()\n\n\t\t\t\t\t\t\tfill = this.getFill(t, f)\n\n\t\t\t\t\t\t\tif (fill !== old) {\n\t\t\t\t\t\t\t\tg.visible ? g.setEndColor(fill) : (f.fill = fill)\n\t\t\t\t\t\t\t\told = fill\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (t === begin || begin === -1) {\n\t\t\t\t\t\t\t\tc.moveTo(p.x, p.y)\n\t\t\t\t\t\t\t\tbegin = 0\n\t\t\t\t\t\t\t} else if (this.stairs) {\n\t\t\t\t\t\t\t\tif (this.invertedStairs) {\n\t\t\t\t\t\t\t\t\tc.moveTo(oldX, oldY)\n\t\t\t\t\t\t\t\t\tc.lineTo(p.x, oldY)\n\t\t\t\t\t\t\t\t\tc.lineTo(p.x, p.y)\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tc.moveTo(oldX, oldY)\n\t\t\t\t\t\t\t\t\tc.lineTo(oldX, p.y)\n\t\t\t\t\t\t\t\t\tc.lineTo(p.x, p.y)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tc.moveTo(oldX, oldY)\n\t\t\t\t\t\t\t\tc.lineTo(p.x, p.y)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tc.strokeStyle = fill\n\t\t\t\t\t\t\tc.stroke()\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (t === begin || begin === -1) {\n\t\t\t\t\t\t\t\tc.moveTo(p.x, p.y)\n\t\t\t\t\t\t\t\tbegin = 0\n\t\t\t\t\t\t\t} else if (this.stairs) {\n\t\t\t\t\t\t\t\tif (this.invertedStairs) c.lineTo(p.x, oldY)\n\t\t\t\t\t\t\t\telse c.lineTo(oldX, p.y)\n\n\t\t\t\t\t\t\t\tc.lineTo(p.x, p.y)\n\t\t\t\t\t\t\t} else c.lineTo(p.x, p.y)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toldX = p.x\n\t\t\t\t\t\toldY = p.y\n\n\t\t\t\t\t\tif (isEach && t !== begin) c.closePath()\n\t\t\t\t\t}\n\t\t}\n\n\t\tconst st = f.stroke\n\n\t\tif (this.chart.isChrome && f.shadow.visible) st.size = Math.max(1.1, st.size)\n\n\t\tc.z = f.z\n\t\tc.depth = f.depth\n\n\t\ts = st.fill\n\t\tif (s === \"\") s = f.fill\n\n\t\tst.prepare(s)\n\t\tf.shadow.prepare(c)\n\n\t\tif (is3d) {\n\t\t\tc.fillStyle = f.fill\n\t\t\tc.fill()\n\t\t}\n\n\t\tif (!isEach) if (s !== \"\") c.stroke()\n\t}\n\n\tdraw(): void {\n\t\tconst len = this.data.values.length\n\n\t\tif (len > 0) {\n\t\t\tthis.isStacked = this.stacked !== \"no\"\n\t\t\tthis.isStack100 = this.stacked === \"100\"\n\n\t\t\tif (this.drawLine) this.doDrawLine(this.chart.drawContext)\n\n\t\t\tif (this.pointer.visible) this.drawPointers()\n\t\t}\n\t}\n}\n","import type { Chart } from \"./chart.js\"\nimport type { AccessibilityOptions } from \"./accessibility.js\"\nimport type { ChartEventMap, EventListener } from \"./events.js\"\nimport type { ChartPlugin, ChartPluginOptions } from \"./plugin.js\"\nimport { updatePluginActivation } from \"./plugin.js\"\nimport { getSeriesType, registerBuiltInSeriesType, type SeriesTypeDefinition } from \"./series-registry.js\"\nimport { Area } from \"./series/area.js\"\nimport { Bar } from \"./series/bar.js\"\nimport { Bubble } from \"./series/bubble.js\"\nimport { Donut } from \"./series/donut.js\"\nimport { Line } from \"./series/line.js\"\nimport { Pie } from \"./series/pie.js\"\nimport { PointXY } from \"./series/point-xy.js\"\nimport type { HistogramNormalize, HistogramRule } from \"./series/histogram.js\"\nimport type { SankeyGraph, SankeyLinkColor } from \"./series/sankey.js\"\nimport type {\n\tBoxPlotGroup,\n\tBoxPlotLimit,\n\tBoxPlotQuantiles,\n\tBoxPlotWhisker,\n\tBoxPlotWhiskerMode\n} from \"./series/box-plot.js\"\nimport type { ViolinGroup, ViolinInner, ViolinScale } from \"./series/violin.js\"\nimport type { TreemapColorBy, TreemapNode, TreemapTiling } from \"./series/treemap.js\"\nimport type { Series } from \"./series.js\"\nimport type { MapDefinition } from \"./series/map-series.js\"\nimport type { MarkConnector, MarkPlacement } from \"./tools/annotation.js\"\n\nexport type { MarkConnector, MarkPlacement } from \"./tools/annotation.js\"\nimport { pointerOf } from \"./series-utils.js\"\nimport type { ThemeName } from \"./theme.js\"\nimport { ToolTip } from \"./tools/index.js\"\nimport type { Tool } from \"./tools/tool.js\"\n\ntype ExtensibleName<T extends string> = T | (string & {})\n\nexport type LegendPosition = \"bottom\" | \"left\" | \"right\" | \"top\"\n/** Whether the legend lists the series, the points of the first visible series, or chooses by series count. */\nexport type LegendStyle = \"auto\" | \"series\" | \"values\"\n/** What each legend item shows for the points of a series. */\nexport type LegendValueFormat =\n\t| \"auto\"\n\t| \"index\"\n\t| \"label\"\n\t| \"labelpercent\"\n\t| \"labelvalue\"\n\t| \"percent\"\n\t| \"percentlabel\"\n\t| \"value\"\n\t| \"valuelabel\"\n\t| \"valuepercent\"\n/** How a legend item shows and toggles a series: clicking an item hides or shows its series unless \"none\". */\nexport type LegendInteraction = \"checkbox\" | \"linethrough\" | \"none\" | \"opacity\"\nexport type LegendSymbolShape = \"diamond\" | \"ellipse\" | \"line\" | \"pill\" | \"rectangle\" | \"triangle\"\nexport type ChartTheme = ExtensibleName<ThemeName>\nexport interface PaletteRegistry {\n\tcastaway: true\n\tclassic: true\n\tcool: true\n\texcel: true\n\tgrayscale: true\n\tmacOS: true\n\tmodern: true\n\tonBlack: true\n\topera: true\n\tpastels: true\n\trainbow: true\n\trainbowWide: true\n\tredRiver: true\n\trust: true\n\tseaWash: true\n\tsolid: true\n\tteechart: true\n\tvictorian: true\n\twarm: true\n\tweb: true\n\twindowsVista: true\n\twindowsxp: true\n}\n\nexport type PaletteName = ExtensibleName<keyof PaletteRegistry>\n\nexport type HorizontalAxisName = \"bottom\" | \"top\" | \"both\"\nexport type VerticalAxisName = \"left\" | \"right\" | \"both\"\n/** How multiple series of the same type are combined. */\nexport type StackMode = \"no\" | \"yes\" | \"100\" | \"side\" | \"sideAll\" | \"self\"\nexport type PointerStyle =\n\t| \"cone\"\n\t| \"cross\"\n\t| \"cube\"\n\t| \"cylinder\"\n\t| \"diamond\"\n\t| \"downtriangle\"\n\t| \"ellipse\"\n\t| \"rectangle\"\n\t| \"sphere\"\n\t| \"triangle\"\n\t| \"x\"\n\nexport interface MarksOptions {\n\tvisible?: boolean\n\tstyle?: string\n\tdrawEvery?: number\n\tshowZero?: boolean\n\t/** Fill color for the label background. */\n\tbackgroundColor?: string\n\t/** Outline color for the mark label box. Use an empty string to hide the outline. */\n\tborderColor?: string\n\t/** Text color inside the mark label. */\n\tfontColor?: string\n\t/** Text size in pixels. */\n\tfontSize?: number\n\t/** Corner radius, in pixels, for the label background. */\n\tborderRadius?: number\n\t/** Space between the label text and its background edges, in pixels. */\n\tmargins?: { left?: number; top?: number; right?: number; bottom?: number }\n\t/** Position for pie and donut labels. */\n\tplacement?: MarkPlacement\n\t/** Connector for outside pie and donut labels. */\n\tconnector?: MarkConnector\n}\n\nexport interface PointerOptions {\n\tvisible?: boolean\n\tstyle?: PointerStyle\n\twidth?: number\n\theight?: number\n\tcolorEach?: boolean\n\tstrokeWidth?: number\n\tstrokeColor?: string\n\tshadow?: boolean\n}\n\n/** Visual and visibility options shared by every declarative series type. */\nexport interface SeriesStyleOptions {\n\t/** Stable identity used to match this series across declarative updates and reordering. */\n\tid?: string\n\tlabel?: string\n\t/** Keeps at most this many points when values are appended, dropping the oldest. */\n\tmaxPoints?: number\n\tvisible?: boolean\n\tborderColor?: string\n\tbackgroundColor?: string\n\tborderWidth?: number\n\tshadow?: boolean\n\thoverColor?: string\n\thoverEnabled?: boolean\n\tgradientVisible?: boolean\n\t/** Colors of the series fill gradient. */\n\tgradientColors?: string[]\n\t/** Image used to texture the series fill. */\n\timage?: { url: string }\n\ttransparency?: number\n\tmarks?: MarksOptions\n\t/** CSS cursor shown over the series points. */\n\tcursor?: string\n\t/** Paints each point with its own palette color. `\"auto\"` lets the series decide. */\n\tcolorEach?: boolean | \"auto\"\n\t/** How the series appears in the legend. */\n\tlegend?: SeriesLegendOptions\n}\n\n/** How one series appears in the legend. */\nexport interface SeriesLegendOptions {\n\t/** Lists the series in the legend; `false` hides it. */\n\tvisible?: boolean\n\t/** Overrides the legend symbol of this series. */\n\tsymbol?: {\n\t\tstyle?: LegendSymbolShape\n\t\tcolor?: string\n\t}\n}\n\n/** Options of series drawn against chart axes. */\nexport interface AxisSeriesOptions extends SeriesStyleOptions {\n\thorizAxis?: HorizontalAxisName\n\tvertAxis?: VerticalAxisName\n}\n\nexport type CartesianChartType = \"area\" | \"bar\" | \"bubble\" | \"horizArea\" | \"horizBar\" | \"line\" | \"point\" | \"volume\"\nexport type CircularChartType = \"activityGauge\" | \"donut\" | \"pie\" | \"sliced\"\nexport type ValueChartType = CartesianChartType | CircularChartType\n\n/** One Cartesian point with its own horizontal position and vertical value. */\nexport interface CartesianDataPoint {\n\tx: number | Date\n\ty: number\n}\n\n/**\n * Series plotted against axes whose data is a list of numbers or objects. Omitting `type` uses the chart level\n * `type`. `stacked`, `smooth` and `stairs` throw when the selected type does not support them.\n */\nexport interface CartesianSeriesOptions extends AxisSeriesOptions {\n\ttype?: CartesianChartType\n\tdata: number[] | CartesianDataPoint[] | object[]\n\t/**\n\t * Horizontal position of each numeric point, when it is not the index. Dates make the bottom axis a date axis,\n\t * and ascending values let line and area series process only the visible points when zoomed in. It\n\t * needs one value per point. Use `{ x, y }` data points to keep each position alongside its value.\n\t */\n\tx?: Array<number | Date>\n\t/** Object property used for horizontal positions. Defaults to `x` for object data. */\n\txKey?: string\n\t/** Object property used for vertical values. Defaults to `y` for object data. */\n\tyKey?: string\n\tpointer?: PointerOptions\n\tstacked?: StackMode\n\tsmooth?: number\n\tstairs?: boolean\n\t/** How line series render null values. */\n\ttreatNulls?: \"skip\" | \"dontPaint\"\n\tbarSize?: number\n}\n\n/** Pie like series whose data is a list of numbers and that do not use axes. */\nexport interface CircularSeriesOptions extends SeriesStyleOptions {\n\ttype?: CircularChartType\n\tdata: number[]\n\t/** Maximum pie or donut radius as a percentage of the available radius. */\n\tmaxRadius?: number\n}\n\nexport type ValueSeriesOptions = CartesianSeriesOptions | CircularSeriesOptions\n\nexport interface PolarSeriesOptions extends SeriesStyleOptions {\n\ttype: \"polar\"\n\tdata: number[]\n\tpointer?: PointerOptions\n\tsmooth?: number\n}\n\nexport interface CandleRow {\n\topen: number\n\thigh: number\n\tlow: number\n\tclose: number\n\t/** Optional numeric position; the point index is used when omitted. */\n\tx?: number\n}\n\n/** Financial OHLC series. `type` is required because its data is not a list of numbers. */\nexport interface CandleSeriesOptions extends AxisSeriesOptions {\n\ttype: \"candle\"\n\tdata: CandleRow[]\n\tstyle?: \"candle\" | \"bar\" | \"openclose\"\n}\n\nexport interface HighLowRow {\n\thigh: number\n\tlow: number\n}\n\nexport interface HighLowBarSeriesOptions extends AxisSeriesOptions {\n\ttype: \"highLowBar\"\n\tdata: HighLowRow[]\n}\n\nexport interface GanttTask {\n\tstart: number | Date\n\tend: number | Date\n\t/** Task name; falls back to the chart level label with the same index. */\n\tlabel?: string\n\t/** Vertical position; the task index is used when omitted. */\n\tx?: number\n}\n\nexport interface GanttSeriesOptions extends AxisSeriesOptions {\n\ttype: \"gantt\"\n\tdata: GanttTask[]\n\t/** Height of each task bar, as a percentage of its row. */\n\theight?: number\n\t/** Corner radius of each task bar, in pixels. */\n\tborderRadius?: number\n\t/** Task index pairs connected by dependency arrows. */\n\tnextTasks?: Array<[number, number]>\n\t/** Stroke color used for dependency arrows. */\n\tnextTasksStrokeStyle?: string\n\t/** Draw dependency arrows behind or in front of the task bars. */\n\tnextTasksPosition?: \"back\" | \"front\"\n}\n\n/** Groups raw numbers into bins and draws how many fall in each. */\nexport interface HistogramSeriesOptions extends AxisSeriesOptions {\n\ttype: \"histogram\"\n\t/** Raw values; they are grouped, not plotted one by one. */\n\tdata: number[]\n\t/** Number of bins. When omitted, `rule` chooses it. */\n\tbins?: number\n\t/** Width of each bin, in data units. It takes precedence over `bins`. */\n\tbinWidth?: number\n\t/** How the number of bins is chosen when neither `bins` nor `binWidth` is set; defaults to \"sturges\". */\n\trule?: HistogramRule\n\t/** Bar height: the \"count\" of values, their \"percent\" or the \"density\"; defaults to \"count\". */\n\tnormalize?: HistogramNormalize\n}\n\n/** Draws a box and whiskers for each group, from raw values or from precomputed summaries. */\nexport interface BoxPlotSeriesOptions extends AxisSeriesOptions {\n\ttype: \"boxPlot\"\n\t/** One item per box: a `{ name, values, color? }` group, a precomputed `{ name, min, q1, median, q3, max, outliers? }` or a plain array of values. */\n\tdata: Array<BoxPlotGroup | number[]>\n\t/** Where the whiskers end: \"tukey\" within `whiskerRange` times the IQR, or \"minmax\"; defaults to \"tukey\". */\n\twhisker?: BoxPlotWhisker\n\t/** Multiple of the interquartile range used by the \"tukey\" whiskers; defaults to 1.5. */\n\twhiskerRange?: number\n\t/** Where \"tukey\" whiskers end: at the farthest value inside the fences (\"nearest\") or at the fences (\"exact\"). */\n\twhiskerMode?: BoxPlotWhiskerMode\n\t/** How quartiles are computed from raw values; defaults to 7 (linear interpolation). */\n\tquantiles?: BoxPlotQuantiles\n\t/** What sets the lowest value of the axis: the \"extreme\" value, the \"box\" or the \"whisker\"; defaults to \"extreme\". */\n\tminStats?: BoxPlotLimit\n\t/** What sets the highest value of the axis; defaults to \"extreme\". */\n\tmaxStats?: BoxPlotLimit\n\t/** Draws every raw value as a dot; defaults to false. */\n\tshowPoints?: boolean\n\t/** Radius of the dots in pixels; defaults to 2.5. */\n\tpointRadius?: number\n\t/** Sideways spread of the dots, from 0 to 1 of the box width; defaults to 0.5. */\n\tjitter?: number\n\t/** Width of a box in percent of its category; defaults to 60. */\n\twidth?: number\n\t/** Draws the values beyond the whiskers; defaults to true. */\n\tshowOutliers?: boolean\n\t/** Marks the mean of each group of raw values with a diamond; defaults to false. */\n\tshowMean?: boolean\n\t/** Opacity of the fill of the box, from 0 to 1. */\n\tfillOpacity?: number\n\t/** Width of the outline in pixels. */\n\tlineWidth?: number\n\t/** Formats the values shown in tooltips. */\n\tformatValue?: (value: number) => string\n}\n\n/** Draws the distribution of each group of raw values as a violin. */\nexport interface ViolinSeriesOptions extends AxisSeriesOptions {\n\ttype: \"violin\"\n\t/** One item per violin: a `{ name, values, color? }` group or a plain array of values. */\n\tdata: Array<ViolinGroup | number[]>\n\t/** Smoothing of the density in data units; 0 or omitted chooses it for each group. */\n\tbandwidth?: number\n\t/** Multiplies the automatic bandwidth: below 1 follows the values more closely, above 1 smooths more; defaults to 1. */\n\tsmoothing?: number\n\t/** How far the shapes extend beyond the lowest and highest value, in bandwidths; defaults to 0. */\n\tcut?: number\n\t/** Number of positions where the density is estimated for each violin; defaults to 100. */\n\tresolution?: number\n\t/** Violin widths: all the same (\"width\"), the same area (\"area\") or by number of values (\"count\"). */\n\tscale?: ViolinScale\n\t/** Maximum width of a violin in percent of its category; defaults to 80. */\n\twidth?: number\n\t/** What is drawn inside: the \"median\", a \"box\" with the quartiles or \"none\"; defaults to \"median\". */\n\tinner?: ViolinInner\n\t/** Opacity of the fill, from 0 to 1. */\n\tfillOpacity?: number\n\t/** Width of the outline in pixels; 0 draws none. */\n\tlineWidth?: number\n\t/** Formats the values shown in tooltips. */\n\tformatValue?: (value: number) => string\n}\n\nexport interface TreemapSeriesOptions extends SeriesStyleOptions {\n\ttype: \"treemap\"\n\tdata: TreemapNode\n\t/** How the children of a node are arranged; defaults to \"squarify\". */\n\ttiling?: TreemapTiling\n\t/** What decides the color of a tile; defaults to \"branch\". */\n\tcolorBy?: TreemapColorBy\n\t/** Space between sibling tiles in pixels. */\n\tpadding?: number\n\t/** Height of the title band of branches in pixels; 0 hides the bands. */\n\theaderHeight?: number\n\t/** Corner radius of the tiles in pixels. */\n\tcornerRadius?: number\n\t/** Width of the tile outline in pixels; 0 draws none. */\n\tlineWidth?: number\n\t/** Color of the tile outline; the chart background when omitted. */\n\tborderColor?: string\n\t/** Levels drawn below the focused node, 0 for all of them. */\n\tmaxDepth?: number\n\t/** Draws the node names; defaults to true. */\n\tlabels?: boolean\n\t/** Draws the values under the names of the tiles that have room for them; defaults to true. */\n\tshowValues?: boolean\n\t/** Orders siblings from the largest to the smallest; defaults to true. */\n\tsortByValue?: boolean\n\t/** Clicking a branch zooms into it; defaults to true. */\n\tzoomOnClick?: boolean\n\t/** Formats the values shown in labels and tooltips. */\n\tformatValue?: (value: number) => string\n}\n\nexport interface SankeySeriesOptions extends SeriesStyleOptions {\n\ttype: \"sankey\"\n\tdata: SankeyGraph\n\t/** Width of the node bars in pixels. */\n\tnodeWidth?: number\n\t/** Minimum vertical space between the nodes of a column in pixels. */\n\tnodePadding?: number\n\t/** Opacity of the links, from 0 to 1. */\n\tlinkOpacity?: number\n\t/** Link painting: the color of the source node, of the target node, or a gradient between both. */\n\tlinkColor?: SankeyLinkColor\n\t/** Draws the node names and values; defaults to true. */\n\tlabels?: boolean\n\t/** Formats the values shown in labels and tooltips. */\n\tformatValue?: (value: number) => string\n}\n\n/** A colored band of a gauge: it ends at `to` and starts where the previous band ends, the first one at `min`. */\nexport interface GaugeBand {\n\tto: number\n\tcolor: string\n}\n\n/** A gauge shows a single value between `min` and `max`. */\ninterface GaugeBaseOptions extends SeriesStyleOptions {\n\tdata: number\n\tmin?: number\n\tmax?: number\n\t/** Milliseconds the pointer or arc takes to reach a new value set with `setValue`; 0 disables the animation. */\n\tanimationDuration?: number\n}\n\n/** A classic dial: ticks, labels and a hand over a round, rectangular or segment shaped face. */\nexport interface CircularGaugeSeriesOptions extends GaugeBaseOptions {\n\ttype: \"circularGauge\"\n\t/** Distance between labelled ticks; the range is divided in 20 when omitted. */\n\tstep?: number\n\t/** Minor ticks between two labelled ticks; 0 hides them. */\n\tminorTicks?: number\n\t/** Degrees covered by the scale; defaults to 280. */\n\tangle?: number\n\t/** Degrees the scale is turned clockwise. */\n\trotation?: number\n\t/** The scale runs from `max` to `min`. */\n\tinverted?: boolean\n\t/** Turns the tick labels with the scale. */\n\trotateText?: boolean\n\t/** Face of the dial; defaults to \"circle\". */\n\tshape?: \"circle\" | \"rectangle\" | \"segment\"\n\t/** Shape of the hand; defaults to \"needle\". */\n\thandShape?: \"needle\" | \"rectangle\"\n\t/** Colored bands behind the ticks. */\n\tranges?: GaugeBand[]\n\t/** Text under the value, such as \"km/h\". */\n\tunits?: string\n\t/** Draws the value; defaults to true. */\n\tshowValue?: boolean\n\t/** Lets the user drag the hand; defaults to true. */\n\tdraggable?: boolean\n\t/** Formats the labels of the scale. */\n\tformatLabel?: (value: number) => string\n\t/** Formats the value shown under the hand. */\n\tformatValue?: (value: number) => string\n}\n\nexport interface NumericGaugeSeriesOptions extends GaugeBaseOptions {\n\ttype: \"numericGauge\"\n}\n\n/** A flat radial gauge: a track and a rounded arc that grows with the value. */\nexport interface ArcGaugeSeriesOptions extends GaugeBaseOptions {\n\ttype: \"arcGauge\"\n\t/** Degrees covered by the track, from 180 for a semicircle to 360 for a ring; defaults to 240. */\n\tangle?: number\n\t/** Degrees the track is turned clockwise; 0 leaves the gap at the bottom. */\n\trotation?: number\n\t/** Width of the track as a percentage of the radius; defaults to 14. */\n\tthickness?: number\n\t/** Rounds the ends of the track and the arc; defaults to true. */\n\troundCaps?: boolean\n\t/** Fills from the end of the track instead of from the start. */\n\tinverted?: boolean\n\t/** The arc takes the color of the band that contains the value. */\n\tranges?: GaugeBand[]\n\t/** Marks a value with a short line across the track. */\n\ttarget?: number\n\t/** Text under the value. */\n\tcaption?: string\n\t/** Text next to the value, such as \"%\". */\n\tunits?: string\n\t/** Draws the minimum and the maximum under the ends of the track; defaults to true. */\n\tlimits?: boolean\n\t/** Draws the value in the middle; defaults to true. */\n\tshowValue?: boolean\n\t/** Lets the user drag the arc; defaults to false. */\n\tdraggable?: boolean\n\t/** Draws a knob at the end of the arc. */\n\tknob?: boolean\n\t/** Value that dragging snaps to. */\n\tstep?: number\n\t/** Formats the value and the limits. */\n\tformatValue?: (value: number) => string\n\ttrackColor?: string\n\ttextColor?: string\n}\n\nexport type GaugeSeriesOptions = CircularGaugeSeriesOptions | NumericGaugeSeriesOptions | ArcGaugeSeriesOptions\n\nexport interface BulletSeriesOptions extends AxisSeriesOptions {\n\ttype: \"bullet\"\n\t/** Measure of each bullet. */\n\tdata: number[]\n\t/** Draws bullets vertically instead of horizontally. */\n\tvertical?: boolean\n\t/** Target marker position, relative to the origin; use an array for one target per point. */\n\ttarget?: number | number[]\n\t/** Consecutive qualitative range widths; use an array of arrays for different ranges per point. */\n\tranges?: number[] | number[][]\n}\n\n/**\n * Maps every declarative series type to its options. Extend it with declaration merging to type\n * series registered with `registerSeriesType`:\n *\n * ```ts\n * declare module \"teechart.js\" {\n * interface SeriesOptionsRegistry { waterfall: WaterfallSeriesOptions }\n * }\n * ```\n */\nexport interface SeriesOptionsRegistry {\n\tmap: MapSeriesOptions\n\tcolorGrid: ColorGridSeriesOptions\n\tsurface: SurfaceSeriesOptions\n\tlinearGauge: LinearGaugeSeriesOptions\n\tactivityGauge: CircularSeriesOptions\n\tarcGauge: ArcGaugeSeriesOptions\n\tarea: CartesianSeriesOptions\n\tbar: CartesianSeriesOptions\n\tbubble: CartesianSeriesOptions\n\tboxPlot: BoxPlotSeriesOptions\n\tbullet: BulletSeriesOptions\n\tcandle: CandleSeriesOptions\n\tcircularGauge: CircularGaugeSeriesOptions\n\tdonut: CircularSeriesOptions\n\tgantt: GanttSeriesOptions\n\thighLowBar: HighLowBarSeriesOptions\n\thistogram: HistogramSeriesOptions\n\thorizArea: CartesianSeriesOptions\n\thorizBar: CartesianSeriesOptions\n\tline: CartesianSeriesOptions\n\tnumericGauge: NumericGaugeSeriesOptions\n\tpie: CircularSeriesOptions\n\tpoint: CartesianSeriesOptions\n\tpolar: PolarSeriesOptions\n\tsankey: SankeySeriesOptions\n\tsliced: CircularSeriesOptions\n\ttreemap: TreemapSeriesOptions\n\tviolin: ViolinSeriesOptions\n\tvolume: CartesianSeriesOptions\n}\n\n/** Creates the SVG map when the chart mounts, so options can be declared outside the browser. */\nexport interface MapSeriesOptions extends AxisSeriesOptions {\n\ttype: \"map\"\n\tdata: () => MapDefinition\n}\n\n/** One array of cell values per row. */\nexport interface ColorGridSeriesOptions extends AxisSeriesOptions {\n\ttype: \"colorGrid\"\n\tdata: number[][]\n}\n\nexport interface SurfaceSeriesOptions extends AxisSeriesOptions {\n\ttype: \"surface\"\n\tdata: number[][]\n\twireFrame?: boolean\n}\n\nexport interface LinearGaugeSeriesOptions extends SeriesStyleOptions {\n\ttype: \"linearGauge\"\n\tdata: number\n\tmin?: number\n\tmax?: number\n}\n\nexport type ChartType = keyof SeriesOptionsRegistry\nexport type SeriesOptions = SeriesOptionsRegistry[ChartType]\n\nexport interface ChartDataOptions {\n\tlabels?: string[]\n\tseries: SeriesOptions[]\n}\n\nexport interface AxisOptions {\n\tvisible?: boolean\n\ttitle?: string\n\tminimum?: number\n\tmaximum?: number\n\tincrement?: number\n\troundFirst?: boolean\n\ttitleVisible?: boolean\n\ttitleColor?: string\n\ttitleFontSize?: number\n\tticksVisible?: boolean\n\t/** Position of the axis as a percentage across the chart. */\n\tposition?: number\n\tinnerTicksVisible?: boolean\n\tminorTicksVisible?: boolean\n\tlineColor?: string\n\tlineWidth?: number\n\tinverted?: boolean\n\tlog?: boolean\n\theadroom?: number\n\tgrid?: {\n\t\tvisible?: boolean\n\t\tcentered?: boolean\n\t\tlineDash?: boolean\n\t\tlineColor?: string\n\t\tlineWidth?: number\n\t\t/** Fill color of alternating grid bands; an empty string disables the fill. */\n\t\tbandColor?: string\n\t}\n\tlabels?: {\n\t\tvisible?: boolean\n\t\tdecimals?: number\n\t\tfixedDecimals?: boolean\n\t\trotation?: number\n\t\tlabelStyle?: string\n\t\tdateFormat?: string\n\t\tvalueFormat?: string\n\t}\n}\n\nexport interface ZoomOptions {\n\tenabled?: boolean\n\tdirection?: \"both\" | \"horizontal\" | \"vertical\"\n\tkeepAspect?: boolean\n\tmouseButton?: number\n\twheel?: {\n\t\tenabled?: boolean\n\t\tfactor?: number\n\t}\n}\n\nexport interface ScrollOptions {\n\tenabled?: boolean\n\tdirection?: \"both\" | \"horizontal\" | \"vertical\"\n\tmouseButton?: number\n}\n\nexport interface PanelOptions {\n\tbackgroundColor?: string\n\tborderColor?: string\n\tborderWidth?: number\n\ttransparent?: boolean\n\tshadow?: boolean\n\t/** Corner radius of the chart panel, in pixels. */\n\tborderRadius?: number\n\t/** Enables a panel fill gradient. */\n\tgradientVisible?: boolean\n\t/** Colors used by the panel fill gradient. */\n\tgradientColors?: string[]\n\tmargins?: { left?: number; top?: number; right?: number; bottom?: number }\n}\n\nexport interface DOMTipOptions {\n\tenabled?: boolean\n}\n\nexport interface TooltipOptions {\n\tenabled?: boolean\n\t/** Shows visible cartesian series at the hovered category or x value in the default tooltip. */\n\tshared?: boolean\n\trender?: \"dom\" | \"canvas\"\n\tautoHide?: boolean\n\tdelay?: number\n\tanimated?: number\n\tautoRedraw?: boolean\n\tfindPoint?: boolean\n\t/** When true, the DOM tooltip follows the pointer instead of staying anchored to the hovered point. Defaults to false. */\n\tfollowCursor?: boolean\n\trealTime?: boolean\n\t/** Adds x value, share of total, difference from the average, extremes and position to the DOM tooltip. */\n\textended?: boolean\n\tdomStyle?: string\n\tformat?: (series: Series, index: number) => string | Promise<string>\n\tpointer?: {\n\t\tvisible?: boolean\n\t\tfill?: string\n\t\tfirstCircleRadius?: number\n\t\tsecondCircleRadius?: number\n\t\tfirstCircleOpacity?: number\n\t\tsecondCircleOpacity?: number\n\t\tanimationVisible?: boolean\n\t\tanimationDuration?: number\n\t}\n}\n\nexport interface AnimationOptions {\n\t/** Duration in milliseconds. */\n\tduration?: number\n\t/** Animation style. Defaults to `\"axis\"`. */\n\tkind?: \"axis\" | \"left\" | \"top\" | \"right\" | \"bottom\" | \"x\" | \"y\" | \"each\" | \"all\" | \"zoomin\" | \"zoomout\"\n\tmode?: \"linear\" | \"exponential\"\n\t/** Fades the listed elements in while the series animate. */\n\tfade?: {\n\t\tduration?: number\n\t\tseries?: boolean\n\t\tmarks?: boolean\n\t\tlegend?: boolean\n\t\ttitle?: boolean\n\t\taxes?: boolean\n\t\tpanel?: boolean\n\t}\n}\n\nexport interface CursorToolOptions {\n\tenabled?: boolean\n\tdirection?: \"both\" | \"horizontal\" | \"vertical\"\n\trender?: \"full\" | \"copy\" | \"layer\"\n\tfollowMouse?: boolean\n\tcolor?: string\n\twidth?: number\n\tsymbol?: \"circle\" | \"square\" | \"diamond\" | \"none\"\n\tsymbolSize?: number\n}\n\nexport interface DragToolOptions {\n\tenabled?: boolean\n}\n\nexport interface AnnotationOptions {\n\ttext: string\n\t/** Left position in pixels. */\n\tx?: number\n\t/** Top position in pixels. */\n\ty?: number\n\tvisible?: boolean\n\ttransparent?: boolean\n\tbackgroundColor?: string\n\tborderColor?: string\n\tborderWidth?: number\n\tfontColor?: string\n\tfontSize?: number\n\tfontFamily?: string\n}\n\nexport interface ToolsOptions {\n\tcursor?: CursorToolOptions\n\tdrag?: DragToolOptions\n\tannotations?: AnnotationOptions[]\n}\n\n/** Listeners for the events of a chart, by event name. See `ChartEventMap` for their arguments. */\nexport type ChartListeners = { [K in keyof ChartEventMap]?: EventListener<ChartEventMap[K]> }\n\n/** Declarative chart title settings. */\nexport interface ChartTitleOptions {\n\ttext?: string\n\tvisible?: boolean\n\tfontSize?: number\n\tfontFamily?: string\n\tcolor?: string\n\texpand?: boolean\n}\n\nexport interface ChartOptions {\n\t/** Plugins used only by this chart, in addition to globally registered plugins. */\n\tplugins?: ChartPlugin[]\n\t/** Per-chart plugin options keyed by id. Use `false` to disable a registered plugin on this chart. */\n\tpluginOptions?: ChartPluginOptions\n\t/** Series type used by series that do not declare their own. Defaults to `\"line\"`. */\n\ttype?: ChartType\n\tdata?: ChartDataOptions\n\ttitle?: string | ChartTitleOptions\n\tsubtitle?: string\n\tfooter?: string\n\t/**\n\t * Theme applied when the chart is created. Defaults to `\"minimal\"`; use `null` to keep the engine\n\t * defaults untouched. Theme and palette are applied before the rest of the options.\n\t */\n\ttheme?: ChartTheme | null\n\tpalette?: PaletteName | string[]\n\tlegend?: {\n\t\tvisible?: boolean\n\t\tposition?: LegendPosition\n\t\t/** Text drawn above a vertical legend. */\n\t\ttitle?: string\n\t\tstyle?: LegendStyle\n\t\tvalueFormat?: LegendValueFormat\n\t\tinteraction?: LegendInteraction\n\t\t/** Lists the items in reverse order. */\n\t\tinverted?: boolean\n\t\t/** Draws each item text with the color of its series or point. */\n\t\tfontColor?: boolean\n\t\tfontSize?: number\n\t\t/** Item text color. */\n\t\tcolor?: string\n\t\t/** Item text color under the mouse; an empty string keeps `color`. */\n\t\thoverColor?: string\n\t\t/** Fill of the rounded highlight behind the item under the mouse; an empty string draws none. */\n\t\thoverBackground?: string\n\t\t/** Legend background; `null` makes it transparent. */\n\t\tbackground?: string | null\n\t\t/** Horizontal space between the items of a horizontal legend, in pixels; use `rowGap` for vertical legends. */\n\t\titemGap?: number\n\t\t/** Vertical space between rows of items, in pixels. */\n\t\trowGap?: number\n\t\tsymbol?: {\n\t\t\tstyle?: LegendSymbolShape\n\t\t\t/** Sets both the width and the height of the symbol, in pixels. */\n\t\t\tsize?: number\n\t\t\twidth?: number\n\t\t\theight?: number\n\t\t\t/** Space between the symbol and the item text, in pixels. */\n\t\t\tpadding?: number\n\t\t\t/** Corner radius of rectangle symbols, in pixels. */\n\t\t\tradius?: number\n\t\t\t/** Shows the line and pointer style from each series in the legend. */\n\t\t\tuseSeriesPointer?: boolean\n\t\t}\n\t}\n\taxes?: {\n\t\tbottom?: AxisOptions\n\t\tleft?: AxisOptions\n\t\ttop?: AxisOptions\n\t\tright?: AxisOptions\n\t}\n\tpanel?: PanelOptions\n\taspect?: { clip?: boolean; view3d?: boolean }\n\twalls?: { visible?: boolean }\n\tdomTip?: DOMTipOptions\n\ttooltip?: TooltipOptions\n\tzoom?: ZoomOptions\n\tscroll?: ScrollOptions\n\t/**\n\t * Device pixels per drawing unit, or `\"auto\"` for `window.devicePixelRatio`. Renders sharper on high\n\t * density screens at the cost of more pixels to paint. Defaults to 1.\n\t */\n\tpixelRatio?: number | \"auto\"\n\t/** Labels the canvas for screen readers, which cannot read what is painted on it. */\n\taccessibility?: AccessibilityOptions\n\t/**\n\t * Resizes the chart whenever its canvas changes display size, using `ResizeObserver`. The observer is\n\t * removed when the chart is destroyed.\n\t */\n\tresponsive?: boolean\n\t/** Plays an entrance animation once the series are added. */\n\tanimation?: AnimationOptions\n\ttools?: ToolsOptions\n\t/**\n\t * Event listeners. They are attached to the chart, replaced as a group when `on` is set again, and\n\t * removed by `Chart.destroy`. Use `chart.on` for listeners that are not part of the options.\n\t */\n\ton?: ChartListeners\n}\n\n/** Chart option sections that can be restored to TeeChart.js defaults. */\nexport type ResettableChartOption =\n\t| \"data\"\n\t| \"domTip\"\n\t| \"footer\"\n\t| \"legend\"\n\t| \"on\"\n\t| \"palette\"\n\t| \"panel\"\n\t| \"pluginOptions\"\n\t| \"scroll\"\n\t| \"subtitle\"\n\t| \"theme\"\n\t| \"title\"\n\t| \"tooltip\"\n\t| \"type\"\n\t| \"zoom\"\n\nconst DEFAULT_THEME: ChartTheme = \"modern\"\nconst DEFAULT_SERIES_TYPE: ChartType = \"line\"\n\n// Only these types are always available. Registering the rest lazily keeps `Chart` tree-shakable;\n// see `registerAllSeriesTypes`.\nregisterBuiltInSeriesType(\"area\", Area)\nregisterBuiltInSeriesType(\"bar\", Bar)\nregisterBuiltInSeriesType(\"bubble\", Bubble)\nregisterBuiltInSeriesType(\"donut\", Donut)\nregisterBuiltInSeriesType(\"line\", Line)\nregisterBuiltInSeriesType(\"pie\", Pie)\nregisterBuiltInSeriesType(\"point\", PointXY)\n\nconst markKeys = [\"visible\", \"style\", \"drawEvery\", \"showZero\", \"placement\", \"connector\"] as const\nconst pointerKeys = [\"visible\", \"style\", \"width\", \"height\", \"colorEach\"] as const\n\nexport function isChartOptions(value: unknown): value is ChartOptions {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction requireSeriesType(type: unknown): SeriesTypeDefinition {\n\tconst definition = typeof type === \"string\" ? getSeriesType(type) : undefined\n\tif (!definition) {\n\t\tthrow new Error(\n\t\t\t`Unknown series type ${JSON.stringify(type)}. Types other than area, bar, bubble, donut, line, pie and point ` +\n\t\t\t\t\"must be registered first with registerSeriesType or registerAllSeriesTypes.\"\n\t\t)\n\t}\n\treturn definition\n}\n\ninterface OptionSections {\n\ttools: (chart: Chart, options: ToolsOptions) => void\n\tanimation: (chart: Chart, options: AnimationOptions) => void\n\t/** Returns a function that stops keeping the accessible texts up to date. */\n\taccessibility: (chart: Chart, options: AccessibilityOptions) => () => void\n\t/** Returns a function that stops observing the canvas size. */\n\tresponsive: (chart: Chart) => () => void\n}\n\nconst optionSections: Partial<OptionSections> = {}\n\n/**\n * Enables a chart option section whose implementation is kept out of the core bundle. See\n * `registerAllOptions`.\n * @internal\n */\nexport function registerOptionSection<K extends keyof OptionSections>(name: K, apply: OptionSections[K]): void {\n\toptionSections[name] = apply\n}\n\nfunction requireOptionSection<K extends keyof OptionSections>(name: K): OptionSections[K] {\n\tconst apply = optionSections[name] as OptionSections[K] | undefined\n\tif (!apply) throw new Error(`The \"${name}\" option requires registerAllOptions() to be called first.`)\n\treturn apply\n}\n\n/**\n * Returns the chart tool of the given class, adding one when the chart has none.\n * @internal\n */\nexport function findOrAddTool<T extends Tool>(chart: Chart, ToolClass: new (chart: Chart) => T): T {\n\tconst existing = chart.tools.items.find((tool): tool is T => tool instanceof ToolClass)\n\tif (existing) return existing\n\n\tconst tool = new ToolClass(chart)\n\tchart.tools.add(tool)\n\treturn tool\n}\n\nfunction applyThemeOptions(chart: Chart, options: ChartOptions): void {\n\tif (options.theme === null) return\n\tchart.applyTheme(options.theme ?? DEFAULT_THEME)\n}\n\nfunction applyLegendOptions(chart: Chart, options: NonNullable<ChartOptions[\"legend\"]>): void {\n\tconst legend = chart.legend\n\tif (options.visible !== undefined) legend.visible = options.visible\n\tif (options.position !== undefined) legend.position = options.position\n\tif (options.title !== undefined) legend.title.text = options.title\n\tif (options.style !== undefined) legend.legendStyle = options.style\n\tif (options.valueFormat !== undefined) legend.textStyle = options.valueFormat\n\tif (options.interaction !== undefined) legend.activeStyle = options.interaction\n\tif (options.inverted !== undefined) legend.inverted = options.inverted\n\tif (options.fontColor !== undefined) legend.fontColor = options.fontColor\n\tif (options.fontSize !== undefined) legend.format.font.setSize(options.fontSize)\n\tif (options.color !== undefined) legend.format.font.fill = options.color\n\tif (options.hoverColor !== undefined) legend.hover.font.fill = options.hoverColor\n\tif (options.hoverBackground !== undefined) legend.hoverBackground = options.hoverBackground\n\tif (options.itemGap !== undefined) legend.itemGap = options.itemGap\n\tif (options.rowGap !== undefined) legend.rowGap = options.rowGap\n\tif (options.background !== undefined) {\n\t\tlegend.transparent = options.background === null\n\t\tif (options.background !== null) legend.format.fill = options.background\n\t}\n\n\tconst symbol = options.symbol\n\tif (symbol === undefined) return\n\tif (symbol.style !== undefined) legend.symbol.style = symbol.style\n\tif (symbol.size !== undefined) {\n\t\tlegend.symbol.width = symbol.size\n\t\tlegend.symbol.height = symbol.size\n\t}\n\tif (symbol.width !== undefined) legend.symbol.width = symbol.width\n\tif (symbol.height !== undefined) legend.symbol.height = symbol.height\n\tif (symbol.padding !== undefined) legend.symbol.padding = symbol.padding\n\tif (symbol.radius !== undefined) {\n\t\tlegend.symbol.format.round.x = symbol.radius\n\t\tlegend.symbol.format.round.y = symbol.radius\n\t}\n\tif (symbol.useSeriesPointer !== undefined) legend.symbol.useSeriesPointer = symbol.useSeriesPointer\n}\n\nfunction applyPanelOptions(chart: Chart, panel: PanelOptions): void {\n\tif (panel.backgroundColor !== undefined) chart.panel.format.fill = panel.backgroundColor\n\tif (panel.borderColor !== undefined) chart.panel.format.stroke.fill = panel.borderColor\n\tif (panel.borderWidth !== undefined) chart.panel.format.stroke.size = panel.borderWidth\n\tif (panel.transparent !== undefined) chart.panel.transparent = panel.transparent\n\tif (panel.shadow !== undefined) chart.panel.format.shadow.visible = panel.shadow\n\tif (panel.borderRadius !== undefined) {\n\t\tchart.panel.format.round.x = panel.borderRadius\n\t\tchart.panel.format.round.y = panel.borderRadius\n\t}\n\tif (panel.gradientVisible !== undefined) chart.panel.format.gradient.visible = panel.gradientVisible\n\tif (panel.gradientColors !== undefined) chart.panel.format.gradient.colors = [...panel.gradientColors]\n\tif (panel.margins !== undefined) Object.assign(chart.panel.margins, panel.margins)\n}\n\nfunction applyAspectOptions(chart: Chart, aspect: NonNullable<ChartOptions[\"aspect\"]>): void {\n\tif (aspect.clip !== undefined) chart.aspect.clip = aspect.clip\n\tif (aspect.view3d !== undefined) chart.aspect.view3d = aspect.view3d\n}\n\nfunction applyTooltipOptions(chart: Chart, options: TooltipOptions): void {\n\tconst tooltip = findOrAddTool(chart, ToolTip)\n\n\tif (options.enabled !== undefined) tooltip.active = options.enabled\n\tif (options.shared !== undefined) tooltip.shared = options.shared\n\tif (options.render !== undefined) tooltip.render = options.render\n\tif (options.autoHide !== undefined) tooltip.autoHide = options.autoHide\n\tif (options.delay !== undefined) tooltip.delay = options.delay\n\tif (options.animated !== undefined) tooltip.animated = options.animated\n\tif (options.autoRedraw !== undefined) tooltip.autoRedraw = options.autoRedraw\n\tif (options.findPoint !== undefined) tooltip.findPoint = options.findPoint\n\tif (options.followCursor !== undefined) tooltip.followCursor = options.followCursor\n\tif (options.realTime !== undefined) tooltip.realTime = options.realTime\n\tif (options.extended !== undefined) tooltip.extended = options.extended\n\tif (options.domStyle !== undefined) tooltip.domStyle = options.domStyle\n\tif (options.format !== undefined)\n\t\ttooltip.ongettext = (_tool, _text, series, index) => options.format?.(series, index) ?? \"\"\n\tif (options.pointer !== undefined) Object.assign(tooltip.pointer, options.pointer)\n}\n\nfunction applyAxisOptions(chart: Chart, name: \"bottom\" | \"left\" | \"top\" | \"right\", options: AxisOptions): void {\n\tconst axis = chart.axes[name]\n\tif (options.visible !== undefined) axis.visible = options.visible\n\tif (options.title !== undefined) axis.title.text = options.title\n\tif (options.minimum !== undefined || options.maximum !== undefined) {\n\t\taxis.setMinMax(options.minimum ?? axis.minimum, options.maximum ?? axis.maximum)\n\t}\n\tif (options.inverted !== undefined) axis.inverted = options.inverted\n\tif (options.log !== undefined) axis.log = options.log\n\tif (options.headroom !== undefined) axis.headroom = options.headroom\n\tif (options.increment !== undefined) axis.increment = options.increment\n\tif (options.roundFirst !== undefined) axis.labels.roundFirst = options.roundFirst\n\tif (options.titleVisible !== undefined) axis.title.visible = options.titleVisible\n\tif (options.titleColor !== undefined) axis.title.format.font.fill = options.titleColor\n\tif (options.titleFontSize !== undefined) axis.title.format.font.setSize(options.titleFontSize)\n\tif (options.ticksVisible !== undefined) axis.ticks.visible = options.ticksVisible\n\tif (options.position !== undefined) axis.position = options.position\n\tif (options.innerTicksVisible !== undefined) axis.innerTicks.visible = options.innerTicksVisible\n\tif (options.minorTicksVisible !== undefined) axis.minorTicks.visible = options.minorTicksVisible\n\tif (options.lineColor !== undefined) axis.format.stroke.fill = options.lineColor\n\tif (options.lineWidth !== undefined) axis.format.stroke.size = options.lineWidth\n\tif (options.grid?.visible !== undefined) axis.grid.visible = options.grid.visible\n\tif (options.grid?.centered !== undefined) axis.grid.centered = options.grid.centered\n\tif (options.grid?.lineDash !== undefined) axis.grid.lineDash = options.grid.lineDash\n\tif (options.grid?.lineColor !== undefined) axis.grid.format.stroke.fill = options.grid.lineColor\n\tif (options.grid?.lineWidth !== undefined) axis.grid.format.stroke.size = options.grid.lineWidth\n\tif (options.grid?.bandColor !== undefined) axis.grid.format.fill = options.grid.bandColor\n\n\tconst labels = options.labels\n\tif (!labels) return\n\tif (labels.visible !== undefined) axis.labels.visible = labels.visible\n\tif (labels.decimals !== undefined) axis.labels.decimals = labels.decimals\n\tif (labels.fixedDecimals !== undefined) axis.labels.fixedDecimals = labels.fixedDecimals\n\tif (labels.rotation !== undefined) axis.labels.rotation = labels.rotation\n\tif (labels.labelStyle !== undefined) axis.labels.labelStyle = labels.labelStyle\n\tif (labels.dateFormat !== undefined) axis.labels.dateFormat = labels.dateFormat\n\tif (labels.valueFormat !== undefined) axis.labels.valueFormat = labels.valueFormat\n}\n\nfunction applyZoomOptions(chart: Chart, zoom: ZoomOptions): void {\n\tif (zoom.enabled !== undefined) chart.zoom.enabled = zoom.enabled\n\tif (zoom.direction !== undefined) chart.zoom.direction = zoom.direction\n\tif (zoom.keepAspect !== undefined) chart.zoom.keepAspect = zoom.keepAspect\n\tif (zoom.mouseButton !== undefined) chart.zoom.mouseButton = zoom.mouseButton\n\tif (zoom.wheel?.enabled !== undefined) chart.zoom.wheel.enabled = zoom.wheel.enabled\n\tif (zoom.wheel?.factor !== undefined) chart.zoom.wheel.factor = zoom.wheel.factor\n}\n\nfunction applyScrollOptions(chart: Chart, scroll: ScrollOptions): void {\n\tif (scroll.enabled !== undefined) chart.scroll.enabled = scroll.enabled\n\tif (scroll.direction !== undefined) chart.scroll.direction = scroll.direction\n\tif (scroll.mouseButton !== undefined) chart.scroll.mouseButton = scroll.mouseButton\n}\n\nfunction unsupportedOption(type: string, option: string): never {\n\tthrow new Error(`Series type ${JSON.stringify(type)} does not support the \"${option}\" option`)\n}\n\nfunction applySeriesStyle(series: Series, options: SeriesStyleOptions): void {\n\tif (options.label !== undefined) series.title = options.label\n\tif (options.visible !== undefined) series.visible = options.visible\n\tif (options.borderColor !== undefined) series.format.stroke.fill = options.borderColor\n\tif (options.backgroundColor !== undefined) series.format.fill = options.backgroundColor\n\tif (options.borderWidth !== undefined) series.format.stroke.size = options.borderWidth\n\tif (options.shadow !== undefined) series.format.shadow.visible = options.shadow\n\tif (options.hoverColor !== undefined) series.hover.stroke.fill = options.hoverColor\n\tif (options.hoverEnabled !== undefined) series.hover.enabled = options.hoverEnabled\n\tif (options.gradientVisible !== undefined) series.format.gradient.visible = options.gradientVisible\n\tif (options.gradientColors !== undefined) series.format.gradient.colors = [...options.gradientColors]\n\tif (options.image !== undefined) series.format.image.url = options.image.url\n\tif (options.transparency !== undefined) series.format.transparency = options.transparency\n\tif (options.cursor !== undefined) series.cursor = options.cursor\n\tif (options.maxPoints !== undefined) series.maxPoints = options.maxPoints\n\tif (options.legend?.visible !== undefined) series.legend.visible = options.legend.visible\n\tif (options.legend?.symbol !== undefined) series.legend.symbol = { ...series.legend.symbol, ...options.legend.symbol }\n\tif (options.colorEach !== undefined) {\n\t\tseries.colorEach = options.colorEach === true ? \"yes\" : options.colorEach === false ? \"no\" : options.colorEach\n\t}\n\n\tconst marks = options.marks\n\tif (!marks) return\n\tif (marks.backgroundColor !== undefined) series.marks.format.fill = marks.backgroundColor\n\tif (marks.borderColor !== undefined) series.marks.format.stroke.fill = marks.borderColor\n\tif (marks.fontColor !== undefined) series.marks.format.font.fill = marks.fontColor\n\tif (marks.fontSize !== undefined) series.marks.format.font.setSize(marks.fontSize)\n\tif (marks.borderRadius !== undefined) {\n\t\tseries.marks.format.round.x = marks.borderRadius\n\t\tseries.marks.format.round.y = marks.borderRadius\n\t}\n\tif (marks.margins !== undefined) Object.assign(series.marks.margins, marks.margins)\n\tfor (const key of markKeys) {\n\t\tif (marks[key] !== undefined) Object.assign(series.marks, { [key]: marks[key] })\n\t}\n}\n\ninterface SeriesCapabilityOptions {\n\thorizAxis?: HorizontalAxisName\n\tvertAxis?: VerticalAxisName\n\tpointer?: PointerOptions\n\tstacked?: StackMode\n\tsmooth?: number\n\tstairs?: boolean\n\ttreatNulls?: \"skip\" | \"dontPaint\"\n\tbarSize?: number\n\tmaxRadius?: number\n}\n\n/** Applies options that only some series support, failing clearly when the series type lacks them. */\nfunction applySeriesCapabilities(series: Series, type: string, options: SeriesCapabilityOptions): void {\n\tif (options.horizAxis !== undefined || options.vertAxis !== undefined) {\n\t\tif (series.useAxes === false) unsupportedOption(type, options.horizAxis !== undefined ? \"horizAxis\" : \"vertAxis\")\n\t\tif (options.horizAxis !== undefined) series.horizAxis = options.horizAxis\n\t\tif (options.vertAxis !== undefined) series.vertAxis = options.vertAxis\n\t}\n\n\tif (options.pointer !== undefined) {\n\t\tconst pointer = pointerOf(series)\n\t\tif (!pointer) unsupportedOption(type, \"pointer\")\n\t\tfor (const key of pointerKeys) {\n\t\t\tif (options.pointer[key] !== undefined) Object.assign(pointer, { [key]: options.pointer[key] })\n\t\t}\n\t\tif (options.pointer.strokeWidth !== undefined) pointer.format.stroke.size = options.pointer.strokeWidth\n\t\tif (options.pointer.strokeColor !== undefined) pointer.format.stroke.fill = options.pointer.strokeColor\n\t\tif (options.pointer.shadow !== undefined) pointer.format.shadow.visible = options.pointer.shadow\n\t}\n\n\tif (options.stacked !== undefined) {\n\t\tif (series.stacked === undefined) unsupportedOption(type, \"stacked\")\n\t\tseries.stacked = options.stacked\n\t}\n\t// Point and bubble series have no connecting line to curve or step.\n\tconst hasLine = !(series instanceof PointXY)\n\tif (options.smooth !== undefined) {\n\t\tconst curved = series as Series & { smooth?: number }\n\t\tif (!hasLine || typeof curved.smooth !== \"number\") unsupportedOption(type, \"smooth\")\n\t\tcurved.smooth = options.smooth\n\t}\n\tif (options.stairs !== undefined) {\n\t\tconst stepped = series as Series & { stairs?: boolean }\n\t\tif (!hasLine || typeof stepped.stairs !== \"boolean\") unsupportedOption(type, \"stairs\")\n\t\tstepped.stairs = options.stairs\n\t}\n\tif (options.treatNulls !== undefined) {\n\t\tif (!(\"treatNulls\" in series)) unsupportedOption(type, \"treatNulls\")\n\t\t;(series as Series & { treatNulls: \"skip\" | \"dontPaint\" }).treatNulls = options.treatNulls\n\t}\n\tif (options.barSize !== undefined) {\n\t\tconst bar = series as Series & { barSize?: number }\n\t\tif (typeof bar.barSize !== \"number\") unsupportedOption(type, \"barSize\")\n\t\tbar.barSize = options.barSize\n\t}\n\tif (options.maxRadius !== undefined) {\n\t\tconst circular = series as Series & { maxRadius?: number }\n\t\tif (typeof circular.maxRadius !== \"number\") unsupportedOption(type, \"maxRadius\")\n\t\tcircular.maxRadius = options.maxRadius\n\t}\n}\n\n/** Applies the `x` option, which gives each point its own horizontal position. */\nfunction applyPositions(series: Series, type: string, options: { x?: Array<number | Date> }): void {\n\tconst positions = options.x\n\tif (positions === undefined) return\n\n\tif (series.useAxes === false) unsupportedOption(type, \"x\")\n\tif (!Array.isArray(positions) || positions.length !== series.data.values.length) {\n\t\tthrow new Error(\n\t\t\t`The \"x\" option of a ${type} series needs one value for each of its ${series.data.values.length} points`\n\t\t)\n\t}\n\n\tseries.data.x = [...positions]\n}\n\nconst cartesianValueTypes: ReadonlySet<string> = new Set([\n\t\"area\",\n\t\"bar\",\n\t\"bubble\",\n\t\"horizArea\",\n\t\"horizBar\",\n\t\"line\",\n\t\"point\",\n\t\"volume\"\n])\n\nfunction cartesianPoints(\n\ttype: string,\n\tdata: unknown,\n\toptions: { x?: Array<number | Date>; xKey?: string; yKey?: string }\n): CartesianDataPoint[] | undefined {\n\tif (!cartesianValueTypes.has(type) || !Array.isArray(data) || data.length === 0) return undefined\n\tif (!data.some(point => typeof point === \"object\" && point !== null)) return undefined\n\tif (options.x !== undefined)\n\t\tthrow new Error(`The \"x\" option cannot be combined with object data points in a ${type} series`)\n\tconst xKey = options.xKey ?? \"x\"\n\tconst yKey = options.yKey ?? \"y\"\n\treturn data.map((point): CartesianDataPoint => {\n\t\tif (typeof point !== \"object\" || point === null || !(xKey in point) || !(yKey in point)) {\n\t\t\tthrow new TypeError(`The data of a ${type} series must contain the \"${xKey}\" and \"${yKey}\" properties`)\n\t\t}\n\t\tconst row = point as Record<string, unknown>\n\t\tconst x = row[xKey]\n\t\tconst y = row[yKey]\n\t\tif (!(typeof x === \"number\" || x instanceof Date) || typeof y !== \"number\") {\n\t\t\tthrow new TypeError(`The \"${xKey}\" property must be a number or Date and \"${yKey}\" must be a number`)\n\t\t}\n\t\treturn { x, y }\n\t})\n}\n\nfunction populateSeries(\n\tseries: Series,\n\tdefinition: SeriesTypeDefinition,\n\ttype: string,\n\toptions: SeriesOptions,\n\tlabels: readonly string[] | undefined\n): void {\n\tconst points = cartesianPoints(\n\t\ttype,\n\t\toptions.data,\n\t\toptions as { x?: Array<number | Date>; xKey?: string; yKey?: string }\n\t)\n\tconst data = points ? points.map(point => point.y) : options.data\n\tif (definition.setData) definition.setData(series, data, labels)\n\telse series.setData(data as number[], labels, false)\n\n\tif (points) series.data.x = points.map(point => point.x)\n\telse applyPositions(series, type, options as { x?: Array<number | Date> })\n\tdefinition.configure?.(series, options)\n\tapplySeriesStyle(series, options)\n\t// Types without these options are rejected at compile time; the guards in the applier cover plain JavaScript.\n\tapplySeriesCapabilities(series, type, options as SeriesStyleOptions & SeriesCapabilityOptions)\n}\n\nfunction createSeries(options: SeriesOptions, type: string, labels: readonly string[] | undefined): Series {\n\tconst definition = requireSeriesType(type)\n\tconst series = definition.create()\n\tpopulateSeries(series, definition, type, options, labels)\n\treturn series\n}\n\ninterface ManagedSeries {\n\tid?: string\n\ttype: string\n\tseries: Series\n}\n\n/** What a chart remembers about the options applied to it, so later updates can be merged and reconciled. */\ninterface DeclarativeState {\n\toptions: ChartOptions\n\tseries: ManagedSeries[]\n\t/** Removes the listeners that came from the `on` option. */\n\tlisteners: Array<() => void>\n\t/** Stops refreshing the generated accessible texts. */\n\tstopAccessibility?: () => void\n\t/** Stops observing the canvas size. */\n\tstopResponsive?: () => void\n}\n\nconst states = new WeakMap<Chart, DeclarativeState>()\n\ntype PlainObject = Record<string, unknown>\n\nfunction isPlainObject(value: unknown): value is PlainObject {\n\tif (typeof value !== \"object\" || value === null) return false\n\tconst prototype = Object.getPrototypeOf(value)\n\treturn prototype === Object.prototype || prototype === null\n}\n\nfunction cloneValue(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(cloneValue)\n\tif (isPlainObject(value))\n\t\treturn Object.fromEntries(Object.entries(value).map(([key, item]) => [key, cloneValue(item)]))\n\treturn value\n}\n\n/** Merges plain objects recursively; arrays and any other value in `patch` replace the one in `base`. */\nfunction mergeValue(base: unknown, patch: unknown): unknown {\n\tif (!isPlainObject(base) || !isPlainObject(patch)) return patch\n\n\tconst result: PlainObject = { ...base }\n\tfor (const [key, value] of Object.entries(patch)) {\n\t\tif (value !== undefined) result[key] = mergeValue(base[key], value)\n\t}\n\treturn result\n}\n\n/** Identified series are matched by id; other series are matched by position. */\nfunction mergeSeriesOptions(\n\tbase: readonly SeriesOptions[] | undefined,\n\tpatch: readonly SeriesOptions[],\n\tbaseType: string,\n\tpatchType: string\n): SeriesOptions[] {\n\treturn patch.map((entry, index) => {\n\t\tconst positional = base?.[index]\n\t\tconst previous =\n\t\t\tentry.id === undefined\n\t\t\t\t? positional?.id === undefined\n\t\t\t\t\t? positional\n\t\t\t\t\t: undefined\n\t\t\t\t: base?.find(item => item.id === entry.id)\n\t\tif (!previous || (previous.type ?? baseType) !== (entry.type ?? patchType)) return entry\n\n\t\t// `data` is replaced as a whole: merging two data trees or row lists would mix old and new values.\n\t\tconst { data: _previousData, ...previousRest } = previous\n\t\tconst { data, ...entryRest } = entry\n\t\treturn { ...(mergeValue(previousRest, entryRest) as PlainObject), data } as unknown as SeriesOptions\n\t})\n}\n\nfunction mergeOptions(base: ChartOptions, patch: ChartOptions): ChartOptions {\n\tconst { data, ...rest } = patch\n\tconst merged = mergeValue(base, rest) as ChartOptions\n\tif (data === undefined) return merged\n\n\tconst baseType = base.type ?? DEFAULT_SERIES_TYPE\n\tconst patchType = merged.type ?? DEFAULT_SERIES_TYPE\n\treturn {\n\t\t...merged,\n\t\tdata: {\n\t\t\tlabels: data.labels ?? base.data?.labels,\n\t\t\tseries: mergeSeriesOptions(base.data?.series, data.series, baseType, patchType)\n\t\t}\n\t}\n}\n\nconst chartEventNames: ReadonlySet<string> = new Set([\n\t\"draw\",\n\t\"resize\",\n\t\"zoom\",\n\t\"zoomreset\",\n\t\"scroll\",\n\t\"seriesclick\",\n\t\"pointfocus\",\n\t\"destroy\"\n])\n\n/** Checks the `on` option before anything is applied. */\nfunction validListeners(on: ChartListeners | undefined): Array<[keyof ChartEventMap, EventListener<never[]>]> {\n\tconst result: Array<[keyof ChartEventMap, EventListener<never[]>]> = []\n\tfor (const [name, listener] of Object.entries(on ?? {})) {\n\t\tif (!chartEventNames.has(name)) throw new Error(`Unknown chart event ${JSON.stringify(name)}`)\n\t\tif (typeof listener !== \"function\") throw new TypeError(`The \"${name}\" listener must be a function`)\n\t\tresult.push([name as keyof ChartEventMap, listener as EventListener<never[]>])\n\t}\n\treturn result\n}\n\ninterface SeriesPlanItem {\n\ttype: string\n\tentry: SeriesOptions\n\tcreated: Series\n\tprevious: ManagedSeries | undefined\n\treusable: Series | undefined\n}\n\nfunction validateSeriesIds(entries: readonly SeriesOptions[] | undefined): void {\n\tconst ids = new Set<string>()\n\tfor (const entry of entries ?? []) {\n\t\tif (entry.id === undefined) continue\n\t\tif (!entry.id.trim()) throw new Error(\"Series id cannot be empty\")\n\t\tif (ids.has(entry.id)) throw new Error(`Duplicate series id ${JSON.stringify(entry.id)}`)\n\t\tids.add(entry.id)\n\t}\n}\n\n/** Replaces `previous` with `next` in the chart, keeping the drawing order. */\nfunction replaceSeries(chart: Chart, previous: Series, next: Series): void {\n\tconst items = chart.series.items\n\tconst position = items.indexOf(previous)\n\tchart.addSeries(next)\n\titems.splice(items.indexOf(next), 1)\n\titems.splice(position === -1 ? items.length : position, 0, next)\n\tchart.removeSeries(previous, true)\n}\n\nfunction reconcileSeries(\n\tchart: Chart,\n\tplan: SeriesPlanItem[],\n\ttracked: ManagedSeries[],\n\tlabels?: readonly string[]\n): ManagedSeries[] {\n\tconst result: ManagedSeries[] = []\n\n\tplan.forEach(item => {\n\t\tif (item.reusable) {\n\t\t\tpopulateSeries(item.reusable, requireSeriesType(item.type), item.type, item.entry, labels)\n\t\t\tresult.push({ id: item.entry.id, type: item.type, series: item.reusable })\n\t\t\treturn\n\t\t}\n\n\t\tconst previous = item.previous\n\t\tif (previous) replaceSeries(chart, previous.series, item.created)\n\t\telse chart.addSeries(item.created)\n\t\t// Adding the series lets the theme style it; the options of the user win over the theme.\n\t\trequireSeriesType(item.type).configure?.(item.created, item.entry)\n\t\tapplySeriesStyle(item.created, item.entry)\n\t\tapplySeriesCapabilities(item.created, item.type, item.entry as SeriesStyleOptions & SeriesCapabilityOptions)\n\t\tresult.push({ id: item.entry.id, type: item.type, series: item.created })\n\t})\n\n\tconst retained = new Set(result.map(item => item.series))\n\tfor (const extra of tracked) {\n\t\tif (!retained.has(extra.series) && chart.series.items.includes(extra.series)) chart.removeSeries(extra.series, true)\n\t}\n\tconst positions = chart.series.items.flatMap((series, index) => (retained.has(series) ? [index] : []))\n\tfor (const [index, position] of positions.entries()) chart.series.items[position] = result[index].series\n\treturn result\n}\n\n/**\n * Applies options to a chart. `initial` options belong to a new chart and get the default theme; later\n * options are a patch over the options applied before.\n */\nfunction applyOptions(chart: Chart, patch: ChartOptions, initial: boolean): void {\n\tconst state: DeclarativeState = states.get(chart) ?? { options: {}, series: [], listeners: [] }\n\tif (!initial && patch.plugins !== undefined) {\n\t\tthrow new Error(\"The plugins option can only be set when the chart is created\")\n\t}\n\n\tconst merged = mergeOptions(state.options, patch)\n\tconst themeChanged = initial ? merged.theme !== null : patch.theme !== undefined && patch.theme !== null\n\t// A theme or palette rewrites colors and fonts, so every option that refines them is applied again.\n\tconst reapplyAll = initial || themeChanged || patch.palette !== undefined\n\tconst source = reapplyAll ? merged : patch\n\n\t// Resolve everything that can fail before the chart is modified.\n\tconst defaultType = merged.type ?? DEFAULT_SERIES_TYPE\n\trequireSeriesType(defaultType)\n\tconst applyTools = patch.tools !== undefined ? requireOptionSection(\"tools\") : undefined\n\tconst applyAnimation = patch.animation !== undefined ? requireOptionSection(\"animation\") : undefined\n\tconst listeners = patch.on !== undefined ? validListeners(merged.on) : undefined\n\tconst applyAccessibility = patch.accessibility !== undefined ? requireOptionSection(\"accessibility\") : undefined\n\t// Turning responsive off needs nothing registered: there is nothing to stop.\n\tconst observeSize = patch.responsive ? requireOptionSection(\"responsive\") : undefined\n\n\tconst entries = reapplyAll || patch.type !== undefined ? merged.data?.series : patch.data?.series\n\tconst labels = merged.data?.labels\n\tvalidateSeriesIds(entries)\n\tconst plan: SeriesPlanItem[] | undefined = entries?.map((entry, index) => {\n\t\tconst type = entry.type ?? defaultType\n\t\tconst positional = state.series[index]\n\t\tconst previous =\n\t\t\tentry.id === undefined\n\t\t\t\t? positional?.id === undefined\n\t\t\t\t\t? positional\n\t\t\t\t\t: undefined\n\t\t\t\t: state.series.find(item => item.id === entry.id)\n\t\treturn {\n\t\t\ttype,\n\t\t\tentry,\n\t\t\tcreated: createSeries(entry, type, labels),\n\t\t\tprevious,\n\t\t\treusable: previous?.type === type && chart.series.items.includes(previous.series) ? previous.series : undefined\n\t\t}\n\t})\n\n\tif (themeChanged) applyThemeOptions(chart, initial ? merged : { theme: patch.theme })\n\tif (merged.palette !== undefined && reapplyAll) chart.applyPalette(merged.palette)\n\tif (source.pixelRatio !== undefined) chart._applyPixelRatio(source.pixelRatio)\n\tif (typeof source.title === \"string\") {\n\t\tchart.title.text = source.title\n\t\tchart.title.visible = true\n\t} else if (source.title !== undefined) {\n\t\tif (source.title.text !== undefined) chart.title.text = source.title.text\n\t\tif (source.title.visible !== undefined) chart.title.visible = source.title.visible\n\t\tif (source.title.fontSize !== undefined) chart.title.format.font.setSize(source.title.fontSize)\n\t\tif (source.title.fontFamily !== undefined)\n\t\t\tchart.title.format.font.style = `${source.title.fontSize ?? 18}px ${source.title.fontFamily}`\n\t\tif (source.title.color !== undefined) chart.title.format.font.fill = source.title.color\n\t\tif (source.title.expand !== undefined) chart.title.expand = source.title.expand\n\t}\n\tif (source.subtitle !== undefined) chart.subtitle.text = source.subtitle\n\tif (source.footer !== undefined) chart.footer.text = source.footer\n\tif (source.legend !== undefined) applyLegendOptions(chart, source.legend)\n\tif (source.panel !== undefined) applyPanelOptions(chart, source.panel)\n\tif (source.aspect !== undefined) applyAspectOptions(chart, source.aspect)\n\tif (source.walls?.visible !== undefined) chart.walls.visible = source.walls.visible\n\tif (source.domTip?.enabled !== undefined) chart.domTip.enabled = source.domTip.enabled\n\tif (source.tooltip !== undefined) applyTooltipOptions(chart, source.tooltip)\n\tif (source.axes !== undefined) {\n\t\tfor (const [name, axisOptions] of Object.entries(source.axes)) {\n\t\t\tif (axisOptions) applyAxisOptions(chart, name as \"bottom\" | \"left\" | \"top\" | \"right\", axisOptions)\n\t\t}\n\t}\n\tif (source.zoom !== undefined) applyZoomOptions(chart, source.zoom)\n\tif (source.scroll !== undefined) applyScrollOptions(chart, source.scroll)\n\tif (patch.tools !== undefined) applyTools?.(chart, patch.tools)\n\n\tlet tracked = state.series\n\tif (plan) {\n\t\tchart.batchUpdate(() => {\n\t\t\ttracked = reconcileSeries(chart, plan, state.series, labels)\n\t\t})\n\t}\n\n\tlet subscriptions = state.listeners\n\tif (listeners) {\n\t\tfor (const unsubscribe of subscriptions) unsubscribe()\n\t\tsubscriptions = listeners.map(([name, listener]) => chart.on(name, listener as never))\n\t}\n\n\tlet stopAccessibility = state.stopAccessibility\n\tif (patch.accessibility !== undefined && merged.accessibility) {\n\t\tstopAccessibility?.()\n\t\tstopAccessibility = applyAccessibility?.(chart, merged.accessibility)\n\t}\n\n\tlet stopResponsive = state.stopResponsive\n\tif (patch.responsive !== undefined) {\n\t\tstopResponsive?.()\n\t\tstopResponsive = merged.responsive ? observeSize?.(chart) : undefined\n\t}\n\n\tconst previousPluginOptions = chart.pluginOptions\n\tchart.pluginOptions = merged.pluginOptions ?? {}\n\tstates.set(chart, {\n\t\toptions: merged,\n\t\tseries: tracked,\n\t\tlisteners: subscriptions,\n\t\tstopAccessibility,\n\t\tstopResponsive\n\t})\n\tif (!initial) updatePluginActivation(chart, previousPluginOptions, chart.pluginOptions)\n\tif (patch.animation !== undefined) applyAnimation?.(chart, patch.animation)\n}\n\n/** Applies the options a chart is created with: the default theme first, then everything else. */\nexport function applyChartOptions(chart: Chart, options: ChartOptions): void {\n\tapplyOptions(chart, options, true)\n}\n\n/**\n * Applies a patch over the options already applied to the chart. Only the given keys change, series\n * are matched by position, and a theme or palette reapplies the options that refine them.\n */\nexport function updateChartOptions(chart: Chart, patch: ChartOptions): void {\n\tapplyOptions(chart, patch, false)\n}\n\nconst chartOptionDefaults: Partial<Record<ResettableChartOption, unknown>> = {\n\tdata: { series: [] },\n\tdomTip: { enabled: false },\n\tfooter: \"\",\n\tlegend: { visible: true, position: \"bottom\", interaction: \"linethrough\", symbol: { useSeriesPointer: false } },\n\ton: {},\n\tpalette: undefined,\n\tpanel: { backgroundColor: \"white\", transparent: true, shadow: false, borderWidth: 0 },\n\tpluginOptions: {},\n\tscroll: { enabled: false, direction: \"both\", mouseButton: 0 },\n\tsubtitle: \"\",\n\ttheme: DEFAULT_THEME,\n\ttitle: { text: \"TeeChart\", visible: false },\n\ttooltip: {\n\t\tenabled: false,\n\t\tshared: false,\n\t\trender: \"dom\",\n\t\tautoHide: true,\n\t\tdelay: 1000,\n\t\tanimated: true,\n\t\tautoRedraw: true\n\t},\n\ttype: DEFAULT_SERIES_TYPE,\n\tzoom: { enabled: false, direction: \"both\", keepAspect: false, mouseButton: 0, wheel: { enabled: false, factor: 1.1 } }\n}\n\n/** Restores the selected declarative option sections to their TeeChart.js defaults. */\nexport function resetChartOptions(chart: Chart, sections?: readonly ResettableChartOption[]): void {\n\tconst state = states.get(chart)\n\tif (!state) return\n\tconst selected = sections ?? (Object.keys(chartOptionDefaults) as ResettableChartOption[])\n\tconst patch: ChartOptions = {}\n\tfor (const section of selected) {\n\t\tif (!(section in chartOptionDefaults)) throw new TypeError(`The \"${section}\" option cannot be reset`)\n\t}\n\tfor (const section of selected) {\n\t\tdelete state.options[section]\n\t\tconst value = chartOptionDefaults[section]\n\t\tif (value !== undefined) Object.assign(patch, { [section]: cloneValue(value) })\n\t}\n\tif (selected.includes(\"palette\") && patch.theme === undefined) patch.theme = DEFAULT_THEME\n\tapplyOptions(chart, patch, false)\n}\n\n/** Returns a copy of the declarative options applied to the chart so far. */\nexport function getChartOptions(chart: Chart): ChartOptions {\n\tconst options = states.get(chart)?.options ?? {}\n\tconst { plugins, ...rest } = options\n\treturn { ...(cloneValue(rest) as ChartOptions), ...(plugins ? { plugins } : {}) }\n}\n\n/**\n * How to bring a chart that was built from `previous` in line with `next`: `\"none\"` when they are\n * equivalent, `\"patch\"` when `Chart.setOptions` can do it, and `\"recreate\"` when a value was removed or\n * the plugin definitions changed.\n */\nexport type ChartOptionsChange = \"none\" | \"patch\" | \"recreate\"\n\nexport interface ChartOptionsComparison {\n\tchange: ChartOptionsChange\n\t/**\n\t * What to pass to `Chart.setOptions`: only the top level sections whose value changed, so that an\n\t * unchanged `theme` is not reapplied and an unchanged `animation` does not play again. For\n\t * `\"recreate\"` it holds all of `next`, ready for the new chart.\n\t */\n\tpatch: ChartOptions\n}\n\nfunction isDeepEqual(a: unknown, b: unknown): boolean {\n\tif (Object.is(a, b)) return true\n\tif (Array.isArray(a) && Array.isArray(b)) {\n\t\treturn a.length === b.length && a.every((item, index) => isDeepEqual(item, b[index]))\n\t}\n\tif (isPlainObject(a) && isPlainObject(b)) {\n\t\tconst keys = new Set([...Object.keys(a), ...Object.keys(b)])\n\t\tfor (const key of keys) {\n\t\t\tif (!isDeepEqual(a[key], b[key])) return false\n\t\t}\n\t\treturn true\n\t}\n\treturn a instanceof Date && b instanceof Date && a.getTime() === b.getTime()\n}\n\n/** True when `next` still defines every value that `previous` defines. */\nfunction keepsEveryValue(previous: unknown, next: unknown): boolean {\n\tif (previous === undefined) return true\n\tif (next === undefined) return false\n\n\tif (Array.isArray(previous) && Array.isArray(next)) {\n\t\t// Identified series can move; unkeyed entries retain positional matching. Lists may shrink.\n\t\treturn previous.every((item, index) => {\n\t\t\tif (index >= next.length || !isPlainObject(item)) return true\n\t\t\tconst matching =\n\t\t\t\ttypeof item.id === \"string\"\n\t\t\t\t\t? next.find(candidate => isPlainObject(candidate) && candidate.id === item.id)\n\t\t\t\t\t: next[index]\n\t\t\treturn !isPlainObject(matching) || keepsEveryValue(item, matching)\n\t\t})\n\t}\n\tif (isPlainObject(previous) && isPlainObject(next)) {\n\t\treturn Object.keys(previous).every(key => {\n\t\t\tif (key === \"pluginOptions\" && isPlainObject(previous[key]) && isPlainObject(next[key])) {\n\t\t\t\treturn keepsPluginOptions(previous[key] as ChartPluginOptions, next[key] as ChartPluginOptions)\n\t\t\t}\n\t\t\treturn keepsEveryValue(previous[key], next[key])\n\t\t})\n\t}\n\treturn true\n}\n\nfunction keepsPluginOptions(previous: ChartPluginOptions, next: ChartPluginOptions): boolean {\n\treturn Object.keys(previous).every(id => {\n\t\tconst before = previous[id]\n\t\tconst after = next[id]\n\t\tif (before === false || after === false) return true\n\t\treturn keepsEveryValue(before, after)\n\t})\n}\n\nexport function compareChartOptions(\n\tprevious: ChartOptions | undefined,\n\tnext: ChartOptions | undefined\n): ChartOptionsComparison {\n\tconst before = previous ?? {}\n\tconst after = next ?? {}\n\tif (isDeepEqual(before, after)) return { change: \"none\", patch: {} }\n\tif (!isDeepEqual(before.plugins, after.plugins) || !keepsEveryValue(before, after)) {\n\t\treturn { change: \"recreate\", patch: after }\n\t}\n\n\tconst patch: Record<string, unknown> = {}\n\tfor (const [key, value] of Object.entries(after)) {\n\t\tif (!isDeepEqual(before[key as keyof ChartOptions], value)) patch[key] = value\n\t}\n\treturn { change: \"patch\", patch: patch as ChartOptions }\n}\n","import { Axis } from \"./axis.js\"\nimport type { Chart } from \"../../chart.js\"\n\nexport class Axes {\n\tchart: Chart\n\tvisual: unknown\n\tvisible = true\n\ttransparency = 0\n\tleft: Axis\n\ttop: Axis\n\tright: Axis\n\tbottom: Axis\n\titems: Axis[]\n\n\tconstructor(chart: Chart) {\n\t\tthis.chart = chart\n\t\tthis.left = new Axis(chart, false, false)\n\t\tthis.top = new Axis(chart, true, true)\n\t\tthis.right = new Axis(chart, false, true)\n\t\tthis.bottom = new Axis(chart, true, false)\n\t\tthis.items = [this.left, this.top, this.right, this.bottom]\n\t}\n\n\teach(callback: (this: Axis) => void): void {\n\t\tfor (const axis of this.items) callback.call(axis)\n\t}\n\n\tadd(horizontal = false, otherSide = false): Axis {\n\t\tconst axis = new Axis(this.chart, horizontal, otherSide)\n\t\taxis.custom = true\n\t\tthis.items.push(axis)\n\t\treturn axis\n\t}\n}\n","import { Point, Rectangle } from \"../primitives.js\"\nimport type { Chart } from \"../../chart.js\"\nimport type { Series } from \"../../series.js\"\nimport { pointerOf } from \"../../series-utils.js\"\nimport { Format } from \"./format.js\"\n\ntype LegendSymbolStyle = \"rectangle\" | \"triangle\" | \"ellipse\" | \"diamond\" | \"pill\" | \"line\" | string\n\n/** Overrides of the legend symbol of one series, set in `series.legend.symbol`. */\nexport interface SeriesLegendSymbol {\n\t/** Shape of this series' symbol instead of `legend.symbol.style`. */\n\tstyle?: LegendSymbolStyle\n\t/** Fill color of this series' symbol instead of the series legend color. */\n\tcolor?: string\n}\n\n/** What `LegendSymbol.ondraw` receives to draw a symbol on its own. */\nexport interface LegendSymbolDrawArgs {\n\tctx: Chart[\"drawContext\"]\n\tseries: Series\n\t/** Point index when the legend lists values, or the legend item order when it lists series. */\n\tindex: number\n\t/** Top left corner and size of the box reserved for the symbol, in pixels. */\n\tx: number\n\ty: number\n\twidth: number\n\theight: number\n\t/** The color the default symbol would use. */\n\tcolor: string\n\t/** The mouse is over the legend item, or the series is highlighted. */\n\thovered: boolean\n}\n\ninterface SeriesPointer {\n\tvisible?: boolean\n\tstyle?: string\n\twidth?: number\n\theight?: number\n\tformat?: Format\n}\n\nexport class LegendSymbol {\n\tchart: Chart\n\tformat: Format\n\twidth = 8\n\theight = 8\n\tpadding = 8\n\tstyle: LegendSymbolStyle = \"rectangle\"\n\tvisible = true\n\t/** Draws a line sample and the visible series pointer using its own format. */\n\tuseSeriesPointer = false\n\t/**\n\t * Draws the symbol instead of the built-in shapes. Return `true` when the symbol was drawn; any other\n\t * result draws the default shape.\n\t */\n\tondraw: ((args: LegendSymbolDrawArgs) => boolean | undefined) | undefined\n\n\tconstructor(chart: Chart) {\n\t\tthis.chart = chart\n\t\tthis.format = new Format(chart)\n\t\tthis.format.shadow.visible = true\n\t\tthis.format.shadow.color = \"silver\"\n\t\tthis.format.shadow.width = 2\n\t\tthis.format.shadow.height = 2\n\t\tthis.format.depth = 0.01\n\t}\n\n\ttryHover(series: Series, index: number): Series[\"hover\"] | null {\n\t\tif (series.hover.enabled) {\n\t\t\tconst showValues = this.chart.legend.showValues()\n\t\t\tif ((showValues && series.over === index) || (!showValues && series.over >= 0)) return series.hover\n\t\t}\n\t\treturn null\n\t}\n\n\tdraw(series: Series, index: number, x: number, y: number): void {\n\t\tconst c = this.chart.drawContext\n\t\tconst f = this.format\n\t\tconst fhover = this.tryHover(series, index)\n\t\tconst oldFill = f.fill\n\t\tconst oldStroke = f.stroke\n\t\tconst custom = series.legend.symbol\n\t\tconst style = custom?.style ?? this.style\n\t\tconst color = custom?.color ?? series.legendColor(index)\n\t\tf.fill = color\n\t\tc.z = -0.01\n\t\tconst pointer: SeriesPointer | undefined = pointerOf(series)\n\n\t\tif (this.ondraw) {\n\t\t\tconst box = { x, y: y - this.height * 0.5 - 1, width: this.width, height: this.height }\n\t\t\tlet drawn = false\n\n\t\t\t// The callback may change fonts, alignment or line styles; none of it reaches the legend text.\n\t\t\tc.save()\n\t\t\ttry {\n\t\t\t\tdrawn =\n\t\t\t\t\tthis.ondraw({\n\t\t\t\t\t\tctx: c,\n\t\t\t\t\t\tseries,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t\t...box,\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\thovered: fhover !== null || this.chart.legend.over === index\n\t\t\t\t\t}) === true\n\t\t\t} finally {\n\t\t\t\tc.restore()\n\t\t\t\tf.fill = oldFill\n\t\t\t\tf.stroke = oldStroke\n\t\t\t}\n\n\t\t\tif (drawn) return\n\t\t\tf.fill = color\n\t\t}\n\n\t\tif (this.useSeriesPointer && !custom?.style && pointer?.visible && pointer.format) {\n\t\t\ttry {\n\t\t\t\tthis.drawSeriesPointer(series, index, x, y, pointer, fhover)\n\t\t\t} finally {\n\t\t\t\tf.fill = oldFill\n\t\t\t\tf.stroke = oldStroke\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\tswitch (style) {\n\t\t\tcase \"rectangle\":\n\t\t\t\tif (fhover) f.stroke = fhover.stroke\n\t\t\t\tif (this.chart.aspect.view3d) {\n\t\t\t\t\tconst r = { x, y: y - this.height * 0.5 - 1, width: this.width, height: this.height }\n\t\t\t\t\tconst oldZ = f.z\n\t\t\t\t\tconst oldCtxZ = c.z\n\t\t\t\t\tf.z = c.z - f.depth\n\t\t\t\t\tf.cube(r)\n\t\t\t\t\tf.draw(c, null, r)\n\t\t\t\t\tf.z = oldZ\n\t\t\t\t\tc.z = oldCtxZ\n\t\t\t\t} else f.rectangle(x, y - this.height * 0.5 - 1, this.width, this.height)\n\t\t\t\tbreak\n\t\t\tcase \"triangle\":\n\t\t\t\tif (fhover) f.stroke = fhover.stroke\n\t\t\t\tf.polygon([\n\t\t\t\t\tnew Point(x + this.width * 0.5, y - this.height * 0.5),\n\t\t\t\t\tnew Point(x + this.width, y + this.height * 0.5),\n\t\t\t\t\tnew Point(x, y + this.height * 0.5)\n\t\t\t\t])\n\t\t\t\tbreak\n\t\t\tcase \"ellipse\":\n\t\t\t\tif (fhover) f.stroke = fhover.stroke\n\t\t\t\tf.ellipse(x + this.width * 0.5, y, this.width, this.height)\n\t\t\t\tbreak\n\t\t\tcase \"diamond\":\n\t\t\t\tif (fhover) f.stroke = fhover.stroke\n\t\t\t\tf.polygon([\n\t\t\t\t\tnew Point(x + this.width * 0.5, y - this.height * 0.5),\n\t\t\t\t\tnew Point(x + this.width, y),\n\t\t\t\t\tnew Point(x + this.width * 0.5, y + this.height * 0.5),\n\t\t\t\t\tnew Point(x, y)\n\t\t\t\t])\n\t\t\t\tbreak\n\t\t\tcase \"pill\": {\n\t\t\t\tif (fhover) f.stroke = fhover.stroke\n\t\t\t\tconst { x: oldX, y: oldY } = f.round\n\t\t\t\tconst radius = Math.min(this.width, this.height) * 0.5\n\t\t\t\tf.round.x = radius\n\t\t\t\tf.round.y = radius\n\t\t\t\tf.rectangle(x, y - this.height * 0.5 - 1, this.width, this.height)\n\t\t\t\tf.round.x = oldX\n\t\t\t\tf.round.y = oldY\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tc.beginPath()\n\t\t\t\tc.moveTo(x, y)\n\t\t\t\tc.lineTo(x + this.width, y)\n\t\t\t\tif (fhover) fhover.stroke.prepare()\n\t\t\t\telse f.stroke.prepare(f.fill)\n\t\t\t\tc.stroke()\n\t\t\t\tbreak\n\t\t}\n\n\t\tf.fill = oldFill\n\t\tf.stroke = oldStroke\n\t}\n\n\tprivate drawSeriesPointer(\n\t\tseries: Series,\n\t\tindex: number,\n\t\tx: number,\n\t\ty: number,\n\t\tpointer: SeriesPointer,\n\t\thover: Series[\"hover\"] | null\n\t): void {\n\t\tconst c = this.chart.drawContext\n\t\tconst pointerFormat = pointer.format\n\t\tif (!pointerFormat) return\n\n\t\tconst sourceWidth = Math.max(1, pointer.width || this.width)\n\t\tconst sourceHeight = Math.max(1, pointer.height || this.height)\n\t\tconst scale = Math.min(1, this.width / sourceWidth, this.height / sourceHeight)\n\t\tconst width = Math.max(3, sourceWidth * scale)\n\t\tconst height = Math.max(3, sourceHeight * scale)\n\t\tconst centerX = x + this.width * 0.5\n\t\tconst centerY = y\n\t\tconst left = centerX - width * 0.5\n\t\tconst top = centerY - height * 0.5\n\t\tconst rectangle = new Rectangle(left, top, width, height)\n\n\t\tif (series.drawLine === true) {\n\t\t\tconst lineColor = series.format.stroke.fill || series.legendColor(index)\n\t\t\tconst gap = width * 0.5 + Math.max(0, series.format.stroke.size) * 0.5\n\t\t\tconst leftEnd = centerX - gap\n\t\t\tconst rightStart = centerX + gap\n\n\t\t\tc.beginPath()\n\t\t\tif (leftEnd > x) {\n\t\t\t\tc.moveTo(x, y)\n\t\t\t\tc.lineTo(leftEnd, y)\n\t\t\t}\n\t\t\tif (rightStart < x + this.width) {\n\t\t\t\tc.moveTo(rightStart, y)\n\t\t\t\tc.lineTo(x + this.width, y)\n\t\t\t}\n\t\t\tif (hover) hover.stroke.prepare()\n\t\t\telse series.format.stroke.prepare(lineColor)\n\t\t\tc.stroke()\n\t\t}\n\n\t\tconst oldPointerStroke = pointerFormat.stroke\n\n\t\tif (hover) pointerFormat.stroke = hover.stroke\n\n\t\ttry {\n\t\t\tswitch (pointer.style) {\n\t\t\t\tcase \"rectangle\":\n\t\t\t\t\tpointerFormat.rectangle(rectangle)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"ellipse\":\n\t\t\t\t\tpointerFormat.ellipse(centerX, centerY, width, height)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"sphere\":\n\t\t\t\t\tpointerFormat.sphere(centerX, centerY, width, height)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"triangle\":\n\t\t\t\t\tpointerFormat.polygon([\n\t\t\t\t\t\tnew Point(centerX, top),\n\t\t\t\t\t\tnew Point(left, top + height),\n\t\t\t\t\t\tnew Point(left + width, top + height)\n\t\t\t\t\t])\n\t\t\t\t\tbreak\n\t\t\t\tcase \"downtriangle\":\n\t\t\t\t\tpointerFormat.polygon([new Point(centerX, top + height), new Point(left, top), new Point(left + width, top)])\n\t\t\t\t\tbreak\n\t\t\t\tcase \"diamond\":\n\t\t\t\t\tpointerFormat.polygon([\n\t\t\t\t\t\tnew Point(centerX, top),\n\t\t\t\t\t\tnew Point(left, centerY),\n\t\t\t\t\t\tnew Point(centerX, top + height),\n\t\t\t\t\t\tnew Point(left + width, centerY)\n\t\t\t\t\t])\n\t\t\t\t\tbreak\n\t\t\t\tcase \"cross\":\n\t\t\t\t\tc.beginPath()\n\t\t\t\t\tc.moveTo(left, centerY)\n\t\t\t\t\tc.lineTo(left + width, centerY)\n\t\t\t\t\tc.moveTo(centerX, top)\n\t\t\t\t\tc.lineTo(centerX, top + height)\n\t\t\t\t\tpointerFormat.stroke.prepare(pointerFormat.fill)\n\t\t\t\t\tc.stroke()\n\t\t\t\t\tbreak\n\t\t\t\tcase \"x\":\n\t\t\t\t\tc.beginPath()\n\t\t\t\t\tc.moveTo(left, top)\n\t\t\t\t\tc.lineTo(left + width, top + height)\n\t\t\t\t\tc.moveTo(left, top + height)\n\t\t\t\t\tc.lineTo(left + width, top)\n\t\t\t\t\tpointerFormat.stroke.prepare(pointerFormat.fill)\n\t\t\t\t\tc.stroke()\n\t\t\t\t\tbreak\n\t\t\t\tcase \"cube\":\n\t\t\t\t\tpointerFormat.cube(rectangle)\n\t\t\t\t\tpointerFormat.draw(c, null, rectangle)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"cylinder\":\n\t\t\t\t\tpointerFormat.cylinder(rectangle, 1, true, false)\n\t\t\t\t\tpointerFormat.draw(c, null, rectangle)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"cone\":\n\t\t\t\t\tpointerFormat.cylinder(rectangle, 0, true, false)\n\t\t\t\t\tpointerFormat.draw(c, null, rectangle)\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tpointerFormat.ellipse(centerX, centerY, width, height)\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t} finally {\n\t\t\tpointerFormat.stroke = oldPointerStroke\n\t\t}\n\t}\n}\n","import { Annotation } from \"../../tools/index.js\"\nimport { trunc } from \"../../utils.js\"\nimport { Rectangle } from \"../primitives.js\"\nimport { Format } from \"./format.js\"\nimport { LegendSymbol } from \"./legend-symbol.js\"\nimport type { Chart } from \"../../chart.js\"\nimport type { Graphics } from \"../../rendering/graphics.js\"\nimport type { Series } from \"../../series.js\"\nimport { Stroke } from \"./stroke.js\"\n\n/** The text and layout of a legend item, which `onbeforedrawLegendItem` can change. */\nexport interface LegendItemArgs {\n\ttext: string | string[]\n\tindex: number\n\tr: Rectangle\n\tsymbolWidth: number\n\tstopLegend: boolean\n}\n\ninterface ItemPosition {\n\tx: number\n\ty: number\n}\n\n/**\n * @memberOf Tee.Chart\n * @constructor\n * @class Displays a list of chart series data\n * @param {Tee.Chart} chart The parent chart this legend object belongs to.\n * @property {Number} align Legend position as offset % of chart size. Default 0.\n * @property {Number} padding Percent of chart size pixels to leave as margin from legend.\n * @property {Boolean} transparent Determines to draw or not the legend background.\n * @property {Format} format Formatting properties to draw legend background and items.\n * @property {Format} hover Limited Formatting properties for mouseover hover of text. Offers color and enabled.\n * @property {Annotation} title Draws a title on top of legend.\n * @property {Rectangle} bounds Defines the legend position in pixels.\n * @property {String} position Automatic position legend (\"left\", \"top\", \"right\" or \"bottom\").\n * @property {Boolean} visible Defines to draw or not the legend.\n * @property {Boolean} inverted When true, legend items are displayed in inverted order.\n * @property {Boolean} fontColor Determines to fill each legend item text using series or point colors.\n * @property {Stroke} dividing Draws a line between legend items.\n * @property {LegendSymbol} symbol Properties to draw a small indicator next to each legend item. Set `symbol.useSeriesPointer`\n * to draw each series' pointer style in the legend.\n * @property {String} legendStyle Determines to draw all visible series names or first visible series points. (\"auto\", \"series\", \"values\").\n * @property {String} activeStyle Determines the style to draw legend items when series are clicked. (\"none\", \"checkbox\", \"linethrough\", \"opacity\").\n * @property {String} textStyle What to draw at each legend item for series values: \"auto\", \"valuelabel\", \"label\", \"value\", \"percent\", \"index\", \"labelvalue\", \"percentlabel\", \"valuepercent\"\n */\nexport class Legend {\n\tongettext: ((legend: Legend, series: Series, index: number, text: string | string[]) => string | string[]) | undefined\n\tonclick: ((series: Series, index: number) => void) | undefined\n\tonhover: ((index: number, item: number) => void) | undefined\n\tonbeforedrawLegendItem: ((args: LegendItemArgs) => void) | undefined\n\n\tchart: Chart\n\ttransparent = false\n\tuseStrokeColor = false\n\tactiveStyle = \"linethrough\"\n\tformat: Format\n\ttitle: Annotation\n\tbounds: Rectangle\n\tposition = \"right\"\n\tvisible = true\n\tinverted = false\n\tpadding = 5\n\tmargin = 5\n\talign = 0\n\tfontColor = false\n\tdividing: Stroke\n\tover = -1\n\tsymbol: LegendSymbol\n\titemHeight = 10\n\tinnerOff = 0\n\tlegendStyle = \"auto\"\n\ttextStyle = \"auto\"\n\thover: Format\n\t_titleHeight = 0\n\t_itemWidth = 0\n\t_itemWidths = [0, 0]\n\t_itemPos = { x: 0, y: 0 }\n\t_itemRect = new Rectangle()\n\t_rMouse = new Rectangle()\n\t_cellRect = new Rectangle()\n\t/** Horizontal space between items, in pixels. */\n\titemGap = 8\n\t/** Space between the item text and the legend's right edge when the legend is vertical, in pixels. */\n\tedgeInset = 6\n\t/** Extra vertical space between rows of items, in pixels. */\n\trowGap = 0\n\t/** Moves the symbol up (negative) or down so it lines up with the item text, in pixels. */\n\tsymbolOffsetY = 0\n\t/** Fill of the rounded highlight drawn behind the item under the mouse. Empty draws no highlight. */\n\thoverBackground = \"\"\n\t/** Draws the symbol of hidden series faded when `activeStyle` keeps them in the legend. */\n\tdimHidden = false\n\t_aligns = [true]\n\tshowHidden = false\n\trows = 1\n\tperRow = 0\n\tvisual: unknown = null\n\n\tconstructor(chart: Chart) {\n\t\tthis.chart = chart\n\n\t\tconst f = (this.format = new Format(chart))\n\t\tf.fill = \"white\"\n\t\tf.round.x = 8\n\t\tf.round.y = 8\n\t\tf.font.baseLine = \"top\"\n\t\tf.shadow.visible = true\n\n\t\tf.z = 0\n\t\tf.depth = 0.05\n\n\t\tthis.title = new Annotation(chart)\n\t\tthis.title.transparent = true\n\n\t\tthis.bounds = new Rectangle()\n\n\t\tconst d = (this.dividing = new Stroke(chart))\n\t\td.fill = \"\" //\"rgb(220,220,220)\";\n\t\td.cap = \"butt\"\n\n\t\t/*\n\t\t * Contains properties to paint a visual representation near each legend item.\n\t\t */\n\t\tthis.symbol = new LegendSymbol(chart)\n\n\t\tthis.hover = new Format(chart)\n\t\tthis.hover.enabled = true\n\t\tthis.hover.font.fill = \"red\"\n\t}\n\n\t/**\n\t * Restores the symbol, hover and spacing design the legend has before any theme styles it, so a theme\n\t * that does not restyle them does not inherit the design of a previously applied one.\n\t */\n\tresetDesign() {\n\t\tconst { visible, style, useSeriesPointer } = this.symbol\n\t\tthis.symbol = new LegendSymbol(this.chart)\n\t\tObject.assign(this.symbol, { visible, style, useSeriesPointer })\n\n\t\tthis.hover = new Format(this.chart)\n\t\tthis.hover.enabled = true\n\t\tthis.hover.font.fill = \"red\"\n\n\t\tthis.format.shadow.visible = true\n\t\tthis.itemGap = 8\n\t\tthis.edgeInset = 6\n\t\tthis.hoverBackground = \"\"\n\t\tthis.dimHidden = false\n\t\tthis.rowGap = 0\n\t\tthis.symbolOffsetY = 0\n\t}\n\n\t/** Distance between the top of one row of items and the next. */\n\trowPitch() {\n\t\treturn this.itemHeight + this.rowGap\n\t}\n\n\tseriesCount() {\n\t\treturn this.showHidden ? this.chart.series.items.length : this.chart.series.visibleCount()\n\t}\n\n\ttotalWidth() {\n\t\tlet w = this._itemWidth + this.itemGap\n\t\tconst s = this.symbol\n\t\tif (s.visible) w += s.width + s.padding\n\t\treturn w\n\t}\n\n\t_space() {\n\t\treturn this.bounds.y + this._titleHeight + this.margin * this.chart.bounds.height * 0.01\n\t}\n\n\tavailRows() {\n\t\tlet h = this._space() + this.itemHeight * 0.5\n\t\tif (!h) h = 0\n\t\treturn trunc((this.chart.bounds.getBottom() - h) / this.rowPitch())\n\t}\n\n\titemsCount() {\n\t\tconst ss = this.chart.series\n\t\tlet result = this.seriesCount()\n\t\tconst rr = this.chart.bounds\n\n\t\tif (result === 0) return 0\n\n\t\tconst st = this.legendStyle\n\n\t\tif (st === \"values\" && result > 0) result = ss.firstVisible()?.legendCount() ?? 0\n\t\telse {\n\t\t\tif ((st === \"auto\" && result > 1) || st === \"series\") {\n\t\t\t\tfor (let t = 0; t < ss.items.length; t++) if (!ss.items[t].legend.visible) result--\n\t\t\t} else if (result === 1) result = ss.firstVisible()?.legendCount() ?? 0\n\t\t}\n\n\t\tif (this.isVertical()) {\n\t\t\tif (this.itemHeight * 0.5 + result * this.rowPitch() > rr.height - this._space()) result = this.availRows()\n\t\t} else {\n\t\t\tthis.rows = 1\n\n\t\t\tconst total = this.totalWidth()\n\t\t\tconst pad = this.calcPadding(rr)\n\t\t\tconst chartW = rr.width - 2 * pad\n\n\t\t\tif (result * total > chartW) {\n\t\t\t\tthis.perRow = trunc(chartW / total)\n\n\t\t\t\tif (result > this.perRow) {\n\t\t\t\t\tthis.rows = 1 + trunc(result / this.perRow)\n\n\t\t\t\t\tif (this.rows * this.rowPitch() > rr.height - this.bounds.y) {\n\t\t\t\t\t\tthis.rows = this.availRows()\n\t\t\t\t\t\tresult = this.rows * this.perRow\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else this.perRow = result\n\t\t}\n\n\t\treturn result\n\t}\n\n\tshowValues() {\n\t\treturn this.legendStyle === \"values\" || (this.legendStyle === \"auto\" && this.seriesCount() === 1)\n\t}\n\n\titemText(series: Series, index: number) {\n\t\tconst res = series.legendText(index, this.textStyle, false, true)\n\t\treturn this.ongettext ? this.ongettext(this, series, index, res) : res\n\t}\n\n\t/** Right edge of the item text, derived from the item cell so both always agree. */\n\tcalcItemPos(index: number, pos: ItemPosition) {\n\t\tconst r = this._cellRect\n\t\tthis.calcItemRect(index, r)\n\t\tpos.x = this.isVertical() ? r.x + r.width - this.edgeInset - this.innerOff : r.x + r.width\n\t\tpos.y = r.y + this.innerOff\n\t}\n\n\tcalcItemRect(index: number, r: Rectangle) {\n\t\tconst i = this.itemHeight\n\t\tconst b = this.bounds\n\t\tr.height = i\n\t\tr.x = b.x\n\t\tr.y = b.y\n\n\t\tif (this.isVertical()) {\n\t\t\tr.width = b.width\n\t\t\tr.y += i * 0.4 + index * this.rowPitch() + this._titleHeight\n\t\t} else {\n\t\t\tr.width = this.totalWidth()\n\t\t\tr.x += this.innerOff + (index % this.perRow) * r.width\n\t\t\tr.y += i * 0.25 + trunc(index / this.perRow) * this.rowPitch()\n\t\t}\n\t}\n\n\tmousedown(_p: ItemPosition) {\n\t\tif (this.over !== -1 && this.activeStyle !== \"none\") {\n\t\t\tif (this.showValues()) {\n\t\t\t\tconst series = this.chart.series.firstVisible()\n\t\t\t\tif (series && this.over < series.data.values.length) {\n\t\t\t\t\tseries.setPointVisible(this.over, series.isNull(this.over))\n\t\t\t\t\tthis.chart.draw()\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (let t = 0; t < this.chart.series.items.length; t++) {\n\t\t\t\t\tconst currentSeries = this.chart.series.items[t]\n\t\t\t\t\tif (t === this.over) {\n\t\t\t\t\t\tcurrentSeries.visible = !currentSeries.visible\n\t\t\t\t\t\tthis.chart.draw()\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this.onclick && this.over !== -1) {\n\t\t\tif (this.showValues()) {\n\t\t\t\tconst first = this.chart.series.firstVisible()\n\t\t\t\tif (first) this.onclick(first, this.over)\n\t\t\t} else {\n\t\t\t\tconst ss = this.chart.series.items\n\t\t\t\tconst l = ss.length\n\t\t\t\tlet c = 0\n\t\t\t\tfor (let t = 0; t < l; t++) {\n\t\t\t\t\tif (this.showHidden || ss[t].visible) {\n\t\t\t\t\t\tif (c === this.over) {\n\t\t\t\t\t\t\tthis.onclick(ss[t], -1)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tc++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t}\n\n\tmousemove(p: ItemPosition) {\n\t\tlet n = this.over\n\n\t\tif (this.bounds.contains(p)) {\n\t\t\tconst c = this.itemsCount()\n\t\t\tfor (let t = 0; t < c; t++) {\n\t\t\t\tthis.calcItemRect(t, this._rMouse)\n\t\t\t\tif (this._rMouse.contains(p)) {\n\t\t\t\t\tn = t\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else n = -1\n\n\t\tif (n !== this.over) {\n\t\t\tif (this.onhover) this.onhover(this.over, n)\n\n\t\t\tthis.over = n\n\n\t\t\tconst o = this.chart\n\t\t\to._scheduleDraw()\n\t\t}\n\n\t\tif (this.onclick) this.chart.newCursor = n === -1 ? \"default\" : \"pointer\"\n\t}\n\n\tdrawSymbol(series: Series, index: number, itemPos: ItemPosition) {\n\t\tconst ctx = this.chart.drawContext\n\t\tconst fade = this.dimHidden && !series.visible\n\t\tconst alpha = ctx.globalAlpha\n\n\t\tif (fade) ctx.globalAlpha = alpha * 0.35\n\n\t\ttry {\n\t\t\tthis.symbol.draw(\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\titemPos.x - this._itemWidth - this.symbol.width - this.symbol.padding,\n\t\t\t\titemPos.y + this.itemHeight * 0.4 + this.symbolOffsetY\n\t\t\t)\n\t\t} finally {\n\t\t\tif (fade) ctx.globalAlpha = alpha\n\t\t}\n\t}\n\n\t/** Draws the highlight behind the item under the mouse, when `hoverBackground` is set. */\n\tdrawHoverBackground(index: number) {\n\t\tif (this.over !== index || !this.hover.enabled || this.hoverBackground === \"\" || this.chart.aspect.view3d) return\n\n\t\t// Wraps the symbol and text of the item, centered on the symbol, with a little air between rows.\n\t\tconst pos = this._itemPos\n\t\tthis.calcItemPos(index, pos)\n\n\t\tconst symbol = this.symbol\n\t\tconst symbolSpace = symbol.visible ? symbol.width + symbol.padding : 0\n\t\tconst padX = 8\n\t\tconst height = this.itemHeight - 2\n\t\tconst left = pos.x - this._itemWidth - symbolSpace - padX\n\t\tconst centerY = pos.y + this.itemHeight * 0.4 - 1 + this.symbolOffsetY\n\n\t\tconst h = this.hover\n\t\th.fill = this.hoverBackground\n\t\th.stroke.fill = \"\"\n\t\th.shadow.visible = false\n\t\th.round.x = height * 0.5\n\t\th.round.y = height * 0.5\n\t\th.rectangle(left, centerY - height * 0.5, pos.x + padX - left, height)\n\t}\n\n\t/** Runs `onbeforedrawLegendItem`, which can change the item text and layout or hide the item. */\n\tprivate beforeDrawItem(text: string | string[], index: number, r: Rectangle) {\n\t\tconst args: LegendItemArgs = { text, index, r, symbolWidth: this.symbol.width, stopLegend: false }\n\t\tthis.onbeforedrawLegendItem?.(args)\n\t\treturn args\n\t}\n\n\tdrawItem(text: string | string[], series: Series, index: number, isSeries = false) {\n\t\tlet stopLegend = false\n\n\t\tconst vertical = this.isVertical()\n\t\tconst f = this.format\n\t\tconst r = this._itemRect\n\n\t\t// Add active style to legend item\n\t\tthis.showHidden = this.activeStyle !== \"none\"\n\n\t\tthis.calcItemPos(index, this._itemPos)\n\n\t\tr.x = this._itemPos.x\n\t\tr.y = this._itemPos.y\n\n\t\tif (vertical) r.y -= this.chart.isMozilla ? 0 : 2\n\t\telse if (this.chart.isMozilla) r.y++\n\t\telse r.y--\n\n\t\tconst old = f.font.fill\n\n\t\tthis.drawHoverBackground(index)\n\n\t\tconst itemVisible = isSeries ? series.visible : !series.isNull(index)\n\n\t\tif (!itemVisible && this.activeStyle === \"opacity\") {\n\t\t\tf.font.fill = \"silver\"\n\t\t} else {\n\t\t\tif (this.over === index) f.font.fill = this.hover.enabled && this.hover.font.fill ? this.hover.font.fill : old\n\t\t\telse if (this.fontColor) f.font.fill = this.showValues() ? series.legendColor(index) : series.format.fill\n\t\t}\n\n\t\tif (this.activeStyle === \"linethrough\" && !itemVisible) f.font.lineThrough = true\n\t\telse f.font.lineThrough = false\n\n\t\tconst c = this.chart.graphics || (this.chart.ctx as Graphics | null)\n\t\tif (!c) return\n\n\t\tif (isSeries) {\n\t\t\tf.font.textAlign = \"start\"\n\t\t\tr.x -= this._itemWidths[0]\n\t\t\tc.textAlign = f.font.textAlign\n\n\t\t\tconst getLegendArgs = this.beforeDrawItem(text, index, r)\n\n\t\t\tif (getLegendArgs.stopLegend) stopLegend = true\n\n\t\t\ttext = getLegendArgs.text\n\n\t\t\tconst prevStrokStyle = f.stroke.fill\n\t\t\tif (!this.showValues()) {\n\t\t\t\tif (this.activeStyle === \"checkbox\") {\n\t\t\t\t\tconst x = r.x - 2\n\t\t\t\t\tconst y = r.y + 4\n\n\t\t\t\t\tc.beginPath()\n\t\t\t\t\tc.moveTo(x, y)\n\t\t\t\t\tc.lineTo(x + 8.5, y)\n\t\t\t\t\tc.lineTo(x + 8.5, y + 8.5)\n\t\t\t\t\tc.lineTo(x, y + 8.5)\n\t\t\t\t\tc.lineTo(x, y)\n\t\t\t\t\tc.strokeStyle = \"black\"\n\t\t\t\t\tc.stroke()\n\t\t\t\t\tc.closePath()\n\n\t\t\t\t\tr.x += 12\n\n\t\t\t\t\tif (series.visible) {\n\t\t\t\t\t\tc.beginPath()\n\t\t\t\t\t\tc.moveTo(x + 2, y + 4)\n\t\t\t\t\t\tc.lineTo(x + 4, y + 6)\n\t\t\t\t\t\tc.lineTo(x + 7, y + 3)\n\t\t\t\t\t\tc.stroke()\n\t\t\t\t\t\tc.closePath()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.strokeStyle = prevStrokStyle\n\n\t\t\tif (!stopLegend) f.drawText(r, text as string)\n\t\t} else {\n\t\t\tif (!Array.isArray(text)) text = [text]\n\n\t\t\tif (vertical) {\n\t\t\t\tlet l = text.length\n\t\t\t\tconst oldW = r.width\n\t\t\t\tconst sep = f.textWidth(\" \")\n\t\t\t\twhile (l--) {\n\t\t\t\t\tf.font.textAlign = this._aligns[l] ? \"start\" : \"end\"\n\t\t\t\t\tr.x -= this._itemWidths[l]\n\n\t\t\t\t\tc.textAlign = f.font.textAlign\n\n\t\t\t\t\tconst getLegendArgs = this.beforeDrawItem(text, index, r)\n\n\t\t\t\t\tif (getLegendArgs.stopLegend) stopLegend = true\n\n\t\t\t\t\ttext = getLegendArgs.text\n\n\t\t\t\t\tif (!stopLegend) f.drawText(r, text[l])\n\n\t\t\t\t\tr.width -= this._itemWidths[l] + sep\n\t\t\t\t}\n\t\t\t\tr.width = oldW\n\t\t\t} else {\n\t\t\t\tf.font.textAlign = \"start\"\n\t\t\t\tr.x -= this._itemWidth\n\t\t\t\tc.textAlign = f.font.textAlign\n\n\t\t\t\tconst getLegendArgs = this.beforeDrawItem(text, index, r)\n\n\t\t\t\tif (getLegendArgs.stopLegend) stopLegend = true\n\n\t\t\t\ttext = getLegendArgs.text\n\n\t\t\t\tif (!stopLegend) f.drawText(r, (text as string[]).join(\" \"))\n\t\t\t}\n\t\t}\n\n\t\tif (!stopLegend) {\n\t\t\tf.font.fill = old\n\n\t\t\tconst hassymbol = !series.isColorEach || this.showValues()\n\n\t\t\tif (this.symbol.visible && hassymbol) this.drawSymbol(series, index, this._itemPos)\n\n\t\t\tif (index > 0 && this.dividing.fill !== \"\") {\n\t\t\t\tconst b = this.bounds\n\t\t\t\tc.beginPath()\n\n\t\t\t\tif (this.isVertical()) {\n\t\t\t\t\tc.moveTo(b.x, r.y - 2)\n\t\t\t\t\tc.lineTo(b.getRight(), r.y - 2)\n\t\t\t\t} else {\n\t\t\t\t\tlet xx = r.x - this._itemWidth - 4\n\t\t\t\t\tconst sy = this.symbol\n\t\t\t\t\tif (sy.visible) xx -= sy.width + sy.padding\n\t\t\t\t\tc.moveTo(xx, b.y)\n\t\t\t\t\tc.lineTo(xx, b.getBottom())\n\t\t\t\t}\n\n\t\t\t\tthis.dividing.prepare()\n\t\t\t\tc.stroke()\n\t\t\t}\n\t\t}\n\t}\n\n\tdrawSeries(index: number, order: number) {\n\t\tconst currentSeries = this.chart.series.items[index]\n\t\tif ((this.showHidden || currentSeries.visible) && currentSeries.legend.visible) {\n\t\t\tthis.drawItem(currentSeries.titleText(index), currentSeries, order, true)\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t}\n\n\tdraw() {\n\t\tlet c = this.itemsCount()\n\t\tconst ti = this.title\n\t\tconst ctx = this.chart.drawContext\n\t\tconst f = this.format\n\t\tconst ft = this.format.transparency\n\t\tconst vertical = this.isVertical()\n\t\tlet old = 1\n\n\t\tif (c > 0) {\n\t\t\tconst groups = ctx.beginParent\n\t\t\tthis.visual = ctx.beginParent ? ctx.beginParent() : null\n\n\t\t\tf.cube(this.bounds) //avoids first Legend item being dropped from format in WebGL transparent Legends\n\n\t\t\tif (!this.transparent) {\n\t\t\t\tf.draw(ctx, null, this.bounds)\n\t\t\t}\n\n\t\t\tif (ft > 0) {\n\t\t\t\told = ctx.globalAlpha\n\t\t\t\tctx.globalAlpha = (1 - ft) * old\n\t\t\t}\n\n\t\t\tif (vertical && this._titleHeight > 0) {\n\t\t\t\tti.bounds.x = this.bounds.x - 4\n\t\t\t\tti.bounds.y = this.bounds.y\n\t\t\t\tti.doDraw()\n\t\t\t}\n\n\t\t\tf.font.prepare()\n\t\t\tthis._itemRect.width = this._itemWidth\n\t\t\tthis._itemRect.height = this.itemHeight\n\n\t\t\tif (this.showValues()) {\n\t\t\t\tconst s = this.chart.series.firstVisible()\n\t\t\t\tif (!s) return\n\t\t\t\tlet order = 0\n\t\t\t\tlet len = c\n\n\t\t\t\tswitch (this.textStyle) {\n\t\t\t\t\tcase \"auto\":\n\t\t\t\t\tcase \"percentlabel\":\n\t\t\t\t\tcase \"valuelabel\":\n\t\t\t\t\t\tthis._aligns = [false, true]\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"labelpercent\":\n\t\t\t\t\tcase \"labelvalue\":\n\t\t\t\t\t\tthis._aligns = [true, false]\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"label\":\n\t\t\t\t\t\tthis._aligns = [true]\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"valuepercent\":\n\t\t\t\t\t\tthis._aligns = [true, false]\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthis._aligns = [false]\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif (this.inverted) while (len--) this.drawItem(this.itemText(s, len), s, order++)\n\t\t\t\telse for (let t = 0; t < len; t++) this.drawItem(this.itemText(s, t), s, t)\n\t\t\t} else {\n\t\t\t\tlet len = this.chart.series.count()\n\t\t\t\tif (vertical) len = Math.min(len, this.availRows())\n\t\t\t\tc = 0\n\n\t\t\t\tthis._aligns = [true]\n\n\t\t\t\tif (this.inverted)\n\t\t\t\t\twhile (len--) {\n\t\t\t\t\t\tif (this.drawSeries(len, c)) c++\n\t\t\t\t\t}\n\t\t\t\telse for (let t = 0; t < len; t++) if (this.drawSeries(t, c)) c++\n\t\t\t}\n\n\t\t\tif (ft > 0) ctx.globalAlpha = old\n\n\t\t\tif (groups) ctx.endParent?.()\n\t\t}\n\t}\n\n\tcalcWidths() {\n\t\tconst l = this.chart.series\n\t\tconst f = this.format\n\t\tlet s: Series | null\n\t\tlet t: number\n\t\tlet d: number\n\t\tlet c: number\n\t\tlet text: string | string[] | string[]\n\n\t\tthis._itemWidth = 0\n\t\tthis._itemWidths = [0, 0]\n\n\t\tif (this.showValues()) {\n\t\t\ts = l.firstVisible()\n\t\t\tif (!s) return\n\t\t\tc = this.itemsCount()\n\n\t\t\tfor (t = 0; t < c; t++) {\n\t\t\t\ttext = this.itemText(s, t)\n\t\t\t\tif (!Array.isArray(text)) text = [text]\n\n\t\t\t\tif (text.length > 0) {\n\t\t\t\t\td = f.textWidth(text[0])\n\t\t\t\t\tif (d > this._itemWidths[0]) this._itemWidths[0] = d\n\n\t\t\t\t\tif (text.length > 1) {\n\t\t\t\t\t\td = f.textWidth(text[1])\n\t\t\t\t\t\tif (d > this._itemWidths[1]) this._itemWidths[1] = d\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tc = l.count()\n\n\t\t\tfor (t = 0; t < c; t++) {\n\t\t\t\ts = l.items[t]\n\n\t\t\t\tif (this.showHidden || s.visible) {\n\t\t\t\t\td = f.textWidth(s.titleText(t))\n\t\t\t\t\tif (d > this._itemWidths[0]) this._itemWidths[0] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis._itemWidth = this._itemWidths[0] + this._itemWidths[1]\n\t}\n\n\tcalcPadding(r: Rectangle) {\n\t\treturn 0.01 * this.padding * (this.isVertical() ? r.width : r.height)\n\t}\n\n\tisVertical() {\n\t\tconst p = this.position\n\t\treturn p === \"right\" || p === \"left\"\n\t}\n\n\tcalcrect() {\n\t\tlet titleWidth = 0\n\t\tconst t = this.title\n\t\tconst r = this.chart.chartRect\n\t\tconst a = this.align\n\t\tconst b = this.bounds\n\t\tconst vert = this.isVertical()\n\t\tconst f = this.format\n\n\t\tif (t.shouldDraw()) {\n\t\t\tt.resize()\n\t\t\tthis._titleHeight = t.bounds.height\n\t\t\ttitleWidth = t.bounds.width\n\t\t} else this._titleHeight = 0\n\n\t\tif (vert) b.y = a === 0 ? r.y : this.chart.bounds.height * a * 0.01\n\t\telse b.x = a === 0 ? r.x : this.chart.bounds.width * a * 0.01\n\n\t\tf.font.prepare()\n\t\tthis.itemHeight = f.textHeight(\"Wj\")\n\n\t\tthis.calcWidths()\n\n\t\tconst pad = this.calcPadding(r)\n\t\tlet s: number\n\t\tconst co = this.itemsCount()\n\n\t\tif (vert) {\n\t\t\ts = this.symbol.visible ? this.symbol.width + this.symbol.padding : 0\n\n\t\t\tb.width = Math.max(titleWidth, 2 * this.edgeInset + this._itemWidth + s)\n\t\t\tb.height = this.itemHeight * 0.5 + co * this.rowPitch() - this.rowGap + this._titleHeight\n\n\t\t\tif (b.width - 6 > titleWidth) t.bounds.width = b.width - 6\n\t\t} else {\n\t\t\tb.width = pad + this.perRow * this.totalWidth()\n\t\t\tb.x += 0.5 * (r.width - b.width)\n\t\t\tb.height = this.rows * this.rowPitch() - this.rowGap + this.itemHeight * 0.25\n\t\t}\n\n\t\tif (f.stroke.fill !== \"\") {\n\t\t\ts = +f.stroke.size\n\t\t\tif (s > 1) {\n\t\t\t\tb.width += s\n\t\t\t\tb.height += s\n\t\t\t\tthis.innerOff = s * 0.5\n\t\t\t}\n\t\t}\n\n\t\tif (co === 0) return\n\n\t\tif (this.position === \"right\") {\n\t\t\tb.x = r.getRight() - b.width - this.margin * b.width * 0.01\n\t\t\tif (r.automatic) r.setRight(Math.max(r.x, b.x - pad))\n\t\t} else if (this.position === \"left\") {\n\t\t\tb.x = r.x\n\t\t\tif (r.automatic) r.setLeft(b.x + b.width + pad)\n\t\t} else if (this.position === \"top\") {\n\t\t\tb.y = r.y + pad\n\t\t\tif (r.automatic) r.setTop(b.getBottom() + pad)\n\t\t} else {\n\t\t\tb.y = r.getBottom() - b.height - pad\n\t\t\tif (r.automatic) r.setBottom(b.y - pad)\n\t\t}\n\t}\n}\n","import { Format } from \"./format.js\"\nimport { Margins } from \"./margins.js\"\nimport type { Chart } from \"../../chart.js\"\n\nexport class Panel {\n\tchart: Chart\n\tformat: Format\n\ttransparent: boolean\n\tmargins: Margins\n\n\tconstructor(chart: Chart) {\n\t\tthis.chart = chart\n\t\tthis.format = new Format(chart)\n\t\tthis.format.round.x = 12\n\t\tthis.format.round.y = 12\n\t\tthis.format.stroke.size = 3\n\t\tthis.format.gradient.visible = true\n\t\tthis.format.gradient.direction = \"bottomtop\"\n\t\tthis.format.shadow.visible = true\n\t\tthis.format.stroke.fill = \"#606060\"\n\t\tthis.transparent = !!chart.__webgl\n\t\tthis.margins = new Margins()\n\t}\n\n\tclear(): void {\n\t\tconst bounds = this.chart.bounds\n\t\tthis.chart.renderer.clearRect(bounds.x, bounds.y, bounds.width, bounds.height)\n\t}\n\n\tdraw(): void {\n\t\tif (this.transparent || this.chart.__webgl) {\n\t\t\tthis.clear()\n\t\t\treturn\n\t\t}\n\n\t\tconst rectangle = this.chart.chartRect\n\t\tconst format = this.format\n\t\tconst shadow = format.shadow\n\n\t\tif (shadow.visible) {\n\t\t\trectangle.width -= 0.5 * Math.abs(shadow.width) + 2\n\t\t\trectangle.height -= 0.5 * Math.abs(shadow.height) + 2\n\t\t\tif (shadow.width < 0) rectangle.x -= shadow.width\n\t\t\tif (shadow.height < 0) rectangle.y -= shadow.height\n\t\t}\n\n\t\tlet strokeSize = 0\n\t\tif (format.stroke.fill !== \"\") {\n\t\t\tstrokeSize = format.stroke.size\n\t\t\tif (strokeSize > 1) {\n\t\t\t\tstrokeSize *= 0.5\n\t\t\t\trectangle.x += strokeSize\n\t\t\t\trectangle.y += strokeSize\n\t\t\t\trectangle.width -= 2 * strokeSize\n\t\t\t\trectangle.height -= 2 * strokeSize\n\t\t\t}\n\t\t}\n\n\t\tif (shadow.visible || format.round.x > 0 || format.round.y > 0) this.clear()\n\t\tformat.rectangle(rectangle)\n\n\t\tif (strokeSize > 0) {\n\t\t\trectangle.x += strokeSize\n\t\t\trectangle.y += strokeSize\n\t\t\trectangle.width -= 2 * strokeSize\n\t\t\trectangle.height -= 2 * strokeSize\n\t\t}\n\t}\n}\n","import { Point } from \"../primitives.js\"\nimport type { Chart } from \"../../chart.js\"\n\nexport type ScrollDirection = \"both\" | \"horizontal\" | \"vertical\" | string\n\nexport class Scroll {\n\tchart: Chart\n\tactive = false\n\tenabled = true\n\tdone = false\n\tmouseButton = 2\n\tdirection: ScrollDirection = \"both\"\n\tposition = new Point(0, 0)\n\n\tconstructor(chart: Chart) {\n\t\tthis.chart = chart\n\t}\n}\n","import { Rectangle } from \"../primitives.js\"\nimport { Format } from \"./format.js\"\nimport type { Chart } from \"../../chart.js\"\n\nexport class Wall {\n\tchart: Chart\n\tformat: Format\n\tvisible = true\n\tbounds: Rectangle\n\tsize = 0\n\n\tconstructor(chart: Chart) {\n\t\tthis.chart = chart\n\t\tthis.format = new Format(chart)\n\t\tthis.format.fill = \"#E6E6E6\"\n\t\tthis.format.stroke.fill = \"black\"\n\t\tthis.format.z = 0\n\t\tthis.format.depth = 0\n\t\tthis.bounds = new Rectangle()\n\t}\n\n\tdraw(): void {\n\t\tthis.format.cube(this.bounds)\n\t\tthis.format.draw(this.chart.drawContext, null, this.bounds)\n\t}\n}\n","import { Point, Rectangle } from \"../primitives.js\"\nimport type { Chart } from \"../../chart.js\"\nimport type { Axis } from \"./axis.js\"\nimport { Format } from \"./format.js\"\n\nexport type ZoomDirection = \"both\" | \"horizontal\" | \"vertical\" | string\ntype ZoomChart = Chart & { oldPos: Point }\n\nexport class Zoom {\n\tchart: ZoomChart\n\tonreset?: () => void\n\tactive = false\n\tenabled = true\n\tdone = false\n\ttouching = false\n\tdirection: ZoomDirection = \"both\"\n\tkeepAspect = false\n\tmouseButton = 0\n\twheel = { enabled: false, factor: 1 }\n\told: Point | null = null\n\t_rect = new Rectangle()\n\tformat: Format\n\n\tconstructor(chart: Chart) {\n\t\tthis.chart = chart as ZoomChart\n\t\tthis.format = new Format(chart)\n\t\tthis.format.fill = \"rgba(255,255,255,0.5)\"\n\t\tthis.format.stroke.fill = \"darkgray\"\n\t\tthis.format.stroke.size = 2\n\t}\n\n\tchange(pos: Point): void {\n\t\tif (!this.old) this.old = new Point(0, 0)\n\t\tconst old = this.chart.oldPos\n\t\tthis.old.x = pos.x - old.x\n\t\tthis.old.y = this.keepAspect\n\t\t\t? this.old.x * (this.chart.chartRect.height / this.chart.chartRect.width)\n\t\t\t: pos.y - old.y\n\t}\n\n\t_check(): Rectangle {\n\t\tconst chartRect = this.chart.chartRect\n\t\tconst direction = this.direction\n\t\tconst both = direction === \"both\"\n\t\tconst r = this._rect\n\t\tr.set(chartRect.x, chartRect.y, chartRect.width, chartRect.height)\n\n\t\tif (this.old) {\n\t\t\tif (both || direction === \"horizontal\") {\n\t\t\t\tif (this.old.x < 0) {\n\t\t\t\t\tr.x = this.chart.oldPos.x + this.old.x\n\t\t\t\t\tr.width = -this.old.x\n\t\t\t\t} else {\n\t\t\t\t\tr.x = this.chart.oldPos.x\n\t\t\t\t\tr.width = this.old.x\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (both || direction === \"vertical\") {\n\t\t\t\tif (this.old.y < 0) {\n\t\t\t\t\tr.y = this.chart.oldPos.y + this.old.y\n\t\t\t\t\tr.height = -this.old.y\n\t\t\t\t} else {\n\t\t\t\t\tr.y = this.chart.oldPos.y\n\t\t\t\t\tr.height = this.old.y\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn r\n\t}\n\n\tdraw(): void {\n\t\tthis.format.rectangle(this._check())\n\t}\n\n\tapply(): boolean {\n\t\tif (!this.old) return false\n\t\tif (this.old.x < 0 || this.old.y < 0) {\n\t\t\tthis.reset()\n\t\t\tthis.onreset?.()\n\t\t\tthis.chart._emit(\"zoomreset\", this.chart)\n\t\t} else {\n\t\t\tconst r = this._check()\n\t\t\tif (r.width > 3 && r.height > 3) {\n\t\t\t\tconst direction = this.direction\n\t\t\t\tconst both = direction === \"both\"\n\t\t\t\tthis.chart.axes.each(function (this: Axis) {\n\t\t\t\t\tif (this.horizontal) {\n\t\t\t\t\t\tif (both || direction === \"horizontal\") this.calcMinMax(r.x, r.x + r.width)\n\t\t\t\t\t} else if (both || direction === \"vertical\") this.calcMinMax(r.y + r.height, r.y)\n\t\t\t\t})\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\treset(): void {\n\t\tthis.chart.axes.each(function (this: Axis) {\n\t\t\tthis.automatic = true\n\t\t})\n\t}\n}\n","import type { Chart } from \"./chart.js\"\nimport type { Axis } from \"./core/elements/axis.js\"\nimport type { Zoom } from \"./core/elements/zoom.js\"\nimport { Point } from \"./core/primitives.js\"\nimport { cancelAnimationFrame, getWindow, requestAnimationFrame } from \"./platform.js\"\nimport { ToolTip } from \"./tools/index.js\"\nimport { doubleTap } from \"./utils.js\"\nimport { notifyPluginHooks, type ChartPluginEvent } from \"./plugin.js\"\n\ntype InteractionEvent = {\n\ttype?: string\n\ttouches?: TouchList\n\tclientX?: number\n\tclientY?: number\n\tbutton?: number\n\tpointerId?: number\n\tfromElement?: EventTarget | null\n\ttarget?: (EventTarget & { setCapture?: () => void; releasePointerCapture?: (pointerId: number) => void }) | null\n\tpreventDefault?: () => void\n\tcancelBubble?: boolean\n}\ntype LegacyCanvas = HTMLCanvasElement & Record<string, unknown>\ntype LegacyCanvasWithChart = LegacyCanvas & { chart: Chart }\ntype LegacyWheelEvent = WheelEvent & { wheelDelta?: number; detail?: number; returnValue?: boolean }\ntype LegacyPointerTarget = EventTarget & {\n\tsetCapture?: () => void\n\tsetPointerCapture?: (pointerId: number) => void\n\treleasePointerCapture?: (pointerId: number) => void\n}\ntype EventHandler = (event: InteractionEvent) => boolean | void\n\ninterface CanvasHandlerRegistration {\n\thandler: EventHandler\n\tprevious: EventHandler | null | undefined\n}\n\nconst canvasHandlerRegistrations = new WeakMap<LegacyCanvas, Map<string, CanvasHandlerRegistration[]>>()\n/** Any function: plugin event handlers are wrapped without knowing their parameters. */\ntype AnyHandler = (...args: never[]) => unknown\n\nconst pluginEventWrappers = new WeakMap<object, WeakMap<AnyHandler, AnyHandler>>()\nconst pluginWrappedHandlers = new WeakSet<AnyHandler>()\n\nfunction wrapperFor(chart: Chart, handler: AnyHandler, create: () => AnyHandler): AnyHandler {\n\tif (pluginWrappedHandlers.has(handler)) return handler\n\tlet wrappers = pluginEventWrappers.get(chart)\n\tif (!wrappers) {\n\t\twrappers = new WeakMap()\n\t\tpluginEventWrappers.set(chart, wrappers)\n\t}\n\n\tlet wrapped = wrappers.get(handler)\n\tif (!wrapped) {\n\t\twrapped = create()\n\t\twrappers.set(handler, wrapped)\n\t\tpluginWrappedHandlers.add(wrapped)\n\t}\n\treturn wrapped\n}\n\ntype InteractionChart = Chart & {\n\t_doWheel: (this: LegacyCanvasWithChart, event?: LegacyWheelEvent) => void\n\t_doMouseOut: (this: LegacyCanvasWithChart, event?: MouseEvent) => void\n\tdomousemove: (this: LegacyCanvasWithChart, event?: InteractionEvent) => boolean\n\tdomousedown: (this: LegacyCanvasWithChart, event?: InteractionEvent) => boolean\n\tdomouseup: (this: LegacyCanvasWithChart, event?: InteractionEvent) => void\n\tdomousecancel: (this: LegacyCanvasWithChart, event?: InteractionEvent) => void\n\toldPos: Point\n\toldCursor?: string\n\tonscroll?: (event: InteractionEvent) => void\n\tonzoom?: () => void\n\tmousedown?: (event: InteractionEvent) => boolean\n\tmousemove?: (point: Point) => boolean\n\tmouseup?: (event: InteractionEvent) => boolean\n\t_twoFingersZoomCleanup: (() => void) | null\n\tseries: Chart[\"series\"] & {\n\t\tmouseout(): void\n\t\tmousemove(point: Point): void\n\t\tmousedown(event: MouseEvent): boolean\n\t\tclicked(point: Point): boolean\n\t}\n\ttitle: Chart[\"title\"] & { onclick?: (title: Chart[\"title\"]) => void }\n}\n\n/**\n * Shared canvas interaction helpers.\n *\n * The chart remains responsible for its public event callbacks, while this\n * module owns registration and gesture-specific lifecycle details.\n */\n\nexport function registerCanvasListener(\n\tchart: Chart,\n\ttarget: HTMLCanvasElement,\n\ttype: string,\n\tlistener: EventListenerOrEventListenerObject,\n\toptions?: boolean | AddEventListenerOptions\n): void {\n\tconst wrapped =\n\t\ttypeof listener === \"function\"\n\t\t\t? (wrapperFor(chart, listener, () => (event: Event) => {\n\t\t\t\t\tconst pluginEvent = event as unknown as ChartPluginEvent\n\t\t\t\t\tif (!notifyPluginHooks(chart, \"beforeEvent\", [pluginEvent], chart.plugins)) return\n\t\t\t\t\tlistener.call(target, event)\n\t\t\t\t\tnotifyPluginHooks(chart, \"afterEvent\", [pluginEvent], chart.plugins)\n\t\t\t\t}) as EventListener)\n\t\t\t: listener\n\tfor (const key of Object.keys(chart)) {\n\t\tconst value = (chart as unknown as Record<string, unknown>)[key]\n\t\tif (value === listener) (chart as unknown as Record<string, unknown>)[key] = wrapped\n\t}\n\ttarget.addEventListener(type, wrapped, options)\n\tchart._eventCleanups.push(() => target.removeEventListener(type, wrapped, options))\n}\n\nexport function registerCanvasHandler(\n\tchart: Chart,\n\ttarget: LegacyCanvas,\n\tproperty: string,\n\thandler: EventHandler\n): void {\n\tconst wrapped = wrapperFor(chart, handler, () => (event?: InteractionEvent): boolean | void => {\n\t\tconst pluginEvent = (event || {}) as ChartPluginEvent\n\t\tif (!notifyPluginHooks(chart, \"beforeEvent\", [pluginEvent], chart.plugins)) return false\n\t\tconst result = handler.call(target, event as InteractionEvent)\n\t\tnotifyPluginHooks(chart, \"afterEvent\", [pluginEvent], chart.plugins)\n\t\treturn result\n\t}) as EventHandler\n\tfor (const key of Object.keys(chart)) {\n\t\tconst value = (chart as unknown as Record<string, unknown>)[key]\n\t\tif (value === handler) (chart as unknown as Record<string, unknown>)[key] = wrapped\n\t}\n\tlet properties = canvasHandlerRegistrations.get(target)\n\tif (!properties) {\n\t\tproperties = new Map()\n\t\tcanvasHandlerRegistrations.set(target, properties)\n\t}\n\tlet registrations = properties.get(property)\n\tif (!registrations) {\n\t\tregistrations = []\n\t\tproperties.set(property, registrations)\n\t}\n\tconst registration = { handler: wrapped, previous: target[property] as EventHandler | null | undefined }\n\tregistrations.push(registration)\n\ttarget[property] = wrapped\n\tchart._eventCleanups.push(() => {\n\t\tif (target[property] === wrapped) target[property] = registration.previous || null\n\t\t// A newer chart must not restore this handler after its owner is destroyed.\n\t\tfor (const other of registrations) {\n\t\t\tif (other !== registration && other.previous === registration.handler) other.previous = registration.previous\n\t\t}\n\t\tconst index = registrations.indexOf(registration)\n\t\tif (index !== -1) registrations.splice(index, 1)\n\t\tif (registrations.length === 0) properties.delete(property)\n\t\tif (properties.size === 0) canvasHandlerRegistrations.delete(target)\n\t})\n}\n\n/**\n * Installs the two-finger zoom gesture once for a chart.\n *\n * @param {Tee.Chart} chart Chart receiving the gesture.\n * @param {Zoom} zoom Zoom configuration.\n */\nexport function setupTwoFingersZoom(chart: Chart, zoom: Zoom): void {\n\tif (chart._twoFingersZoomCleanup) return\n\n\tconst canvas = chart.interactionCanvas || chart.canvas\n\tlet maxDistX = 0\n\tlet minDistX = 0\n\tlet maxDistY = 0\n\tlet minDistY = 0\n\tlet newMinDistX = 0\n\tlet newMaxDistX = 0\n\tlet newMinDistY = 0\n\tlet newMaxDistY = 0\n\tlet oldMinDistX = 0\n\tlet oldMaxDistX = 0\n\tlet oldMinDistY = 0\n\tlet oldMaxDistY = 0\n\tlet touches: TouchList | null = null\n\tlet touchedMoreThanOnceStart = false\n\tlet pMinX: number\n\tlet pMinY: number\n\tlet pMaxX: number\n\tlet pMaxY: number\n\tlet iniMinX: number\n\tlet iniMinY: number\n\tlet iniMaxX: number\n\tlet iniMaxY: number\n\n\tfunction touchZoom() {\n\t\tif (touches && touches.length > 1) {\n\t\t\tlet tmp = 0\n\t\t\tconst touch1 = touches[0]\n\t\t\tconst touch2 = touches[1]\n\t\t\tzoom.touching = true\n\n\t\t\tif (!touchedMoreThanOnceStart) {\n\t\t\t\tiniMinX = touch1.pageX\n\t\t\t\tiniMaxX = touch2.pageX\n\t\t\t\tiniMinY = touch1.pageY\n\t\t\t\tiniMaxY = touch2.pageY\n\n\t\t\t\tif (iniMinX > iniMaxX) {\n\t\t\t\t\ttmp = iniMinX\n\t\t\t\t\tiniMinX = iniMaxX\n\t\t\t\t\tiniMaxX = tmp\n\t\t\t\t}\n\t\t\t\tif (iniMinY > iniMaxY) {\n\t\t\t\t\ttmp = iniMinY\n\t\t\t\t\tiniMinY = iniMaxY\n\t\t\t\t\tiniMaxY = tmp\n\t\t\t\t}\n\n\t\t\t\ttouchedMoreThanOnceStart = true\n\t\t\t} else {\n\t\t\t\tpMinX = touch1.pageX\n\t\t\t\tpMaxX = touch2.pageX\n\t\t\t\tpMinY = touch1.pageY\n\t\t\t\tpMaxY = touch2.pageY\n\t\t\t\tif (pMinX > pMaxX) {\n\t\t\t\t\ttmp = pMinX\n\t\t\t\t\tpMinX = pMaxX\n\t\t\t\t\tpMaxX = tmp\n\t\t\t\t}\n\t\t\t\tif (pMinY > pMaxY) {\n\t\t\t\t\ttmp = pMinY\n\t\t\t\t\tpMinY = pMaxY\n\t\t\t\t\tpMaxY = tmp\n\t\t\t\t}\n\n\t\t\t\tnewMinDistX = pMinX - iniMinX\n\t\t\t\tnewMinDistY = pMinY - iniMinY\n\t\t\t\tnewMaxDistX = pMaxX - iniMaxX\n\t\t\t\tnewMaxDistY = pMaxY - iniMaxY\n\t\t\t\tminDistX = oldMinDistX - newMinDistX\n\t\t\t\tminDistY = oldMinDistY - newMinDistY\n\t\t\t\tmaxDistX = oldMaxDistX - newMaxDistX\n\t\t\t\tmaxDistY = oldMaxDistY - newMaxDistY\n\t\t\t\toldMinDistX = newMinDistX\n\t\t\t\toldMinDistY = newMinDistY\n\t\t\t\toldMaxDistX = newMaxDistX\n\t\t\t\toldMaxDistY = newMaxDistY\n\t\t\t}\n\n\t\t\tif (zoom.direction === \"both\" || zoom.direction === \"horizontal\") {\n\t\t\t\tdrawMinMaxBottom(chart.axes.bottom.startPos + minDistX, chart.axes.bottom.endPos + maxDistX)\n\t\t\t}\n\t\t\tif (zoom.direction === \"both\" || zoom.direction === \"vertical\") {\n\t\t\t\tdrawMinMaxLeft(chart.axes.left.startPos + minDistY, chart.axes.left.endPos + maxDistY)\n\t\t\t}\n\t\t}\n\t}\n\n\tconst onTouchEnd = () => {\n\t\tif (touchedMoreThanOnceStart) touchedMoreThanOnceStart = false\n\t\tzoom.touching = false\n\t}\n\tconst onTouchMove = (event: TouchEvent): void => {\n\t\tevent.preventDefault()\n\t\ttouches = event.touches\n\t\ttouchZoom()\n\t}\n\n\tregisterCanvasListener(chart, canvas, \"touchend\", onTouchEnd)\n\tregisterCanvasListener(chart, canvas, \"touchcancel\", onTouchEnd)\n\tregisterCanvasListener(chart, canvas, \"touchmove\", onTouchMove as EventListener)\n\tchart._twoFingersZoomCleanup = () => {\n\t\tzoom.touching = false\n\t\tchart._twoFingersZoomCleanup = null\n\t}\n\tchart._eventCleanups.push(chart._twoFingersZoomCleanup)\n\n\tfunction drawMinMaxBottom(min: number, max: number): void {\n\t\tchart.axes.top.calcMinMax(min, max)\n\t\tchart.axes.bottom.calcMinMax(min, max)\n\t\tchart.draw()\n\t}\n\tfunction drawMinMaxLeft(min: number, max: number): void {\n\t\tchart.axes.right.calcMinMax(min, max)\n\t\tchart.axes.left.calcMinMax(min, max)\n\t\tchart.draw()\n\t}\n}\n\n/**\n * Installs mouse-wheel and mouse-out behavior for a chart.\n *\n * @param {Tee.Chart} chart Chart receiving the handlers.\n */\nexport function setupPointerAuxiliaryHandlers(chart: Chart): void {\n\tconst interactionChart = chart as InteractionChart\n\tconst canvas = (chart.interactionCanvas || chart.canvas) as LegacyCanvas\n\n\tinteractionChart._doWheel = function (this: LegacyCanvasWithChart, event?: LegacyWheelEvent): void {\n\t\tfunction applyAxis(axis: Axis): void {\n\t\t\tconst axisRange = axis.maximum - axis.minimum\n\t\t\tif (axisRange > 0) {\n\t\t\t\tconst range = delta * axisRange * 0.05\n\t\t\t\taxis.setMinMax(axis.minimum + range, axis.maximum - range)\n\t\t\t}\n\t\t}\n\n\t\tconst currentChart = this.chart as InteractionChart\n\t\tif (!currentChart || currentChart.destroyed) return\n\t\tif (!currentChart.zoom.wheel.enabled) {\n\t\t\tfor (const tool of currentChart.tools.items) {\n\t\t\t\tif (tool instanceof ToolTip && tool.active) tool.hide()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tevent = event || (getWindow()?.event as LegacyWheelEvent | undefined)\n\t\tif (!event) return\n\t\tconst delta =\n\t\t\tcurrentChart.zoom.wheel.factor *\n\t\t\t(event.wheelDelta\n\t\t\t\t? event.wheelDelta / 120\n\t\t\t\t: event.deltaY\n\t\t\t\t\t? -event.deltaY / (event.deltaMode === 1 ? 3 : 100)\n\t\t\t\t\t: event.detail\n\t\t\t\t\t\t? -event.detail / 3\n\t\t\t\t\t\t: 0)\n\n\t\tif (Math.abs(delta) > 0) {\n\t\t\tconst point = { x: 0, y: 0 }\n\t\t\tcurrentChart.calcMouse(event, point)\n\n\t\t\tif (currentChart.chartRect.contains(point)) {\n\t\t\t\tcurrentChart.axes.each(function () {\n\t\t\t\t\tapplyAxis(this)\n\t\t\t\t})\n\t\t\t\tcurrentChart.draw()\n\t\t\t\tevent.returnValue = false\n\t\t\t\tif (event.preventDefault) event.preventDefault()\n\t\t\t}\n\n\t\t\tfor (const tool of currentChart.tools.items) {\n\t\t\t\tif (tool instanceof ToolTip && tool.active) tool.mousemove(point)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Legacy handlers receive the event as an argument and use the canvas as `this`.\n\tconst wheelHandler = interactionChart._doWheel as unknown as EventListener\n\tif (typeof canvas.addEventListener === \"function\") {\n\t\tregisterCanvasListener(chart, canvas, \"wheel\", wheelHandler, { passive: false })\n\t\tregisterCanvasListener(chart, canvas, \"DOMMouseScroll\", wheelHandler, false)\n\t}\n\tregisterCanvasHandler(chart, canvas, \"onmousewheel\", interactionChart._doWheel as unknown as EventHandler)\n\n\tinteractionChart._doMouseOut = function (this: LegacyCanvasWithChart, event?: MouseEvent): void {\n\t\tif (!this.chart || this.chart.destroyed) return\n\t\tif (!(event?.target as LegacyPointerTarget | null)?.setCapture) this.chart.scroll.active = false\n\t\tthis.chart.domTip.stop(this.chart)\n\t\tthis.chart.series.mouseout()\n\t\tthis.chart.tools.mouseout()\n\t}\n\tregisterCanvasHandler(chart, canvas, \"onmouseout\", interactionChart._doMouseOut as unknown as EventHandler)\n\tregisterCanvasListener(chart, canvas, \"pointerleave\", () => chart.domTip.stop(chart))\n}\n\n/** The pointer events a chart can receive without a DOM, see `Chart.dispatchPointerEvent`. */\nexport type ChartPointerEventKind = \"move\" | \"down\" | \"up\" | \"cancel\" | \"leave\" | \"wheel\"\n\n/** Position, in canvas pixels, and details of a pointer event dispatched with `Chart.dispatchPointerEvent`. */\nexport interface ChartPointerEvent {\n\tx: number\n\ty: number\n\t/** The mouse button of a `down` event; 0 is the primary button. */\n\tbutton?: number\n\t/** The wheel movement of a `wheel` event; negative values zoom in. */\n\tdeltaY?: number\n\tpointerId?: number\n}\n\nconst pointerHandlerNames: Record<ChartPointerEventKind, string> = {\n\tmove: \"onpointermove\",\n\tdown: \"onpointerdown\",\n\tup: \"onpointerup\",\n\tcancel: \"onpointercancel\",\n\tleave: \"onmouseout\",\n\twheel: \"onmousewheel\"\n}\n\n/**\n * Delivers a pointer event to the handlers of a chart. It is the way to interact with a chart drawn on an\n * `OffscreenCanvas` in a Worker, which receives no DOM events: the page forwards the events with canvas\n * relative coordinates.\n */\nexport function dispatchPointerEvent(chart: Chart, kind: ChartPointerEventKind, event: ChartPointerEvent): boolean {\n\tconst canvas = (chart.interactionCanvas || chart.canvas) as LegacyCanvas\n\tconst handler = canvas[pointerHandlerNames[kind]] as EventHandler | null | undefined\n\tif (typeof handler !== \"function\" || chart.destroyed) return false\n\n\thandler.call(canvas, {\n\t\ttype: kind === \"wheel\" ? \"wheel\" : kind === \"leave\" ? \"mouseout\" : `pointer${kind}`,\n\t\tclientX: event.x,\n\t\tclientY: event.y,\n\t\tbutton: event.button ?? 0,\n\t\tpointerId: event.pointerId,\n\t\tdeltaY: event.deltaY ?? 0,\n\t\tdeltaMode: 0,\n\t\tpreventDefault: () => {}\n\t} as InteractionEvent)\n\treturn true\n}\n\n/**\n * Installs the primary mouse, pointer and touch handlers for a chart.\n * The public handler properties remain on Chart for legacy integrations.\n *\n * @param {Tee.Chart} chart Chart receiving the handlers.\n */\nexport function setupPrimaryChartInteraction(chart: Chart): void {\n\tconst interactionChart = chart as InteractionChart\n\tconst canvas = (chart.interactionCanvas || chart.canvas) as LegacyCanvas\n\tconst movePoint = new Point(0, 0)\n\tconst downPoint = new Point(0, 0)\n\tlet frameHandle: number | null = null\n\tlet lastPointerEventAt = 0\n\n\tfunction isCompatibilityEvent(event: InteractionEvent | undefined): boolean {\n\t\tconst type = event?.type || \"\"\n\t\tif (type.startsWith(\"pointer\")) {\n\t\t\tlastPointerEventAt = Date.now()\n\t\t\treturn false\n\t\t}\n\t\treturn (type.startsWith(\"mouse\") || type.startsWith(\"touch\")) && Date.now() - lastPointerEventAt < 800\n\t}\n\n\tinteractionChart.oldPos = new Point()\n\tinteractionChart.calcMouse = function (event: Event, point: { x: number; y: number }): void {\n\t\t// Mouse and touch points both provide the position in the client area.\n\t\tconst { clientX, clientY } = event as Event & { clientX: number; clientY: number }\n\t\tpoint.x = clientX\n\t\tpoint.y = clientY\n\n\t\tlet element = (this.interactionCanvas || this.canvas) as LegacyCanvas\n\t\tif (element.getBoundingClientRect) {\n\t\t\tconst rect = element.getBoundingClientRect()\n\t\t\tpoint.x -= rect.left\n\t\t\tpoint.y -= rect.top\n\t\t} else if (element.offsetParent) {\n\t\t\tdo {\n\t\t\t\tpoint.x -= element.offsetLeft\n\t\t\t\tpoint.y -= element.offsetTop\n\t\t\t\telement = element.offsetParent as LegacyCanvas\n\t\t\t} while (element)\n\t\t}\n\t}\n\n\tfunction scheduleDraw(currentChart: InteractionChart): void {\n\t\tif (frameHandle !== null) return\n\t\tframeHandle = requestAnimationFrame(() => {\n\t\t\tframeHandle = null\n\t\t\tif (!currentChart.destroyed) currentChart.draw()\n\t\t})\n\t}\n\n\tinteractionChart.domousemove = function (this: LegacyCanvasWithChart, event?: InteractionEvent): boolean {\n\t\tconst currentChart = this.chart as InteractionChart\n\t\tif (!currentChart?.ctx || currentChart.destroyed) return false\n\n\t\tevent = event || (getWindow()?.event as InteractionEvent | undefined)\n\t\tif (isCompatibilityEvent(event)) return false\n\t\tif (!event) return false\n\t\tif (event.touches) event = event.touches[event.touches.length - 1]\n\n\t\tcurrentChart.calcMouse(event as unknown as Event, movePoint)\n\t\tif (currentChart.scroll.active) {\n\t\t\tconst direction = currentChart.scroll.direction\n\t\t\tconst both = direction === \"both\"\n\t\t\tif (both || direction === \"horizontal\") {\n\t\t\t\tconst delta = currentChart.axes.bottom.fromSize(currentChart.oldPos.x - movePoint.x)\n\t\t\t\tcurrentChart.axes.top.scroll(delta)\n\t\t\t\tcurrentChart.axes.bottom.scroll(delta)\n\t\t\t}\n\t\t\tif (both || direction === \"vertical\") {\n\t\t\t\tconst delta = -currentChart.axes.left.fromSize(currentChart.oldPos.y - movePoint.y)\n\t\t\t\tcurrentChart.axes.left.scroll(delta)\n\t\t\t\tcurrentChart.axes.right.scroll(delta)\n\t\t\t}\n\n\t\t\tcurrentChart.oldPos.x = movePoint.x\n\t\t\tcurrentChart.oldPos.y = movePoint.y\n\t\t\tcurrentChart.scroll.done = true\n\t\t\tif (currentChart.onscroll) currentChart.onscroll(event)\n\t\t\tcurrentChart._emit(\"scroll\", event)\n\t\t\tif (currentChart.scroll.done) scheduleDraw(currentChart)\n\t\t\treturn false\n\t\t}\n\n\t\tif (currentChart.zoom.active) {\n\t\t\tif (movePoint.x !== currentChart.oldPos.x || movePoint.y !== currentChart.oldPos.y) {\n\t\t\t\tcurrentChart.zoom.change(movePoint)\n\t\t\t\tscheduleDraw(currentChart)\n\t\t\t\tcurrentChart.zoom.done = true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\n\t\tcurrentChart.newCursor = null\n\t\tcurrentChart.tools.mousemove(movePoint)\n\t\tcurrentChart.series.mousemove(movePoint)\n\t\tcurrentChart.legend.mousemove(movePoint)\n\t\tcurrentChart.title.mousemove(movePoint)\n\t\tif (currentChart.mousemove) currentChart.mousemove(movePoint)\n\n\t\t// An OffscreenCanvas has no style: the cursor is left in `chart.newCursor` for the owner of the canvas.\n\t\tconst style = (currentChart.interactionCanvas || currentChart.canvas).style\n\t\tif (!style) return true\n\n\t\tif (currentChart.newCursor) {\n\t\t\tif (style.cursor !== currentChart.newCursor) {\n\t\t\t\tcurrentChart.oldCursor = style.cursor\n\t\t\t\tstyle.cursor = currentChart.newCursor\n\t\t\t}\n\t\t} else if (currentChart.oldCursor !== undefined && style.cursor !== currentChart.oldCursor) {\n\t\t\tstyle.cursor = currentChart.oldCursor\n\t\t}\n\t\treturn true\n\t}\n\n\tinteractionChart.domousedown = function (this: LegacyCanvasWithChart, event?: InteractionEvent): boolean {\n\t\tevent = event || (getWindow()?.event as InteractionEvent | undefined)\n\t\tconst currentChart = this.chart as InteractionChart\n\t\tif (!event || !currentChart || currentChart.destroyed) return false\n\t\tif (isCompatibilityEvent(event)) return false\n\n\t\tconst sourceEvent = event.touches ? event.touches[0] : event\n\t\tcurrentChart.calcMouse(sourceEvent as unknown as Event, downPoint)\n\t\tconst inRect = currentChart.series.anyUsesAxes() && currentChart.chartRect.contains(downPoint)\n\t\tif (event.touches) {\n\t\t\tdoubleTap(currentChart)\n\t\t\tif (currentChart.zoom.enabled) setupTwoFingersZoom(currentChart, currentChart.zoom)\n\t\t}\n\n\t\tif (event.touches) {\n\t\t\tif (event.touches.length > 1) currentChart.scroll.active = false\n\t\t\telse {\n\t\t\t\tcurrentChart.scroll.active = currentChart.scroll.enabled && inRect\n\t\t\t\tif (currentChart.scroll.active) currentChart.zoom.active = false\n\t\t\t}\n\t\t} else {\n\t\t\tcurrentChart.zoom.active = event.button === currentChart.zoom.mouseButton && currentChart.zoom.enabled && inRect\n\t\t\tcurrentChart.scroll.active =\n\t\t\t\tevent.button === currentChart.scroll.mouseButton && currentChart.scroll.enabled && inRect\n\t\t}\n\n\t\tcurrentChart.zoom.done = false\n\t\tcurrentChart.scroll.done = false\n\t\tcurrentChart.oldPos = downPoint\n\t\tconst isPrimaryButton = event.button === undefined || event.button === 0\n\t\tlet done = false\n\t\tif (isPrimaryButton) {\n\t\t\tdone = currentChart.tools.mousedown(event as unknown as MouseEvent)\n\t\t\tif (!done) done = currentChart.series.mousedown(event as unknown as MouseEvent)\n\t\t\tif (!done) done = currentChart.legend.mousedown(event as unknown as Point)\n\t\t\tif (!done && currentChart.mousedown) done = currentChart.mousedown(event)\n\t\t\t;(currentChart.interactionCanvas || currentChart.canvas).oncontextmenu = null\n\t\t} else if (event.button === 2) (currentChart.interactionCanvas || currentChart.canvas).oncontextmenu = () => false\n\n\t\tif (done) currentChart.zoom.active = currentChart.scroll.active = false\n\t\telse done = currentChart.zoom.active || currentChart.scroll.active\n\t\tif (event.preventDefault) event.preventDefault()\n\t\telse event.cancelBubble = true\n\n\t\tif (done) {\n\t\t\tconst target = event.target || event.fromElement\n\t\t\tconst pointerTarget = target as LegacyPointerTarget | null\n\t\t\tif (pointerTarget?.setPointerCapture && event.pointerId) pointerTarget.setPointerCapture(event.pointerId)\n\t\t}\n\t\treturn !done\n\t}\n\n\tinteractionChart.domouseup = function (this: LegacyCanvasWithChart, event?: InteractionEvent): void {\n\t\tevent = event || (getWindow()?.event as InteractionEvent | undefined)\n\t\tconst currentChart = this.chart as InteractionChart\n\t\tif (!event || !currentChart || currentChart.destroyed) return\n\t\tif (isCompatibilityEvent(event)) return\n\n\t\tcurrentChart.zoom.active = false\n\t\tcurrentChart.scroll.active = false\n\t\tlet done: boolean\n\t\tif (currentChart.zoom.done && !currentChart.zoom.touching) {\n\t\t\tif (currentChart.zoom.apply()) {\n\t\t\t\tcurrentChart.onzoom?.()\n\t\t\t\tcurrentChart._emit(\"zoom\", currentChart)\n\t\t\t}\n\t\t\tcurrentChart.draw()\n\t\t\tdone = true\n\t\t} else {\n\t\t\tdone = currentChart.scroll.done\n\t\t\tif (!done) done = currentChart.series.clicked(currentChart.oldPos)\n\t\t\tif (!done) done = currentChart.tools.clicked(currentChart.oldPos)\n\t\t\tif (!done) {\n\t\t\t\tdone = currentChart.title.clicked(currentChart.oldPos)\n\t\t\t\tif (done && currentChart.title.onclick) currentChart.title.onclick(currentChart.title)\n\t\t\t}\n\t\t\tif (!done && currentChart.mouseup) done = currentChart.mouseup(event)\n\t\t}\n\n\t\tcurrentChart.zoom.old = null\n\t\tcurrentChart.zoom.done = false\n\t\tcurrentChart.scroll.done = false\n\t\tif (done && event.preventDefault) event.preventDefault()\n\t\telse if (done) event.cancelBubble = true\n\t\telse (currentChart.interactionCanvas || currentChart.canvas).oncontextmenu = null\n\n\t\tconst target = event.target || event.fromElement\n\t\tconst pointerTarget = target as LegacyPointerTarget | null\n\t\tif (pointerTarget?.releasePointerCapture && event.pointerId) pointerTarget.releasePointerCapture(event.pointerId)\n\t}\n\n\tinteractionChart.domousecancel = function (this: LegacyCanvasWithChart, event?: InteractionEvent): void {\n\t\tconst currentChart = this.chart as InteractionChart\n\t\tif (!currentChart) return\n\t\tif (isCompatibilityEvent(event)) return\n\t\tcurrentChart.zoom.active = false\n\t\tcurrentChart.zoom.done = false\n\t\tcurrentChart.zoom.touching = false\n\t\tcurrentChart.zoom.old = null\n\t\tcurrentChart.scroll.active = false\n\t\tcurrentChart.scroll.done = false\n\t\tconst target = event?.target || event?.fromElement\n\t\tconst pointerTarget = target as LegacyPointerTarget | null\n\t\tif (pointerTarget?.releasePointerCapture && event?.pointerId) pointerTarget.releasePointerCapture(event.pointerId)\n\t}\n\n\tregisterCanvasHandler(chart, canvas, \"onpointerdown\", interactionChart.domousedown)\n\tregisterCanvasHandler(chart, canvas, \"onpointerup\", interactionChart.domouseup)\n\tregisterCanvasHandler(chart, canvas, \"onpointermove\", interactionChart.domousemove)\n\tregisterCanvasHandler(chart, canvas, \"onpointercancel\", interactionChart.domousecancel)\n\tregisterCanvasHandler(chart, canvas, \"onlostpointercapture\", interactionChart.domousecancel)\n\tregisterCanvasHandler(chart, canvas, \"onmousedown\", interactionChart.domousedown)\n\tregisterCanvasHandler(chart, canvas, \"onmouseup\", interactionChart.domouseup)\n\tregisterCanvasHandler(chart, canvas, \"onmousemove\", interactionChart.domousemove)\n\tregisterCanvasHandler(chart, canvas, \"ontouchstart\", interactionChart.domousedown)\n\tregisterCanvasHandler(chart, canvas, \"ontouchend\", interactionChart.domouseup)\n\tregisterCanvasHandler(chart, canvas, \"ontouchmove\", interactionChart.domousemove)\n\tregisterCanvasHandler(chart, canvas, \"ontouchcancel\", interactionChart.domousecancel)\n\tchart._eventCleanups.push(() => {\n\t\tif (frameHandle !== null) cancelAnimationFrame(frameHandle)\n\t\tframeHandle = null\n\t})\n}\n","import type { Chart } from \"../chart.js\"\nimport type { Axis } from \"../core/elements/axis.js\"\nimport { type Point, Rectangle } from \"../core/primitives.js\"\nimport type { Series } from \"../series.js\"\nimport { drawPluginHooks } from \"../plugin.js\"\n\ninterface Margins {\n\tx: number\n\ty: number\n}\n\ninterface LegacySeries extends Series {\n\tonclick?: (series: Series, index: number, x: number, y: number) => boolean\n\ttransform?: () => void\n\tvisual?: unknown\n\tvertMargins(result: Margins): void\n\thorizMargins(result: Margins): void\n\tdraw(): void\n\tdrawMarks(): void\n\tbeforeDraw?(): void\n}\n\ntype SeriesConstructor = abstract new (...args: never[]) => object\n\ninterface SeriesDrawingContext extends CanvasRenderingContext2D {\n\tbeginParent?: () => unknown\n\tendParent?: () => void\n}\n\nfunction asLegacySeries(series: Series): LegacySeries {\n\treturn series as LegacySeries\n}\n\n/**\n * Calculates the stroke size used to clip a series against an axis.\n */\nfunction axisStrokeSize(axis: Axis): number {\n\tif (axis.visible && axis.firstSeries) {\n\t\tconst stroke = axis.format.stroke\n\t\treturn stroke.fill === \"\" ? 0 : stroke.size * 0.5\n\t}\n\treturn 0\n}\n\n/**\n * @memberOf Tee.Chart\n * @constructor\n * @class Contains a list of chart series objects\n * @param {Tee.Chart} chart The parent chart this list of series belongs to.\n * @property {Tee.Series[]} items The array containing series instances.\n */\nexport class SeriesList {\n\tchart: Chart\n\titems: Series[]\n\n\tconstructor(chart: Chart) {\n\t\tthis.chart = chart\n\t\tthis.items = []\n\t}\n\n\t/**\n\t * Adds a series unless it is already present.\n\t *\n\t * @param {Tee.Series} series Series to add.\n\t * @returns {Tee.Series} The added or existing series.\n\t */\n\tadd(series: Series): Series {\n\t\tif (!this.items.includes(series)) this.items.push(series)\n\t\treturn series\n\t}\n\n\t/**\n\t * Removes a series from the list.\n\t *\n\t * @param {Tee.Series} series Series to remove.\n\t * @returns {Boolean} Whether the series was removed.\n\t */\n\tremove(series: Series, destroy = false): boolean {\n\t\tconst index = this.items.indexOf(series)\n\t\tif (index === -1) return false\n\t\tthis.items.splice(index, 1)\n\t\tif (destroy) series.destroy?.()\n\t\treturn true\n\t}\n\n\t/**\n\t * Removes all series from the list.\n\t *\n\t * @returns {Tee.SeriesList} This list.\n\t */\n\tclear(destroy = false): this {\n\t\tif (destroy) for (const series of this.items) series?.destroy?.()\n\t\tthis.items.length = 0\n\t\treturn this\n\t}\n\n\tdestroy(): void {\n\t\tthis.clear(true)\n\t}\n\n\t/**\n\t * @returns {Number} Returns the total number of series in chart, visible or not.\n\t */\n\tcount(): number {\n\t\treturn this.items.length\n\t}\n\n\t/**\n\t * @returns {Boolean} Returns if {@link Point} p parameter is over any series point.\n\t */\n\tclicked(p: Point): boolean {\n\t\tlet done = false\n\n\t\tconst chartListens = this.chart._hasListeners(\"seriesclick\")\n\n\t\tthis.each(s => {\n\t\t\tconst legacySeries = asLegacySeries(s)\n\t\t\tif (!legacySeries.visible) return\n\t\t\tif (!legacySeries.onclick && !chartListens && !legacySeries._hasListeners(\"click\")) return\n\n\t\t\tconst index = legacySeries.clicked(p)\n\t\t\tif (index === -1) return\n\n\t\t\tif (legacySeries.onclick) done = legacySeries.onclick(legacySeries, index, p.x, p.y)\n\t\t\tlegacySeries._emit(\"click\", legacySeries, index, p.x, p.y)\n\t\t\tthis.chart._emit(\"seriesclick\", legacySeries, index, p.x, p.y)\n\t\t})\n\n\t\treturn done\n\t}\n\n\tmousedown(event: MouseEvent): boolean {\n\t\tlet done = false\n\t\tfor (let t = 0; t < this.items.length; t++) {\n\t\t\tconst s = asLegacySeries(this.items[t])\n\t\t\tif (!s) break\n\t\t\tif (s.visible) {\n\t\t\t\tif (s.mousedown(event)) done = true\n\t\t\t}\n\t\t}\n\n\t\treturn done\n\t}\n\n\tmousemove(p: Point): void {\n\t\tfor (let t = 0; t < this.items.length; t++) {\n\t\t\tconst s = this.items[t]\n\t\t\tif (!s) break\n\t\t\tif (s.visible) s.mousemove(p)\n\t\t}\n\t}\n\n\tmouseout(): void {\n\t\tthis.each(s => {\n\t\t\tif (s.visible) s.mouseout()\n\t\t})\n\t}\n\n\t/**\n\t * Counts how many visible series exist of the same class type.\n\t * @param {Series} [s]\n\t * @param {Function} [c]\n\t * @param {{index: number, total: number}} [res]\n\t * @returns {Number} Returns the number of visible series in chart of the same type as this.\n\t */\n\tvisibleCount(s?: Series, constructorType?: SeriesConstructor, result?: { index: number; total: number }): number {\n\t\tlet count = 0\n\t\tfor (let index = this.items.length - 1; index >= 0; index--) {\n\t\t\tconst series = this.items[index]\n\t\t\tif (series.visible && (!constructorType || series instanceof constructorType)) {\n\t\t\t\tif (result && series === s) result.index = count\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t\tif (result) {\n\t\t\tresult.total = count\n\t\t\tresult.index = count - 1 - result.index\n\t\t}\n\t\treturn count\n\t}\n\n\tbeforeDraw(): void {\n\t\tthis.each(s => {\n\t\t\tif (s.useAxes) s.recalcAxes()\n\n\t\t\ts.calcColorEach()\n\t\t})\n\t}\n\n\t/**\n\t * @returns {Boolean} Returns if any visible series in chart needs axes to be represented.\n\t */\n\t/** @returns {boolean} */\n\tanyUsesAxes(): boolean {\n\t\tfor (let index = this.items.length - 1; index >= 0; index--) {\n\t\t\tconst series = this.items[index]\n\t\t\tif (series.visible && series.useAxes) return true\n\t\t}\n\n\t\treturn false\n\t}\n\n\t/**\n\t * @returns {Tee.Series} Returns the first visible series in chart, or null if any.\n\t */\n\t/** @returns {Series | null} */\n\tfirstVisible(): Series | null {\n\t\tfor (const series of this.items) {\n\t\t\tif (series.visible) return series\n\t\t}\n\t\treturn null\n\t}\n\n\t/**\n\t * Calculates the maximum amount of vertical margins in pixels from all series.\n\t * @returns {Point} Returns the maximum top/bottom distance in pixels that all series need to be separated from axes.\n\t */\n\t/** @returns {{x: number, y: number} | undefined} */\n\tvertMargins(): Margins | undefined {\n\t\tif (this.items.length === 0) return undefined\n\t\tconst result: Margins = { x: 0, y: 0 }\n\t\tconst margins: Margins = { x: 0, y: 0 }\n\t\tasLegacySeries(this.items[0]).vertMargins(result)\n\n\t\tfor (let index = 1; index < this.items.length; index++) {\n\t\t\tconst series = this.items[index]\n\t\t\tif (series.data.values.length > 0) {\n\t\t\t\tmargins.x = 0\n\t\t\t\tmargins.y = 0\n\t\t\t\tasLegacySeries(series).vertMargins(margins)\n\t\t\t\tif (margins.x > result.x) result.x = margins.x\n\t\t\t\tif (margins.y > result.y) result.y = margins.y\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n\n\t/**\n\t * Calculates the maximum amount of horizontal margins in pixels from all series\n\t * @returns {Point} Returns the maximum left/right distance in pixels that all series need to be separated from axes.\n\t */\n\t/** @returns {{x: number, y: number} | undefined} */\n\thorizMargins(): Margins | undefined {\n\t\tif (this.items.length === 0) return undefined\n\t\tconst result: Margins = { x: 0, y: 0 }\n\t\tconst margins: Margins = { x: 0, y: 0 }\n\t\tasLegacySeries(this.items[0]).horizMargins(result)\n\n\t\tfor (let index = 1; index < this.items.length; index++) {\n\t\t\tconst series = this.items[index]\n\t\t\tif (series.data.values.length > 0) {\n\t\t\t\tmargins.x = 0\n\t\t\t\tmargins.y = 0\n\t\t\t\tasLegacySeries(series).horizMargins(margins)\n\n\t\t\t\tif (margins.x > result.x) result.x = margins.x\n\t\t\t\tif (margins.y > result.y) result.y = margins.y\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n\n\t/**\n\t * @returns {Number} Returns the minimum of all visible non-empty series associated to axis, minimum x values.\n\t * @param {import(\"../core/elements/axis\").Axis | null} axis\n\t */\n\t/** @returns {number} */\n\tminXValue(axis: Axis | null): number {\n\t\tlet result = Infinity\n\t\tthis.eachAxis(axis, series => {\n\t\t\tconst value = series.minXValue()\n\t\t\tif (value < result) result = value\n\t\t})\n\t\treturn result\n\t}\n\n\t/**\n\t * @returns {Number} Returns the minimum of all visible series mininum data values.\n\t * @param {import(\"../core/elements/axis\").Axis | null} axis\n\t */\n\t/** @returns {number} */\n\tminYValue(axis: Axis | null): number {\n\t\tlet result = Infinity\n\t\tthis.eachAxis(axis, series => {\n\t\t\tconst value = series.minYValue()\n\t\t\tif (value < result) result = value\n\t\t})\n\t\treturn result\n\t}\n\n\t/**\n\t * @returns {Number} Returns the maximum of all visible series maximum x values.\n\t * @param {import(\"../core/elements/axis\").Axis | null} axis\n\t */\n\t/** @returns {number} */\n\tmaxXValue(axis: Axis | null): number {\n\t\tlet result = -Infinity\n\t\tthis.eachAxis(axis, series => {\n\t\t\tconst value = series.maxXValue()\n\t\t\tif (value > result) result = value\n\t\t})\n\t\treturn result\n\t}\n\n\t/**\n\t * @returns {Number} Returns the maximum of all visible series maximum data values.\n\t * @param {import(\"../core/elements/axis\").Axis | null} axis\n\t */\n\t/** @returns {number} */\n\tmaxYValue(axis: Axis | null): number {\n\t\tlet result = -Infinity\n\t\tthis.eachAxis(axis, series => {\n\t\t\tconst value = series.maxYValue()\n\t\t\tif (value > result) result = value\n\t\t})\n\t\treturn result\n\t}\n\n\tdraw(): void {\n\t\tif (this.items.length === 0 || !this.chart.ctx) return\n\t\tconst context = this.chart.ctx as SeriesDrawingContext\n\t\tconst { aspect, axes, chartRect } = this.chart\n\n\t\tfor (const item of this.items) {\n\t\t\tconst series = asLegacySeries(item)\n\t\t\tif (series.visible && series.beforeDraw) series.beforeDraw()\n\t\t}\n\n\t\tconst shouldClip = aspect.clip && this.anyUsesAxes()\n\t\tif (shouldClip) {\n\t\t\tconst rectangle = new Rectangle(\n\t\t\t\tchartRect.x + axisStrokeSize(axes.left),\n\t\t\t\tchartRect.y + axisStrokeSize(axes.top),\n\t\t\t\tchartRect.width - axisStrokeSize(axes.right),\n\t\t\t\tchartRect.height - axisStrokeSize(axes.bottom)\n\t\t\t)\n\t\t\taspect.clipRect(rectangle)\n\t\t}\n\n\t\ttry {\n\t\t\tconst beginParent = context.beginParent\n\t\t\tfor (let seriesIndex = 0; seriesIndex < this.items.length; seriesIndex++) {\n\t\t\t\tconst series = asLegacySeries(this.items[seriesIndex])\n\t\t\t\tif (!series.visible) continue\n\t\t\t\tif (!drawPluginHooks(this.chart, \"beforeSeriesDraw\", context, this.chart.plugins, series, seriesIndex)) continue\n\n\t\t\t\tconst oldAlpha = context.globalAlpha\n\t\t\t\tcontext.globalAlpha = 1 - series.format.transparency\n\n\t\t\t\tif (series.transform) {\n\t\t\t\t\tcontext.save()\n\t\t\t\t\tseries.transform()\n\t\t\t\t}\n\t\t\t\tseries.visual = beginParent ? beginParent() : null\n\t\t\t\tseries.onbeforedraw?.(series)\n\t\t\t\tseries.draw()\n\t\t\t\tif (beginParent) context.endParent?.()\n\t\t\t\tseries.ondraw?.(series)\n\t\t\t\tseries._emit(\"draw\", series)\n\t\t\t\tif (series.transform) context.restore()\n\n\t\t\t\tcontext.globalAlpha = oldAlpha\n\t\t\t\tdrawPluginHooks(this.chart, \"afterSeriesDraw\", context, this.chart.plugins, series, seriesIndex)\n\t\t\t}\n\t\t} finally {\n\t\t\tif (shouldClip) context.restore()\n\t\t}\n\n\t\tfor (const item of this.items) {\n\t\t\tconst series = asLegacySeries(item)\n\t\t\tif (series.visible && series.marks.visible) {\n\t\t\t\tif (series.transform) {\n\t\t\t\t\tcontext.save()\n\t\t\t\t\tseries.transform()\n\t\t\t\t}\n\t\t\t\tseries.drawMarks()\n\t\t\t\tif (series.transform) context.restore()\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Calls a function for each series in list.\n\t * @param {(series: Series) => void} f\n\t * @returns {void}\n\t */\n\teach(callback: (series: Series) => void): void {\n\t\tfor (const series of this.items) callback(series)\n\t}\n\n\t/**\n\t * Calls a function for each series associated with an axis.\n\t * @param {import(\"../core/elements/axis\").Axis | null} axis\n\t * @param {(series: Series) => void} func\n\t * @returns {void}\n\t */\n\teachAxis(axis: Axis | null, callback: (series: Series) => void): void {\n\t\tfor (let index = this.items.length - 1; index >= 0; index--) {\n\t\t\tconst series = asLegacySeries(this.items[index])\n\t\t\tif (series.visible && (!axis || series.associatedToAxis(axis)) && (series.__alwaysDraw || series.count() > 0)) {\n\t\t\t\tcallback(series)\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { Chart } from \"../chart.js\"\nimport { ToolTip } from \"./annotation.js\"\nimport { Tool } from \"./tool.js\"\n\ninterface ChartPoint {\n\tx: number\n\ty: number\n}\n\ntype ClickableTool = Tool & {\n\tonclick?: (tool: Tool, x: number, y: number) => boolean\n}\n\n/**\n * @memberOf Tee.Chart\n * @constructor\n * @class Contains a list with all \"tools\"\n * @param {Tee.Chart} chart The parent chart this tool list belongs to.\n * @property {Tool[]} items Array of Tool objects.\n */\nexport class Tools {\n\tchart: Chart\n\titems: Tool[]\n\n\tconstructor(chart: Chart) {\n\t\tthis.chart = chart\n\t\tthis.items = []\n\t}\n\n\tdraw(): void {\n\t\tthis.forEachActive(tool => {\n\t\t\tif (tool instanceof ToolTip) {\n\t\t\t\tif (tool.currP !== undefined && tool.realTime) tool.mousemove(tool.currP)\n\t\t\t\telse tool.draw()\n\t\t\t} else tool.draw()\n\t\t})\n\t}\n\n\tmousemove(p: ChartPoint): void {\n\t\tthis.forEachActive(tool => {\n\t\t\tif (tool instanceof ToolTip) tool.currP = undefined\n\t\t\ttool.mousemove(p)\n\t\t})\n\t}\n\n\tmousedown(event: MouseEvent): boolean {\n\t\tlet done = false\n\t\tthis.forEachActive(tool => {\n\t\t\tif (tool.mousedown(event)) done = true\n\t\t})\n\n\t\treturn done\n\t}\n\n\tmouseout(): void {\n\t\tthis.forEachActive(tool => tool.mouseout())\n\t}\n\n\tclicked(p: ChartPoint): boolean {\n\t\tlet done = false\n\n\t\tfor (let index = this.items.length - 1; index >= 0; index--) {\n\t\t\tconst tool = this.items[index]\n\t\t\tif (tool.active && tool.clicked(p)) {\n\t\t\t\tdone = true\n\n\t\t\t\tconst clickableTool = tool as ClickableTool\n\t\t\t\tif (clickableTool.onclick) done = clickableTool.onclick(tool, p.x, p.y)\n\t\t\t}\n\t\t}\n\n\t\treturn done\n\t}\n\n\t/**\n\t * @returns {Tool} Returns the tool parameter.\n\t */\n\tadd(tool: Tool): Tool {\n\t\tif (!(tool instanceof Tool)) throw new TypeError(\"Tools.add requires a Tool instance\")\n\t\tif (tool.chart !== this.chart) {\n\t\t\tthrow new Error(\"A Tool belongs to the Chart it was created with; create a new Tool for another Chart\")\n\t\t}\n\t\tif (!this.items.includes(tool)) {\n\t\t\tif (\"setChart\" in tool && typeof tool.setChart === \"function\") tool.setChart(this.chart)\n\t\t\tthis.items.push(tool)\n\t\t}\n\t\treturn tool\n\t}\n\n\tremove(tool: Tool, destroy = false): boolean {\n\t\tconst index = this.items.indexOf(tool)\n\t\tif (index === -1) return false\n\t\tthis.items.splice(index, 1)\n\t\tif (destroy) tool.destroy?.()\n\t\treturn true\n\t}\n\n\tclear(destroy = false): this {\n\t\tif (destroy) for (const tool of this.items) tool?.destroy?.()\n\t\tthis.items.length = 0\n\t\treturn this\n\t}\n\n\tdestroy(): void {\n\t\tthis.clear(true)\n\t}\n\n\tprivate forEachActive(callback: (tool: Tool) => void): void {\n\t\tfor (const tool of this.items) {\n\t\t\tif (tool.active) callback(tool)\n\t\t}\n\t}\n}\n","import {\n\tapplyChartOptions,\n\tgetChartOptions,\n\tisChartOptions,\n\tresetChartOptions,\n\tupdateChartOptions,\n\ttype ChartOptions,\n\ttype ResettableChartOption,\n\ttype ChartTheme\n} from \"./chart-options.js\"\nimport { Axes } from \"./core/elements/axes.js\"\nimport { Axis } from \"./core/elements/axis.js\"\nimport { Format } from \"./core/elements/format.js\"\nimport { Legend } from \"./core/elements/legend.js\"\nimport { Panel } from \"./core/elements/panel.js\"\nimport { Scroll } from \"./core/elements/scroll.js\"\nimport { Wall } from \"./core/elements/wall.js\"\nimport { Zoom } from \"./core/elements/zoom.js\"\nimport { Rectangle } from \"./core/primitives.js\"\nimport { DOMTipController } from \"./dom-tip.js\"\nimport { Emitter, type ChartEventMap, type EventListener } from \"./events.js\"\nimport {\n\ttype ChartPointerEvent,\n\ttype ChartPointerEventKind,\n\tdispatchPointerEvent,\n\tsetupPointerAuxiliaryHandlers,\n\tsetupPrimaryChartInteraction\n} from \"./interaction.js\"\nimport { Palette } from \"./palette.js\"\nimport {\n\tcancelAnimationFrame,\n\tgetDocument,\n\tgetNavigator,\n\tgetWindow,\n\tisCanvasElement,\n\tisTableElement,\n\trequestAnimationFrame\n} from \"./platform.js\"\nimport {\n\tdrawPluginHooks,\n\tnotifyPluginHooks,\n\tprepareChartPlugins,\n\tsetChartPluginEnabled,\n\ttype ChartPlugin,\n\ttype ChartPluginOptions\n} from \"./plugin.js\"\nimport type { Graphics } from \"./rendering/graphics.js\"\nimport { CanvasRenderer, type Renderer } from \"./rendering/renderer.js\"\nimport type { ThreeGraphics } from \"./rendering/three-graphics.js\"\nimport type { Series } from \"./series.js\"\nimport type { Three } from \"./teechart-3d.js\"\nimport { Bar } from \"./series/bar.js\"\nimport { SeriesList } from \"./series/series-list.js\"\nimport type { SeriesCollection } from \"./series/series-list.types.js\"\nimport { applyPalette, applyTheme, styleAddedSeries, type PaletteInput } from \"./theme.js\"\nimport { Title, ToolTip } from \"./tools/index.js\"\nimport { Tools } from \"./tools/tools.js\"\nimport { colorToRgba, getTableCellText } from \"./utils.js\"\n\ntype SeriesConstructor = new (chart?: Chart) => Series\n\ninterface ChartPoint {\n\tx: number\n\ty: number\n}\n\ninterface ChartAspect {\n\tchart: Chart\n\tview3d: boolean\n\torthogonal: boolean\n\t/** @deprecated Misspelled; use `orthogonal`. */\n\tortogonal: boolean\n\trotation: number\n\televation: number\n\tperspective: number\n\tclip: boolean\n\t_orthox: number\n\t_orthoy: number\n\tclipRect(rectangle: Rectangle): void\n}\n\ninterface ChartCanvas extends HTMLCanvasElement {\n\tchart?: Chart\n\t__webgl?: boolean\n}\n\ninterface ChartContext extends CanvasRenderingContext2D, ThreeGraphics {}\n\ntype ThreeChartAdapter = {\n\trenderer?: { domElement?: ChartCanvas }\n\tisEnabled?: () => boolean\n\tclearRect?: () => void\n}\n\nfunction isThreeChartAdapter(value: unknown): value is ThreeChartAdapter {\n\tif (!value || typeof value !== \"object\") return false\n\tconst adapter = value as ThreeChartAdapter\n\treturn typeof adapter.isEnabled === \"function\" && !!adapter.renderer?.domElement\n}\n\ntype LegacyWindow = Window & { mozRequestAnimationFrame?: unknown }\ntype LegacyNavigator = Navigator & { userLanguage?: string }\n\ninterface ChartWalls {\n\tchart: Chart\n\tvisible: boolean\n\tleft: Wall\n\tright: Wall\n\tbottom: Wall\n\tback: Wall\n\ttransparency?: number\n\tvisual?: unknown\n\tdraw(rectangle: Rectangle, aspect: ChartAspect): void\n}\n\n/**\n * @example\n * var Chart1 = new Tee.Chart(\"canvas\");\n * Chart1.addSeries(new Tee.Bar([1,2,3,4]));\n * Chart1.draw();\n * @constructor\n * @class The main Chart class\n * @param {String|HTMLCanvasElement} [canvas] Optional canvas id or <a href=\"https://www.w3.org/wiki/HTML/Elements/canvas\">element</a>.\n * @property {HTMLCanvasElement} canvas The <a href=\"https://www.w3.org/wiki/HTML/Elements/canvas\">canvas</a> where this chart will paint to.\n * @property {Rectangle} bounds The rectangle where this chart will be painted inside canvas.\n * @property {Tee.Palette} palette The list of colors to use as default colors for series and points.\n * @property {Tee.Chart.Aspect} aspect Contains properties related to 3D and graphics parameters.\n * @property {Tee.Chart.Panel} panel Contains properties used to fill the chart background.\n * @property {Tee.Chart.Walls} walls Contains properties used to draw chart walls around axes.\n * @property {Tee.Chart.Axes} axes Contains a list of axis used to draw series.\n * @property {Tee.Chart.Legend} legend Contains properties to control the legend, a panel showing the list of series or values.\n * @property {Tee.Chart.SeriesList} series Contains a list of Tee.Series objects that belong to this chart.\n * @property {Tee.Chart.Title} title Properties to draw text at top side of chart.\n * @property {Tee.Chart.Title} footer Properties to draw text at bottom side of chart.\n * @property {Tee.Chart.Zoom} zoom Properties to control mouse/touch dragging to zoom chart axes scales.\n * @property {Tee.Chart.Scroll} scroll Properties to control mouse/touch dragging to scroll or pan contents inside chart axes.\n * @property {Tee.Chart.Tools} tools Contains a list of Tool objects that belong to this chart.\n */\nexport class Chart {\n\tdeclare canvas: ChartCanvas\n\tinteractionCanvas?: HTMLCanvasElement\n\trenderer: Renderer\n\tctx: ChartContext | null = null\n\tgraphics: Graphics | null = null\n\treflectionColor: string | number[] | undefined\n\tondraw: ((chart: Chart) => void) | undefined\n\t/** Called when the mouse moves over a different point of a series. */\n\tonhover: ((series: Series, index: number) => void) | undefined\n\t_events?: Emitter<ChartEventMap>\n\t_stopWatchingPixelRatio?: () => void\n\tisNLc = false\n\t_eventCleanups: Array<() => void>\n\t_animations: Set<{ cancel(): void }>\n\t_twoFingersZoomCleanup: (() => void) | null\n\t_drawFrameHandle: number | ReturnType<typeof setTimeout> | null\n\t_updateDepth: number\n\t_updatePending: boolean\n\tdestroyed: boolean\n\tisChrome: boolean\n\tisAndroid: boolean\n\tisMozilla: boolean\n\tlanguage: string\n\t__webgl: boolean\n\tbounds: Rectangle\n\tchartRect: Rectangle\n\tpalette: Palette\n\taspect: ChartAspect\n\tpanel: Panel\n\twalls: ChartWalls\n\taxes: Axes\n\tlegend: Legend\n\tseries: SeriesCollection\n\ttitle: Title\n\tsubtitle: Title\n\tfooter: Title\n\tsubfooter: Title\n\tzoom: Zoom\n\tscroll: Scroll\n\ttools: Tools\n\tdomTip: DOMTipController\n\tplugins: ChartPlugin[]\n\tpluginOptions: ChartPluginOptions = {}\n\tnewCursor: string | null = null\n\tdeclare calcMouse: (event: Event, point: ChartPoint) => void\n\n\t/**\n\t * @param canvas The canvas element or its id; a new canvas is created when omitted.\n\t * @param options Declarative options. Use `chart.setOptions` to update them later.\n\t */\n\tconstructor(canvas?: string | ChartCanvas | OffscreenCanvas | Three, options?: ChartOptions)\n\t/**\n\t * @deprecated Pass declarative `options`, or add series with `chart.addSeries`. The values and series\n\t * constructor arguments will be removed in a future major version.\n\t */\n\tconstructor(\n\t\tcanvas?: string | ChartCanvas | OffscreenCanvas | Three,\n\t\tdata?: number[] | number[][],\n\t\ttype?: SeriesConstructor\n\t)\n\tconstructor(canvas?: unknown, data?: number[] | number[][] | ChartOptions, type?: SeriesConstructor) {\n\t\tthis._eventCleanups = []\n\t\tthis._animations = new Set()\n\t\tthis._twoFingersZoomCleanup = null\n\t\tthis._drawFrameHandle = null\n\t\tthis.destroyed = false\n\t\tthis._updateDepth = 0\n\t\tthis._updatePending = false\n\t\tthis.domTip = new DOMTipController()\n\t\tlet createdCanvas = false\n\n\t\tconst runtimeWindow = getWindow()\n\t\tconst runtimeDocument = getDocument()\n\t\tconst runtimeNavigator = getNavigator()\n\t\tconst legacyWindow = runtimeWindow as LegacyWindow | undefined\n\t\tconst legacyNavigator = runtimeNavigator as LegacyNavigator | undefined\n\n\t\tconst userAgent = runtimeNavigator?.userAgent?.toLowerCase() || \"\"\n\n\t\t/**\n\t\t * @constant\n\t\t * @private\n\t\t */\n\t\tthis.isChrome = userAgent.indexOf(\"chrome\") > -1\n\t\t/**\n\t\t * @constant\n\t\t * @private\n\t\t */\n\t\tthis.isAndroid = userAgent.indexOf(\"android\") > -1\n\t\t/**\n\t\t * @constant\n\t\t * @private\n\t\t */\n\t\tthis.isMozilla = !!legacyWindow?.mozRequestAnimationFrame\n\n\t\tthis.language = legacyNavigator?.userLanguage || runtimeNavigator?.language || \"\"\n\n\t\tconst threeAdapter = isThreeChartAdapter(canvas) ? canvas : null\n\t\tif (threeAdapter) {\n\t\t\t// Tee.Three remains the chart canvas/context for the legacy 3D\n\t\t\t// renderer. Its WebGL canvas is only used as the DOM event target.\n\t\t\tthis.canvas = canvas as ChartCanvas\n\t\t\tthis.interactionCanvas = threeAdapter.renderer?.domElement\n\t\t} else if (canvas) {\n\t\t\tif (isCanvasElement(canvas)) this.canvas = canvas as ChartCanvas\n\t\t\telse if (typeof canvas === \"string\") this.canvas = runtimeDocument?.getElementById(canvas) as ChartCanvas\n\t\t\telse this.canvas = canvas as ChartCanvas\n\t\t}\n\n\t\tif (!this.canvas) {\n\t\t\tif (!runtimeDocument) throw new Error(\"Tee.Chart requires a canvas or a document\")\n\t\t\tthis.canvas = runtimeDocument.createElement(\"canvas\")\n\t\t\tcreatedCanvas = true\n\t\t}\n\n\t\tconst canvasElement = this.canvas\n\t\tthis.renderer = threeAdapter\n\t\t\t? ({\n\t\t\t\t\tgetContext: () => threeAdapter as unknown as CanvasRenderingContext2D,\n\t\t\t\t\tsetContext: () => undefined,\n\t\t\t\t\tclearRect: () => threeAdapter.clearRect?.()\n\t\t\t\t} as Renderer)\n\t\t\t: new CanvasRenderer(canvasElement)\n\t\tif (createdCanvas && this.renderer instanceof CanvasRenderer) this.renderer.resize(600, 400)\n\n\t\tthis.__webgl = threeAdapter ? threeAdapter.isEnabled?.() || false : (canvasElement.__webgl ?? false)\n\n\t\tconst rendererSize =\n\t\t\tthis.renderer instanceof CanvasRenderer\n\t\t\t\t? this.renderer.getSize()\n\t\t\t\t: { width: canvasElement.width, height: canvasElement.height }\n\t\tconst clientSize =\n\t\t\tthis.renderer instanceof CanvasRenderer\n\t\t\t\t? this.renderer.getClientSize()\n\t\t\t\t: { width: canvasElement.clientWidth, height: canvasElement.clientHeight }\n\n\t\tif (canvasElement.__webgl || clientSize.width === 0)\n\t\t\tthis.bounds = new Rectangle(0, 0, rendererSize.width, rendererSize.height)\n\t\telse {\n\t\t\tthis.bounds = new Rectangle(0, 0, clientSize.width, clientSize.height)\n\t\t\tif (this.renderer instanceof CanvasRenderer) this.renderer.resize(clientSize.width, clientSize.height)\n\t\t\telse {\n\t\t\t\tcanvasElement.width = clientSize.width\n\t\t\t\tcanvasElement.height = clientSize.height\n\t\t\t}\n\t\t}\n\n\t\tthis.chartRect = new Rectangle()\n\t\tthis.chartRect.automatic = true\n\t\tthis.chartRect.setFrom(this.bounds)\n\n\t\tthis.palette = new Palette([\n\t\t\t\"#4466a3\",\n\t\t\t\"#f39c35\",\n\t\t\t\"#f14c14\",\n\t\t\t\"#4e97a8\",\n\t\t\t\"#2b406b\",\n\t\t\t\"#1d7b63\",\n\t\t\t\"#b3080e\",\n\t\t\t\"#f2c05d\",\n\t\t\t\"#5db79e\",\n\t\t\t\"#707070\",\n\t\t\t\"#f3ea8d\",\n\t\t\t\"#b4b4b4\"\n\t\t])\n\n\t\t/**\n\t\t * @memberOf Tee.Chart\n\t\t * @class Contains properties related to canvas and 2D / 3D\n\t\t * @param {Tee.Chart} chart The parent chart this aspect object belongs to.\n\t\t * @property {Boolean} clip When true, series contents will be restricted to paint inside axes boundaries.\n\t\t */\n\t\tthis.aspect = {\n\t\t\tchart: this,\n\t\t\tview3d: this.__webgl,\n\t\t\torthogonal: !this.__webgl,\n\t\t\tget ortogonal(): boolean {\n\t\t\t\treturn this.orthogonal\n\t\t\t},\n\t\t\tset ortogonal(value: boolean) {\n\t\t\t\tthis.orthogonal = value\n\t\t\t},\n\t\t\trotation: 0,\n\t\t\televation: 315,\n\t\t\tperspective: 50,\n\t\t\tclip: true,\n\n\t\t\t_orthox: 10,\n\t\t\t_orthoy: 8,\n\n\t\t\t/**\n\t\t\t * @param {Rectangle} rectangle The rectangle object to apply clipping.\n\t\t\t */\n\t\t\tclipRect: function (rectangle: Rectangle): void {\n\t\t\t\tconst context = this.chart.drawContext\n\t\t\t\tcontext.save()\n\n\t\t\t\tcontext.beginPath()\n\n\t\t\t\tif (this.view3d)\n\t\t\t\t\tcontext.rect(\n\t\t\t\t\t\trectangle.x,\n\t\t\t\t\t\trectangle.y - this._orthoy,\n\t\t\t\t\t\trectangle.width + this._orthox,\n\t\t\t\t\t\trectangle.height + this._orthoy\n\t\t\t\t\t)\n\t\t\t\telse context.rect(rectangle.x, rectangle.y, rectangle.width, rectangle.height)\n\n\t\t\t\tcontext.clip()\n\t\t\t\t//c.closePath();\n\t\t\t}\n\t\t} satisfies ChartAspect\n\n\t\t/*\n\t\t * Properties to paint the chart background\n\t\t */\n\t\tthis.panel = new Panel(this)\n\n\t\t/**\n\t\t * @memberOf Tee.Chart\n\t\t * @constructor\n\t\t * @class Contains left, right, bottom and back wall objects\n\t\t * @param {Tee.Chart} chart The parent chart this walls object belongs to.\n\t\t * @property {Boolean} [visible=true] Determines if walls will be displayed or not.\n\t\t * @property {Tee.Chart.Wall} back Visual properties to paint the back wall.\n\t\t */\n\t\tthis.walls = {\n\t\t\tchart: this,\n\t\t\tvisible: true,\n\t\t\tleft: new Wall(this),\n\t\t\tright: new Wall(this),\n\t\t\tbottom: new Wall(this),\n\t\t\tback: new Wall(this),\n\n\t\t\tdraw: function (rectangle: Rectangle, aspect: ChartAspect): void {\n\t\t\t\tconst context = this.chart.drawContext\n\t\t\t\tconst transparency = this.transparency ?? 0\n\t\t\t\tconst groups = context.beginParent\n\n\t\t\t\tthis.visual = context.beginParent ? context.beginParent() : null\n\n\t\t\t\tlet previousAlpha: number | undefined\n\t\t\t\tif (transparency > 0) {\n\t\t\t\t\tpreviousAlpha = context.globalAlpha\n\t\t\t\t\tcontext.globalAlpha = (1 - transparency) * previousAlpha\n\t\t\t\t}\n\n\t\t\t\tconst backBounds = this.back.bounds\n\t\t\t\tbackBounds.setFrom(rectangle)\n\n\t\t\t\tif (aspect.view3d) {\n\t\t\t\t\tconst bottomSize = this.bottom.visible ? this.bottom.size : 0\n\t\t\t\t\tconst leftSize = this.left.size\n\n\t\t\t\t\tif (leftSize > 0) {\n\t\t\t\t\t\tbackBounds.x -= leftSize\n\t\t\t\t\t\tbackBounds.width += leftSize\n\t\t\t\t\t}\n\n\t\t\t\t\tif (bottomSize > 0) backBounds.height += bottomSize\n\n\t\t\t\t\tthis.left.bounds.set(rectangle.x - leftSize, rectangle.y, leftSize, rectangle.height + bottomSize)\n\t\t\t\t\tthis.bottom.bounds.set(rectangle.x, rectangle.getBottom(), rectangle.width, bottomSize)\n\n\t\t\t\t\tthis.back.format.depth = this.back.size\n\t\t\t\t}\n\n\t\t\t\t!this.back.visible || this.back.draw()\n\n\t\t\t\tif (this.chart.aspect.view3d) {\n\t\t\t\t\tif (this.left.visible) this.left.draw()\n\t\t\t\t\tif (this.bottom.visible) this.bottom.draw()\n\t\t\t\t\tif (this.right.visible) this.right.draw()\n\t\t\t\t}\n\n\t\t\t\tif (transparency > 0 && previousAlpha !== undefined) context.globalAlpha = previousAlpha\n\n\t\t\t\tif (groups) context.endParent?.()\n\t\t\t}\n\t\t} satisfies ChartWalls\n\n\t\tconst backWallFormat = this.walls.back.format\n\t\tbackWallFormat.fill = \"rgb(240,240,240)\"\n\t\tbackWallFormat.shadow.visible = true\n\t\tbackWallFormat.z = 1\n\n\t\tconst leftWall = this.walls.left\n\t\tleftWall.format.fill = \"#BBAA77\"\n\t\tleftWall.format.depth = 1\n\t\tleftWall.size = 2\n\n\t\tconst bottomWall = this.walls.bottom\n\t\tbottomWall.format.depth = 1\n\t\tbottomWall.size = 2\n\n\t\tthis.walls.right.visible = false\n\n\t\t/*\n\t\t * Four axes\n\t\t */\n\t\tthis.axes = new Axes(this)\n\n\t\t/*\n\t\t * Properties to paint a list of series or values.\n\t\t */\n\t\tthis.legend = new Legend(this)\n\n\t\t/*\n\t\t * List of Tee.Series objects that this chart contains.\n\t\t */\n\t\tthis.series = new SeriesList(this)\n\n\t\tthis.title = new Title(this, \"blue\")\n\t\tthis.title.text = \"TeeChart\"\n\t\tthis.title.visible = false\n\t\tthis.title.format.z = 1\n\n\t\tthis.subtitle = new Title(this, \"blue\")\n\t\tthis.subtitle.format.z = 1\n\n\t\tthis.footer = new Title(this, \"red\")\n\t\tthis.footer.format.z = 0\n\n\t\tthis.subfooter = new Title(this, \"red\")\n\t\tthis.subfooter.format.z = 0\n\n\t\tthis.zoom = new Zoom(this)\n\t\tthis.scroll = new Scroll(this)\n\t\tif (threeAdapter) {\n\t\t\tthis.zoom.enabled = false\n\t\t\tthis.scroll.enabled = false\n\t\t}\n\n\t\tthis.tools = new Tools(this)\n\t\tthis.tools.add(new ToolTip(this))\n\n\t\t/**\n\t\t * Executes several chart updates and redraws once at the end.\n\t\t *\n\t\t * @param {Function} callback Update callback.\n\t\t * @returns {*} The callback result.\n\t\t */\n\t\tsetupPrimaryChartInteraction(this)\n\t\tsetupPointerAuxiliaryHandlers(this)\n\n\t\tcanvasElement.chart = this\n\t\t// WebGL draws through the Three adapter, but interaction handlers run on\n\t\t// its renderer canvas and expect their canvas receiver to own the chart.\n\t\tif (this.interactionCanvas && this.interactionCanvas !== canvasElement) {\n\t\t\tconst interactionCanvas = this.interactionCanvas as ChartCanvas\n\t\t\tinteractionCanvas.chart = this\n\t\t\tthis._eventCleanups.push(() => {\n\t\t\t\tif (interactionCanvas.chart === this) delete interactionCanvas.chart\n\t\t\t})\n\t\t}\n\n\t\tconst addDataSeries = (values: number[]): void => {\n\t\t\tconst seriesConstructor = type || Bar\n\t\t\tconst series = this.addSeries(new seriesConstructor(this))\n\t\t\tseries.data.values = values\n\t\t}\n\n\t\tconst declarativeOptions = isChartOptions(data) ? data : undefined\n\n\t\tif (!declarativeOptions && Array.isArray(data) && data.length > 0) {\n\t\t\tif (Array.isArray(data[0])) {\n\t\t\t\tconst groupedData = data as number[][]\n\t\t\t\tfor (let groupIndex = 0; groupIndex < groupedData.length; groupIndex++) addDataSeries(groupedData[groupIndex])\n\t\t\t} else addDataSeries(data as number[])\n\t\t}\n\n\t\tthis.plugins = declarativeOptions?.plugins ?? []\n\t\tprepareChartPlugins(this, this.plugins)\n\n\t\tif (declarativeOptions) applyChartOptions(this, declarativeOptions)\n\t\tnotifyPluginHooks(this, \"beforeInit\", [], this.plugins)\n\t\tnotifyPluginHooks(this, \"afterInit\", [], this.plugins)\n\t}\n\n\t/**\n\t * Main Chart draw method. Repaints all chart contents.\n\t */\n\tdraw(ctx?: ChartContext): void {\n\t\tconst seriesCollection = this.series\n\t\tconst chartRect = this.chartRect\n\n\t\tconst context = ctx ?? (this.renderer.getContext() as ChartContext | null) //,{alpha:false} (opaque canvas)\n\t\tif (!context) throw new Error(\"Canvas does not provide Context\")\n\n\t\tthis.ctx = context\n\t\tthis.renderer.setContext(context)\n\t\t// A context passed in by the caller is drawn as it is.\n\t\tif (!ctx && this.renderer instanceof CanvasRenderer) this.renderer.applyTransform(context)\n\t\tthis.graphics = this.renderer.getGraphics ? this.renderer.getGraphics() : null\n\n\t\tif (chartRect.automatic) chartRect.setFrom(this.bounds)\n\t\tif (!notifyPluginHooks(this, \"beforeRender\", [context], this.plugins)) return\n\t\tif (!drawPluginHooks(this, \"beforeDraw\", context, this.plugins)) return\n\n\t\tlet paintAxes = false,\n\t\t\tpaintWalls = false,\n\t\t\tmaxZ = 1,\n\t\t\tzIndex = 0\n\t\tconst visibleSeriesCount = seriesCollection.visibleCount()\n\n\t\tfor (let seriesIndex = seriesCollection.items.length - 1; seriesIndex >= 0; seriesIndex--) {\n\t\t\tconst seriesItem = seriesCollection.items[seriesIndex]\n\n\t\t\tif (seriesItem.visible) {\n\t\t\t\tseriesItem.initZ(zIndex, visibleSeriesCount)\n\t\t\t\tzIndex++\n\n\t\t\t\tif (seriesItem._paintAxes) paintAxes = true\n\t\t\t\tif (seriesItem._paintWalls) paintWalls = true\n\n\t\t\t\tif (seriesItem.maxZ && seriesItem.maxZ > maxZ) maxZ = seriesItem.maxZ\n\t\t\t}\n\t\t}\n\n\t\tthis.walls.left.format.depth = maxZ\n\t\tthis.walls.bottom.format.depth = maxZ\n\t\tthis.walls.back.format.z = maxZ\n\n\t\tthis.panel.draw()\n\n\t\tif (chartRect.automatic) this.panel.margins.apply(chartRect)\n\t\tdrawPluginHooks(this, \"afterPanelDraw\", context, this.plugins)\n\n\t\tthis.title.tryDraw(true)\n\t\tthis.subtitle.tryDraw(true)\n\t\tthis.footer.tryDraw(false)\n\t\tthis.subfooter.tryDraw(false)\n\n\t\tseriesCollection.beforeDraw()\n\n\t\tif (this.legend.visible) {\n\t\t\tthis.legend.calcrect()\n\t\t\tthis.legend.draw()\n\t\t}\n\n\t\tif (this.aspect.view3d && !this.__webgl) {\n\t\t\tchartRect.y += this.aspect._orthoy\n\t\t\tchartRect.height -= this.aspect._orthoy\n\t\t\tchartRect.width -= this.aspect._orthox\n\t\t}\n\n\t\tconst axes = this.axes\n\t\tlet previousAlpha = 1\n\n\t\tif (seriesCollection.anyUsesAxes()) {\n\t\t\tconst updateScales = notifyPluginHooks(this, \"beforeScaleUpdate\", [], this.plugins)\n\t\t\tif (updateScales) {\n\t\t\t\taxes.each(Axis.adjustRect)\n\t\t\t\taxes.each(Axis.calcRect)\n\t\t\t}\n\n\t\t\tif (this.walls.visible && paintWalls) this.walls.draw(chartRect, this.aspect)\n\n\t\t\tif (axes.visible && paintAxes) {\n\t\t\t\tif (axes.transparency > 0) {\n\t\t\t\t\tpreviousAlpha = context.globalAlpha\n\t\t\t\t\tcontext.globalAlpha = (1 - axes.transparency) * previousAlpha\n\t\t\t\t}\n\n\t\t\t\tconst groups = context.beginParent\n\t\t\t\taxes.visual = context.beginParent ? context.beginParent() : null\n\n\t\t\t\taxes.each(Axis.draw)\n\n\t\t\t\tif (groups) context.endParent?.()\n\n\t\t\t\tif (axes.transparency > 0) context.globalAlpha = previousAlpha\n\t\t\t}\n\t\t\tif (updateScales) notifyPluginHooks(this, \"afterScaleUpdate\", [], this.plugins)\n\t\t}\n\n\t\tdrawPluginHooks(this, \"afterAxesDraw\", context, this.plugins)\n\n\t\tthis.series.draw()\n\t\tnotifyPluginHooks(this, \"afterAllSeriesDraw\", [context], this.plugins)\n\t\tthis.tools.draw()\n\n\t\tif (this.zoom.active && !this.zoom.touching) this.zoom.draw()\n\t\tdrawPluginHooks(this, \"afterDraw\", context, this.plugins)\n\n\t\tif (this.ondraw) this.ondraw(this)\n\t\tthis._emit(\"draw\", this)\n\t\tnotifyPluginHooks(this, \"afterRender\", [context], this.plugins)\n\n\t\tif (this.isNLc) {\n\t\t\tconst evaluationFormat = new Format(this)\n\t\t\tconst msg = \"TeeChart Evaluation (c)Steema Software 2021\"\n\t\t\tconst watermarkContext = this.ctx\n\t\t\twatermarkContext.save()\n\t\t\twatermarkContext.font = \"13px Courier\"\n\t\t\tconst textWidth = evaluationFormat.textWidth(msg)\n\t\t\tconst rText = {\n\t\t\t\tx: this.chartRect.x + this.chartRect.width / 2 - textWidth / 2,\n\t\t\t\ty: this.bounds.height / 2,\n\t\t\t\twidth: textWidth,\n\t\t\t\theight: evaluationFormat.textHeight(\"H\")\n\t\t\t}\n\t\t\twatermarkContext.translate(this.chartRect.x + this.chartRect.width / 2, this.bounds.height / 2)\n\t\t\twatermarkContext.rotate((-30 * Math.PI) / 180)\n\t\t\twatermarkContext.translate(-(this.chartRect.x + this.chartRect.width / 2), -(this.bounds.height / 2))\n\t\t\tevaluationFormat.font.fill = \"rgba(64,108,128, 0.55)\"\n\t\t\tevaluationFormat.drawText(rText, msg)\n\t\t\twatermarkContext.restore()\n\t\t}\n\t}\n\n\tbatchUpdate<T>(callback: (chart: Chart) => T): T {\n\t\tif (typeof callback !== \"function\") throw new TypeError(\"Chart.batchUpdate requires a callback\")\n\t\tif (this.destroyed) return callback(this)\n\n\t\tthis._updateDepth++\n\t\ttry {\n\t\t\treturn callback(this)\n\t\t} finally {\n\t\t\tthis._updateDepth--\n\t\t\tif (this._updateDepth === 0 && this._updatePending) {\n\t\t\t\tthis._updatePending = false\n\t\t\t\tthis.draw()\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * The context of the chart while it is being drawn. Series, axes and tools use it from their draw\n\t * methods, which only run after the chart has set it.\n\t */\n\tget drawContext(): ChartContext {\n\t\tif (!this.ctx) throw new Error(\"The chart has no drawing context yet: draw it first\")\n\t\treturn this.ctx\n\t}\n\n\t_requestDraw(): void {\n\t\tif (this.destroyed) return\n\t\tif (this._updateDepth > 0) this._updatePending = true\n\t\telse this.draw()\n\t}\n\n\t_scheduleDraw(): void {\n\t\tif (this.destroyed || this._drawFrameHandle !== null) return\n\t\tthis._drawFrameHandle = requestAnimationFrame(() => {\n\t\t\tthis._drawFrameHandle = null\n\t\t\tthis._requestDraw()\n\t\t})\n\t}\n\n\t/**\n\t * A series already attached to another chart is removed from its previous owner before it is added here.\n\t * @returns {Tee.Series} Returns the series parameter.\n\t * @param {Tee.Series} series The series object to add to chart.\n\t */\n\taddSeries<T extends Series>(series: T): T {\n\t\tconst previousChart = series.chart\n\t\tif (previousChart && previousChart !== this) previousChart.removeSeries(series)\n\t\tseries.setChart(series, this)\n\t\tconst legacySeries = series as Series & {\n\t\t\tdonutArray?: unknown\n\t\t\tlinkDonutsToChart?: () => void\n\t\t}\n\t\tif (legacySeries.donutArray != null && legacySeries.donutArray !== \"undefined\") legacySeries.linkDonutsToChart?.()\n\n\t\tconst existingIndex = this.series.items.indexOf(series)\n\t\tconst seriesIndex = existingIndex === -1 ? this.series.items.length : existingIndex\n\t\tthis.series.add(series)\n\n\t\tif (series.title === \"\") series.title = `Series${(1 + seriesIndex).toString()}`\n\t\tconst paletteColor = this.palette.get(seriesIndex)\n\t\tif (series.format.fill === \"\" && paletteColor !== undefined) series.format.fill = paletteColor\n\t\tstyleAddedSeries(this, series, seriesIndex)\n\n\t\treturn series\n\t}\n\n\tremoveSeries(series: Series, destroy = false): boolean {\n\t\treturn this.series.remove(series, destroy)\n\t}\n\n\tgetSeries(index: number): Series | undefined {\n\t\treturn this.series.items[index]\n\t}\n\n\t/**\n\t * Updates the canvas drawing size from explicit dimensions or its rendered size.\n\t *\n\t * @param {Number} [width] Drawing width in CSS pixels.\n\t * @param {Number} [height] Drawing height in CSS pixels.\n\t * @returns {Tee.Chart} This chart.\n\t */\n\tresize(width?: number, height?: number): Chart {\n\t\tconst canvasElement = this.canvas\n\t\tconst size =\n\t\t\tthis.renderer instanceof CanvasRenderer\n\t\t\t\t? this.renderer.getSize()\n\t\t\t\t: { width: canvasElement.width, height: canvasElement.height }\n\t\tconst clientSize =\n\t\t\tthis.renderer instanceof CanvasRenderer\n\t\t\t\t? this.renderer.getClientSize()\n\t\t\t\t: { width: canvasElement.clientWidth, height: canvasElement.clientHeight }\n\t\tconst nextWidth = width || clientSize.width || size.width\n\t\tconst nextHeight = height || clientSize.height || size.height\n\n\t\tif (nextWidth > 0 && nextHeight > 0) {\n\t\t\tif (!notifyPluginHooks(this, \"beforeResize\", [nextWidth, nextHeight], this.plugins)) return this\n\t\t\tif (this.renderer instanceof CanvasRenderer) this.renderer.resize(nextWidth, nextHeight)\n\t\t\telse {\n\t\t\t\tif (canvasElement.width !== nextWidth) canvasElement.width = nextWidth\n\t\t\t\tif (canvasElement.height !== nextHeight) canvasElement.height = nextHeight\n\t\t\t}\n\t\t\tthis.bounds.set(0, 0, nextWidth, nextHeight)\n\t\t\tthis.chartRect.setFrom(this.bounds)\n\t\t\tthis.draw()\n\t\t\tthis._emit(\"resize\", nextWidth, nextHeight)\n\t\t\tnotifyPluginHooks(this, \"afterResize\", [nextWidth, nextHeight], this.plugins)\n\t\t}\n\n\t\treturn this\n\t}\n\n\t/**\n\t * Device pixels used for each drawing unit. `1` (the default) keeps the canvas at its drawing size;\n\t * use `setPixelRatio` to render sharper on high density screens.\n\t */\n\tget pixelRatio(): number {\n\t\treturn this.renderer instanceof CanvasRenderer ? this.renderer.pixelRatio : 1\n\t}\n\n\t/**\n\t * Renders with `ratio` device pixels per drawing unit, or with `window.devicePixelRatio` when it is\n\t * `\"auto\"`. The canvas keeps its display size and coordinates stay in CSS pixels. WebGL (3D) canvases\n\t * are not affected.\n\t *\n\t * @param {Number|\"auto\"} ratio Device pixels per drawing unit.\n\t * @returns {Tee.Chart} This chart.\n\t */\n\tsetPixelRatio(ratio: number | \"auto\"): this {\n\t\tif (this._applyPixelRatio(ratio)) this._requestDraw()\n\t\treturn this\n\t}\n\n\t/** Applies the ratio without drawing; returns whether the canvas changed. */\n\t_applyPixelRatio(ratio: number | \"auto\"): boolean {\n\t\tif (!(this.renderer instanceof CanvasRenderer) || this.destroyed) return false\n\n\t\t// An automatic ratio follows the screen: moving the window to another monitor or zooming the page\n\t\t// changes devicePixelRatio.\n\t\tif (ratio === \"auto\") this._watchDevicePixelRatio()\n\t\telse this._unwatchDevicePixelRatio()\n\n\t\tconst next = ratio === \"auto\" ? getWindow()?.devicePixelRatio || 1 : ratio\n\t\tif (this.renderer.pixelRatio === next) return false\n\n\t\tthis.renderer.setPixelRatio(next)\n\t\tthis.renderer.resize(this.bounds.width, this.bounds.height)\n\t\treturn true\n\t}\n\n\t_watchDevicePixelRatio(): void {\n\t\tthis._unwatchDevicePixelRatio()\n\n\t\tconst runtimeWindow = getWindow()\n\t\tif (typeof runtimeWindow?.matchMedia !== \"function\") return\n\n\t\t// A media query only matches one density, so it is created again after every change.\n\t\tconst query = runtimeWindow.matchMedia(`(resolution: ${runtimeWindow.devicePixelRatio || 1}dppx)`)\n\t\tconst listener = (): void => {\n\t\t\tif (this._applyPixelRatio(\"auto\")) this._requestDraw()\n\t\t}\n\t\tquery.addEventListener?.(\"change\", listener)\n\t\tthis._stopWatchingPixelRatio = () => query.removeEventListener?.(\"change\", listener)\n\t}\n\n\t_unwatchDevicePixelRatio(): void {\n\t\tthis._stopWatchingPixelRatio?.()\n\t\tthis._stopWatchingPixelRatio = undefined\n\t}\n\n\tupdate(): void {\n\t\tif (this.destroyed || !notifyPluginHooks(this, \"beforeUpdate\", [], this.plugins)) return\n\t\tthis.draw()\n\t\tnotifyPluginHooks(this, \"afterUpdate\", [], this.plugins)\n\t}\n\n\t/**\n\t * Applies declarative options as a patch over the ones already applied, and redraws once.\n\t *\n\t * Only the given keys change. Series are matched by position, so `data.series` describes the complete\n\t * list: existing series are updated in place, missing ones are removed and new ones are added. A theme\n\t * or palette reapplies the options that refine them. `plugins` can only be set at creation;\n\t * `pluginOptions` can be patched after creation, and plugin activation changes run that plugin's\n\t * initialization or cleanup hooks without recreating the chart. Options that were removed from an\n\t * object are not reverted. Does nothing on a destroyed chart.\n\t *\n\t * @param {ChartOptions} options The options to apply.\n\t * @returns {Tee.Chart} This chart.\n\t */\n\tsetOptions(options: ChartOptions): this {\n\t\tif (!isChartOptions(options)) throw new TypeError(\"Chart.setOptions requires an options object\")\n\t\tif (this.destroyed || !notifyPluginHooks(this, \"beforeUpdate\", [], this.plugins)) return this\n\n\t\tupdateChartOptions(this, options)\n\t\tthis._requestDraw()\n\t\tnotifyPluginHooks(this, \"afterUpdate\", [], this.plugins)\n\t\treturn this\n\t}\n\n\t/** Restores the selected declarative option sections to TeeChart.js defaults and redraws once. */\n\tresetOptions(sections?: readonly ResettableChartOption[]): this {\n\t\tif (this.destroyed || !notifyPluginHooks(this, \"beforeUpdate\", [], this.plugins)) return this\n\t\tresetChartOptions(this, sections)\n\t\tthis._requestDraw()\n\t\tnotifyPluginHooks(this, \"afterUpdate\", [], this.plugins)\n\t\treturn this\n\t}\n\n\t/** Enables or disables an attached plugin without recreating the chart. */\n\tsetPluginEnabled(id: string, enabled: boolean): this {\n\t\tif (this.destroyed) return this\n\t\tsetChartPluginEnabled(this, id, enabled)\n\t\treturn this\n\t}\n\n\t/**\n\t * Returns a copy of the declarative options applied to this chart, through the constructor or\n\t * `setOptions`. Changes made with the imperative API are not reflected.\n\t */\n\tgetOptions(): ChartOptions {\n\t\treturn getChartOptions(this)\n\t}\n\n\t/**\n\t * Paints chart to image parameter, as PNG or JPEG picture made from canvas.\n\t * @param {String} image The id of an Image HTML component.\n\t * @param {String} format Can be \"image/png\" or \"image/jpeg\".\n\t * @param {Number} quality From 0% to 100%, jpeg compression quality.\n\t */\n\ttoImage(image: string, format: string, quality?: number): void {\n\t\tconst imageElement = getDocument()?.getElementById(image) as HTMLImageElement | null\n\t\tif (!imageElement) return\n\n\t\tconst dataUrl =\n\t\t\tthis.renderer instanceof CanvasRenderer\n\t\t\t\t? format !== \"\"\n\t\t\t\t\t? this.renderer.toDataURL(format, quality)\n\t\t\t\t\t: this.renderer.toDataURL()\n\t\t\t\t: undefined\n\t\timageElement.src = dataUrl || (format !== \"\" ? this.canvas.toDataURL(format, quality) : this.canvas.toDataURL())\n\t}\n\n\t/**\n\t * Encodes the chart as an image. Unlike `toImage` it works without a document, for example on an\n\t * `OffscreenCanvas` in a Worker.\n\t *\n\t * @param {String} [type] Image format, \"image/png\" by default.\n\t * @param {Number} [quality] From 0 to 1, compression quality of \"image/jpeg\" and \"image/webp\".\n\t */\n\ttoBlob(type?: string, quality?: number): Promise<Blob> {\n\t\tif (this.renderer instanceof CanvasRenderer) return this.renderer.toBlob(type, quality)\n\t\treturn Promise.reject(new Error(\"This chart cannot be encoded as a Blob\"))\n\t}\n\n\t/**\n\t * Delivers a pointer event, with canvas relative coordinates, to the chart handlers. A chart drawn on an\n\t * `OffscreenCanvas` receives no DOM events, so the page forwards them. Returns false when the chart\n\t * has no handler for the event or is destroyed.\n\t */\n\tdispatchPointerEvent(kind: ChartPointerEventKind, event: ChartPointerEvent): boolean {\n\t\treturn dispatchPointerEvent(this, kind, event)\n\t}\n\n\t/**\n\t * Releases event handlers and timers owned by this chart.\n\t * Calling destroy more than once is safe.\n\t */\n\tdestroy(): void {\n\t\tif (this.destroyed) return\n\n\t\tlet failure: unknown\n\t\tlet failed = false\n\t\tconst attempt = (action: () => void): void => {\n\t\t\ttry {\n\t\t\t\taction()\n\t\t\t} catch (error) {\n\t\t\t\tif (!failed) failure = error\n\t\t\t\tfailed = true\n\t\t\t}\n\t\t}\n\n\t\tattempt(() => notifyPluginHooks(this, \"beforeDestroy\", [], this.plugins))\n\t\t// Listeners run while the chart is still usable; a failing one must not skip the cleanup below.\n\t\tattempt(() => this._emit(\"destroy\", this))\n\t\tthis._events?.clear()\n\t\tthis.destroyed = true\n\t\tif (this._drawFrameHandle !== null) attempt(() => cancelAnimationFrame(this._drawFrameHandle as number))\n\t\tthis._drawFrameHandle = null\n\t\tattempt(() => this.tools.destroy())\n\t\tattempt(() => this.series.destroy())\n\t\tattempt(() => this.domTip.stop(this))\n\t\tfor (const animation of this._animations) attempt(() => animation.cancel())\n\t\tthis._animations.clear()\n\t\tattempt(() => this._unwatchDevicePixelRatio())\n\t\tfor (let i = this._eventCleanups.length - 1; i >= 0; i--) attempt(() => this._eventCleanups[i]())\n\t\tthis._eventCleanups.length = 0\n\t\tattempt(() => notifyPluginHooks(this, \"afterDestroy\", [], this.plugins))\n\t\tif (failed) throw failure\n\t}\n\n\t/** Subscribes `listener` to chart events and returns a function that removes it. */\n\ton<K extends keyof ChartEventMap>(name: K, listener: EventListener<ChartEventMap[K]>): () => void {\n\t\treturn (this._events ??= new Emitter<ChartEventMap>()).on(name, listener)\n\t}\n\n\t/** Like `on`, but the listener runs once. */\n\tonce<K extends keyof ChartEventMap>(name: K, listener: EventListener<ChartEventMap[K]>): () => void {\n\t\treturn (this._events ??= new Emitter<ChartEventMap>()).on(name, listener, true)\n\t}\n\n\t/** Removes `listener`, or every listener of `name` when it is omitted. */\n\toff<K extends keyof ChartEventMap>(name: K, listener?: EventListener<ChartEventMap[K]>): void {\n\t\tthis._events?.off(name, listener)\n\t}\n\n\t/** @internal */\n\t_hasListeners(name: keyof ChartEventMap): boolean {\n\t\treturn this._events?.has(name) ?? false\n\t}\n\n\t/** @internal */\n\t_emit<K extends keyof ChartEventMap>(name: K, ...args: ChartEventMap[K]): void {\n\t\tthis._events?.emit(name, ...args)\n\t}\n\n\tdrawReflection(): void {\n\t\tconst context = this.drawContext\n\t\tconst chartHeight = this.bounds.height\n\n\t\tcontext.scale(1, -1)\n\t\tcontext.translate(0, -chartHeight * 2)\n\n\t\tthis.ondraw = undefined\n\t\tthis.draw()\n\t\tcontext.translate(0, chartHeight * 2)\n\t\tcontext.scale(1, -1)\n\n\t\tconst canvasSize =\n\t\t\t\tthis.renderer instanceof CanvasRenderer\n\t\t\t\t\t? this.renderer.getSize()\n\t\t\t\t\t: { width: this.canvas.width, height: this.canvas.height },\n\t\t\tmirrorHeight = canvasSize.height - chartHeight,\n\t\t\treflectionY = chartHeight,\n\t\t\tgradient = context.createLinearGradient(0, reflectionY, 0, reflectionY + mirrorHeight),\n\t\t\treflectionColor = this.reflectionColor as string | number[]\n\n\t\tgradient.addColorStop(0, colorToRgba(reflectionColor, 0.5))\n\t\tgradient.addColorStop(1, colorToRgba(reflectionColor, 1))\n\t\tcontext.fillStyle = gradient\n\t\tcontext.beginPath()\n\t\tcontext.shadowColor = \"transparent\"\n\t\tcontext.rect(0, reflectionY, this.bounds.width, mirrorHeight)\n\t\tcontext.fill()\n\n\t\tthis.ondraw = this.drawReflection\n\t}\n\n\tfromTable(\n\t\ttable: string | HTMLTableElement,\n\t\tseriesConstructor: SeriesConstructor,\n\t\tuseColumns: boolean,\n\t\theader: number | null,\n\t\tlabels: number | null\n\t): void {\n\t\tfunction setTitleFooter(chart: Chart, cell: HTMLTableCellElement | null): void {\n\t\t\tif (cell) {\n\t\t\t\tconst cellValue = getTableCellText(cell)\n\n\t\t\t\tif (chart.title.text === \"\") chart.title.text = cellValue\n\t\t\t\telse chart.footer.text = cellValue\n\t\t\t}\n\t\t}\n\n\t\tconst tableElement = isTableElement(table)\n\t\t\t? (table as HTMLTableElement)\n\t\t\t: (getDocument()?.getElementById(table as string) as HTMLTableElement | null | undefined)\n\n\t\tif (tableElement) {\n\t\t\tif (header === null) header = -1\n\t\t\tif (labels === null) labels = -1\n\n\t\t\tthis.series.items = []\n\n\t\t\tif (useColumns) {\n\t\t\t\tif (header > -1) {\n\t\t\t\t\tconst headerRow = tableElement.rows[header]\n\n\t\t\t\t\tif (headerRow) {\n\t\t\t\t\t\tfor (let columnIndex = labels + 1; columnIndex < headerRow.cells.length; columnIndex++) {\n\t\t\t\t\t\t\tconst headerCell = headerRow.cells[columnIndex]\n\t\t\t\t\t\t\tthis.addSeries(new seriesConstructor()).title = getTableCellText(headerCell)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (labels > -1) setTitleFooter(this, headerRow.cells[labels])\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst firstRow = tableElement.rows[0]\n\n\t\t\t\t\tif (firstRow) {\n\t\t\t\t\t\tfor (let columnIndex = labels + 1; columnIndex < firstRow.cells.length; columnIndex++) {\n\t\t\t\t\t\t\tthis.addSeries(new seriesConstructor()).title = `Series ${columnIndex.toFixed(0)}`\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (let rowIndex = header + 1; rowIndex < tableElement.rows.length; rowIndex++) {\n\t\t\t\t\tconst dataRow = tableElement.rows[rowIndex]\n\t\t\t\t\tfor (let columnIndex = labels + 1; columnIndex < dataRow.cells.length; columnIndex++) {\n\t\t\t\t\t\tconst dataCell = dataRow.cells[columnIndex]\n\t\t\t\t\t\tconst cellValue = getTableCellText(dataCell)\n\t\t\t\t\t\tconst value = cellValue === \"\" ? null : parseFloat(cellValue)\n\t\t\t\t\t\t// A null marks a missing value, which series skip when drawing.\n\t\t\t\t\t\tthis.series.items[columnIndex - labels - 1].data.values.push(value as number)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (labels > -1) {\n\t\t\t\t\t\tconst label = getTableCellText(dataRow.cells[labels])\n\t\t\t\t\t\tthis.series.each(series => {\n\t\t\t\t\t\t\tseries.data.labels.push(label)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (let rowIndex = header + 1; rowIndex < tableElement.rows.length; rowIndex++) {\n\t\t\t\t\tconst dataRow = tableElement.rows[rowIndex]\n\t\t\t\t\tconst firstDataColumn = Math.max(labels, 0)\n\t\t\t\t\tfor (let columnIndex = firstDataColumn; columnIndex < dataRow.cells.length; columnIndex++) {\n\t\t\t\t\t\tconst dataCell = dataRow.cells[columnIndex]\n\t\t\t\t\t\tif (columnIndex === labels) {\n\t\t\t\t\t\t\tthis.addSeries(new seriesConstructor()).title = getTableCellText(dataCell)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst cellValue = getTableCellText(dataCell)\n\t\t\t\t\t\t\tconst value = cellValue === \"\" ? null : parseFloat(cellValue)\n\t\t\t\t\t\t\t// A null marks a missing value, which series skip when drawing.\n\t\t\t\t\t\t\tthis.series.items[rowIndex - header - 1].data.values.push(value as number)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (header > -1) {\n\t\t\t\t\tconst headerRow = tableElement.rows[header]\n\n\t\t\t\t\tif (headerRow) {\n\t\t\t\t\t\tfor (let columnIndex = labels + 1; columnIndex < headerRow.cells.length; columnIndex++) {\n\t\t\t\t\t\t\tconst headerCell = headerRow.cells[columnIndex]\n\t\t\t\t\t\t\tthis.series.each(series => {\n\t\t\t\t\t\t\t\tseries.data.labels.push(getTableCellText(headerCell))\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (labels > -1) setTitleFooter(this, headerRow.cells[labels])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.draw()\n\t\t}\n\t}\n\n\tapplyTheme(theme?: ChartTheme): void {\n\t\tapplyTheme(this, theme)\n\t}\n\n\tapplyPalette(paletteName: PaletteInput): void {\n\t\tapplyPalette(this, paletteName)\n\t}\n}\n"],"names":["FONT","light","palette","surface","ink","strong","grid","axisLine","markBorder","dark","withAlpha","color","alpha","hex","exec","value","Number","parseInt","trimZeros","_value","text","test","replace","styleSeries","series","index","tokens","length","format","pointer","pointerOf","marks","gradient","visible","shadow","fill","stroke","size","round","x","y","font","style","Object","assign","margins","left","right","top","bottom","arrow","hover","beveled","depth","colorEach","dial","back","ticks","minor","hand","center","slice","indexOf","units","formatValue","String","Math","styleDial","violin","medianColor","dotStroke","arc","trackColor","textColor","mutedColor","surfaceColor","barSize","direction","colors","applyModern","chart","panel","panelFormat","transparent","walls","axis","axes","items","labels","ongetlabel","title","horizontal","integerSteps","headroom","separation","footer","legend","fontColor","itemGap","edgeInset","rowGap","symbolOffsetY","hoverBackground","dimHidden","symbol","width","height","padding","styleLegend","entries","modernLightTheme","apply","modernDarkTheme","chartPluginResources","WeakMap","validatePluginResources","pluginThemes","pluginPalettes","name","keys","trim","Error","setChartPluginResources","plugins","themes","Map","palettes","plugin","set","Array","isArray","paintWithPalette","pointerStroke","get","undefined","modCustomAxes","featureColor","defaultStrokeColor","i","setSize","minimalTheme","applyInternalPalette","a","baseFontStyle","paletteName","colorList","registerTheme","registerPalette","unregisterTheme","hasOwn","builtInThemes","unregisterPalette","seriesStylers","modernThemes","modern","modernDark","default","minimal","excel","twilight","daybreak","darkContrastColor","defaultStyle","resolveValue","option","mode","values","data","list","map","_","item","Date","getTime","isFinite","push","reduce","sum","sort","b","middle","statistic","computeSplit","options","xAxis","yAxis","xValue","split","yValue","min","startPos","endPos","max","clamp","calc","quadrantsPlugin","id","defaults","inset","divider","areas","topLeft","topRight","bottomLeft","bottomRight","afterAxesDraw","ctx","_series","pluginOptions","quadrants","save","beginPath","rect","clip","cells","cx","cy","backgroundColor","fillStyle","fillRect","drawFills","restore","afterAllSeriesDraw","strokeStyle","lineWidth","moveTo","lineTo","drawLines","pad","px","py","align","baseline","textAlign","textBaseline","fillText","drawLabels","isPlainObject","prototype","getPrototypeOf","clonePluginValue","fromEntries","key","mergePluginOptions","result","previous","invokePluginHook","hook","args","configuredOptions","state","pluginStatesByChart","callback","cleanups","pluginCleanupsByChart","cleanupPlugin","failure","failed","destroy","error","delete","activePluginsByChart","resolveChartPlugins","localPlugins","activePlugins","validatePlugin","orderedPlugins","order","disabledPluginOptionsByChart","JSON","stringify","registerPlugin","unregisterPlugin","drawPluginHooks","notifyPluginHooks","states","create","clearChartPluginResources","seriesTypes","builtInSeriesTypes","Set","registerSeriesType","definition","SeriesClass","toDefinition","registerBuiltInSeriesType","add","unregisterSeriesType","has","drawSpline","pts","t","move","closed","cp","n","point","x0","y0","x1","y1","x2","y2","tension","square","d","sqrt","unshift","concat","bezierCurveTo","quadraticCurveTo","Pointer","transform","inflateMargins","constructor","this","f","Format","setChart","draw","p","c","drawContext","z","w","h","rectangle","Rectangle","wh","cube","ellipse","sphere","g","oldDir","oldColors","cylinder","polygon","Point","prepare","CustomSeries","Series","onbeforedrawpointer","o","o2","super","stacked","stairs","invertedStairs","continuous","clickTolerance","enabled","line","isStacked","isStack100","smooth","maxYValue","stackMaxValue","calcStack","calcColorEach","isColorEach","colorEachLine","initZ","total","at","_traceDecimated","begin","end","noNulls","yMandatory","needMove","column","NaN","xs","ys","minIndex","maxIndex","emit","flush","slots","slot","isNull","pixel","along","drawPointers","len","isEach","old","setEndColor","getFill","getSize","over","_pointWindow","margin","isAscending","probe","across","sign","target","search","limit","strict","low","high","first","after","clicked","p1","p2","pointIndex","drawLine","lineWindow","firstPoint","lastPoint","p1a","pointInLine","r","po","pointerWindow","lowest","contains","horizMargins","s","vertMargins","_index","Area","useOrigin","origin","closeArea","mandatoryAxis","nm","notmandatory","originPos","isY","start","inverted","smop","doStack","closePoint","tmpStrokeFill","visiblePointRange","minimum","maximum","trunc","spline","tmp","axisSize","st","closePath","bounds","__webgl","minYValue","v","_baseMinYValue","_baseMinXValue","minXValue","_baseMaxXValue","maxXValue","CustomBar","sideMargins","offset","customBarSize","barStyle","percent","offsetPoint","bar","visibleBar","_margin","hasPaintedOver","location","drawBar","oldz","pos","image","ellipsoid","ellipsePath","countAll","upToThis","res","calcBarOffset","all","countall","tmpLen","calcStackPos","pointOrigin","drawSortedValues","sorted","sortedState","animation","sortedOptions","sortedDrawAnimation","sorting","running","sortValues","prevValues","originalValues","sortedValues","endValues","sortingAnimationType","doStep","onstop","onstart","animate","sortedLabels","originalLabels","initOffsets","isLine","_styles","styles","url","repeat","backFill","sortedP","sortedValuesIndices","findIndex","onbeforedrawPoint","calcBarBounds","barRectangle","pointPainted","isover","ff","getFillStyle","shadowColor","visibleCount","nomand","mand","range","calcSize","markPos","yMand","op","m","inv","canDraw","aspect","is3d","view3d","wx","wy","orthogonal","_orthox","_orthoy","labelOrTitle","l","Bar","hasNeg","ArrayMin","textHeight","ss","val","_baseMaxYValue","_vertAxis","PointXY","Bubble","inflate","radius","addRandom","count","random","_p","calcWidth","calcHeight","lowIndex","highIndex","Pie","donut","rotation","useAxes","angleWidth","maxRadius","orderAscending","explode","concentric","clockwise","piex","piey","donutRadius","angle","endAngle","hoverang","anchorPosition","hoverExplode","hoverDuration","hoverProgress","hoverFrame","hitTesting","getValue","calcCenter","mid","cos","sin","doHover","changed","animateHover","duration","getWindow","matchMedia","matches","last","now","tick","destroyed","step","moving","current","next","_scheduleDraw","requestAnimationFrame","context","pointCount","isPointInPath","PI","turn","abs","sweep","anchor","tooltipSide","dx","dy","calcPos","getCenter","tube","slices","cellRect","r2","doSort","isNaN","drawMarks","drawEvery","sliceAngle","drawPolar","Donut","lessDonutWidth","donutArray","refreshWidth","nVisibleDonuts","getLessDonutWidth","Line","treatNulls","blur","doDrawLine","oldX","oldY","no","stSeg","isChrome","DEFAULT_THEME","DEFAULT_SERIES_TYPE","markKeys","pointerKeys","isChartOptions","requireSeriesType","type","optionSections","registerOptionSection","requireOptionSection","findOrAddTool","ToolClass","existing","tools","find","tool","applyAxisOptions","setMinMax","log","increment","roundFirst","titleVisible","titleColor","titleFontSize","ticksVisible","position","innerTicksVisible","innerTicks","minorTicksVisible","minorTicks","lineColor","centered","lineDash","bandColor","decimals","fixedDecimals","labelStyle","dateFormat","valueFormat","unsupportedOption","applySeriesStyle","label","borderColor","borderWidth","hoverColor","hoverEnabled","gradientVisible","gradientColors","transparency","cursor","maxPoints","fontSize","borderRadius","applySeriesCapabilities","horizAxis","vertAxis","strokeWidth","strokeColor","hasLine","curved","stepped","circular","cartesianValueTypes","populateSeries","points","some","xKey","yKey","TypeError","row","cartesianPoints","setData","positions","applyPositions","configure","createSeries","cloneValue","mergeValue","base","patch","mergeSeriesOptions","baseType","patchType","entry","positional","_previousData","previousRest","entryRest","chartEventNames","applyOptions","initial","listeners","merged","rest","mergeOptions","themeChanged","theme","reapplyAll","source","defaultType","applyTools","applyAnimation","on","listener","validListeners","applyAccessibility","accessibility","observeSize","responsive","ids","validateSeriesIds","plan","created","reusable","includes","applyTheme","applyThemeOptions","applyPalette","pixelRatio","_applyPixelRatio","fontFamily","expand","subtitle","legendStyle","textStyle","interaction","activeStyle","background","useSeriesPointer","applyLegendOptions","applyPanelOptions","applyAspectOptions","domTip","tooltip","ToolTip","active","shared","render","autoHide","delay","animated","autoRedraw","findPoint","followCursor","realTime","extended","domStyle","ongettext","_tool","_text","applyTooltipOptions","axisOptions","zoom","keepAspect","mouseButton","wheel","factor","applyZoomOptions","scroll","applyScrollOptions","tracked","batchUpdate","forEach","addSeries","splice","removeSeries","replaceSeries","retained","extra","flatMap","reconcileSeries","subscriptions","unsubscribe","stopAccessibility","stopResponsive","previousPluginOptions","before","wasEnabled","isEnabled","disabledOptions","previousOptions","updatePluginActivation","chartOptionDefaults","isDeepEqual","is","every","keepsEveryValue","matching","candidate","keepsPluginOptions","compareChartOptions","change","Axes","visual","Axis","each","call","otherSide","custom","LegendSymbol","ondraw","tryHover","showValues","fhover","oldFill","oldStroke","legendColor","box","drawn","hovered","drawSeriesPointer","oldZ","oldCtxZ","pointerFormat","sourceWidth","sourceHeight","scale","centerX","centerY","gap","leftEnd","rightStart","oldPointerStroke","Legend","onclick","onhover","onbeforedrawLegendItem","useStrokeColor","dividing","itemHeight","innerOff","_titleHeight","_itemWidth","_itemWidths","_itemPos","_itemRect","_rMouse","_cellRect","_aligns","showHidden","rows","perRow","baseLine","Annotation","Stroke","cap","resetDesign","rowPitch","seriesCount","totalWidth","_space","availRows","getBottom","itemsCount","rr","firstVisible","legendCount","isVertical","calcPadding","chartW","itemText","legendText","calcItemPos","calcItemRect","mousedown","setPointVisible","currentSeries","mousemove","newCursor","drawSymbol","itemPos","fade","globalAlpha","drawHoverBackground","symbolSpace","beforeDrawItem","symbolWidth","stopLegend","drawItem","isSeries","vertical","isMozilla","itemVisible","lineThrough","graphics","getLegendArgs","prevStrokStyle","drawText","oldW","sep","textWidth","join","hassymbol","getRight","xx","sy","drawSeries","titleText","ti","ft","groups","beginParent","doDraw","endParent","calcWidths","calcrect","titleWidth","chartRect","vert","shouldDraw","resize","co","automatic","setRight","setLeft","setTop","setBottom","Panel","Margins","clear","renderer","clearRect","strokeSize","Scroll","done","Wall","Zoom","onreset","touching","_rect","oldPos","_check","both","reset","_emit","calcMinMax","canvasHandlerRegistrations","pluginEventWrappers","pluginWrappedHandlers","WeakSet","wrapperFor","handler","wrappers","wrapped","registerCanvasListener","event","pluginEvent","addEventListener","_eventCleanups","removeEventListener","registerCanvasHandler","property","properties","registrations","registration","other","setupTwoFingersZoom","_twoFingersZoomCleanup","canvas","interactionCanvas","pMinX","pMinY","pMaxX","pMaxY","iniMinX","iniMinY","iniMaxX","iniMaxY","maxDistX","minDistX","maxDistY","minDistY","newMinDistX","newMaxDistX","newMinDistY","newMaxDistY","oldMinDistX","oldMaxDistX","oldMinDistY","oldMaxDistY","touches","touchedMoreThanOnceStart","touchZoom","touch1","touch2","pageX","pageY","drawMinMaxLeft","onTouchEnd","preventDefault","setupPointerAuxiliaryHandlers","interactionChart","_doWheel","currentChart","hide","delta","wheelDelta","deltaY","deltaMode","detail","calcMouse","axisRange","applyAxis","returnValue","wheelHandler","passive","_doMouseOut","setCapture","stop","mouseout","pointerHandlerNames","down","up","cancel","leave","asLegacySeries","axisStrokeSize","firstSeries","SeriesList","remove","chartListens","_hasListeners","legacySeries","constructorType","beforeDraw","recalcAxes","anyUsesAxes","Infinity","eachAxis","shouldClip","clipRect","seriesIndex","oldAlpha","onbeforedraw","associatedToAxis","__alwaysDraw","Tools","forEachActive","currP","clickableTool","Tool","Chart","reflectionColor","_events","_stopWatchingPixelRatio","isNLc","_animations","_drawFrameHandle","_updateDepth","_updatePending","isAndroid","language","subfooter","DOMTipController","createdCanvas","runtimeWindow","runtimeDocument","getDocument","runtimeNavigator","getNavigator","legacyWindow","legacyNavigator","userAgent","toLowerCase","mozRequestAnimationFrame","userLanguage","threeAdapter","adapter","domElement","isThreeChartAdapter","isCanvasElement","getElementById","createElement","canvasElement","getContext","setContext","CanvasRenderer","rendererSize","clientSize","getClientSize","clientWidth","clientHeight","setFrom","Palette","ortogonal","elevation","perspective","previousAlpha","backBounds","bottomSize","leftSize","backWallFormat","leftWall","bottomWall","Title","movePoint","downPoint","frameHandle","lastPointerEventAt","isCompatibilityEvent","startsWith","scheduleDraw","clientX","clientY","element","getBoundingClientRect","offsetParent","offsetLeft","offsetTop","domousemove","fromSize","onscroll","oldCursor","domousedown","sourceEvent","inRect","doubleTap","button","oncontextmenu","cancelBubble","pointerTarget","fromElement","setPointerCapture","pointerId","domouseup","onzoom","mouseup","releasePointerCapture","domousecancel","cancelAnimationFrame","setupPrimaryChartInteraction","addDataSeries","seriesConstructor","declarativeOptions","groupedData","groupIndex","prepareChartPlugins","seriesCollection","applyTransform","getGraphics","paintAxes","paintWalls","maxZ","zIndex","visibleSeriesCount","seriesItem","_paintAxes","_paintWalls","tryDraw","updateScales","adjustRect","calcRect","evaluationFormat","msg","watermarkContext","rText","translate","rotate","_requestDraw","previousChart","linkDonutsToChart","existingIndex","toString","paletteColor","styleAddedSeries","getSeries","nextWidth","nextHeight","setPixelRatio","ratio","_watchDevicePixelRatio","_unwatchDevicePixelRatio","devicePixelRatio","query","update","setOptions","resetOptions","sections","selected","section","resetChartOptions","setPluginEnabled","setChartPluginEnabled","getOptions","getChartOptions","toImage","quality","imageElement","dataUrl","toDataURL","src","toBlob","Promise","reject","dispatchPointerEvent","kind","attempt","action","Emitter","once","off","drawReflection","chartHeight","mirrorHeight","reflectionY","createLinearGradient","addColorStop","colorToRgba","fromTable","table","useColumns","header","setTitleFooter","cell","cellValue","getTableCellText","tableElement","isTableElement","headerRow","columnIndex","headerCell","firstRow","toFixed","rowIndex","dataRow","dataCell","parseFloat","themeName","registeredColors"],"mappings":";;;;;;;;;;;;;;sPAmBA,MAAMA,EAAO,gEA4BPC,EAAsB,CAC3BC,QA3B4B,CAC5B,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAkBAC,QAAS,UACTC,IAAK,UACLC,OAAQ,UACRC,KAAM,UACNC,SAAU,UACVC,WAAY,WAGPC,EAAqB,CAC1BP,QAxBgC,CAChC,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAeAC,QAAS,UACTC,IAAK,UACLC,OAAQ,UACRC,KAAM,yBACNC,SAAU,yBACVC,WAAY,0BAyBb,SAASE,EAAUC,EAAeC,GACjC,MAAMC,EAAM,oBAAoBC,KAAKH,GACrC,IAAKE,EAAK,OAAOF,EACjB,MAAMI,EAAQC,OAAOC,SAASJ,EAAI,GAAI,IACtC,MAAO,QAASE,GAAS,GAAM,OAAQA,GAAS,EAAK,OAAe,IAARA,KAAeH,IAC5E,CAGA,SAASM,EAAUC,EAAgBC,GAClC,MAAO,eAAeC,KAAKD,GAAQA,EAAKE,QAAQ,SAAU,IAAMF,CACjE,CA2DA,SAASG,EAAYC,EAAgBC,EAAeC,GACnD,MAAMf,EAAQe,EAAOxB,QAAQuB,EAAQC,EAAOxB,QAAQyB,QAC9CC,EAASJ,EAAOI,OAChBC,EAAUC,EAAUN,GACpBO,EAAQP,EAAOO,MA8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AAgB,aACtB/D,EAAMU,MAAM9D,OAAOa,KAAKC,MAAQqG,EAChC/D,EAAMU,MAAM9D,OAAOa,KAAKC,MAAQ,QAAQqG,IACxC/D,EAAMU,MAAM9D,OAAOa,KAAKN,KAAOqG,EAC/BxD,EAAMU,MAAM9D,OAAOa,KAAKP,OAAOD,SAAU,CAC1C,CAkFA,SAAS4G,EAAqB7D,EAAuBgE,GAEpD,IAAIC,EAAsB,CACzB,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WA+RD,GA3RoB,aAAhBD,EACHC,EAAY,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,WACpC,YAAhBD,EAC3BC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAEgC,SAAhBD,EACjBC,EAAY,CACX,sBACA,sBACA,uBACA,uBACA,uBACA,uBACA,uBACA,mBAEiC,UAAhBD,EAClBC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAE4C,cAAhBD,EAC7BC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAEwC,UAAhBD,EACzBC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAEyC,WAAhBD,EAC1BC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAEmC,YAAhBD,EACpBC,EAAY,CAAC,uBAAwB,uBAAwB,sBAAuB,oBACzC,YAAhBD,EAC3BC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAEmC,YAAhBD,EACpBC,EAAY,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,WAC1C,aAAhBD,EACrBC,EAAY,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,WAE5C,SAAhBD,EACRC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAEmC,YAAhBD,EACpBC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAEwC,UAAhBD,EACzBC,EAAY,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,WACrD,aAAhBD,EACrBC,EAAY,CACX,oBACA,oBACA,sBACA,oBACA,wBACA,wBACA,sBACA,sBACA,oBACA,oBACA,oBACA,sBACA,sBACA,wBACA,sBACA,kBACA,uBACA,wBACA,wBACA,sBAEgC,SAAhBD,EACjBC,EAAY,CACX,wBACA,uBACA,uBACA,uBACA,uBACA,sBACA,sBACA,kBAEsC,QAAhBD,EACvBC,EAAY,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,WACtD,gBAAhBD,EAC/BC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAE+C,iBAAhBD,EAChCC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAE4C,cAAhBD,EAC7BC,EAAY,CACX,wBACA,uBACA,uBACA,uBACA,wBACA,sBACA,sBACA,sBACA,qBACA,qBACA,wBACA,wBACA,wBAE4C,cAAhBD,IAC7BC,EAAY,CACX,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,YAGFjE,EAAMgE,YAAcA,EACpBhE,EAAM9E,QAAQ4E,OAASmE,EAEnBjE,EAAMxD,OAAO+D,MAAM5D,OAAS,EAC/B,IAAK,IAAI+G,EAAI,EAAGA,EAAI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