ag-charts-community
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
1,812 lines (1,779 loc) • 1.42 MB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
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 date2,
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,
defined as defined2,
fillOptionsDef,
fontOptionsDef as fontOptionsDef2,
greaterThan as greaterThan2,
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,
string as string2,
strokeOptionsDef as strokeOptionsDef2,
typeUnion,
undocumented as undocumented2,
union as union2
} from "ag-charts-core";
// packages/ag-charts-community/src/chart/axesOptionsDefs.ts
import {
and,
arrayLength,
arrayOf,
arrayOfDefs,
attachDescription,
boolean,
callback,
callbackDefs,
callbackOf,
color,
defined,
fontOptionsDef,
greaterThan,
instanceOf,
isValidNumberFormat,
lessThan,
lineDashOptionsDef,
number,
object,
optionsDefs,
or,
positiveNumber,
positiveNumberNonZero,
ratio,
required,
string,
strokeOptionsDef,
themeOperator,
undocumented,
union
} from "ag-charts-core";
// packages/ag-charts-community/src/util/time/index.ts
var time_exports = {};
__export(time_exports, {
TimeInterval: () => TimeInterval,
day: () => day,
friday: () => friday,
hour: () => hour,
millisecond: () => millisecond,
minute: () => minute,
monday: () => monday,
month: () => month,
saturday: () => saturday,
second: () => second,
sunday: () => sunday,
thursday: () => thursday,
tuesday: () => tuesday,
utcDay: () => utcDay,
utcHour: () => utcHour,
utcMinute: () => utcMinute,
utcMonth: () => utcMonth,
utcYear: () => utcYear,
wednesday: () => wednesday,
year: () => year
});
// packages/ag-charts-community/src/util/time/duration.ts
var durationSecond = 1e3;
var durationMinute = durationSecond * 60;
var durationHour = durationMinute * 60;
var durationDay = durationHour * 24;
var durationWeek = durationDay * 7;
var durationMonth = durationDay * 30;
var durationYear = durationDay * 365;
// packages/ag-charts-community/src/util/time/interval.ts
import { Logger } from "ag-charts-core";
var TimeInterval = class _TimeInterval {
constructor(unit, milliseconds, hierarchy, _encode, _decode, step = 1, _rangeCallback) {
this.unit = unit;
this.milliseconds = milliseconds;
this.hierarchy = hierarchy;
this._encode = _encode;
this._decode = _decode;
this.step = step;
this._rangeCallback = _rangeCallback;
}
static extent(start2, stop, visibleRange) {
if (start2.getTime() > stop.getTime()) {
[start2, stop] = [stop, start2];
if (visibleRange != null) {
visibleRange = [1 - visibleRange[1], 1 - visibleRange[0]];
}
}
if (visibleRange != null) {
const delta3 = stop.getTime() - start2.getTime();
const t0 = start2.getTime();
start2 = new Date(t0 + visibleRange[0] * delta3);
stop = new Date(t0 + visibleRange[1] * delta3);
}
return [start2, stop];
}
getOffset(snapTo, step) {
return Math.floor(this._encode(new Date(snapTo))) % step;
}
/**
* Returns a new date representing the latest interval boundary date before or equal to date.
* For example, `day.floor(date)` typically returns 12:00 AM local time on the given date.
* @param date
*/
floor(date5) {
const d = new Date(date5);
const e = this._encode(d);
return this._decode(e);
}
/**
* Returns a new date representing the earliest interval boundary date after or equal to date.
* @param date
*/
ceil(date5) {
const d = new Date(Number(date5) - 1);
const e = this._encode(d);
return this._decode(e + 1);
}
rangeIndices(start2, stop, { extend = false, visibleRange = [0, 1], limit }) {
[start2, stop] = _TimeInterval.extent(start2, stop, visibleRange);
const e0 = this._encode(extend ? this.floor(start2) : this.ceil(start2));
let e1 = this._encode(extend ? this.ceil(stop) : this.floor(stop));
if (limit != null && e1 - e0 > limit) {
e1 = e0 + limit;
}
return [e0, e1];
}
/**
* Returns an array of dates representing every interval boundary after or equal to start (inclusive) and before stop (exclusive).
* @param start Range start.
* @param stop Range end.
* @param extend If specified, the requested range will be extended to the closest "nice" values.
*/
range(start2, stop, params = {}) {
let rangeCallback;
if (start2.getTime() > stop.getTime()) {
rangeCallback = this._rangeCallback?.(stop, start2);
} else {
rangeCallback = this._rangeCallback?.(start2, stop);
}
const [e0, e1] = this.rangeIndices(start2, stop, params);
const range3 = [];
for (let e = e0; e <= e1; e++) {
const d = this._decode(e);
range3.push(d);
}
rangeCallback?.();
return range3;
}
previous(date5) {
return this._decode(this._encode(this.ceil(date5)) - 1);
}
next(date5) {
return this._decode(this._encode(this.floor(date5)) + 1);
}
rangeCount(start2, stop, params = {}) {
const [e0, e1] = this.rangeIndices(start2, stop, params);
return e1 - e0;
}
/**
* Returns a filtered view of this interval representing every step'th date.
* It can be a number of minutes, hours, days etc.
* Must be a positive integer.
* @param step
*/
every(step, options) {
if (step === 1 && options?.snapTo != null)
return this;
const { unit, milliseconds, hierarchy, step: baseStep } = this;
let offset4 = 0;
let rangeCallback;
const unsafeStep = step;
step = Math.max(1, Math.round(step));
if (unsafeStep !== step) {
Logger.warnOnce(`interval step of [${unsafeStep}] rounded to [${step}].`);
}
const { snapTo = "start" } = options ?? {};
if (typeof snapTo === "string") {
const initialOffset = offset4;
rangeCallback = (start2, stop) => {
const s = snapTo === "start" ? start2 : stop;
offset4 = this.getOffset(s, step);
return () => offset4 = initialOffset;
};
} else if (typeof snapTo === "number") {
offset4 = this.getOffset(new Date(snapTo), step);
} else if (snapTo instanceof Date) {
offset4 = this.getOffset(snapTo, step);
}
const encode13 = (date5) => Math.floor((this._encode(date5) - offset4) / step);
const decode13 = (encoded) => this._decode(encoded * step + offset4);
return new _TimeInterval(unit, milliseconds * step, hierarchy, encode13, decode13, baseStep * step, rangeCallback);
}
};
// packages/ag-charts-community/src/util/time/year.ts
function encode(date5) {
return date5.getFullYear();
}
function decode(encoded) {
const d = /* @__PURE__ */ new Date();
d.setFullYear(encoded);
d.setMonth(0, 1);
d.setHours(0, 0, 0, 0);
return d;
}
var yearMs = (365 + 1 / 4 - 1 / 100 + 1 / 400) * 24 * 60 * 60 * 1e3;
var year = new TimeInterval("year", yearMs, void 0, encode, decode);
// packages/ag-charts-community/src/util/time/month.ts
function encode2(date5) {
return date5.getFullYear() * 12 + date5.getMonth();
}
function decode2(encoded) {
const y = Math.floor(encoded / 12);
const month2 = encoded - y * 12;
return new Date(y, month2, 1);
}
var month = new TimeInterval("month", year.milliseconds / 12, year, encode2, decode2);
// packages/ag-charts-community/src/util/time/day.ts
function encode3(date5) {
const tzOffsetMs = date5.getTimezoneOffset() * durationMinute;
return Math.floor((date5.getTime() - tzOffsetMs) / durationDay);
}
function decode3(encoded) {
const d = new Date(1970, 0, 1);
d.setDate(d.getDate() + encoded);
return d;
}
var day = new TimeInterval("day", 24 * 60 * 60 * 1e3, month, encode3, decode3);
// packages/ag-charts-community/src/util/time/millisecond.ts
function encode4(date5) {
return date5.getTime();
}
function decode4(encoded) {
return new Date(encoded);
}
var millisecond = new TimeInterval("millisecond", 1, day, encode4, decode4);
// packages/ag-charts-community/src/util/time/second.ts
var offset = (/* @__PURE__ */ new Date()).getTimezoneOffset() * durationMinute;
function encode5(date5) {
return Math.floor((date5.getTime() - offset) / durationSecond);
}
function decode5(encoded) {
return new Date(offset + encoded * durationSecond);
}
var second = new TimeInterval("second", 1e3, day, encode5, decode5);
// packages/ag-charts-community/src/util/time/minute.ts
var offset2 = (/* @__PURE__ */ new Date()).getTimezoneOffset() * durationMinute;
function encode6(date5) {
return Math.floor((date5.getTime() - offset2) / durationMinute);
}
function decode6(encoded) {
return new Date(offset2 + encoded * durationMinute);
}
var minute = new TimeInterval("minute", 60 * 1e3, day, encode6, decode6);
// packages/ag-charts-community/src/util/time/hour.ts
var offset3 = (/* @__PURE__ */ new Date()).getTimezoneOffset() * durationMinute;
function encode7(date5) {
return Math.floor((date5.getTime() - offset3) / durationHour);
}
function decode7(encoded) {
return new Date(offset3 + encoded * durationHour);
}
var hour = new TimeInterval("hour", 60 * 60 * 1e3, day, encode7, decode7);
// packages/ag-charts-community/src/util/time/week.ts
function weekday(weekStart) {
const thursday2 = 4;
const dayShift = (7 + weekStart - thursday2) % 7;
function encode13(date5) {
const tzOffsetMs = date5.getTimezoneOffset() * durationMinute;
return Math.floor((date5.getTime() - tzOffsetMs) / durationWeek - dayShift / 7);
}
function decode13(encoded) {
const d = new Date(1970, 0, 1);
d.setDate(d.getDate() + encoded * 7 + dayShift);
return d;
}
return new TimeInterval("day", 7 * 24 * 60 * 60 * 1e3, month, encode13, decode13, 7);
}
var sunday = weekday(0);
var monday = weekday(1);
var tuesday = weekday(2);
var wednesday = weekday(3);
var thursday = weekday(4);
var friday = weekday(5);
var saturday = weekday(6);
// packages/ag-charts-community/src/util/time/utcYear.ts
function encode8(date5) {
return date5.getUTCFullYear();
}
function decode8(encoded) {
const d = /* @__PURE__ */ new Date();
d.setUTCFullYear(encoded);
d.setUTCMonth(0, 1);
d.setUTCHours(0, 0, 0, 0);
return d;
}
var utcYear = new TimeInterval("year", year.milliseconds, void 0, encode8, decode8);
// packages/ag-charts-community/src/util/time/utcMonth.ts
function encode9(date5) {
return date5.getUTCFullYear() * 12 + date5.getUTCMonth();
}
function decode9(encoded) {
const year2 = Math.floor(encoded / 12);
const m = encoded - year2 * 12;
return new Date(Date.UTC(year2, m, 1));
}
var utcMonth = new TimeInterval("month", month.milliseconds, utcYear, encode9, decode9);
// packages/ag-charts-community/src/util/time/utcDay.ts
function encode10(date5) {
return Math.floor(date5.getTime() / durationDay);
}
function decode10(encoded) {
const d = /* @__PURE__ */ new Date(0);
d.setUTCDate(d.getUTCDate() + encoded);
d.setUTCHours(0, 0, 0, 0);
return d;
}
var utcDay = new TimeInterval("day", 24 * 60 * 60 * 1e3, utcMonth, encode10, decode10);
// packages/ag-charts-community/src/util/time/utcMinute.ts
function encode11(date5) {
return Math.floor(date5.getTime() / durationMinute);
}
function decode11(encoded) {
return new Date(encoded * durationMinute);
}
var utcMinute = new TimeInterval("minute", 60 * 1e3, utcDay, encode11, decode11);
// packages/ag-charts-community/src/util/time/utcHour.ts
function encode12(date5) {
return Math.floor(date5.getTime() / durationHour);
}
function decode12(encoded) {
return new Date(encoded * durationHour);
}
var utcHour = new TimeInterval("hour", 60 * 60 * 1e3, utcDay, encode12, decode12);
// packages/ag-charts-community/src/chart/axesOptionsDefs.ts
var timeIntervalUnit = union("millisecond", "second", "minute", "hour", "day", "month", "year");
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: string,
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,
...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
};
commonAxisOptionsDefs.context = undocumented(() => 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,
title: {
enabled: boolean,
text: string,
spacing: positiveNumber,
formatter: callback,
...fontOptionsDef
}
};
cartesianAxisOptionsDefs.title._enabledFromTheme = undocumented(boolean);
function cartesianAxisCrosshairOptions(canFormat) {
const crosshairLabel = {
enabled: boolean,
xOffset: number,
yOffset: number,
renderer: callbackOf(
or(
string,
optionsDefs(
{
text: string,
color,
backgroundColor: color,
opacity: ratio
},
"crosshair label renderer result object"
)
)
)
};
if (canFormat) {
crosshairLabel.format = string;
}
return {
enabled: boolean,
snap: boolean,
label: crosshairLabel,
...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, instanceOf(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 tooltipDeprecatedTypeValidator = union2(
"pointer",
"node",
"top",
"right",
"bottom",
"left",
"top-left",
"top-right",
"bottom-left",
"bottom-right"
);
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",
"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 contextMenuActionsArray = arrayOfDefs2(
{
label: required2(string2),
action: required2(callback2)
},
"a context menu actions array"
);
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 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: {
...fillOptionsDef,
...strokeOptionsDef2
},
inactiveStyle: {
...fillOptionsDef,
...strokeOptionsDef2
},
highlightStyle: {
...fillOptionsDef,
...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,
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: {
type: tooltipDeprecatedTypeValidator,
anchorTo: union2("pointer", "node", "chart"),
placement: or2(tooltipPlacementValidator, arrayOf2(tooltipPlacementValidator)),
xOffset: number2,
yOffset: number2
}
},
animation: {
enabled: boolean2,
duration: positiveNumber2
},
contextMenu: {
enabled: boolean2,
items: contextMenuItemsArray,
extraActions: contextMenuActionsArray,
extraSeriesAreaActions: contextMenuActionsArray,
extraNodeActions: contextMenuActionsArray,
extraLegendItemActions: contextMenuActionsArray
},
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, date)), 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,
minVisibleItemsX: positiveNumber2,
minVisibleItemsY: 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")
}
}
};
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
},
...fillOptionsDef
});
commonChartOptionsDefs.context = undocumented2(() => true);
commonChartOptionsDefs.overrideDevicePixelRatio = undocumented2(number2);
commonChartOptionsDefs.sync.domainMode = undocumented2(union2("direction", "position", "key"));
var commonSeriesThemeableOptionsDefs = {
cursor: string2,
showInLegend: boolean2,
nodeClickRange: rangeValidator,
listeners: {
nodeClick: callback2,
nodeDoubleClick: callback2
},
highlightStyle: {
item: { ...fillOptionsDef, ...strokeOptionsDef2 },
series: {
enabled: boolean2,
dimOpacity: ratio2,
strokeWidth: positiveNumber2
}
}
};
var commonSeriesOptionsDefs = {
...commonSeriesThemeableOptionsDefs,
id: string2,
visible: boolean2,
data: array
};
commonSeriesOptionsDefs.context = undocumented2(() => true);
commonSeriesOptionsDefs.seriesGrouping = undocumented2(defined2);
commonSeriesOptionsDefs.highlight = undocumented2({ enabled: boolean2 });
var markerOptionsDefs = {
enabled: boolean2,
shape: shapeValidator,
size: positiveNumber2,
itemStyler: callbackDefs2({
...fillOptionsDef,
...strokeOptionsDef2,
...lineDashOptionsDef2,
shape: shapeValidator,
size: positiveNumber2
}),
...fillOptionsDef,
...strokeOptionsDef2,
...lineDashOptionsDef2
};
var seriesLabelOptionsDefs = {
enabled: boolean2,
formatter: callback2,
...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: {
type: tooltipDeprecatedTypeValidator,
anchorTo: union2("node", "pointer", "chart"),
placement: or2(tooltipPlacementValidator, arrayOf2(tooltipPlacementValidator)),
xOffset: number2,
yOffset: number2
},
interaction: {
enabled: boolean2
}
};
tooltipOptionsDefs.position._seriesOverrideType = undocumented2(tooltipDeprecatedTypeValidator);
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 fillOptionsDef2,
lineDashOptionsDef as lineDashOptionsDef3,
number as number3,
required as required3,
string as string3,
strokeOptionsDef as strokeOptionsDef3
} from "ag-charts-core";
var areaSeriesThemeableOptionsDef = {
showInMiniChart: boolean3,
connectMissingData: boolean3,
interpolation: interpolationOptionsDefs,
label: seriesLabelOptionsDefs,
marker: markerOptionsDefs,
tooltip: tooltipOptionsDefs,
shadow: shadowOptionsDefs,
...commonSeriesThemeableOptionsDefs,
...fillOptionsDef2,
...strokeOptionsDef3,
...lineDashOptionsDef3
};
var areaSeriesOptionsDef = {
...areaSeriesThemeableOptionsDef,
...commonSeriesOptionsDefs,
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 {
boolean as boolean4,
callbackDefs as callbackDefs3,
constant as constant2,
fillOptionsDef as fillOptionsDef3,
lineDashOptionsDef as lineDashOptionsDef4,
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 barSeriesThemeableOptionsDef = {
direction: union3("horizontal", "vertical"),
showInMiniChart: boolean4,
cornerRadius: positiveNumber3,
itemStyler: callbackDefs3({
...fillOptionsDef3,
...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,
...fillOptionsDef3,
...strokeOptionsDef4,
...lineDashOptionsDef4
};
barSeriesThemeableOptionsDef.sparklineMode = undocumented3(boolean4);
var barSeriesOptionsDef = {
...barSeriesThemeableOptionsDef,
...commonSeriesOptionsDefs,
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,
number as number5,
required as required5,
string as string5,
strokeOptionsDef as strokeOptionsDef5,
undocumented as undocumented4
} from "ag-charts-core";
var lineSeriesThemeableOptionsDef = {
title: string5,
showInMiniChart: boolean5,
connectMissingData: boolean5,
interpolation: interpolationOptionsDefs,
label: seriesLabelOptionsDefs,
marker: markerOptionsDefs,
tooltip: tooltipOptionsDefs,
errorBar: errorBarThemeableOptionsDefs,
...commonSeriesThemeableOptionsDefs,
...strokeOptionsDef5,
...lineDashOptionsDef5
};
lineSeriesThemeableOptionsDef.sparklineMode = undocumented4(boolean5);
var lineSeriesOptionsDef = {
...lineSeriesThemeableOptionsDef,
...commonSeriesOptionsDefs,
type: 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 { entries, isArray, isObject, isPlainObject } 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
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;
}
// 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/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,
footnote,
height: height2,
listeners,
locale,
minHeight,
minWidth,
overrideDevicePixelRatio,
padding,
subtitle,
theme,
title,
width: width2,
type,
cursor,
nodeClickRange,
tooltip = {},
value,
scale: scale2 = {},
startAngle,
endAngle,
highlightStyle,
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,
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,
nodeClickRange,
tooltip: seriesTooltipOptions,
value,
highlightStyle,
segmentation,
bar,
targets,
outerRadius,
innerRadius,
outerRadiusRatio,
innerRadiusRatio,
cornerRadius,
cornerMode,
label,
secondaryLabel,
spacing,
...rest
});
if ("context" in opts) {
chartOpts["context"] = opts.context;
}
return {
...chartOpts,
series: [seriesOpts]
};
}
function linearGaugeOptions(opts) {
const {
animation,
background,
container,
contextMenu,
footnote,
height: height2,
listeners,
locale,
minHeight,
minWidth,
overrideDevicePixelRatio,
padding,
subtitle,
theme,
title,
width: width2,
type,
cursor,
nodeClickRange,
tooltip = {},
value,
scale: scale2 = {},
direction = "vertical",
thickness,
highlightStyle,
segmentation,
bar,
targets,
cornerRadius,
cornerMode,
label,
...rest
} = opts;
const { chartTooltipOptions, seriesTooltipOptions } = tooltipOptions(tooltip);
const chartOpts = pickProps(opts, {
animation,
background,
container,
contextMenu,
footnote,
height: height2,
listeners,
locale,
minHeight,
minWidth,
overrideDevicePixelRatio,
padding,
subtitle,
theme,
title,
tooltip: chartTooltipOptions,
width: width2
});
const seriesOpts = pickProps(opts, {
scale: scale2,
type,
cursor,
nodeClickRange,
tooltip: seriesTooltipOptions,
value,
direction,
thickness,
highlightStyle,
segmentation,
bar,
targets,
cornerRadius,
cornerMode,
label,
...rest
});
if ("context" in opts) {
chartOpts["context"] = opts.context;
}
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) {
if (opts.listeners) {
const { nodeClick, nodeDoubleClick, ...listeners } = opts.listeners;
opts = {
...opts,
listeners: {
seriesNodeClick: nodeClick,
seriesNodeDoubleClick: nodeDoubleClick,
...listeners
}
};
}
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 fillOptionsDef4,
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 requi