UNPKG

ag-charts-community

Version:

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

1,828 lines (1,809 loc) 1.45 MB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 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-community/src/api/preset/presetModules.ts import { and as and4, array as array2, boolean as boolean7, color as color4, date as date3, defined as defined3, greaterThan as greaterThan4, lessThan as lessThan4, lineDashOptionsDef as lineDashOptionsDef7, number as number7, or as or4, positiveNumber as positiveNumber5, ratio as ratio4, string as string7, strokeOptionsDef as strokeOptionsDef7, typeUnion as typeUnion2, undocumented as undocumented6, union as union5 } from "ag-charts-core"; // packages/ag-charts-community/src/chart/commonOptionsDefs.ts import { ErrorType, ValidationError, and as and2, array, arrayLength as arrayLength2, arrayOf as arrayOf2, arrayOfDefs as arrayOfDefs2, attachDescription as attachDescription2, boolean as boolean2, callback as callback2, callbackDefs as callbackDefs2, callbackOf as callbackOf2, color as color2, date as date2, defined as defined2, fillOptionsDef as fillOptionsDef2, fontOptionsDef as fontOptionsDef2, greaterThan as greaterThan2, highlightOptionsDef, htmlElement, lessThan as lessThan2, lineDashOptionsDef as lineDashOptionsDef2, number as number2, object as object2, optionsDefs as optionsDefs2, or as or2, positiveNumber as positiveNumber2, ratio as ratio2, required as required2, shapeHighlightOptionsDef, string as string2, strokeOptionsDef as strokeOptionsDef2, typeUnion, undocumented as undocumented2, union as union2 } from "ag-charts-core"; // packages/ag-charts-types/src/chart/navigatorOptions.ts var __MINI_CHART_SERIES_OPTIONS = void 0; var __VERIFY_MINI_CHART_SERIES_OPTIONS = void 0; __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; __VERIFY_THEME_OVERRIDES = __THEME_OVERRIDES; // packages/ag-charts-types/src/presets/gauge/commonOptions.ts var __THEMEABLE_OPTIONS = void 0; var __VERIFY_THEMEABLE_OPTIONS = void 0; __VERIFY_THEMEABLE_OPTIONS = __THEMEABLE_OPTIONS; var __AXIS_LABEL_OPTIONS = void 0; var __VERIFY_AXIS_LABEL_OPTIONS = void 0; __VERIFY_AXIS_LABEL_OPTIONS = __AXIS_LABEL_OPTIONS; // packages/ag-charts-community/src/chart/axesOptionsDefs.ts import { and, arrayLength, arrayOf, arrayOfDefs, attachDescription, boolean, callback, callbackDefs, callbackOf, color, date, defined, fillOptionsDef, fontOptionsDef, greaterThan, isValidNumberFormat, lessThan, lineDashOptionsDef, number, object, optionsDefs, or, positiveNumber, positiveNumberNonZero, ratio, required, string, strokeOptionsDef, themeOperator, undocumented, union } from "ag-charts-core"; var timeIntervalUnit = union("millisecond", "second", "minute", "hour", "day", "month", "year"); var timeIntervalDefs = { unit: required(timeIntervalUnit), step: positiveNumberNonZero, epoch: date, utc: boolean }; timeIntervalDefs.every = callback; var timeInterval = optionsDefs(timeIntervalDefs, "a time interval object"); var numberFormatValidator = attachDescription(isValidNumberFormat, "a valid number format string"); var commonCrossLineLabelOptionsDefs = { enabled: boolean, text: string, padding: number, ...fontOptionsDef }; var commonCrossLineOptionsDefs = attachDescription( { enabled: boolean, type: required(union("line", "range")), range: and( attachDescription((_, { options }) => options.type === "range", "crossLine type to be 'range'"), arrayOf(defined), arrayLength(2, 2) ), value: and( attachDescription((_, { options }) => options.type === "line", "crossLine type to be 'line'"), defined ), label: commonCrossLineLabelOptionsDefs, fill: color, fillOpacity: ratio, ...strokeOptionsDef, ...lineDashOptionsDef }, "cross-line options" ); var cartesianCrossLineOptionsDefs = { ...commonCrossLineOptionsDefs, label: { ...commonCrossLineLabelOptionsDefs, position: union( "top", "left", "right", "bottom", "top-left", "top-right", "bottom-left", "bottom-right", "inside", "inside-left", "inside-right", "inside-top", "inside-bottom", "inside-top-left", "inside-bottom-left", "inside-top-right", "inside-bottom-right" ), rotation: number } }; var commonAxisLabelOptionsDefs = { enabled: boolean, rotation: number, avoidCollisions: boolean, minSpacing: positiveNumber, spacing: positiveNumber, formatter: callback, itemStyler: callbackDefs({ ...fontOptionsDef, spacing: number }), ...fontOptionsDef }; var cartesianAxisLabelOptionsDefs = { autoRotate: boolean, autoRotateAngle: number, wrapping: union("never", "always", "hyphenate", "on-space"), truncate: undocumented(boolean), ...commonAxisLabelOptionsDefs }; var cartesianNumericAxisLabel = { format: numberFormatValidator, ...cartesianAxisLabelOptionsDefs }; var cartesianTimeAxisLabel = { format: or(string, object), ...cartesianAxisLabelOptionsDefs }; var cartesianAxisTick = { enabled: boolean, width: positiveNumber, size: positiveNumber, stroke: color }; var cartesianTimeAxisParentLevel = { enabled: boolean, label: cartesianTimeAxisLabel, tick: cartesianAxisTick }; var commonAxisOptionsDefs = { reverse: boolean, gridLine: { enabled: boolean, width: positiveNumber, style: arrayOfDefs( { stroke: or(color, themeOperator), lineDash: arrayOf(positiveNumber) }, "a grid-line style object array" ) }, interval: { values: arrayOf(defined), minSpacing: positiveNumber }, label: commonAxisLabelOptionsDefs, line: { enabled: boolean, width: positiveNumber, stroke: color }, tick: cartesianAxisTick, context: () => true }; commonAxisOptionsDefs.layoutConstraints = undocumented({ stacked: required(boolean), align: required(union("start", "end")), unit: required(union("percent", "px")), width: required(positiveNumber) }); var cartesianAxisOptionsDefs = { ...commonAxisOptionsDefs, keys: arrayOf(string), crossLines: arrayOfDefs(cartesianCrossLineOptionsDefs, "a cross-line options array"), position: union("top", "right", "bottom", "left"), thickness: positiveNumber, maxThicknessRatio: ratio, title: { enabled: boolean, text: string, spacing: positiveNumber, formatter: callback, ...fontOptionsDef } }; var cartesianAxisBandHighlightOptions = { enabled: boolean, ...fillOptionsDef, ...strokeOptionsDef, ...lineDashOptionsDef }; cartesianAxisOptionsDefs.title._enabledFromTheme = undocumented(boolean); function cartesianAxisCrosshairOptions(canFormat, timeFormat) { const baseCrosshairLabel = { enabled: boolean, xOffset: number, yOffset: number, formatter: callbackOf(string), renderer: callbackOf( or( string, optionsDefs( { text: string, color, backgroundColor: color, opacity: ratio }, "crosshair label renderer result object" ) ) ) }; let crosshairLabel; if (canFormat) { crosshairLabel = { ...baseCrosshairLabel, format: timeFormat ? or( string, optionsDefs({ millisecond: string, second: string, hour: string, day: string, month: string, year: string }) ) : string }; } return { enabled: boolean, snap: boolean, label: crosshairLabel ?? baseCrosshairLabel, ...strokeOptionsDef, ...lineDashOptionsDef }; } function continuousAxisOptions(validDatum, supportTimeInterval) { return { min: and(validDatum, lessThan("max")), max: and(validDatum, greaterThan("min")), nice: boolean, interval: { step: supportTimeInterval ? or(positiveNumberNonZero, timeIntervalUnit, timeInterval) : positiveNumberNonZero, values: arrayOf(validDatum), minSpacing: and(positiveNumber, lessThan("maxSpacing")), maxSpacing: and(positiveNumber, greaterThan("minSpacing")) } }; } // packages/ag-charts-community/src/chart/commonOptionsDefs.ts var shapeValidator = or2( union2("circle", "cross", "diamond", "heart", "plus", "pin", "square", "star", "triangle"), callback2 ); var textWrapValidator = union2("never", "always", "hyphenate", "on-space"); var tooltipPlacementValidator = union2( "top", "right", "bottom", "left", "top-right", "bottom-right", "bottom-left", "top-left", "center" ); var rangeValidator = or2(positiveNumber2, union2("exact", "nearest")); var zoomAnchorPoint = union2("pointer", "start", "middle", "end"); var chartCaptionOptionsDefs = { enabled: boolean2, text: string2, textAlign: union2("left", "center", "right"), wrapping: union2("never", "always", "hyphenate", "on-space"), spacing: positiveNumber2, maxWidth: positiveNumber2, maxHeight: positiveNumber2, ...fontOptionsDef2 }; chartCaptionOptionsDefs.padding = undocumented2(positiveNumber2); var chartOverlayOptionsDefs = { enabled: boolean2, text: string2, renderer: callbackOf2(or2(string2, htmlElement)) }; var contextMenuItemLiterals = [ "defaults", "download", "zoom-to-cursor", "pan-to-cursor", "reset-zoom", "toggle-series-visibility", "toggle-other-series", "separator" ]; var contextMenuItemObjectDef = { type: union2("action", "separator"), showOn: union2("always", "series-area", "series-node", "legend-item"), label: required2(string2), enabled: boolean2, action: callback2, items: (value, context) => contextMenuItemsArray(value, context) }; contextMenuItemObjectDef.iconUrl = undocumented2(string2); var contextMenuItemObjectValidator = optionsDefs2(contextMenuItemObjectDef); var contextMenuItemValidator = attachDescription2( (value, context) => { let result; if (typeof value === "string") { const allowedValues = contextMenuItemLiterals; if (allowedValues.includes(value)) { result = true; } else { result = { valid: false, invalid: [], cleared: null }; result.invalid.push( new ValidationError( ErrorType.Invalid, `a context menu item string alias: ["${contextMenuItemLiterals.join('", "')}"]`, value, context.path ) ); } } else { result = contextMenuItemObjectValidator(value, context); } return result; }, `a context menu item object or string alias: [${contextMenuItemLiterals.join(", ")}]` ); var contextMenuItemsArray = arrayOf2(contextMenuItemValidator, "a menu items array", false); var toolbarButtonOptionsDefs = { label: string2, ariaLabel: string2, tooltip: string2, icon: union2( "align-center", "align-left", "align-right", "arrow-drawing", "arrow-down-drawing", "arrow-up-drawing", "callout-annotation", "candlestick-series", "close", "comment-annotation", "date-range-drawing", "date-price-range-drawing", "delete", "disjoint-channel-drawing", "drag-handle", "fill-color", "line-style-solid", "line-style-dashed", "line-style-dotted", "high-low-series", "hlc-series", "hollow-candlestick-series", "horizontal-line-drawing", "line-color", "line-series", "line-with-markers-series", "locked", "measurer-drawing", "note-annotation", "ohlc-series", "pan-end", "pan-left", "pan-right", "pan-start", "parallel-channel-drawing", "position-bottom", "position-center", "position-top", "price-label-annotation", "price-range-drawing", "reset", "settings", "step-line-series", "text-annotation", "trend-line-drawing", "fibonacci-retracement-drawing", "fibonacci-retracement-trend-based-drawing", "unlocked", "vertical-line-drawing", "zoom-in", "zoom-out" ) }; var formatter = or2(string2, callbackOf2(string2)); var formatObjectValidator = optionsDefs2({ x: formatter, y: formatter, angle: formatter, radius: formatter, size: formatter, color: formatter, label: formatter, secondaryLabel: formatter, sectorLabel: formatter, calloutLabel: formatter, legendItem: formatter }); var commonChartOptionsDefs = { width: positiveNumber2, height: positiveNumber2, minWidth: positiveNumber2, minHeight: positiveNumber2, suppressFieldDotNotation: boolean2, title: chartCaptionOptionsDefs, subtitle: chartCaptionOptionsDefs, footnote: chartCaptionOptionsDefs, padding: { top: positiveNumber2, right: positiveNumber2, bottom: positiveNumber2, left: positiveNumber2 }, seriesArea: { clip: boolean2, padding: { top: positiveNumber2, right: positiveNumber2, bottom: positiveNumber2, left: positiveNumber2 } }, legend: { enabled: boolean2, position: union2("top", "right", "bottom", "left"), orientation: union2("horizontal", "vertical"), maxWidth: positiveNumber2, maxHeight: positiveNumber2, spacing: positiveNumber2, preventHidingAll: boolean2, reverseOrder: boolean2, toggleSeries: boolean2, item: { marker: { size: positiveNumber2, shape: shapeValidator, padding: positiveNumber2, strokeWidth: positiveNumber2 }, line: { length: positiveNumber2, strokeWidth: positiveNumber2 }, label: { maxLength: positiveNumber2, formatter: callback2, ...fontOptionsDef2 }, maxWidth: positiveNumber2, paddingX: positiveNumber2, paddingY: positiveNumber2, showSeriesStroke: boolean2 }, pagination: { marker: { size: positiveNumber2, shape: shapeValidator, padding: positiveNumber2 }, activeStyle: { ...fillOptionsDef2, ...strokeOptionsDef2 }, inactiveStyle: { ...fillOptionsDef2, ...strokeOptionsDef2 }, highlightStyle: { ...fillOptionsDef2, ...strokeOptionsDef2 }, label: fontOptionsDef2 }, listeners: { legendItemClick: callback2, legendItemDoubleClick: callback2 } }, gradientLegend: { enabled: boolean2, position: union2("top", "right", "bottom", "left"), spacing: positiveNumber2, reverseOrder: boolean2, gradient: { preferredLength: positiveNumber2, thickness: positiveNumber2 }, scale: { label: { ...fontOptionsDef2, minSpacing: positiveNumber2, format: numberFormatValidator, formatter: callback2 }, padding: positiveNumber2, interval: { step: number2, values: array, minSpacing: and2(positiveNumber2, lessThan2("maxSpacing")), maxSpacing: and2(positiveNumber2, greaterThan2("minSpacing")) } } }, listeners: { seriesNodeClick: callback2, seriesNodeDoubleClick: callback2, seriesVisibilityChange: callback2, click: callback2, doubleClick: callback2, annotations: callback2, zoom: callback2 }, loadGoogleFonts: boolean2, highlight: { range: union2("tooltip", "node") }, overlays: { loading: chartOverlayOptionsDefs, noData: chartOverlayOptionsDefs, noVisibleSeries: chartOverlayOptionsDefs, unsupportedBrowser: chartOverlayOptionsDefs }, tooltip: { enabled: boolean2, showArrow: boolean2, pagination: boolean2, delay: positiveNumber2, range: rangeValidator, wrapping: textWrapValidator, mode: union2("single", "shared", "compact"), position: { anchorTo: union2("pointer", "node", "chart"), placement: or2(tooltipPlacementValidator, arrayOf2(tooltipPlacementValidator)), xOffset: number2, yOffset: number2 } }, animation: { enabled: boolean2, duration: positiveNumber2 }, contextMenu: { enabled: boolean2, items: contextMenuItemsArray }, context: () => true, dataSource: { getData: callback2 }, keyboard: { enabled: boolean2, tabIndex: number2 }, touch: { dragAction: union2("none", "drag", "hover") }, ranges: { enabled: boolean2, buttons: arrayOfDefs2( { ...toolbarButtonOptionsDefs, value: or2(number2, and2(arrayOf2(or2(number2, date2)), arrayLength2(2, 2)), callback2) }, "range button options array" ) }, // modules locale: { localeText: object2, getLocaleText: callbackOf2(string2) }, background: { visible: boolean2, fill: color2, // enterprise image: { url: required2(string2), top: number2, right: number2, bottom: number2, left: number2, width: positiveNumber2, height: positiveNumber2, opacity: ratio2 } }, styleNonce: string2, sync: { enabled: boolean2, groupId: string2, axes: union2("x", "y", "xy"), nodeInteraction: boolean2, zoom: boolean2 }, zoom: { enabled: boolean2, enableAxisDragging: boolean2, enableDoubleClickToReset: boolean2, enablePanning: boolean2, enableScrolling: boolean2, enableSelecting: boolean2, enableTwoFingerZoom: boolean2, keepAspectRatio: boolean2, anchorPointX: zoomAnchorPoint, anchorPointY: zoomAnchorPoint, axes: union2("x", "y", "xy"), deceleration: or2(union2("off", "short", "long"), ratio2), minVisibleItems: positiveNumber2, panKey: union2("alt", "ctrl", "meta", "shift"), scrollingStep: ratio2, autoScaling: { enabled: boolean2, padding: ratio2 }, buttons: { enabled: boolean2, buttons: arrayOfDefs2( { ...toolbarButtonOptionsDefs, value: union2("reset", "zoom-in", "zoom-out", "pan-left", "pan-right", "pan-start", "pan-end"), section: string2 }, "zoom button options array" ), visible: union2("always", "zoomed", "hover") } }, formatter: or2(callbackOf2(string2), formatObjectValidator) }; commonChartOptionsDefs.dataSource.requestThrottle = undocumented2(positiveNumber2); commonChartOptionsDefs.dataSource.updateThrottle = undocumented2(positiveNumber2); commonChartOptionsDefs.dataSource.updateDuringInteraction = undocumented2(boolean2); commonChartOptionsDefs.zoom.enableIndependentAxes = undocumented2(boolean2); commonChartOptionsDefs.statusBar = undocumented2(defined2); commonChartOptionsDefs.foreground = undocumented2({ visible: boolean2, text: string2, image: { url: string2, top: number2, right: number2, bottom: number2, left: number2, width: positiveNumber2, height: positiveNumber2, opacity: ratio2 }, ...fillOptionsDef2 }); commonChartOptionsDefs.overrideDevicePixelRatio = undocumented2(number2); commonChartOptionsDefs.sync.domainMode = undocumented2(union2("direction", "position", "key")); var commonSeriesThemeableOptionsDefs = { cursor: string2, context: () => true, showInLegend: boolean2, nodeClickRange: rangeValidator, listeners: { seriesNodeClick: callback2, seriesNodeDoubleClick: callback2 }, // TODO Remove in next major version highlightStyle: { item: { ...fillOptionsDef2, ...strokeOptionsDef2 }, series: { enabled: boolean2, dimOpacity: ratio2, strokeWidth: positiveNumber2 } }, highlight: highlightOptionsDef(shapeHighlightOptionsDef) }; var commonSeriesOptionsDefs = { ...commonSeriesThemeableOptionsDefs, id: string2, visible: boolean2, context: () => true, data: array }; commonSeriesOptionsDefs.seriesGrouping = undocumented2(defined2); var markerOptionsDefs = { enabled: boolean2, shape: shapeValidator, size: positiveNumber2, itemStyler: callbackDefs2({ ...fillOptionsDef2, ...strokeOptionsDef2, ...lineDashOptionsDef2, shape: shapeValidator, size: positiveNumber2 }), ...fillOptionsDef2, ...strokeOptionsDef2, ...lineDashOptionsDef2 }; var seriesLabelOptionsDefs = { enabled: boolean2, formatter: callback2, format: numberFormatValidator, ...fontOptionsDef2 }; var autoSizedLabelOptionsDefs = { ...seriesLabelOptionsDefs, lineHeight: positiveNumber2, minimumFontSize: positiveNumber2, wrapping: textWrapValidator, overflowStrategy: union2("ellipsis", "hide") }; var errorBarThemeableOptionsDefs = { visible: boolean2, cap: { visible: boolean2, length: positiveNumber2, lengthRatio: ratio2, ...strokeOptionsDef2, ...lineDashOptionsDef2 }, ...strokeOptionsDef2, ...lineDashOptionsDef2 }; var errorBarOptionsDefs = { ...errorBarThemeableOptionsDefs, xLowerKey: string2, xUpperKey: string2, yLowerKey: string2, yUpperKey: string2, xLowerName: string2, xUpperName: string2, yLowerName: string2, yUpperName: string2, itemStyler: callbackDefs2({ visible: boolean2, ...strokeOptionsDef2, ...lineDashOptionsDef2, cap: { visible: boolean2, length: positiveNumber2, lengthRatio: ratio2, ...strokeOptionsDef2, ...lineDashOptionsDef2 } }) }; var tooltipOptionsDefs = { enabled: boolean2, showArrow: boolean2, range: rangeValidator, renderer: callbackOf2( or2( string2, optionsDefs2( { heading: string2, title: string2, data: arrayOfDefs2({ label: required2(string2), value: required2(string2) }) }, "tooltip renderer result object" ) ) ), position: { anchorTo: union2("node", "pointer", "chart"), placement: or2(tooltipPlacementValidator, arrayOf2(tooltipPlacementValidator)), xOffset: number2, yOffset: number2 }, interaction: { enabled: boolean2 } }; var shadowOptionsDefs = { enabled: boolean2, xOffset: number2, yOffset: number2, blur: positiveNumber2, color: color2 }; var interpolationOptionsDefs = typeUnion( { linear: {}, smooth: { tension: ratio2 }, step: { position: union2("start", "middle", "end") } }, "interpolation line options" ); // packages/ag-charts-community/src/chart/series/cartesian/areaSeriesOptionsDef.ts import { boolean as boolean3, constant, fillOptionsDef as fillOptionsDef3, lineDashOptionsDef as lineDashOptionsDef3, multiSeriesHighlightOptionsDef, number as number3, required as required3, shapeHighlightOptionsDef as shapeHighlightOptionsDef2, string as string3, strokeOptionsDef as strokeOptionsDef3 } from "ag-charts-core"; var highlight = multiSeriesHighlightOptionsDef(shapeHighlightOptionsDef2, shapeHighlightOptionsDef2); var areaSeriesThemeableOptionsDef = { showInMiniChart: boolean3, connectMissingData: boolean3, interpolation: interpolationOptionsDefs, label: seriesLabelOptionsDefs, marker: markerOptionsDefs, tooltip: tooltipOptionsDefs, shadow: shadowOptionsDefs, ...commonSeriesThemeableOptionsDefs, ...fillOptionsDef3, ...strokeOptionsDef3, ...lineDashOptionsDef3, highlight }; var areaSeriesOptionsDef = { ...areaSeriesThemeableOptionsDef, ...commonSeriesOptionsDefs, highlight, type: required3(constant("area")), xKey: required3(string3), yKey: required3(string3), xName: string3, yName: string3, stacked: boolean3, stackGroup: string3, normalizedTo: number3 }; // packages/ag-charts-community/src/chart/series/cartesian/barSeriesOptionsDef.ts import { barHighlightOptionsDef, boolean as boolean4, callbackDefs as callbackDefs3, constant as constant2, fillOptionsDef as fillOptionsDef4, lineDashOptionsDef as lineDashOptionsDef4, multiSeriesHighlightOptionsDef as multiSeriesHighlightOptionsDef2, number as number4, positiveNumber as positiveNumber3, required as required4, string as string4, strokeOptionsDef as strokeOptionsDef4, undocumented as undocumented3, union as union3 } from "ag-charts-core"; var highlight2 = multiSeriesHighlightOptionsDef2(barHighlightOptionsDef, barHighlightOptionsDef); var barSeriesThemeableOptionsDef = { direction: union3("horizontal", "vertical"), showInMiniChart: boolean4, cornerRadius: positiveNumber3, itemStyler: callbackDefs3({ ...fillOptionsDef4, ...strokeOptionsDef4, ...lineDashOptionsDef4, cornerRadius: positiveNumber3 }), crisp: boolean4, label: { ...seriesLabelOptionsDefs, placement: union3("inside-center", "inside-start", "inside-end", "outside-start", "outside-end"), padding: positiveNumber3 }, errorBar: errorBarThemeableOptionsDefs, shadow: shadowOptionsDefs, tooltip: tooltipOptionsDefs, ...commonSeriesThemeableOptionsDefs, highlight: highlight2, ...fillOptionsDef4, ...strokeOptionsDef4, ...lineDashOptionsDef4 }; barSeriesThemeableOptionsDef.sparklineMode = undocumented3(boolean4); var barSeriesOptionsDef = { ...barSeriesThemeableOptionsDef, ...commonSeriesOptionsDefs, highlight: highlight2, type: required4(constant2("bar")), xKey: required4(string4), yKey: required4(string4), xName: string4, yName: string4, direction: union3("horizontal", "vertical"), grouped: boolean4, stacked: boolean4, stackGroup: string4, normalizedTo: number4, legendItemName: string4, errorBar: errorBarOptionsDefs }; barSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented3(boolean4); barSeriesOptionsDef.fastDataProcessing = undocumented3(boolean4); barSeriesOptionsDef.focusPriority = undocumented3(number4); // packages/ag-charts-community/src/chart/series/cartesian/lineSeriesOptionsDef.ts import { boolean as boolean5, constant as constant3, lineDashOptionsDef as lineDashOptionsDef5, lineHighlightOptionsDef, multiSeriesHighlightOptionsDef as multiSeriesHighlightOptionsDef3, number as number5, required as required5, shapeHighlightOptionsDef as shapeHighlightOptionsDef3, string as string5, strokeOptionsDef as strokeOptionsDef5, undocumented as undocumented4 } from "ag-charts-core"; var highlight3 = multiSeriesHighlightOptionsDef3(shapeHighlightOptionsDef3, lineHighlightOptionsDef); var lineSeriesThemeableOptionsDef = { title: string5, showInMiniChart: boolean5, connectMissingData: boolean5, interpolation: interpolationOptionsDefs, label: seriesLabelOptionsDefs, marker: markerOptionsDefs, tooltip: tooltipOptionsDefs, errorBar: errorBarThemeableOptionsDefs, ...commonSeriesThemeableOptionsDefs, ...strokeOptionsDef5, ...lineDashOptionsDef5, highlight: highlight3 }; lineSeriesThemeableOptionsDef.sparklineMode = undocumented4(boolean5); var lineSeriesOptionsDef = { ...lineSeriesThemeableOptionsDef, ...commonSeriesOptionsDefs, highlight: highlight3, type: required5(constant3("line")), xKey: required5(string5), yKey: required5(string5), xName: string5, yName: string5, stacked: boolean5, stackGroup: string5, normalizedTo: number5, legendItemName: string5, errorBar: errorBarOptionsDefs }; lineSeriesOptionsDef.pickOutsideVisibleMinorAxis = undocumented4(boolean5); lineSeriesOptionsDef.focusPriority = undocumented4(number5); // packages/ag-charts-community/src/util/object.ts import * as core from "ag-charts-core"; // packages/ag-charts-community/src/util/decorator.ts var BREAK_TRANSFORM_CHAIN = Symbol("BREAK"); var CONFIG_KEY = "__decorator_config"; var ACCESSORS_KEY = "__decorator_accessors"; function addFakeTransformToInstanceProperty(target, propertyKeyOrSymbol) { initialiseConfig(target, propertyKeyOrSymbol).optional = true; } function initialiseConfig(target, propertyKeyOrSymbol) { if (Object.getOwnPropertyDescriptor(target, CONFIG_KEY) == null) { Object.defineProperty(target, CONFIG_KEY, { value: {} }); } if (Object.getOwnPropertyDescriptor(target, ACCESSORS_KEY) == null) { const parentAccessors = Object.getPrototypeOf(target)?.[ACCESSORS_KEY]; const accessors = parentAccessors?.slice() ?? []; Object.defineProperty(target, ACCESSORS_KEY, { value: accessors }); } const config = target[CONFIG_KEY]; const propertyKey = propertyKeyOrSymbol.toString(); if (config[propertyKey] != null) { return config[propertyKey]; } config[propertyKey] = { setters: [], getters: [], observers: [] }; const descriptor = Object.getOwnPropertyDescriptor(target, propertyKeyOrSymbol); let prevGet = descriptor?.get; let prevSet = descriptor?.set; if (prevGet == null || prevSet == null) { const accessors = target[ACCESSORS_KEY]; let index = accessors.indexOf(propertyKeyOrSymbol); if (index === -1) { index = accessors.push(propertyKeyOrSymbol) - 1; } prevGet ?? (prevGet = function() { let accessorValues = this.__accessors; if (accessorValues == null) { accessorValues = accessors.slice().fill(void 0); Object.defineProperty(this, "__accessors", { value: accessorValues }); } return accessorValues[index]; }); prevSet ?? (prevSet = function(value) { let accessorValues = this.__accessors; if (accessorValues == null) { accessorValues = accessors.slice().fill(void 0); Object.defineProperty(this, "__accessors", { value: accessorValues }); } accessorValues[index] = value; }); } const getter = function() { let value = prevGet.call(this); for (const transformFn of config[propertyKey].getters) { value = transformFn(this, propertyKeyOrSymbol, value); if (value === BREAK_TRANSFORM_CHAIN) { return; } } return value; }; const setter = function(value) { const { setters, observers } = config[propertyKey]; let oldValue; if (setters.some((f) => f.length > 2)) { oldValue = prevGet.call(this); } for (const transformFn of setters) { value = transformFn(this, propertyKeyOrSymbol, value, oldValue); if (value === BREAK_TRANSFORM_CHAIN) { return; } } prevSet.call(this, value); for (const observerFn of observers) { observerFn(this, value, oldValue); } }; Object.defineProperty(target, propertyKeyOrSymbol, { set: setter, get: getter, enumerable: true, configurable: false }); return config[propertyKey]; } function addTransformToInstanceProperty(setTransform, getTransform, configMetadata) { return (target, propertyKeyOrSymbol) => { const config = initialiseConfig(target, propertyKeyOrSymbol); config.setters.push(setTransform); if (getTransform) { config.getters.unshift(getTransform); } if (configMetadata) { Object.assign(config, configMetadata); } }; } function addObserverToInstanceProperty(setObserver) { return (target, propertyKeyOrSymbol) => { initialiseConfig(target, propertyKeyOrSymbol).observers.push(setObserver); }; } function isDecoratedObject(target) { return typeof target !== "undefined" && CONFIG_KEY in target; } function listDecoratedProperties(target) { const targets = /* @__PURE__ */ new Set(); while (isDecoratedObject(target)) { targets.add(target?.[CONFIG_KEY]); target = Object.getPrototypeOf(target); } return Array.from(targets).flatMap((configMap) => Object.keys(configMap)); } function extractDecoratedProperties(target) { return listDecoratedProperties(target).reduce((result, key) => { result[key] = target[key] ?? null; return result; }, {}); } // packages/ag-charts-community/src/util/object.ts var { entries, isArray, isObject, isPlainObject } = core; function objectsEqual(a, b) { if (Array.isArray(a)) { if (!Array.isArray(b)) return false; if (a.length !== b.length) return false; return a.every((av, i) => objectsEqual(av, b[i])); } else if (isPlainObject(a)) { if (!isPlainObject(b)) return false; return objectsEqualWith(a, b, objectsEqual); } return a === b; } function objectsEqualWith(a, b, cmp2) { if (Object.is(a, b)) return true; for (const key of Object.keys(b)) { if (!(key in a)) return false; } for (const key of Object.keys(a)) { if (!(key in b)) return false; if (!cmp2(a[key], b[key])) return false; } return true; } function mergeDefaults(...sources) { const target = {}; for (const source of sources) { if (!isObject(source)) continue; const keys = isDecoratedObject(source) ? listDecoratedProperties(source) : Object.keys(source); for (const key of keys) { if (isPlainObject(target[key]) && isPlainObject(source[key])) { target[key] = mergeDefaults(target[key], source[key]); } else { target[key] ?? (target[key] = source[key]); } } } return target; } function merge(...sources) { const target = {}; for (const source of sources) { if (!isObject(source)) continue; const keys = isDecoratedObject(source) ? listDecoratedProperties(source) : Object.keys(source); for (const key of keys) { if (isPlainObject(target[key]) && isPlainObject(source[key])) { target[key] = merge(target[key], source[key]); } else if (!(key in target)) { target[key] ?? (target[key] = source[key]); } } } return target; } function mergeArrayDefaults(dataArray, ...itemDefaults) { if (itemDefaults && isArray(dataArray)) { return dataArray.map((item) => mergeDefaults(item, ...itemDefaults)); } return dataArray; } function without(object3, keys) { const clone2 = { ...object3 }; for (const key of keys) { delete clone2[key]; } return clone2; } function getPath(object3, path) { const pathArray = isArray(path) ? path : path.split("."); return pathArray.reduce((value, pathKey) => value[pathKey], object3); } var SKIP_JS_BUILTINS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]); function setPath(object3, path, newValue) { const pathArray = isArray(path) ? path.slice() : path.split("."); const lastKey = pathArray.pop(); if (pathArray.some((p) => SKIP_JS_BUILTINS.has(p))) return; const lastObject = pathArray.reduce((value, pathKey) => value[pathKey], object3); lastObject[lastKey] = newValue; return lastObject[lastKey]; } function partialAssign(keysToCopy, target, source) { if (source === void 0) { return target; } for (const key of keysToCopy) { const value = source[key]; if (value !== void 0) { target[key] = value; } } return target; } function deepFreeze(obj) { if (obj == null || typeof obj !== "object" || !isPlainObject(obj)) { return obj; } Object.freeze(obj); Object.getOwnPropertyNames(obj).forEach((prop) => { const value = obj[prop]; if (value !== null && (typeof value === "object" || typeof value === "function") && !Object.isFrozen(value)) { deepFreeze(value); } }); return obj; } // packages/ag-charts-community/src/api/preset/presetUtils.ts var IGNORED_PROP = Symbol("IGNORED_PROP"); function pickProps(opts, values) { const out = {}; for (const key of Object.keys(values)) { const value = values[key]; if (value !== IGNORED_PROP && Object.hasOwn(opts, key)) { out[key] = value; } } return out; } // packages/ag-charts-community/src/api/preset/gauge.ts function tooltipOptions(opts) { const { enabled, mode, showArrow, range: range3, position, pagination, delay, wrapping, interaction, renderer, ...rest } = opts; const seriesTooltipOptions = pickProps(opts, { enabled, showArrow, range: range3, position, interaction, renderer, ...rest }); const chartTooltipOptions = pickProps(opts, { enabled: IGNORED_PROP, showArrow: IGNORED_PROP, range: IGNORED_PROP, position: IGNORED_PROP, mode, pagination, delay, wrapping, ...rest }); return { chartTooltipOptions, seriesTooltipOptions }; } function radialGaugeOptions(opts) { const { animation, background, container, contextMenu, context, footnote, height: height2, listeners, locale, minHeight, minWidth, overrideDevicePixelRatio, padding, subtitle, theme, title, width: width2, type, cursor, nodeClickRange, tooltip = {}, value, scale: scale2 = {}, startAngle, endAngle, // eslint-disable-next-line sonarjs/deprecation highlightStyle, highlight: highlight5, segmentation, bar, needle, targets, outerRadius, innerRadius, outerRadiusRatio, innerRadiusRatio, cornerRadius, cornerMode, label, secondaryLabel, spacing, ...rest } = opts; const { chartTooltipOptions, seriesTooltipOptions } = tooltipOptions(tooltip); const chartOpts = pickProps(opts, { animation, background, container, contextMenu, context, footnote, height: height2, listeners, locale, minHeight, minWidth, overrideDevicePixelRatio, padding, subtitle, theme, title, tooltip: chartTooltipOptions, width: width2 }); const seriesOpts = pickProps(opts, { needle: needle != null ? { enabled: true, ...needle } : IGNORED_PROP, startAngle, endAngle, scale: scale2, type, cursor, context, nodeClickRange, tooltip: seriesTooltipOptions, value, highlightStyle, highlight: highlight5, segmentation, bar, targets, outerRadius, innerRadius, outerRadiusRatio, innerRadiusRatio, cornerRadius, cornerMode, label, secondaryLabel, spacing, ...rest }); return { ...chartOpts, series: [seriesOpts] }; } function linearGaugeOptions(opts) { const { animation, background, container, contextMenu, context, footnote, height: height2, listeners, locale, minHeight, minWidth, overrideDevicePixelRatio, padding, subtitle, theme, title, width: width2, type, cursor, nodeClickRange, tooltip = {}, value, scale: scale2 = {}, direction = "vertical", thickness, // eslint-disable-next-line sonarjs/deprecation highlightStyle, highlight: highlight5, segmentation, bar, targets, cornerRadius, cornerMode, label, ...rest } = opts; const { chartTooltipOptions, seriesTooltipOptions } = tooltipOptions(tooltip); const chartOpts = pickProps(opts, { animation, background, container, contextMenu, context, footnote, height: height2, listeners, locale, minHeight, minWidth, overrideDevicePixelRatio, padding, subtitle, theme, title, tooltip: chartTooltipOptions, width: width2 }); const seriesOpts = pickProps(opts, { scale: scale2, type, cursor, context, nodeClickRange, tooltip: seriesTooltipOptions, value, direction, thickness, highlightStyle, highlight: highlight5, segmentation, bar, targets, cornerRadius, cornerMode, label, ...rest }); return { ...chartOpts, series: [seriesOpts] }; } function applyThemeDefaults(opts, presetTheme) { if (presetTheme == null) return opts; const { targets: targetsTheme, ...gaugeTheme } = presetTheme; opts = mergeDefaults(opts, gaugeTheme); if (opts.targets != null && targetsTheme != null) { opts.targets = mergeArrayDefaults(opts.targets, targetsTheme); } return opts; } function gauge(opts, presetTheme) { switch (opts.type) { case "radial-gauge": const radialGaugeOpts = applyThemeDefaults(opts, presetTheme); return radialGaugeOptions(radialGaugeOpts); case "linear-gauge": const linearGaugeOpts = applyThemeDefaults(opts, presetTheme); return linearGaugeOptions(linearGaugeOpts); default: return {}; } } // packages/ag-charts-community/src/api/preset/gaugeOptionsDefs.ts import { and as and3, arrayLength as arrayLength3, arrayOf as arrayOf3, arrayOfDefs as arrayOfDefs3, boolean as boolean6, callback as callback3, color as color3, colorStopsOrderValidator, constant as constant4, fillOptionsDef as fillOptionsDef5, fontOptionsDef as fontOptionsDef3, greaterThan as greaterThan3, lessThan as lessThan3, lineDashOptionsDef as lineDashOptionsDef6, number as number6, optionsDefs as optionsDefs3, or as or3, positiveNumber as positiveNumber4, ratio as ratio3, required as required6, string as string6, strokeOptionsDef as strokeOptionsDef6, undocumented as undocumented5, union as union4 } from "ag-charts-core"; var fillsOptionsDef = { fills: and3( arrayLength3(2), arrayOf3(optionsDefs3({ color: color3, stop: number6 }, "")), colorStopsOrderValidator ), fillMode: union4("continuous", "discrete") }; var linearGaugeTargetOptionsDef = { value: required6(number6), text: string6, shape: or3( union4("circle", "cross", "diamond", "heart", "plus", "pin", "square", "star", "triangle", "line"), callback3 ), placement: union4("before", "after", "middle"), spacing: positiveNumber4, size: positiveNumber4, rotation: number6, ...fillOptionsDef5, ...strokeOptionsDef6, ...lineDashOptionsDef6 }; var radialGaugeTargetOptionsDef = { value: required6(number6), text: string6, shape: or3( union4("circle", "cross", "diamond", "heart", "plus", "pin", "square", "star", "triangle", "line"), callback3 ), placement: union4("inside", "outside", "middle"), spacing: positiveNumber4, size: positiveNumber4, rotation: number6, label: { ...seriesLabelOptionsDefs, spacing: positiveNumber4 }, ...fillOptionsDef5, ...strokeOptionsDef6, ...lineDashOptionsDef6 }; var linearGaugeSeriesThemeableOptionsDef = { direction: union4("horizontal", "vertical"), cornerMode: union4("container", "item"), cornerRadius: positiveNumber4, thickness: positiveNumber4, segmentation: { enabled: boolean6, spacing: positiveNumber4, interval: { values: arrayOf3(number6), step: number6, count: number6 } }, bar: { enabled: boolean6, thickness: positiveNumber4, thicknessRatio: ratio3, ...fillsOptionsDef, ...fillOptionsDef5, ...strokeOptionsDef6, ...lineDashOptionsDef6 }, label: { ...autoSizedLabelOptionsDefs, text: string6, spacing: positiveNumber4, avoidCollisions: boolean6, placement: union4( "inside-start", "outside-start", "inside-end", "outside-end", "inside-center", "bar-inside", "bar-inside-end", "bar-outside-end", "bar-end" ) }, tooltip: tooltipOptionsDefs, ...without(commonSeriesThemeableOptionsDefs, ["listeners"]) }; var linearGaugeSeriesOptionsDef = { ...linearGaugeSeriesThemeableOptionsDef, ...without(commonSeriesOptionsDefs, ["listeners"]), type: required6(constant4("linear-gauge")), value: required6(number6), scale: { min: and3(number6, lessThan3("max")), max: and3(number6, greaterThan3("min")), label: { enabled: boolean6, formatter: callback3, rotation: number6, spacing: positiveNumber4, minSpacing: positiveNumber4, placement: union4("before", "after"), avoidCollisions: boolean6, format: numberFormatValidator, ...fontOptionsDef3 }, interval: { values: arrayOf3(number6), step: number6 }, ...fillsOptionsDef, ...fillOptionsDef5, ...strokeOptionsDef6, ...lineDashOptionsDef6 }, targets: arrayOfDefs3(linearGaugeTargetOptionsDef, "target options array") }; linearGaugeSeriesOptionsDef.margin = undocumented5(number6); linearGaugeSeriesOptionsDef.defaultColorRange = undocumented5(arrayOf3(color3)); linearGaugeSeriesOptionsDef.defaultTarget = undocumented5({ ...linearGaugeTargetOptionsDef, value: number6, label: { ...seriesLabelOptionsDefs, spacing: number6 } }); linearGaugeSeriesOptionsDef.defaultScale = undocumented5(linearGaugeSeriesOptionsDef.scale); linearGaugeSeriesOptionsDef.scale.defaultFill = undocumented5(color3); var radialGaugeSeriesThemeableOptionsDef = { outerRadius: positiveNumber4, innerRadius: positiveNumber4, outerRadiusRatio: ratio3, innerRadiusRatio: ratio3, startAngle: number6, endAngle: number6, spacing: positiveNumber4, cornerMode: union4("container", "item"), cornerRadius: positiveNumber4, scale: { min: and3(number6, lessThan3("max")), max: and3(number6, greaterThan3("min")), label: { enabled: boolean6, formatter: callback3, rotation: number6, spacing: positiveNumber4, minSpacing: positiveNumber4, avoidCollisions: boolean6, format: numberFormatValidator, ...fontOptionsDef3 }, interval: { values: arrayOf3(number6), step: number6 }, ...fillsOptionsDef, ...fillOptionsDef5, ...strokeOptionsDef6, ...lineDashOptionsDef6 }, segmentation: { enabled: boolean6, spacing: positiveNumber4, interval: { values: arrayOf3(number6), step: number6, count: number6 } }, bar: { enabled: boolean6, ...fillsOptionsDef, ...fillOptionsDef5, ...strokeOptionsDef6, ...lineDashOptionsDef6 }, needle: { enabled: boolean6, spacing: positiveNumber4, radiusRatio: ratio3, ...fillOptionsDef5, ...strokeOptionsDef6, ...lineDashOptionsDef6 }, label: { text: string6, spacing: positiveNumber4, ...autoSizedLabelOptionsDefs }, secondaryLabel: { text: string6, ...autoSizedLabelOptionsDefs }, tooltip: tooltipOptionsDefs, ...commonSeriesThemeableOptionsDefs }; var radialGaugeSeriesOptionsDef = { ...radialGaugeSeriesThemeableOptionsDef, ...commonSeriesOptionsDefs, type: required6(constant4("radial-gauge")), value: required6(number6), targets: arrayOfDefs3(radialGaugeTargetOptionsDef, "target options array") }; radialGaugeSeriesOptionsDef.defaultColorRange = undocumented5(arrayOf3(color3)); radialGaugeSeriesOptionsDef.defaultTarget = undocumented5({ ...radialGaugeTargetOptionsDef, value: number6, label: { ...seriesLabelOptionsDefs, spacing: number6 } }); radialGaugeSeriesOptionsDef.scale.defaultFill = undocumented5(color3); // packages/ag-charts-community/src/api/preset/priceVolumePreset.ts import { Logger } from "ag-charts-core"; // packages/ag-charts-community/src/chart/themes/symbols.ts var IS_DARK_THEME = Symbol("is-dark-theme"); var DEFAULT_SEPARATION_LINES_COLOUR = Symbol("default-separation-lines-colour"); var DEFAULT_SHADOW_COLOUR = Symbol("default-shadow-colour"); var DEFAULT_CAPTION_LAYOUT_STYLE = Symbol("default-caption-layout-style"); var DEFAULT_CAPTION_ALIGNMENT = Symbol("default-caption-alignment"); var PALETTE_UP_STROKE = Symbol("palette-up-stroke"); var PALETTE_DOWN_STROKE = Symbol("palette-down-stroke"); var PALETTE_UP_FILL = Symbol("palette-up-fill"); var PALETTE_DOWN_FILL = Symbol("palette-down-fill"); var PALETTE_NEUTRAL_STROKE = Symbol("palette-neutral-stroke"); var PALETTE_NEUTRAL_FILL = Symbol("palette-neutral-fill"); var PALETTE_ALT_UP_STROKE = Symbol("palette-alt-up-stroke"); var PALETTE_ALT_DOWN_STROKE = Symbol("palette-alt-down-stroke"); var PALETTE_ALT_UP_FILL = Symbol("palette-alt-up-fill"); var PALETTE_ALT_DOWN_FILL = Symbol("palette-alt-down-fill"); var PALETTE_ALT_NEUTRAL_FILL = Symbol("palette-gray-fill"); var PALETTE_ALT_NEUTRAL_STROKE = Symbol("palette-gray-stroke"); var DEFAULT_POLAR_SERIES_STROKE = Symbol("default-polar-series-stroke"); var DEFAULT_SPARKLINE_CROSSHAIR_STROKE = Symbol("default-sparkline-crosshair-stroke"); var DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR = Symbol( "default-financial-charts-annotation-stroke" ); var DEFAULT_FIBONACCI_STROKES = Symbol("default-hierarchy-strokes"); var DEFAULT_TEXT_ANNOTATION_COLOR = Symbol("default-text-annotation-color"); var DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL = Symbol( "default-financial-charts-annotation-background-fill" ); var DEFAULT_ANNOTATION_HANDLE_FILL = Symbol("default-annotation-handle-fill"); var DEFAULT_ANNOTATION_STATISTICS_FILL = Symbol("default-annotation-statistics-fill"); var DEFAULT_ANNOTATION_STATISTICS_STROKE = Symbol("default-annotation-statistics-stroke"); var DEFAULT_ANNOTATION_STATISTICS_COLOR = Symbol("default-annotation-statistics-color"); var DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE = Symbol( "default-annotation-statistics-divider-stroke" ); var DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL = Symbol( "default-annotation-statistics-fill" ); var DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE = Symbol( "default-annotation-statistics-stroke" ); var DEFAULT_TEXTBOX_FILL = Symbol("default-textbox-fill"); var DEFAULT_TEXTBOX_STROKE = Symbol("default-textbox-stroke"); var DEFAULT_TEXTBOX_COLOR = Symbol("default-textbox-color"); var DEFAULT_TOOLBAR_POSITION = Symbol("default-toolbar-position"); var DEFAULT_GRIDLINE_ENABLED = Symbol("default-gridline-enabled"); // packages/ag-charts-community/src/util/color.ts import { clamp } from "ag-charts-core"; var lerp = (x, y, t) => x * (1 - t) + y * t; var srgbToLinear = (value) => { const sign = value < 0 ? -1 : 1; const abs = Math.abs(value); if (abs <= 0.04045) return value / 12.92; return sign * ((abs + 0.055) / 1.055) ** 2.4; }; var srgbFromLinear = (value) => { const sign = value < 0 ? -1 : 1; const abs = Math.abs(value); if (abs > 31308e-7) { return sign * (1.055 * abs