UNPKG

ag-charts-community

Version:

Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue

1,396 lines (1,370 loc) 2.23 MB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; // packages/ag-charts-locale/src/en-US.ts var AG_CHARTS_LOCALE_EN_US = { // Initial screen reader alt-text of the series area ariaInitSeriesArea: "interactive chart", // Screen reader announcement when focusing an item in the chart ariaAnnounceHoverDatum: "${datum}", // Screen reader announcement when focusing a chart ariaAnnounceChart: "chart, ${seriesCount}[number] series", // Screen reader announcement when focusing a standalone chart (gauges, pyramid) ariaAnnounceStandaloneChart: "chart, ${caption}", // Screen reader announcement when focusing a hierarchy chart ariaAnnounceHierarchyChart: "hierarchy chart, ${caption}", // Screen reader announcement when focusing a gauge chart ariaAnnounceGaugeChart: "gauge chart, ${caption}", // Screen reader announcement when focusing an item in a treemap or sunburst chart ariaAnnounceHierarchyDatum: "level ${level}[number], ${count}[number] children, ${description}", // Screen reader announcement when focusing a link in a Sankey or chord chart ariaAnnounceFlowProportionLink: "link ${index} of ${count}, from ${from} to ${to}, ${sizeName} ${size}", // Screen reader announcement when focusing a node in a Sankey or chord chart ariaAnnounceFlowProportionNode: "node ${index} of ${count}, ${description}", // Screen reader announcement when focusing a leaf node in an Organization chart ariaAnnounceOrgChartLeaf: "${description}, level ${level}[number], ${posInSet}[number] of ${setSize}[number]", // Screen reader announcement when focusing a parent node in an Organization chart with multiple children ariaAnnounceOrgChartParent: "${description}, level ${level}[number], ${posInSet}[number] of ${setSize}[number], ${collapsedState}, ${childCount}[number] children, press Enter or Space to toggle", // Screen reader announcement when focusing a parent node in an Organization chart with exactly one child ariaAnnounceOrgChartParentSingular: "${description}, level ${level}[number], ${posInSet}[number] of ${setSize}[number], ${collapsedState}, 1 child, press Enter or Space to toggle", ariaOrgChartCollapsed: "collapsed", ariaOrgChartExpanded: "expanded", // Screen reader description for legend items ariaDescriptionLegendItem: "Press Space or Enter to toggle visibility", // Screen reader for the '+' horizontal line button on the Y-axis ariaLabelAddHorizontalLine: "Add Horizontal Line", // Screen reader text for annotations toolbar ariaLabelAnnotationsToolbar: "Annotations", // Screen reader text for annotation-options toolbar ariaLabelAnnotationOptionsToolbar: "Annotation Options", // Screen reader text for annotation-settings dialog ariaLabelAnnotationSettingsDialog: "Annotation Settings", // Screen reader text for the color-code label in the picker dialog ariaLabelColor: "Color", // Screen reader text for the color picker dialog ariaLabelColorPicker: "Color picker", // Screen reader text for the alpha-channel slider label ariaLabelColorPickerAlpha: "Transparency", // Screen reader text for the hue slider label ariaLabelColorPickerHue: "Hue", // Screen reader text for when the color-code is multi-colored ariaLabelColorPickerMultiColor: "Multi Color", // Screen reader text for the 2D palette slider label ariaLabelColorPickerPalette: "Palette", // Screen reader text for the financial charts toolbar ariaLabelFinancialCharts: "Financial Charts", // Screen reader text label for the gauge targets ariaLabelGaugeTarget: "Target", // Screen reader text label for the gauge values ariaLabelGaugeValue: "Value", // Screen reader text for the legend toolbar ariaLabelLegend: "Legend", // Screen reader text for the legend pagination button ariaLabelLegendPagination: "Legend Pagination", // Screen reader text for the previous legend page button ariaLabelLegendPagePrevious: "Previous Legend Page", // Screen reader text for the next legend page button ariaLabelLegendPageNext: "Next Legend Page", // Screen reader text for the an item in the legend ariaLabelLegendItem: "${label}, Legend item ${index}[number] of ${count}[number]", // Screen reader text for the an unknown item in the legend ariaLabelLegendItemUnknown: "Unknown legend item", // Screen reader text for the navigator element ariaLabelNavigator: "Navigator", // Screen reader text for an accessibility control that changes the position of the navigator's range ariaLabelNavigatorRange: "Range", // Screen reader text for the horizontal axis scrollbar ariaLabelScrollbarHorizontal: "X-axis scrollbar", // Screen reader text for the vertical axis scrollbar ariaLabelScrollbarVertical: "Y-axis scrollbar", // Screen reader text for an accessibility control that changes the start of the navigator's range ariaLabelNavigatorMinimum: "Minimum", // Screen reader text for an accessibility control that changes the end of the navigator's range ariaLabelNavigatorMaximum: "Maximum", // Screen reader text for ranges toolbar ariaLabelRangesToolbar: "Ranges", // Screen reader text for the settings dialog tab-bar ariaLabelSettingsTabBar: "Settings", // Screen reader text for zoom toolbar ariaLabelZoomToolbar: "Zoom", // Aria role description for a 2D role="slider" ariaRoleDescription2DSlider: "2D slider", // Screen reader text for color picker's 2D slider palette ariaValueColorPalette: "s ${s}[percent0to2dp], v ${v}[percent0to2dp]", // Screen reader text for color picker's 2D slider palette (when arrowing up or down) ariaValueColorPaletteFirstV: "v ${v}[percent0to2dp], s ${s}[percent0to2dp]", // Screen reader text for the value of the navigator's range ariaValuePanRange: "${min}[percent0to2dp] to ${max}[percent0to2dp]", // Alt-text for the solid line dash style menu item icon iconAltTextLineStyleSolid: "Solid", // Alt-text for the long-dashed line dash style menu item icon iconAltTextLineStyleDashed: "Long-dashed", // Alt-text for the short-dashed line dash style menu item icon iconAltTextLineStyleDotted: "Short-dashed", // Alt-text for the 'position-top' icon iconAltTextPositionTop: "Top", // Alt-text for the 'position-center' icon iconAltTextPositionCenter: "Center", // Alt-text for the 'position-bottom' icon iconAltTextPositionBottom: "Bottom", // Alt-text for the 'position-left' icon iconAltTextAlignLeft: "Left", // Alt-text for the 'align-center' icon iconAltTextAlignCenter: "Center", // Alt-text for the 'position-right' icon iconAltTextAlignRight: "Right", // Alt-text for the 'close' icon iconAltTextClose: "Close", // Default text for the 'loading data' overlay overlayLoadingData: "Loading data...", // Default text for the 'no data' overlay overlayNoData: "No data to display", // Default text for the 'no visible series' overlay overlayNoVisibleSeries: "No visible series", // Default text for the 'unsupported browser' overlay overlayUnsupportedBrowser: "Incompatible browser version. Please upgrade your browser.", // Text for frequency label in Histogram Series tooltip seriesHistogramTooltipFrequency: "Frequency", // Text for sum label in Histogram Series tooltip seriesHistogramTooltipSum: "${yName} (sum)", // Text for sum label in Histogram Series tooltip seriesHistogramTooltipCount: "${yName} (count)", // Text for sum label in Histogram Series tooltip seriesHistogramTooltipMean: "${yName} (mean)", // Text for the series type toolbar's chart type button toolbarSeriesTypeDropdown: "Chart Type", // Text for the series type toolbar's OHLC chart type button toolbarSeriesTypeOHLC: "OHLC", // Text for the series type toolbar's HLC chart type button toolbarSeriesTypeHLC: "HLC", // Text for the series type toolbar's high low chart type button toolbarSeriesTypeHighLow: "High Low", // Text for the series type toolbar's candles chart type button toolbarSeriesTypeCandles: "Candles", // Text for the series type toolbar's hollow candles chart type button toolbarSeriesTypeHollowCandles: "Hollow Candles", // Text for the series type toolbar's line chart type button toolbarSeriesTypeLine: "Line", // Text for the series type toolbar's line with markers chart type button toolbarSeriesTypeLineWithMarkers: "Line with Markers", // Text for the series type toolbar's line with step line chart type button toolbarSeriesTypeStepLine: "Step Line", // Text for the annotation toolbar's trend line button toolbarAnnotationsTrendLine: "Trend Line", // Text for the annotation toolbar's Fibonacci Retracement button toolbarAnnotationsFibonacciRetracement: "Fib Retracement", // Text for the annotation toolbar's Fibonacci Retracement Trend Based button toolbarAnnotationsFibonacciRetracementTrendBased: "Fib Trend Based", // Text for the annotation toolbar's horizontal line button toolbarAnnotationsHorizontalLine: "Horizontal Line", // Text for the annotation toolbar's vertical line button toolbarAnnotationsVerticalLine: "Vertical Line", // Text for the annotation toolbar's parallel channel button toolbarAnnotationsParallelChannel: "Parallel Channel", // Text for the annotation toolbar's disjoint channel button toolbarAnnotationsDisjointChannel: "Disjoint Channel", // Text for the annotation toolbar's clear all button toolbarAnnotationsClearAll: "Clear All", // Text for the annotation toolbar's fill color picker annotation button toolbarAnnotationsFillColor: "Fill Color", // Text for the annotation toolbar's line color picker annotation button toolbarAnnotationsLineColor: "Line Color", // Text for the annotation toolbar's line style type button toolbarAnnotationsLineStyle: "Line Style", // Text for the annotation toolbar's line stroke width button toolbarAnnotationsLineStrokeWidth: "Line Stroke Width", // Text for the annotation toolbar's settings annotation button toolbarAnnotationsSettings: "Settings", // Text for the annotation toolbar's text color picker annotation button toolbarAnnotationsTextColor: "Text Color", // Text for the annotation toolbar's text size picker annotation button toolbarAnnotationsTextSize: "Text Size", // Text for the annotation toolbar's lock annotation button toolbarAnnotationsLock: "Lock", // Text for the annotation toolbar's unlock annotation button toolbarAnnotationsUnlock: "Unlock", // Text for the annotation toolbar's delete annotation button toolbarAnnotationsDelete: "Delete", // Text for the annotation toolbar's drag handle toolbarAnnotationsDragHandle: "Drag Toolbar", // Text for the annotation toolbar's line drawings menu button toolbarAnnotationsLineAnnotations: "Trend Lines", // Text for the annotation toolbar's Fibonacci drawings menu button toolbarAnnotationsFibonacciAnnotations: "Fibonacci", // Text for the annotation toolbar's text annotations menu button toolbarAnnotationsTextAnnotations: "Text Annotations", // Text for the annotation toolbar's shapes menu button toolbarAnnotationsShapeAnnotations: "Arrows", // Text for the annotation toolbar's measurers menu button toolbarAnnotationsMeasurerAnnotations: "Measurers", // Text for the annotation toolbar's callout button toolbarAnnotationsCallout: "Callout", // Text for the annotation toolbar's comment button toolbarAnnotationsComment: "Comment", // Text for the annotation toolbar's note button toolbarAnnotationsNote: "Note", // Text for the annotation toolbar's text button toolbarAnnotationsText: "Text", // Text for the annotation toolbar's arrow button toolbarAnnotationsArrow: "Arrow", // Text for the annotation toolbar's arrow up button toolbarAnnotationsArrowUp: "Arrow Up", // Text for the annotation toolbar's arrow down button toolbarAnnotationsArrowDown: "Arrow Down", // Text for the annotation toolbar's date range button toolbarAnnotationsDateRange: "Date Range", // Text for the annotation toolbar's price range button toolbarAnnotationsPriceRange: "Price Range", // Text for the annotation toolbar's date and price range button toolbarAnnotationsDatePriceRange: "Date and Price", // Text for the annotation toolbar's quick date and price range button toolbarAnnotationsQuickDatePriceRange: "Measure", // Text for the range toolbar's 1 month button toolbarRange1Month: "1M", // Aria label for the range toolbar's 1 month button toolbarRange1MonthAria: "1 month", // Text for the range toolbar's 3 month button toolbarRange3Months: "3M", // Aria label for the range toolbar's 3 month button toolbarRange3MonthsAria: "3 months", // Text for the range toolbar's 6 month button toolbarRange6Months: "6M", // Aria label for the range toolbar's 6 month button toolbarRange6MonthsAria: "6 months", // Text for the range toolbar's year to date button toolbarRangeYearToDate: "YTD", // Aria label for the range toolbar's year to date month button toolbarRangeYearToDateAria: "Year to date", // Text for the range toolbar's 1 year button toolbarRange1Year: "1Y", // Aria label for the range toolbar's 1 year button toolbarRange1YearAria: "1 year", // Text for the range toolbar's full range button toolbarRangeAll: "All", // Aria label for the range toolbar's full range button toolbarRangeAllAria: "All", // Text for the range toolbar's dropdown default toolbarRangeSelectRange: "Select range", // Aria label for the range toolbar's dropdown default toolbarRangeSelectRangeAria: "Select range", // Text for the zoom toolbar's zoom out button toolbarZoomZoomOut: "Zoom out", // Text for the zoom toolbar's zoom in button toolbarZoomZoomIn: "Zoom in", // Text for the zoom toolbar's pan left button toolbarZoomPanLeft: "Pan left", // Text for the zoom toolbar's pan right button toolbarZoomPanRight: "Pan right", // Text for the zoom toolbar's pan to the start button toolbarZoomPanStart: "Pan to the start", // Text for the zoom toolbar's pan to the end button toolbarZoomPanEnd: "Pan to the end", // Text for the zoom toolbar's pan reset button toolbarZoomReset: "Reset the zoom", // Text for the context menu's download button contextMenuDownload: "Download", // Text for the context menu's toggle series visibility button contextMenuToggleSeriesVisibility: "Toggle Visibility", // Text for the context menu's toggle other series visibility button contextMenuToggleOtherSeries: "Toggle Other Series", // Text for the context menu's zoom to point button contextMenuZoomToCursor: "Zoom to here", // Text for the context menu's pan to point button contextMenuPanToCursor: "Pan to here", // Text for the context menu's reset zoom button contextMenuResetZoom: "Reset zoom", // Text for the annotation dialog's header channel tab label dialogHeaderChannel: "Channel", // Text for the annotation dialog's header line tab label dialogHeaderLine: "Line", // Text for the annotation dialog's header fibonacci retracement line tab label dialogHeaderFibonacciRange: "Fib Retracement", // Text for the annotation dialog's header date range tab label dialogHeaderDateRange: "Date Range", // Text for the annotation dialog's header price range tab label dialogHeaderPriceRange: "Price Range", // Text for the annotation dialog's header date and price range tab label dialogHeaderDatePriceRange: "Date and Price", // Text for the annotation dialog's header text tab label dialogHeaderText: "Text", // Text for the annotation dialog's text alignment radio label dialogInputAlign: "Align", // Text for the annotation dialog's color picker label dialogInputColorPicker: "Color", // Text for the annotation dialog's color picker alt text dialogInputColorPickerAltText: "Text Color", // Text for the annotation dialog's fill color picker label dialogInputFillColorPicker: "Fill", // Text for the annotation dialog's fill color picker alt text dialogInputFillColorPickerAltText: "Fill Color", // Text for the annotation dialog's extend channel start checkbox dialogInputExtendChannelStart: "Extend channel start", // Text for the annotation dialog's extend channel end checkbox dialogInputExtendChannelEnd: "Extend channel end", // Text for the annotation dialog's extend line start checkbox dialogInputExtendLineStart: "Extend line start", // Text for the annotation dialog's extend line end checkbox dialogInputExtendLineEnd: "Extend line end", // Text for the annotation dialog's extend above checkbox dialogInputExtendAbove: "Extend above", // Text for the annotation dialog's extend below checkbox dialogInputExtendBelow: "Extend below", // Text for the annotation dialog's extend left checkbox dialogInputExtendLeft: "Extend left", // Text for the annotation dialog's extend right checkbox dialogInputExtendRight: "Extend right", // Text for the annotation dialog's reverse checkbox dialogInputReverse: "Reverse", // Text for the annotation dialog's show fill checkbox dialogInputShowFill: "Show Fill", // Text for the annotation dialog's font size select box label dialogInputFontSize: "Size", // Text for the annotation dialog's font size select box alt text dialogInputFontSizeAltText: "Font Size", // Text for the annotation dialog's line style radio label dialogInputLineStyle: "Dash", // Text for the annotation dialog's text position radio label dialogInputPosition: "Position", // Text for the annotation dialog's stroke width label dialogInputStrokeWidth: "Weight", // Text for the annotation dialog's stroke width label dialogInputStrokeWidthAltText: "Line Weight", // Text for the annotation dialog's Fibonacci bands label dialogInputFibonacciBands: "Bands", // Text for the annotation dialog's Fibonacci bands label dialogInputFibonacciBandsAltText: "Fibonacci Bands", // Text for text area input placeholders inputTextareaPlaceholder: "Add Text", // Text for the measurer statistics date range bars value measurerDateRangeBars: "${value}[number] bars", // Text for the measurer statistics price range value measurerPriceRangeValue: "${value}[number]", // Text for the measurer statistics price range percentage measurerPriceRangePercent: "${value}[percent]", // Text for the measurer statistics volume value measurerVolume: "Vol ${value}", // Status when multiple data are under the cursor, and the user can click to cycle through which one appears in the tooltip tooltipPaginationStatus: "${index}[number] of ${count}[number]" }; // packages/ag-charts-types/src/chart/navigatorOptions.ts var __MINI_CHART_SERIES_OPTIONS = void 0; var __VERIFY_MINI_CHART_SERIES_OPTIONS = void 0; /*#__PURE__*/ (() => { __VERIFY_MINI_CHART_SERIES_OPTIONS = __MINI_CHART_SERIES_OPTIONS; })(); // packages/ag-charts-types/src/chart/themeOptions.ts var __THEME_OVERRIDES = void 0; var __VERIFY_THEME_OVERRIDES = void 0; /*#__PURE__*/ (() => { __VERIFY_THEME_OVERRIDES = __THEME_OVERRIDES; })(); // packages/ag-charts-types/src/chart/tooltipOptions.ts var AgTooltipAnchorToType = /* @__PURE__ */ /*#__PURE__*/ ((AgTooltipAnchorToType2) => { AgTooltipAnchorToType2["POINTER"] = "pointer"; AgTooltipAnchorToType2["NODE"] = "node"; AgTooltipAnchorToType2["CHART"] = "chart"; return AgTooltipAnchorToType2; })(AgTooltipAnchorToType || {}); var AgTooltipPlacementType = /* @__PURE__ */ /*#__PURE__*/ ((AgTooltipPlacementType2) => { AgTooltipPlacementType2["TOP"] = "top"; AgTooltipPlacementType2["RIGHT"] = "right"; AgTooltipPlacementType2["BOTTOM"] = "bottom"; AgTooltipPlacementType2["LEFT"] = "left"; AgTooltipPlacementType2["TOP_RIGHT"] = "top-right"; AgTooltipPlacementType2["BOTTOM_RIGHT"] = "bottom-right"; AgTooltipPlacementType2["BOTTOM_LEFT"] = "bottom-left"; AgTooltipPlacementType2["TOP_LEFT"] = "top-left"; AgTooltipPlacementType2["CENTER"] = "center"; return AgTooltipPlacementType2; })(AgTooltipPlacementType || {}); // packages/ag-charts-types/src/presets/gauge/commonOptions.ts var __THEMEABLE_OPTIONS = void 0; var __VERIFY_THEMEABLE_OPTIONS = void 0; /*#__PURE__*/ (() => { __VERIFY_THEMEABLE_OPTIONS = __THEMEABLE_OPTIONS; })(); var __AXIS_LABEL_OPTIONS = void 0; var __VERIFY_AXIS_LABEL_OPTIONS = void 0; /*#__PURE__*/ (() => { __VERIFY_AXIS_LABEL_OPTIONS = __AXIS_LABEL_OPTIONS; })(); // packages/ag-charts-community/src/util/time-interop.ts import { Logger } from "ag-charts-core"; function createTimeInterval(unit, step, epoch, utc) { return { unit, step, epoch, utc, every(count) { return createTimeInterval(this.unit, (this.step ?? 1) * count, this.epoch, this.utc); } }; } var cachedInstances = {}; function getTimeInterval(unit, step = 1, epoch, utc = false) { Logger.warnOnce("time import is deprecated, use object notation instead"); const key = `${unit}:${step}:${epoch?.getTime() ?? 0}:${utc}`; let instance = cachedInstances[key]; if (instance == null) { instance = createTimeInterval(unit, step, epoch, utc); cachedInstances[key] = instance; } return instance; } var time = { get millisecond() { return getTimeInterval("millisecond"); }, get second() { return getTimeInterval("second"); }, get minute() { return getTimeInterval("minute"); }, get hour() { return getTimeInterval("hour"); }, get day() { return getTimeInterval("day"); }, get monday() { return getTimeInterval("day", 7, new Date(1970, 0, 5)); }, get tuesday() { return getTimeInterval("day", 7, new Date(1970, 0, 6)); }, get wednesday() { return getTimeInterval("day", 7, new Date(1970, 0, 7)); }, get thursday() { return getTimeInterval("day", 7, new Date(1970, 0, 1)); }, get friday() { return getTimeInterval("day", 7, new Date(1970, 0, 2)); }, get saturday() { return getTimeInterval("day", 7, new Date(1970, 0, 3)); }, get sunday() { return getTimeInterval("day", 7, new Date(1970, 0, 4)); }, get month() { return getTimeInterval("month"); }, get year() { return getTimeInterval("year"); }, get utcMillisecond() { return getTimeInterval("millisecond", 1, void 0, true); }, get utcSecond() { return getTimeInterval("second", 1, void 0, true); }, get utcMinute() { return getTimeInterval("minute", 1, void 0, true); }, get utcHour() { return getTimeInterval("hour", 1, void 0, true); }, get utcDay() { return getTimeInterval("day", 1, void 0, true); }, get utcMonth() { return getTimeInterval("month", 1, void 0, true); }, get utcYear() { return getTimeInterval("year", 1, void 0, true); } }; // packages/ag-charts-community/src/api/agCharts.ts import { Debug as Debug20, MementoCaretaker as MementoCaretaker2, ModuleRegistry as ModuleRegistry13, deepClone as deepClone5, deepFreeze as deepFreeze5, enterpriseRegistry as enterpriseRegistry2, jsonWalk as jsonWalk3, strictObjectKeys } from "ag-charts-core"; // packages/ag-charts-community/src/chart/chart.ts import { ActionOnSet as ActionOnSet3, AgDocument as AgDocument8, AsyncAwaitQueue, ChartAxisDirection as ChartAxisDirection6, ChartUpdateType as ChartUpdateType4, CleanupRegistry as CleanupRegistry17, Color as Color4, Debug as Debug13, Logger as Logger28, ModuleRegistry as ModuleRegistry4, ModuleType as ModuleType3, Padding, Property as Property15, ProxyProperty, ZIndexMap as ZIndexMap5, callWithContext as callWithContext5, createId as createId7, enterpriseRegistry, entries as entries4, getWindow as getWindow4, isFiniteNumber as isFiniteNumber4, isInputPending, jsonApply, mergeDefaults as mergeDefaults3, pause, roundTo, toPlainText as toPlainText7 } from "ag-charts-core"; // packages/ag-charts-community/src/scene/bbox.ts import { boxContains, boxesEqual, clamp, nearestSquared } from "ag-charts-core"; // packages/ag-charts-community/src/util/interpolating.ts var interpolate = /*#__PURE__*/ Symbol("interpolate"); var isInterpolating = (x) => x[interpolate] != null; // packages/ag-charts-community/src/scene/bbox.ts var _BBox = /*#__PURE__*/ (() => { var _c$0 = class _BBox { constructor(x, y, width, height) { this.x = x; this.y = y; this.width = width; this.height = height; } static fromObject({ x, y, width, height }) { return new _BBox(x, y, width, height); } static merge(boxes) { let left = Infinity; let top = Infinity; let right = -Infinity; let bottom = -Infinity; for (const box of boxes) { if (box.x < left) { left = box.x; } if (box.y < top) { top = box.y; } if (end(box.x, box.width) > right) { right = end(box.x, box.width); } if (end(box.y, box.height) > bottom) { bottom = end(box.y, box.height); } } return new _BBox(left, top, right - left, bottom - top); } static nearestBox(x, y, boxes) { return nearestSquared(x, y, boxes); } toDOMRect() { return { x: this.x, y: this.y, width: this.width, height: this.height, top: this.y, left: this.x, right: end(this.x, this.width), bottom: end(this.y, this.height), toJSON() { return {}; } }; } clone() { const { x, y, width, height } = this; return new _BBox(x, y, width, height); } equals(other) { return boxesEqual(this, other); } containsPoint(x, y) { return boxContains(this, x, y); } intersectsWith(other) { return !(this.x + this.width <= other.x || other.x + other.width <= this.x || this.y + this.height <= other.y || other.y + other.height <= this.y); } intersection(other) { const x0 = Math.max(this.x, other.x); const y0 = Math.max(this.y, other.y); const x1 = Math.min(end(this.x, this.width), end(other.x, other.width)); const y1 = Math.min(end(this.y, this.height), end(other.y, other.height)); if (x0 > x1 || y0 > y1) return; return new _BBox(x0, y0, x1 - x0, y1 - y0); } collidesBBox(other) { return this.x < end(other.x, other.width) && end(this.x, this.width) > other.x && this.y < end(other.y, other.height) && end(this.y, this.height) > other.y; } computeCenter() { return { x: this.x + this.width / 2, y: this.y + this.height / 2 }; } isFinite() { return Number.isFinite(this.x) && Number.isFinite(this.y) && Number.isFinite(this.width) && Number.isFinite(this.height); } distanceSquared(x, y) { if (this.containsPoint(x, y)) { return 0; } const dx = x - clamp(this.x, x, end(this.x, this.width)); const dy = y - clamp(this.y, y, end(this.y, this.height)); return dx * dx + dy * dy; } shrink(amount, position) { if (typeof amount === "number") { this.applyMargin(amount, position); } else { for (const key of Object.keys(amount)) { const value = amount[key]; if (typeof value === "number") { this.applyMargin(value, key); } } } if (this.width < 0) { this.width = 0; } if (this.height < 0) { this.height = 0; } return this; } grow(amount, position) { if (typeof amount === "number") { this.applyMargin(-amount, position); } else { for (const key of Object.keys(amount)) { const value = amount[key]; if (typeof value === "number") { this.applyMargin(-value, key); } } } return this; } applyMargin(value, position) { switch (position) { case "top": this.y += value; case "bottom": this.height -= value; break; case "left": this.x += value; case "right": this.width -= value; break; case "vertical": this.y += value; this.height -= value * 2; break; case "horizontal": this.x += value; this.width -= value * 2; break; case void 0: this.x += value; this.y += value; this.width -= value * 2; this.height -= value * 2; break; } } translate(x, y) { this.x += x; this.y += y; return this; } [interpolate](other, d) { return new _BBox( this.x * (1 - d) + other.x * d, this.y * (1 - d) + other.y * d, this.width * (1 - d) + other.width * d, this.height * (1 - d) + other.height * d ); } }; _c$0.zero = Object.freeze(new _c$0(0, 0, 0, 0)); _c$0.NaN = Object.freeze(new _c$0(Number.NaN, Number.NaN, Number.NaN, Number.NaN)); return _c$0; })() var BBox = _BBox; function end(x, width) { if (x === -Infinity && width === Infinity) return Infinity; return x + width; } // packages/ag-charts-community/src/scene/group.ts import { clamp as clamp5, toIterable } from "ag-charts-core"; // packages/ag-charts-community/src/scene/canvas/hdpiOffscreenCanvas.ts import { getOffscreenCanvas } from "ag-charts-core"; // packages/ag-charts-community/src/scene/canvas/canvasUtil.ts import { Debug } from "ag-charts-core"; function clearContext({ context, pixelRatio, width, height }) { context.save(); try { context.resetTransform(); context.clearRect(0, 0, Math.ceil(width * pixelRatio), Math.ceil(height * pixelRatio)); } finally { context.restore(); } } function debugContext(ctx) { if (Debug.check("canvas")) { const save = ctx.save.bind(ctx); const restore = ctx.restore.bind(ctx); let depth = 0; Object.assign(ctx, { save() { save(); depth++; }, restore() { if (depth === 0) { throw new Error("AG Charts - Unable to restore() past depth 0"); } restore(); depth--; }, verifyDepthZero() { if (depth !== 0) { throw new Error(`AG Charts - Save/restore depth is non-zero: ${depth}`); } } }); } } // packages/ag-charts-community/src/scene/canvas/hdpiOffscreenCanvas.ts function canvasDimensions(width, height, pixelRatio) { return [Math.floor(width * pixelRatio), Math.floor(height * pixelRatio)]; } var fallbackCanvas; function getFallbackCanvas() { const OffscreenCanvasCtor = getOffscreenCanvas(); fallbackCanvas ?? (fallbackCanvas = new OffscreenCanvasCtor(1, 1)); return fallbackCanvas; } var HdpiOffscreenCanvas = class { constructor(options) { const { width, height, pixelRatio, willReadFrequently = false } = options; this.width = width; this.height = height; this.pixelRatio = pixelRatio; const [canvasWidth, canvasHeight] = canvasDimensions(width, height, pixelRatio); const OffscreenCanvasCtor = getOffscreenCanvas(); this.canvas = new OffscreenCanvasCtor(canvasWidth, canvasHeight); this.context = this.canvas.getContext("2d", { willReadFrequently }); this.context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); debugContext(this.context); } drawImage(context, dx = 0, dy = 0) { return context.drawImage(this.canvas, dx, dy); } transferToImageBitmap() { if (this.canvas.width < 1 || this.canvas.height < 1) { return getFallbackCanvas().transferToImageBitmap(); } return this.canvas.transferToImageBitmap(); } resize(width, height, pixelRatio) { if (!(width > 0 && height > 0)) return; const { canvas, context } = this; if (width !== this.width || height !== this.height || pixelRatio !== this.pixelRatio) { const [canvasWidth, canvasHeight] = canvasDimensions(width, height, pixelRatio); canvas.width = canvasWidth; canvas.height = canvasHeight; } context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); this.width = width; this.height = height; this.pixelRatio = pixelRatio; } clear() { clearContext(this); } destroy() { this.canvas.width = 0; this.canvas.height = 0; this.context.clearRect(0, 0, 0, 0); this.canvas = null; this.context = null; Object.freeze(this); } }; // packages/ag-charts-community/src/scene/node.ts import { DeclaredSceneChangeDetection, Logger as Logger2, createId, createSvgElement, objectsEqual } from "ag-charts-core"; // packages/ag-charts-community/src/scene/zIndex.ts var cmp = (a, b) => Math.sign(a - b); function compareZIndex(a, b) { if (typeof a === "number" && typeof b === "number") { return cmp(a, b); } const aArray = typeof a === "number" ? [a] : a; const bArray = typeof b === "number" ? [b] : b; const length = Math.min(aArray.length, bArray.length); for (let i = 0; i < length; i += 1) { const diff2 = cmp(aArray[i], bArray[i]); if (diff2 !== 0) return diff2; } return cmp(aArray.length, bArray.length); } // packages/ag-charts-community/src/scene/node.ts import { SceneChangeDetection } from "ag-charts-core"; var PointerEvents = /* @__PURE__ */ /*#__PURE__*/ ((PointerEvents2) => { PointerEvents2[PointerEvents2["All"] = 0] = "All"; PointerEvents2[PointerEvents2["None"] = 1] = "None"; return PointerEvents2; })(PointerEvents || {}); var MAX_ERROR_COUNT = 5; var _Node = /*#__PURE__*/ (() => { var _c$1 = class _Node { constructor(options) { /** Unique number to allow creation order to be easily determined. */ this.serialNumber = _Node._nextSerialNumber++; this.childNodeCounts = { groups: 0, nonGroups: 0, thisComplexity: 0, complexity: 0 }; /** Unique node ID in the form `ClassName-NaturalNumber`. */ this.id = createId(this); this.name = void 0; this.transitionOut = void 0; this.pointerEvents = 0 /* All */; this._datum = void 0; this._previousDatum = void 0; this.scene = void 0; this._debugDirtyProperties = void 0; this.parentNode = void 0; this.cachedBBox = void 0; /** * To simplify the type system (especially in Selections) we don't have the `Parent` node * (one that has children). Instead, we mimic HTML DOM, where any node can have children. * But we still need to distinguish regular leaf nodes from container leafs somehow. */ this.isContainerNode = false; this.visible = true; this.zIndex = 0; this.batchLevel = 0; this.batchDirty = false; this.name = options?.name; this.tag = options?.tag ?? Number.NaN; this.zIndex = options?.zIndex ?? 0; this.scene = options?.scene; if (options?.debugDirty ?? _Node._debugEnabled) { this._debugDirtyProperties = /* @__PURE__ */ new Map([["__first__", []]]); } } static toSVG(node, width, height) { const svg = node?.toSVG(); if (svg == null || !svg.elements.length && !svg.defs?.length) return; const root = createSvgElement("svg"); root.setAttribute("width", String(width)); root.setAttribute("height", String(height)); root.setAttribute("viewBox", `0 0 ${width} ${height}`); root.setAttribute("overflow", "visible"); if (svg.defs?.length) { const defs = createSvgElement("defs"); defs.append(...svg.defs); root.append(defs); } root.append(...svg.elements); return root.outerHTML; } static *extractBBoxes(nodes, skipInvisible) { for (const n of nodes) { if (!skipInvisible || n.visible && !n.transitionOut) { const bbox = n.getBBox(); if (bbox) yield bbox; } } } /** * Some arbitrary data bound to the node. */ get datum() { return this._datum; } set datum(datum) { if (this._datum !== datum) { this._previousDatum = this._datum; this._datum = datum; } } get previousDatum() { return this._previousDatum; } /** @deprecated do not use unsafe non-null assertion (`datum!`), used typed `datum` */ get unsafeNonNullDatum() { return this.datum; } /** @deprecated do not use `any`, used typed `datum` */ get unsafeDatum() { return this.datum; } /** @deprecated do not use `any`, used typed `datum` */ set unsafeDatum(datum) { this.datum = datum; } /** @deprecated do not use `any`, used typed `previousDatum` */ get unsafePreviousDatum() { return this.previousDatum; } get layerManager() { return this.scene?.layersManager; } get imageLoader() { return this.scene?.imageLoader; } closestDatum() { for (const { datum } of this.traverseUp(true)) { if (datum != null) { return datum; } } } /** @deprecated do not use `any` */ unsafeClosestDatum() { return this.closestDatum(); } /** Perform any pre-rendering initialization. */ preRender(_renderCtx, thisComplexity = 1) { this.childNodeCounts.groups = 0; this.childNodeCounts.nonGroups = 1; this.childNodeCounts.complexity = thisComplexity; this.childNodeCounts.thisComplexity = thisComplexity; if (this.batchLevel > 0 || this.batchDirty) { throw new Error("AG Charts - illegal rendering state; batched update in progress"); } return this.childNodeCounts; } /** Guaranteed isolated render - if there is any failure, the Canvas2D context is returned to its prior state. */ isolatedRender(renderCtx) { renderCtx.ctx.save(); try { this.render(renderCtx); } catch (e) { const errorCount = e.errorCount ?? 1; if (errorCount >= MAX_ERROR_COUNT) { e.errorCount = errorCount; throw e; } Logger2.warnOnce("Error during rendering", e, e.stack); } finally { renderCtx.ctx.restore(); } } render(renderCtx) { const { stats } = renderCtx; this.debugDirtyProperties(); if (renderCtx.debugNodeSearch) { const idOrName = this.name ?? this.id; if (renderCtx.debugNodeSearch.some((v) => typeof v === "string" ? v === idOrName : v.test(idOrName))) { renderCtx.debugNodes[this.name ?? this.id] = this; } } if (stats) { stats.nodesRendered++; stats.opsPerformed += this.childNodeCounts.thisComplexity; } } setScene(scene) { this.scene = scene; } *traverseUp(includeSelf) { if (includeSelf) { yield this; } let node = this.parentNode; while (node) { yield node; node = node.parentNode; } } /** * Checks if the node is the root (has no parent). */ isRoot() { return !this.parentNode; } removeChild(node) { throw new Error( `AG Charts - internal error, unknown child node ${node.name ?? node.id} in $${this.name ?? this.id}` ); } remove() { this.parentNode?.removeChild(this); } destroy() { if (this.parentNode) { this.remove(); } } batchedUpdate(fn) { this.batchLevel++; try { fn(); } finally { this.batchLevel--; if (this.batchLevel === 0 && this.batchDirty) { this.markDirty(); this.batchDirty = false; } } } setProperties(styles) { this.batchLevel++; try { const target = this; const source = styles; const keys = Object.keys(source); for (let i = 0, n = keys.length; i < n; i++) { const key = keys[i]; target[key] = source[key]; } } finally { this.batchLevel--; if (this.batchLevel === 0 && this.batchDirty) { this.markDirty(); this.batchDirty = false; } } return this; } setPropertiesWithKeys(styles, keys) { this.batchLevel++; try { const target = this; const source = styles; for (let i = 0, n = keys.length; i < n; i++) { const key = keys[i]; target[key] = source[key]; } } finally { this.batchLevel--; if (this.batchLevel === 0 && this.batchDirty) { this.markDirty(); this.batchDirty = false; } } return this; } containsPoint(_x, _y) { return false; } pickNode(x, y) { if (!this.visible || this.pointerEvents === 1 /* None */) { return; } if (this.containsPoint(x, y)) { return this; } } pickNodes(x, y, into = []) { if (!this.visible || this.pointerEvents === 1 /* None */) { return into; } if (this.containsPoint(x, y)) { into.push(this); } return into; } getBBox() { this.cachedBBox ?? (this.cachedBBox = Object.freeze(this.computeBBox())); return this.cachedBBox; } computeBBox() { return; } onChangeDetection(property) { this.markDirty(property); } markDirtyChildrenOrder() { this.cachedBBox = void 0; } markDirty(property) { if (this.batchLevel > 0) { this.batchDirty = true; return; } if (property != null && this._debugDirtyProperties) { this.markDebugProperties(property); } this.cachedBBox = void 0; this.parentNode?.markDirty(); } markDebugProperties(property) { const sources = this._debugDirtyProperties?.get(property) ?? []; const caller = new Error("Stack trace for property change tracking").stack?.split("\n").filter((line) => { return line !== "Error" && !line.includes(".markDebugProperties") && !line.includes(".markDirty") && !line.includes("Object.assign ") && !line.includes(`${this.constructor.name}.`); }) ?? "unknown"; sources.push(caller[0].replace(" at ", "").trim()); this._debugDirtyProperties?.set(property, sources); } debugDirtyProperties() { if (this._debugDirtyProperties == null) return; if (!this._debugDirtyProperties.has("__first__")) { for (const [property, sources] of this._debugDirtyProperties.entries()) { if (sources.length > 1) { Logger2.logGroup( `Property changed multiple times before render: ${this.constructor.name}.${property} (${sources.length}x)`, () => { for (const source of sources) { Logger2.log(source); } } ); } } } this._debugDirtyProperties.clear(); } static handleNodeZIndexChange(target) { target.onZIndexChange(); } onZIndexChange() { this.parentNode?.markDirtyChildrenOrder(); } /** Override in subclasses that carry a font (Text) or contain font-bearing children (Group). */ resolveFont() { return void 0; } toSVG() { return; } }; _c$1.className = "AbstractNode"; _c$1._nextSerialNumber = 0; _c$1._debugEnabled = false; __decorateClass([ DeclaredSceneChangeDetection() ], _c$1.prototype, "visible", 2); __decorateClass([ DeclaredSceneChangeDetection({ equals: objectsEqual, changeCb: _c$1.handleNodeZIndexChange }) ], _c$1.prototype, "zIndex", 2); return _c$1; })() var Node = _Node; // packages/ag-charts-community/src/scene/shape/shape.ts import { DeclaredSceneChangeDetection as DeclaredSceneChangeDetection2, DeclaredSceneObjectChangeDetection, SceneArrayChangeDetection, SceneObjectChangeDetection, TRIPLE_EQ, boxesEqual as boxesEqual2, clamp as clamp4, generateUUID, isGradientFill, isImageFill, isPatternFill, isString, objectsEqual as objectsEqual2 } from "ag-charts-core"; // packages/ag-charts-community/src/scene/gradient/conicGradient.ts import { createSvgElement as createSvgElement3, normalizeAngle360FromDegrees } from "ag-charts-core"; // packages/ag-charts-community/src/scene/gradient/gradient.ts import { createSvgElement as createSvgElement2 } from "ag-charts-core"; // packages/ag-charts-community/src/scale/colorScale.ts import { Color, Logger as Logger3, clamp as clamp3 } from "ag-charts-core"; // packages/ag-charts-community/src/scale/abstractScale.ts var AbstractScale = class { ticks(_ticks, _domain, _visibleRange) { return void 0; } niceDomain(_ticks, domain = this.domain) { return domain; } get bandwidth() { return void 0; } get step() { return void 0; } get inset() { return void 0; } }; // packages/ag-charts-community/src/scale/invalidating.ts var Invalidating = (target, propertyKey) => { const mappedProperty = Symbol(String(propertyKey)); target[mappedProperty] = void 0; Object.defineProperty(target, propertyKey, { get() { return this[mappedProperty]; }, set(newValue) { const oldValue = this[mappedProperty]; if (oldValue !== newValue) { this[mappedProperty] = newValue; this.invalid = true; } }, enumerable: true, configurable: false }); }; // packages/ag-charts-community/src/scale/scaleUtil.ts import { clamp as clamp2, readIntegratedWrappedValue } from "ag-charts-core"; function visibleTickRange(ticks, reversed, visibleRange) { if (visibleRange == null || visibleRange[0] === 0 && visibleRange[1] === 1) return; const vt0 = clamp2(0, Math.floor(visibleRange[0] * ticks.length), ticks.length); const vt1 = clamp2(0, Math.ceil(visibleRange[1] * ticks.length), ticks.length); const t0 = reversed ? ticks.length - vt1 : vt0; const t1 = reversed ? ticks.length - vt0 : vt1; return [t0, t1]; } function filterVisibleTicks(ticks, reversed, visibleRange) { const tickRange = visibleTickRange(ticks, reversed, visibleRange); if (tickRange == null) return { ticks, count: ticks.length, firstTickIndex: 0 }; const [t0, t1] = tickRange; return { ticks: ticks.slice(t0, t1), count: ticks.length, firstTickIndex: t0 }; } function unpackDomainMinMax(domain) { const min = readIntegratedWrappedValue(domain.at(0)); const max = readIntegratedWrappedValue(domain.at(-1)); return min != void 0 && max != void 0 ? [min, max] : [void 0, void 0]; } // packages/ag-charts-community/src/scale/colorScale.ts var convertColorStringToOklcha = (v) => { const color10 = Color.fromString(v); const [l, c, h] = Color.RGBtoOKLCH(color10.r, color10.g, color10.b); return { l, c, h, a: color10.a }; }; var delta = 1e-6; var isAchromatic = (x) => x.c < delta || x.l < delta || x.l > 1 - delta; var interpolateOklch = (x, y, d) => { d = clamp3(0, d, 1); let h; if (isAchromatic(x)) { h = y.h; } else if (isAchromatic(y)) { h = x.h; } else { const xH = x.h; let yH = y.h; const deltaH = y.h - x.h; if (deltaH > 180) { yH -= 360; } else if (deltaH < -180) { yH += 360; } h = xH * (1 - d) + yH * d; } const c = x.c * (1 - d) + y.c * d; const l = x.l * (1 - d) + y.l * d; const a = x.a * (1 - d) + y.a * d; return Color.fromOKLCH(l, c, h, a); }; var ColorScale = /*#__PURE__*/ (() => { var _c$2 = class extends AbstractScale { constructor() { super(...arguments); this.type = "color"; this.defaultTickCount = 0; this.invalid = true; this.domain = [0, 1]; this.range = ["red", "blue"]; this.mode = "continuous"; this.parsedRange = this.range.map(convertColorStringToOklcha); } update() { const { domain, range: range4 } = this; if (domain.length < 2) { Logger3.warnOnce("`colorDomain` should have at least 2 values."); if (domain.length === 0) { domain.push(0, 1); } else if (domain.length === 1) { domain.push(domain[0] + 1); } } for (let i = 1; i < domain.length; i++) { const a = domain[i - 1]; const b = domain[i]; if (a > b) { Logger3.warnOnce("`colorDomain` values should be supplied in ascending order."); domain.sort((a2, b2) => a2 - b2); break; } } const expectedLength = this.mode === "discrete" ? domain.length - 1 : domain.length; if (range4.length < expectedLength) { for (let i = range4.length; i < expectedLength; i++) { range4.push(range4.length > 0 ? range4[0] : "black"); } } this.parsedRange = this.range.map(convertColorStringToOklcha); } normalizeDomains(...domains) { return { domain: domains.map((d) => d.domain).flat(), animatable: true }; } toDomain() { return; } convert(x) { this.refresh(); const { domain, range: range4, parsedRange } = this; const d0 = domain[0]; const d1 = domain.at(-1); const r0 = range4[0]; const r1 = range4.at(-1); if (x <= d0) { return r0; } if (x >= d1) { return r1; } let index; let q; if (domain.length === 2) { const t = (x - d0) / (d1 - d0); const step = 1 / (range4.length - 1); index = range4.length <= 2 ? 0 : Math.min(Math.floor(t * (range4.length - 1)), range4.length - 2); q = (t - index * step) / step; } else { for (index = 0; index < domain.length - 2; index++) { if (x < domain[index + 1]) { break; } } const a = domain[index]; const b = domain[index + 1]; q = (x - a) / (b - a); } if (this.mode === "discrete") { return range4[index]; } const c0 = parsedRange[index]; const c1 = parsedRange[index + 1]; return interpolateOklch(c0, c1, q).toRgbaString(); } invert() { return; } getDomainMinMax() { return unpackDomainMinMax(this.domain); } refresh() { if (!