ag-charts-enterprise
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
1,395 lines (1,382 loc) • 1.57 MB
JavaScript
"use strict";
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
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-enterprise/src/main.ts
var main_exports = {};
__export(main_exports, {
AgChartsEnterpriseModule: () => AgChartsEnterpriseModule,
LicenseManager: () => LicenseManager2,
setupEnterpriseModules: () => setupEnterpriseModules2
});
module.exports = __toCommonJS(main_exports);
var import_ag_charts_community303 = require("ag-charts-community");
// packages/ag-charts-enterprise/src/license/md5.ts
var MD5 = class {
constructor() {
this.ieCompatibility = false;
}
init() {
this.ieCompatibility = this.md5("hello") != "5d41402abc4b2a76b9719d911017c592";
}
md5cycle(x, k) {
let a = x[0], b = x[1], c = x[2], d = x[3];
a = this.ff(a, b, c, d, k[0], 7, -680876936);
d = this.ff(d, a, b, c, k[1], 12, -389564586);
c = this.ff(c, d, a, b, k[2], 17, 606105819);
b = this.ff(b, c, d, a, k[3], 22, -1044525330);
a = this.ff(a, b, c, d, k[4], 7, -176418897);
d = this.ff(d, a, b, c, k[5], 12, 1200080426);
c = this.ff(c, d, a, b, k[6], 17, -1473231341);
b = this.ff(b, c, d, a, k[7], 22, -45705983);
a = this.ff(a, b, c, d, k[8], 7, 1770035416);
d = this.ff(d, a, b, c, k[9], 12, -1958414417);
c = this.ff(c, d, a, b, k[10], 17, -42063);
b = this.ff(b, c, d, a, k[11], 22, -1990404162);
a = this.ff(a, b, c, d, k[12], 7, 1804603682);
d = this.ff(d, a, b, c, k[13], 12, -40341101);
c = this.ff(c, d, a, b, k[14], 17, -1502002290);
b = this.ff(b, c, d, a, k[15], 22, 1236535329);
a = this.gg(a, b, c, d, k[1], 5, -165796510);
d = this.gg(d, a, b, c, k[6], 9, -1069501632);
c = this.gg(c, d, a, b, k[11], 14, 643717713);
b = this.gg(b, c, d, a, k[0], 20, -373897302);
a = this.gg(a, b, c, d, k[5], 5, -701558691);
d = this.gg(d, a, b, c, k[10], 9, 38016083);
c = this.gg(c, d, a, b, k[15], 14, -660478335);
b = this.gg(b, c, d, a, k[4], 20, -405537848);
a = this.gg(a, b, c, d, k[9], 5, 568446438);
d = this.gg(d, a, b, c, k[14], 9, -1019803690);
c = this.gg(c, d, a, b, k[3], 14, -187363961);
b = this.gg(b, c, d, a, k[8], 20, 1163531501);
a = this.gg(a, b, c, d, k[13], 5, -1444681467);
d = this.gg(d, a, b, c, k[2], 9, -51403784);
c = this.gg(c, d, a, b, k[7], 14, 1735328473);
b = this.gg(b, c, d, a, k[12], 20, -1926607734);
a = this.hh(a, b, c, d, k[5], 4, -378558);
d = this.hh(d, a, b, c, k[8], 11, -2022574463);
c = this.hh(c, d, a, b, k[11], 16, 1839030562);
b = this.hh(b, c, d, a, k[14], 23, -35309556);
a = this.hh(a, b, c, d, k[1], 4, -1530992060);
d = this.hh(d, a, b, c, k[4], 11, 1272893353);
c = this.hh(c, d, a, b, k[7], 16, -155497632);
b = this.hh(b, c, d, a, k[10], 23, -1094730640);
a = this.hh(a, b, c, d, k[13], 4, 681279174);
d = this.hh(d, a, b, c, k[0], 11, -358537222);
c = this.hh(c, d, a, b, k[3], 16, -722521979);
b = this.hh(b, c, d, a, k[6], 23, 76029189);
a = this.hh(a, b, c, d, k[9], 4, -640364487);
d = this.hh(d, a, b, c, k[12], 11, -421815835);
c = this.hh(c, d, a, b, k[15], 16, 530742520);
b = this.hh(b, c, d, a, k[2], 23, -995338651);
a = this.ii(a, b, c, d, k[0], 6, -198630844);
d = this.ii(d, a, b, c, k[7], 10, 1126891415);
c = this.ii(c, d, a, b, k[14], 15, -1416354905);
b = this.ii(b, c, d, a, k[5], 21, -57434055);
a = this.ii(a, b, c, d, k[12], 6, 1700485571);
d = this.ii(d, a, b, c, k[3], 10, -1894986606);
c = this.ii(c, d, a, b, k[10], 15, -1051523);
b = this.ii(b, c, d, a, k[1], 21, -2054922799);
a = this.ii(a, b, c, d, k[8], 6, 1873313359);
d = this.ii(d, a, b, c, k[15], 10, -30611744);
c = this.ii(c, d, a, b, k[6], 15, -1560198380);
b = this.ii(b, c, d, a, k[13], 21, 1309151649);
a = this.ii(a, b, c, d, k[4], 6, -145523070);
d = this.ii(d, a, b, c, k[11], 10, -1120210379);
c = this.ii(c, d, a, b, k[2], 15, 718787259);
b = this.ii(b, c, d, a, k[9], 21, -343485551);
x[0] = this.add32(a, x[0]);
x[1] = this.add32(b, x[1]);
x[2] = this.add32(c, x[2]);
x[3] = this.add32(d, x[3]);
}
cmn(q, a, b, x, s, t) {
a = this.add32(this.add32(a, q), this.add32(x, t));
return this.add32(a << s | a >>> 32 - s, b);
}
ff(a, b, c, d, x, s, t) {
return this.cmn(b & c | ~b & d, a, b, x, s, t);
}
gg(a, b, c, d, x, s, t) {
return this.cmn(b & d | c & ~d, a, b, x, s, t);
}
hh(a, b, c, d, x, s, t) {
return this.cmn(b ^ c ^ d, a, b, x, s, t);
}
ii(a, b, c, d, x, s, t) {
return this.cmn(c ^ (b | ~d), a, b, x, s, t);
}
md51(s) {
const n = s.length;
const state = [1732584193, -271733879, -1732584194, 271733878];
let i;
for (i = 64; i <= s.length; i += 64) {
this.md5cycle(state, this.md5blk(s.substring(i - 64, i)));
}
s = s.substring(i - 64);
const tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
for (i = 0; i < s.length; i++) {
tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
}
tail[i >> 2] |= 128 << (i % 4 << 3);
if (i > 55) {
this.md5cycle(state, tail);
for (i = 0; i < 16; i++) {
tail[i] = 0;
}
}
tail[14] = n * 8;
this.md5cycle(state, tail);
return state;
}
/* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5
* algorithm for multi-byte characters (perhaps by adding every four 16-bit characters and
* shortening the sum to 32 bits). Otherwise I suthis.ggest performing MD-5 as if every character
* was two bytes--e.g., 0040 0025 = @%--but then how will an ordinary MD-5 sum be matched?
* There is no way to standardize text to something like UTF-8 before transformation; speed cost is
* utterly prohibitive. The JavaScript standard itself needs to look at this: it should start
* providing access to strings as preformed UTF-8 8-bit unsigned value arrays.
*/
md5blk(s) {
const md5blks = [];
for (let i = 0; i < 64; i += 4) {
md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
}
return md5blks;
}
rhex(n) {
const hex_chr = "0123456789abcdef".split("");
let s = "", j = 0;
for (; j < 4; j++) {
s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15];
}
return s;
}
hex(x) {
for (let i = 0; i < x.length; i++) {
x[i] = this.rhex(x[i]);
}
return x.join("");
}
md5(s) {
return this.hex(this.md51(s));
}
add32(a, b) {
return this.ieCompatibility ? this.add32Compat(a, b) : this.add32Std(a, b);
}
/* this function is much faster, so if possible we use it. Some IEs are the only ones I know of that
need the idiotic second function, generated by an if clause. */
add32Std(a, b) {
return a + b & 4294967295;
}
add32Compat(x, y) {
const lsw = (x & 65535) + (y & 65535), msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return msw << 16 | lsw & 65535;
}
};
// packages/ag-charts-enterprise/src/license/licenseManager.ts
function missingOrEmpty(value) {
return value == null || value.length === 0;
}
var LICENSE_TYPES = {
"01": "GRID",
"02": "CHARTS",
"0102": "BOTH"
};
var LICENSING_HELP_URL = "https://www.ag-grid.com/charts/licensing/";
var _LicenseManager = class _LicenseManager {
constructor(document2) {
this.watermarkMessage = void 0;
this.totalMessageLength = 124;
this.document = document2;
this.md5 = new MD5();
this.md5.init();
}
validateLicense() {
const licenseDetails = this.getLicenseDetails(_LicenseManager.licenseKey, _LicenseManager.gridContext);
const currentLicenseName = `AG ${licenseDetails.currentLicenseType === "BOTH" ? "Grid and " : ""}Charts Enterprise`;
let suppliedLicenseName = "";
if (licenseDetails.suppliedLicenseType === "BOTH") {
suppliedLicenseName = "AG Grid and AG Charts Enterprise";
} else if (licenseDetails.suppliedLicenseType === "GRID") {
suppliedLicenseName = "AG Grid Enterprise";
} else if (licenseDetails.suppliedLicenseType !== void 0) {
suppliedLicenseName = "AG Charts Enterprise";
}
if (licenseDetails.missing) {
if (!this.isWebsiteUrl() || this.isForceWatermark()) {
this.outputMissingLicenseKey(currentLicenseName);
}
} else if (licenseDetails.expired) {
const gridReleaseDate = _LicenseManager.getChartsReleaseDate();
const formattedReleaseDate = _LicenseManager.formatDate(gridReleaseDate);
this.outputExpiredKey(licenseDetails.expiry, formattedReleaseDate, suppliedLicenseName);
} else if (!licenseDetails.valid) {
this.outputInvalidLicenseKey(
!!licenseDetails.incorrectLicenseType,
currentLicenseName,
suppliedLicenseName
);
} else if (licenseDetails.isTrial && licenseDetails.trialExpired) {
this.outputExpiredTrialKey(licenseDetails.expiry, currentLicenseName, suppliedLicenseName);
}
}
static extractExpiry(license) {
const restrictionHashed = license.substring(license.lastIndexOf("_") + 1, license.length);
return new Date(parseInt(_LicenseManager.decode(restrictionHashed), 10));
}
static extractLicenseComponents(licenseKey) {
let cleanedLicenseKey = licenseKey.replace(/[\u200B-\u200D\uFEFF]/g, "");
cleanedLicenseKey = cleanedLicenseKey.replace(/\r?\n|\r/g, "");
if (licenseKey.length <= 32) {
return { md5: null, license: licenseKey, version: null, isTrial: null };
}
const hashStart = cleanedLicenseKey.length - 32;
const md5 = cleanedLicenseKey.substring(hashStart);
const license = cleanedLicenseKey.substring(0, hashStart);
const [version, isTrial, type] = _LicenseManager.extractBracketedInformation(cleanedLicenseKey);
return { md5, license, version, isTrial, type };
}
getLicenseDetails(licenseKey, gridContext = false) {
const currentLicenseType = "CHARTS";
if (missingOrEmpty(licenseKey)) {
return {
licenseKey,
valid: false,
missing: true,
currentLicenseType
};
}
const chartsReleaseDate = _LicenseManager.getChartsReleaseDate();
const { md5, license, version, isTrial, type } = _LicenseManager.extractLicenseComponents(licenseKey);
let valid = md5 === this.md5.md5(license) && licenseKey.indexOf("For_Trialing_ag-Grid_Only") === -1;
let trialExpired = void 0;
let expired = void 0;
let expiry = null;
let incorrectLicenseType = false;
let suppliedLicenseType = void 0;
function handleTrial() {
const now = /* @__PURE__ */ new Date();
trialExpired = expiry < now;
expired = void 0;
}
if (valid) {
expiry = _LicenseManager.extractExpiry(license);
valid = !isNaN(expiry.getTime());
if (valid) {
expired = chartsReleaseDate > expiry;
switch (version) {
case "legacy":
case "2": {
valid = false;
break;
}
case "3": {
if (missingOrEmpty(type)) {
valid = false;
} else {
suppliedLicenseType = type;
if (type !== LICENSE_TYPES["02"] && type !== LICENSE_TYPES["0102"]) {
valid = false;
incorrectLicenseType = true;
} else if (isTrial) {
handleTrial();
}
}
}
}
}
}
if (!valid) {
return {
licenseKey,
valid,
incorrectLicenseType,
currentLicenseType,
suppliedLicenseType
};
}
return {
licenseKey,
valid,
expiry: _LicenseManager.formatDate(expiry),
expired,
version,
isTrial,
trialExpired,
invalidLicenseTypeForCombo: gridContext ? suppliedLicenseType !== "BOTH" : void 0,
incorrectLicenseType,
currentLicenseType,
suppliedLicenseType
};
}
isDisplayWatermark() {
return this.isForceWatermark() || !this.isLocalhost() && !this.isWebsiteUrl() && !missingOrEmpty(this.watermarkMessage);
}
getWatermarkMessage() {
return this.watermarkMessage ?? "";
}
getHostname() {
if (!this.document) {
return "localhost";
}
const win = this.document.defaultView ?? window;
if (!win) {
return "localhost";
}
const loc = win.location;
const { hostname = "" } = loc;
return hostname;
}
isForceWatermark() {
if (!this.document) {
return false;
}
const win = this.document?.defaultView ?? typeof window != "undefined" ? window : void 0;
if (!win) {
return false;
}
const { pathname } = win.location;
return pathname ? pathname.indexOf("forceWatermark") !== -1 : false;
}
isWebsiteUrl() {
const hostname = this.getHostname();
return /^((?:[\w-]+\.)?ag-grid\.com)$/.exec(hostname) !== null;
}
isLocalhost() {
const hostname = this.getHostname();
return /^(?:127\.0\.0\.1|localhost)$/.exec(hostname) !== null;
}
static formatDate(date2) {
const monthNames = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
const day = date2.getDate();
const monthIndex = date2.getMonth();
const year = date2.getFullYear();
return day + " " + monthNames[monthIndex] + " " + year;
}
static getChartsReleaseDate() {
return new Date(parseInt(_LicenseManager.decode(_LicenseManager.RELEASE_INFORMATION), 10));
}
static decode(input) {
const keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
let t = "";
let n, r, i;
let s, o, u, a;
let f = 0;
const e = input.replace(/[^A-Za-z0-9+/=]/g, "");
while (f < e.length) {
s = keystr.indexOf(e.charAt(f++));
o = keystr.indexOf(e.charAt(f++));
u = keystr.indexOf(e.charAt(f++));
a = keystr.indexOf(e.charAt(f++));
n = s << 2 | o >> 4;
r = (o & 15) << 4 | u >> 2;
i = (u & 3) << 6 | a;
t = t + String.fromCharCode(n);
if (u != 64) {
t = t + String.fromCharCode(r);
}
if (a != 64) {
t = t + String.fromCharCode(i);
}
}
t = _LicenseManager.utf8_decode(t);
return t;
}
static utf8_decode(input) {
input = input.replace(/rn/g, "n");
let t = "";
for (let n = 0; n < input.length; n++) {
const r = input.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
} else if (r > 127 && r < 2048) {
t += String.fromCharCode(r >> 6 | 192);
t += String.fromCharCode(r & 63 | 128);
} else {
t += String.fromCharCode(r >> 12 | 224);
t += String.fromCharCode(r >> 6 & 63 | 128);
t += String.fromCharCode(r & 63 | 128);
}
}
return t;
}
static setGridContext(gridContext = false) {
_LicenseManager.gridContext = gridContext;
}
static setLicenseKey(licenseKey) {
_LicenseManager.licenseKey = licenseKey;
}
static extractBracketedInformation(licenseKey) {
if (!licenseKey.includes("[")) {
return ["legacy", false, void 0];
}
const matches = licenseKey.match(/\[(.*?)\]/g).map((match) => match.replace("[", "").replace("]", ""));
if (!matches || matches.length === 0) {
return ["legacy", false, void 0];
}
const isTrial = matches.filter((match) => match === "TRIAL").length === 1;
const rawVersion = matches.filter((match) => match.startsWith("v"))[0];
const version = rawVersion ? rawVersion.replace("v", "") : "legacy";
const type = LICENSE_TYPES[matches.filter((match) => LICENSE_TYPES[match])[0]];
return [version, isTrial, type];
}
centerPadAndOutput(input) {
const paddingRequired = this.totalMessageLength - input.length;
console.error(input.padStart(paddingRequired / 2 + input.length, "*").padEnd(this.totalMessageLength, "*"));
}
padAndOutput(input, padding = "*", terminateWithPadding = "") {
console.error(
input.padEnd(this.totalMessageLength - terminateWithPadding.length, padding) + terminateWithPadding
);
}
outputInvalidLicenseKey(incorrectLicenseType, currentLicenseName, suppliedLicenseName) {
if (!_LicenseManager.gridContext) {
if (incorrectLicenseType) {
this.centerPadAndOutput("");
this.centerPadAndOutput(` ${currentLicenseName} License `);
this.centerPadAndOutput(" Incompatible License Key ");
this.padAndOutput(
`* Your license key is for ${suppliedLicenseName} only and does not cover you for ${currentLicenseName}.`,
" ",
"*"
);
this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*");
this.centerPadAndOutput("");
this.centerPadAndOutput("");
} else {
this.centerPadAndOutput("");
this.centerPadAndOutput(` ${currentLicenseName} License `);
this.centerPadAndOutput(" Invalid License Key ");
this.padAndOutput(`* Your license key is not valid.`, " ", "*");
this.padAndOutput(`* To troubleshoot your license key visit ${LICENSING_HELP_URL}.`, " ", "*");
this.centerPadAndOutput("");
this.centerPadAndOutput("");
}
}
this.watermarkMessage = "Invalid License";
}
outputExpiredTrialKey(formattedExpiryDate, currentLicenseName, suppliedLicenseName) {
if (!_LicenseManager.gridContext) {
this.centerPadAndOutput("");
this.centerPadAndOutput(` ${currentLicenseName} License `);
this.centerPadAndOutput(" Trial Period Expired. ");
this.padAndOutput(
`* Your trial only license for ${suppliedLicenseName} expired on ${formattedExpiryDate}.`,
" ",
"*"
);
this.padAndOutput("* Please email info@ag-grid.com to purchase a license.", " ", "*");
this.centerPadAndOutput("");
this.centerPadAndOutput("");
}
this.watermarkMessage = "Trial Period Expired";
}
outputMissingLicenseKey(currentLicenseName) {
if (!_LicenseManager.gridContext) {
this.centerPadAndOutput("");
this.centerPadAndOutput(` ${currentLicenseName} License `);
this.centerPadAndOutput(" License Key Not Found ");
this.padAndOutput(`* All ${currentLicenseName} features are unlocked for trial.`, " ", "*");
this.padAndOutput(
"* If you want to hide the watermark please email info@ag-grid.com for a trial license key.",
" ",
"*"
);
this.centerPadAndOutput("");
this.centerPadAndOutput("");
}
this.watermarkMessage = "For Trial Use Only";
}
outputExpiredKey(formattedExpiryDate, formattedReleaseDate, currentLicenseName) {
if (!_LicenseManager.gridContext) {
this.centerPadAndOutput("");
this.centerPadAndOutput(` ${currentLicenseName} License `);
this.centerPadAndOutput(" Incompatible Software Version ");
this.padAndOutput(
`* Your license key works with versions of ${currentLicenseName} released before ${formattedExpiryDate}.`,
" ",
"*"
);
this.padAndOutput(`* The version you are trying to use was released on ${formattedReleaseDate}.`, " ", "*");
this.padAndOutput("* Please contact info@ag-grid.com to renew your license key.", " ", "*");
this.centerPadAndOutput("");
this.centerPadAndOutput("");
}
this.watermarkMessage = "License Expired";
}
};
_LicenseManager.RELEASE_INFORMATION = "MTc0MjgzMzc1OTQxMA==";
_LicenseManager.gridContext = false;
var LicenseManager = _LicenseManager;
// packages/ag-charts-enterprise/src/setup.ts
var import_ag_charts_community302 = require("ag-charts-community");
// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxis.ts
var import_ag_charts_community5 = require("ag-charts-community");
var import_ag_charts_core3 = require("ag-charts-core");
// packages/ag-charts-enterprise/src/utils/polar.ts
function loopSymmetrically(items, step, iterator) {
const loop = (start, end, loopStep, loopIterator) => {
let prev = items[0];
for (let i = start; loopStep > 0 ? i <= end : i > end; i += loopStep) {
const curr = items[i];
if (loopIterator(prev, curr))
return true;
prev = curr;
}
return false;
};
const midIndex = Math.floor(items.length / 2);
if (loop(step, midIndex, step, iterator))
return true;
return loop(items.length - step, midIndex, -step, iterator);
}
// packages/ag-charts-enterprise/src/axes/angle-number/angleAxisInterval.ts
var import_ag_charts_community = require("ag-charts-community");
var { OR, POSITIVE_NUMBER, NAN, AxisInterval, TempValidate } = import_ag_charts_community._ModuleSupport;
var AngleAxisInterval = class extends AxisInterval {
};
__decorateClass([
TempValidate(OR(POSITIVE_NUMBER, NAN))
], AngleAxisInterval.prototype, "minSpacing", 2);
// packages/ag-charts-enterprise/src/axes/angle/angleAxis.ts
var import_ag_charts_community4 = require("ag-charts-community");
var import_ag_charts_core2 = require("ag-charts-core");
// packages/ag-charts-enterprise/src/axes/polar-crosslines/angleCrossLine.ts
var import_ag_charts_community3 = require("ag-charts-community");
var import_ag_charts_core = require("ag-charts-core");
// packages/ag-charts-enterprise/src/axes/polar-crosslines/polarCrossLine.ts
var import_ag_charts_community2 = require("ag-charts-community");
var {
BaseProperties,
ChartAxisDirection,
ARRAY,
BOOLEAN,
COLOR_STRING,
FONT_STYLE,
FONT_WEIGHT,
LINE_DASH,
NUMBER,
OBJECT,
POSITIVE_NUMBER: POSITIVE_NUMBER2,
RATIO,
STRING,
UNION,
AND,
COLOR_STRING_ARRAY,
TempValidate: TempValidate2,
MATCHING_CROSSLINE_TYPE,
createId,
Group
} = import_ag_charts_community2._ModuleSupport;
var PolarCrossLineLabel = class extends BaseProperties {
constructor() {
super(...arguments);
this.fontSize = 14;
this.fontFamily = "Verdana, sans-serif";
this.padding = 5;
this.color = "rgba(87, 87, 87, 1)";
}
};
__decorateClass([
TempValidate2(BOOLEAN, { optional: true })
], PolarCrossLineLabel.prototype, "enabled", 2);
__decorateClass([
TempValidate2(STRING, { optional: true })
], PolarCrossLineLabel.prototype, "text", 2);
__decorateClass([
TempValidate2(FONT_STYLE, { optional: true })
], PolarCrossLineLabel.prototype, "fontStyle", 2);
__decorateClass([
TempValidate2(FONT_WEIGHT, { optional: true })
], PolarCrossLineLabel.prototype, "fontWeight", 2);
__decorateClass([
TempValidate2(POSITIVE_NUMBER2)
], PolarCrossLineLabel.prototype, "fontSize", 2);
__decorateClass([
TempValidate2(STRING)
], PolarCrossLineLabel.prototype, "fontFamily", 2);
__decorateClass([
TempValidate2(NUMBER)
], PolarCrossLineLabel.prototype, "padding", 2);
__decorateClass([
TempValidate2(COLOR_STRING, { optional: true })
], PolarCrossLineLabel.prototype, "color", 2);
__decorateClass([
TempValidate2(BOOLEAN, { optional: true })
], PolarCrossLineLabel.prototype, "parallel", 2);
var PolarCrossLine = class extends BaseProperties {
constructor() {
super(...arguments);
this.id = createId(this);
this.defaultColorRange = [];
this.shape = "polygon";
this.label = new PolarCrossLineLabel();
this.scale = void 0;
this.clippedRange = [-Infinity, Infinity];
this.gridLength = 0;
this.sideFlag = -1;
this.parallelFlipRotation = 0;
this.regularFlipRotation = 0;
this.direction = ChartAxisDirection.X;
this.axisInnerRadius = 0;
this.axisOuterRadius = 0;
this.lineGroup = new Group({ name: this.id });
this.rangeGroup = new Group({ name: this.id });
this.labelGroup = new Group({ name: this.id });
this._isRange = void 0;
}
assignCrossLineGroup(isRange, crossLineRange) {
if (isRange !== this._isRange) {
if (isRange) {
this.rangeGroup.appendChild(crossLineRange);
} else {
this.lineGroup.appendChild(crossLineRange);
}
}
this._isRange = isRange;
}
setSectorNodeProps(node) {
node.fill = this.fill;
node.fillOpacity = this.fillOpacity ?? 1;
node.stroke = this.stroke;
node.strokeOpacity = this.strokeOpacity ?? 1;
node.strokeWidth = this.strokeWidth ?? 1;
node.lineDash = this.lineDash;
}
setLabelNodeProps(node, x, y, baseline, rotation) {
const { label } = this;
node.x = x;
node.y = y;
node.text = label.text;
node.textAlign = "center";
node.textBaseline = baseline;
node.rotation = rotation;
node.rotationCenterX = x;
node.rotationCenterY = y;
node.fill = label.color;
node.fontFamily = label.fontFamily;
node.fontSize = label.fontSize;
node.fontStyle = label.fontStyle;
node.visible = true;
}
};
__decorateClass([
TempValidate2(BOOLEAN, { optional: true })
], PolarCrossLine.prototype, "enabled", 2);
__decorateClass([
TempValidate2(UNION(["range", "line"], "a crossLine type"))
], PolarCrossLine.prototype, "type", 2);
__decorateClass([
TempValidate2(AND(MATCHING_CROSSLINE_TYPE("range"), ARRAY.restrict({ length: 2 })), {
optional: true
})
], PolarCrossLine.prototype, "range", 2);
__decorateClass([
TempValidate2(MATCHING_CROSSLINE_TYPE("value"), { optional: true })
], PolarCrossLine.prototype, "value", 2);
__decorateClass([
TempValidate2(COLOR_STRING_ARRAY)
], PolarCrossLine.prototype, "defaultColorRange", 2);
__decorateClass([
TempValidate2(COLOR_STRING, { optional: true })
], PolarCrossLine.prototype, "fill", 2);
__decorateClass([
TempValidate2(RATIO, { optional: true })
], PolarCrossLine.prototype, "fillOpacity", 2);
__decorateClass([
TempValidate2(COLOR_STRING, { optional: true })
], PolarCrossLine.prototype, "stroke", 2);
__decorateClass([
TempValidate2(NUMBER, { optional: true })
], PolarCrossLine.prototype, "strokeWidth", 2);
__decorateClass([
TempValidate2(RATIO, { optional: true })
], PolarCrossLine.prototype, "strokeOpacity", 2);
__decorateClass([
TempValidate2(LINE_DASH, { optional: true })
], PolarCrossLine.prototype, "lineDash", 2);
__decorateClass([
TempValidate2(UNION(["polygon", "circle"], "a shape"))
], PolarCrossLine.prototype, "shape", 2);
__decorateClass([
TempValidate2(OBJECT)
], PolarCrossLine.prototype, "label", 2);
// packages/ag-charts-enterprise/src/axes/polar-crosslines/angleCrossLine.ts
var {
ChartAxisDirection: ChartAxisDirection2,
getCrossLineValue,
validateCrossLineValue,
normalizeAngle360,
Group: Group2,
Path,
Sector,
RotatableText,
ContinuousScale
} = import_ag_charts_community3._ModuleSupport;
var AngleCrossLine = class extends PolarCrossLine {
constructor() {
super();
this.direction = ChartAxisDirection2.X;
this.polygonNode = new Path();
this.sectorNode = new Sector();
this.lineNode = new Path();
this.crossLineRange = new Group2();
this.labelNode = new RotatableText();
this.ticks = [];
this.crossLineRange.append(this.polygonNode);
this.crossLineRange.append(this.sectorNode);
this.crossLineRange.append(this.lineNode);
this.labelGroup.append(this.labelNode);
}
visibilityCheck() {
if (!ContinuousScale.is(this.scale)) {
return true;
}
const [d0, d1] = this.scale.domain;
const value = getCrossLineValue(this);
if ((0, import_ag_charts_core.isArray)(value)) {
const [start, end] = value;
return start >= d0 && start <= d1 && end >= start && end <= d1;
} else {
return value >= d0 && value <= d1;
}
}
update(visible) {
const { scale } = this;
if (!scale || !this.isValid() || !validateCrossLineValue(getCrossLineValue(this), scale) || !this.visibilityCheck()) {
this.rangeGroup.visible = false;
this.lineGroup.visible = false;
this.labelGroup.visible = false;
return;
}
this.rangeGroup.visible = visible;
this.lineGroup.visible = visible;
this.labelGroup.visible = visible;
this.updateLineNode(visible);
this.updatePolygonNode(visible);
this.updateSectorNode(visible);
this.updateLabelNode(visible);
}
updateLineNode(visible) {
const { scale, type, value, lineNode: line } = this;
if (!visible || type !== "line" || !scale) {
line.visible = false;
return;
}
const angle = scale.convert(value);
if (isNaN(angle)) {
line.visible = false;
return;
}
const { axisInnerRadius, axisOuterRadius } = this;
line.visible = true;
line.stroke = this.stroke;
line.strokeOpacity = this.strokeOpacity ?? 1;
line.strokeWidth = this.strokeWidth ?? 1;
line.fill = void 0;
line.lineDash = this.lineDash;
const x = axisOuterRadius * Math.cos(angle);
const y = axisOuterRadius * Math.sin(angle);
const x0 = axisInnerRadius * Math.cos(angle);
const y0 = axisInnerRadius * Math.sin(angle);
line.path.clear(true);
line.path.moveTo(x0, y0);
line.path.lineTo(x, y);
this.assignCrossLineGroup(false, this.crossLineRange);
}
updatePolygonNode(visible) {
const { polygonNode: polygon, range: range2, scale, shape, type, ticks } = this;
if (!visible || type !== "range" || shape !== "polygon" || !scale || !range2) {
polygon.visible = false;
return;
}
const { axisInnerRadius, axisOuterRadius } = this;
const startIndex = ticks.indexOf(range2[0]);
const endIndex = ticks.indexOf(range2[1]);
const stops = startIndex <= endIndex ? ticks.slice(startIndex, endIndex + 1) : ticks.slice(startIndex).concat(ticks.slice(0, endIndex + 1));
const angles = stops.map((value) => scale.convert(value));
polygon.visible = true;
this.setSectorNodeProps(polygon);
const { path } = polygon;
path.clear(true);
angles.forEach((angle, index) => {
const x = axisOuterRadius * Math.cos(angle);
const y = axisOuterRadius * Math.sin(angle);
if (index === 0) {
path.moveTo(x, y);
} else {
path.lineTo(x, y);
}
});
if (axisInnerRadius === 0) {
path.lineTo(0, 0);
} else {
angles.slice().reverse().forEach((angle) => {
const x = axisInnerRadius * Math.cos(angle);
const y = axisInnerRadius * Math.sin(angle);
path.lineTo(x, y);
});
}
polygon.path.closePath();
this.assignCrossLineGroup(true, this.crossLineRange);
}
updateSectorNode(visible) {
const { sectorNode: sector, range: range2, scale, shape, type } = this;
if (!visible || type !== "range" || shape !== "circle" || !scale || !range2) {
sector.visible = false;
return;
}
const { axisInnerRadius, axisOuterRadius } = this;
const angles = range2.map((value) => scale.convert(value));
const step = scale.step ?? 0;
const padding = scale instanceof import_ag_charts_community3._ModuleSupport.BandScale ? step / 2 : 0;
sector.visible = true;
this.setSectorNodeProps(sector);
sector.centerX = 0;
sector.centerY = 0;
sector.innerRadius = axisInnerRadius;
sector.outerRadius = axisOuterRadius;
sector.startAngle = angles[0] - padding;
sector.endAngle = angles[1] + padding;
this.assignCrossLineGroup(true, this.crossLineRange);
}
updateLabelNode(visible) {
const { label, labelNode: node, range: range2, scale, type, ticks } = this;
if (!visible || label.enabled === false || !label.text || !scale || type === "range" && !range2) {
node.visible = false;
return;
}
node.visible = true;
const { axisInnerRadius, axisOuterRadius } = this;
let labelX;
let labelY;
let rotation;
let textBaseline;
if (type === "line") {
const angle = normalizeAngle360(scale.convert(this.value));
const angle270 = 1.5 * Math.PI;
const isRightSide = (0, import_ag_charts_core.isNumberEqual)(angle, angle270) || angle > angle270 || angle < Math.PI / 2;
const midX = (axisInnerRadius + axisOuterRadius) / 2 * Math.cos(angle);
const midY = (axisInnerRadius + axisOuterRadius) / 2 * Math.sin(angle);
labelX = midX + label.padding * Math.cos(angle + Math.PI / 2);
labelY = midY + label.padding * Math.sin(angle + Math.PI / 2);
textBaseline = isRightSide ? "top" : "bottom";
rotation = isRightSide ? angle : angle - Math.PI;
} else {
const [startAngle, endAngle] = range2.map((value) => normalizeAngle360(scale.convert(value)));
let angle = (startAngle + endAngle) / 2;
if (startAngle > endAngle) {
angle -= Math.PI;
}
angle = normalizeAngle360(angle);
const isBottomSide = ((0, import_ag_charts_core.isNumberEqual)(angle, 0) || angle > 0) && angle < Math.PI;
let distance;
if (this.shape === "circle" || ticks.length < 3) {
distance = axisOuterRadius - label.padding;
} else {
distance = axisOuterRadius * Math.cos(Math.PI / ticks.length) - label.padding;
}
labelX = distance * Math.cos(angle);
labelY = distance * Math.sin(angle);
textBaseline = isBottomSide ? "bottom" : "top";
rotation = isBottomSide ? angle - Math.PI / 2 : angle + Math.PI / 2;
}
this.setLabelNodeProps(node, labelX, labelY, textBaseline, rotation);
}
};
AngleCrossLine.className = "AngleCrossLine";
// packages/ag-charts-enterprise/src/axes/angle/angleAxis.ts
var {
ChartAxisDirection: ChartAxisDirection3,
NUMBER: NUMBER2,
UNION: UNION2,
ProxyOnWrite,
TextWrapper,
TextUtils,
TempValidate: TempValidate3,
toRadians,
normalizeAngle360: normalizeAngle3602,
normalizeAngle360Inclusive,
Path: Path2,
RotatableText: RotatableText2,
Transformable,
BBox
} = import_ag_charts_community4._ModuleSupport;
var AngleAxisLabel = class extends import_ag_charts_community4._ModuleSupport.AxisLabel {
constructor() {
super(...arguments);
this.orientation = "fixed";
}
};
__decorateClass([
TempValidate3(UNION2(["fixed", "parallel", "perpendicular"], "a label orientation"))
], AngleAxisLabel.prototype, "orientation", 2);
var AngleAxis = class extends import_ag_charts_community4._ModuleSupport.PolarAxis {
constructor(moduleCtx, scale) {
super(moduleCtx, scale);
this.startAngle = 0;
this.endAngle = void 0;
this.labelData = [];
this.tickData = [];
this.radiusLine = this.axisGroup.appendChild(new Path2());
this.includeInvisibleDomains = true;
}
get direction() {
return ChartAxisDirection3.X;
}
createLabel() {
return new AngleAxisLabel();
}
calculateTickLayout(domain) {
const { nice, scale } = this;
const ticksParams = {
nice,
interval: void 0,
tickCount: void 0,
minTickCount: 0,
maxTickCount: Infinity
};
const niceDomain = nice ? scale.niceDomain(ticksParams, domain) : domain;
const tickData = this.generateAngleTicks(niceDomain);
this.tickData = tickData;
const ticks = tickData.map((t) => t.value);
const fractionDigits = ticks.reduce(
(f, t) => Math.max(typeof t === "number" ? (0, import_ag_charts_core2.countFractionDigits)(t) : 0, f),
0
);
return {
niceDomain,
primaryTickCount: void 0,
tickDomain: niceDomain,
ticks,
fractionDigits,
bbox: this.getBBox()
};
}
update() {
super.update();
this.updateRadiusLine();
}
normalizedAngles() {
const startAngle = normalizeAngle3602(-Math.PI / 2 + toRadians(this.startAngle));
const sweep = this.endAngle != null ? normalizeAngle360Inclusive(toRadians(this.endAngle) - toRadians(this.startAngle)) : 2 * Math.PI;
const endAngle = startAngle + sweep;
return [startAngle, endAngle];
}
computeRange() {
this.range = this.normalizedAngles();
}
updateSelections() {
const data = this.tickData;
this.gridLineGroupSelection.update(this.gridLength && this.gridLine.enabled ? data : []);
this.tickLineGroupSelection.update(this.tick.enabled ? data : []);
this.tickLabelGroupSelection.update(this.label.enabled ? data : []);
this.gridLineGroupSelection.cleanup();
this.tickLineGroupSelection.cleanup();
this.tickLabelGroupSelection.cleanup();
}
updatePosition() {
const { translation, axisGroup, gridGroup, crossLineRangeGroup, crossLineLineGroup, crossLineLabelGroup } = this;
const translationX = Math.floor(translation.x);
const translationY = Math.floor(translation.y);
axisGroup.translationX = translationX;
axisGroup.translationY = translationY;
gridGroup.translationX = translationX;
gridGroup.translationY = translationY;
crossLineRangeGroup.translationX = translationX;
crossLineRangeGroup.translationY = translationY;
crossLineLineGroup.translationX = translationX;
crossLineLineGroup.translationY = translationY;
crossLineLabelGroup.translationX = translationX;
crossLineLabelGroup.translationY = translationY;
}
updateRadiusLine() {
const node = this.radiusLine;
const { path } = node;
path.clear(true);
const { points, closePath } = this.getAxisLinePoints();
points.forEach(({ x, y, moveTo, arc, radius = 0, startAngle = 0, endAngle = 0 }) => {
if (arc) {
path.arc(x, y, radius, startAngle, endAngle);
} else if (moveTo) {
path.moveTo(x, y);
} else {
path.lineTo(x, y);
}
});
if (closePath) {
path.closePath();
}
node.visible = this.line.enabled;
node.stroke = this.line.stroke;
node.strokeWidth = this.line.width;
node.fill = void 0;
}
getAxisLinePoints() {
const { scale, shape, gridLength: radius } = this;
const [startAngle, endAngle] = this.range;
const isFullCircle = (0, import_ag_charts_core2.isNumberEqual)(endAngle - startAngle, 2 * Math.PI);
const points = [];
if (shape === "circle") {
if (isFullCircle) {
points.push(
{ x: radius, y: 0, moveTo: true },
{
x: 0,
y: 0,
radius,
startAngle: 0,
endAngle: 2 * Math.PI,
arc: true,
moveTo: false
}
);
} else {
points.push(
{
x: radius * Math.cos(startAngle),
y: radius * Math.sin(startAngle),
moveTo: true
},
{
x: 0,
y: 0,
radius,
startAngle: normalizeAngle3602(startAngle),
endAngle: normalizeAngle3602(endAngle),
arc: true,
moveTo: false
}
);
}
} else if (shape === "polygon") {
const angles = scale.ticks({
nice: this.nice,
interval: void 0,
tickCount: void 0,
minTickCount: 0,
maxTickCount: Infinity
})?.map((value) => scale.convert(value));
if (angles && angles.length > 2) {
angles.forEach((angle, i) => {
const x = radius * Math.cos(angle);
const y = radius * Math.sin(angle);
const moveTo = i === 0;
points.push({ x, y, moveTo });
});
}
}
return { points, closePath: isFullCircle };
}
updateGridLines() {
const {
scale,
gridLength: radius,
gridLine: { style, width },
innerRadiusRatio
} = this;
if (!(style && radius > 0)) {
return;
}
const innerRadius = radius * innerRadiusRatio;
const styleCount = style.length;
this.gridLineGroupSelection.each((line, datum, index) => {
const { value } = datum;
const { stroke: stroke2, lineDash } = style[index % styleCount];
const angle = scale.convert(value);
line.x1 = innerRadius * Math.cos(angle);
line.y1 = innerRadius * Math.sin(angle);
line.x2 = radius * Math.cos(angle);
line.y2 = radius * Math.sin(angle);
line.stroke = stroke2;
line.strokeWidth = width;
line.lineDash = lineDash;
line.fill = void 0;
});
this.gridLineGroupSelection.cleanup();
}
updateLabels() {
const { label, tickLabelGroupSelection } = this;
tickLabelGroupSelection.each((node, _, index) => {
const labelDatum = this.labelData[index];
if (!labelDatum || labelDatum.hidden) {
node.visible = false;
return;
}
node.text = labelDatum.text;
node.setFont(label);
node.fill = label.color;
node.x = labelDatum.x;
node.y = labelDatum.y;
node.textAlign = labelDatum.textAlign;
node.textBaseline = labelDatum.textBaseline;
node.visible = true;
if (labelDatum.rotation) {
node.rotation = labelDatum.rotation;
node.rotationCenterX = labelDatum.x;
node.rotationCenterY = labelDatum.y;
} else {
node.rotation = 0;
}
});
}
updateTickLines() {
const { scale, gridLength: radius, tick, tickLineGroupSelection } = this;
tickLineGroupSelection.each((line, datum) => {
const { value } = datum;
const angle = scale.convert(value);
const cos = Math.cos(angle);
const sin = Math.sin(angle);
line.x1 = radius * cos;
line.y1 = radius * sin;
line.x2 = (radius + tick.size) * cos;
line.y2 = (radius + tick.size) * sin;
line.stroke = tick.stroke;
line.strokeWidth = tick.width;
});
}
createLabelNodeData(ticks, options, seriesRect) {
const { label, gridLength: radius, scale, tick } = this;
if (!label.enabled) {
return [];
}
const tempText2 = new RotatableText2();
const seriesLeft = seriesRect.x - this.translation.x;
const seriesRight = seriesRect.x + seriesRect.width - this.translation.x;
const labelData = ticks.map((datum, index) => {
const { value } = datum;
const distance = radius + label.spacing + tick.size;
const angle = scale.convert(value);
const cos = Math.cos(angle);
const sin = Math.sin(angle);
const x = distance * cos;
const y = distance * sin;
const { textAlign, textBaseline } = this.getLabelAlign(angle);
const isLastTickOverFirst = index === ticks.length - 1 && value !== ticks[0] && (0, import_ag_charts_core2.isNumberEqual)(normalizeAngle3602(angle), normalizeAngle3602(scale.convert(ticks[0])));
const rotation = this.getLabelRotation(angle);
let text2 = this.formatTick(value, index, scale.domain);
tempText2.text = text2;
tempText2.x = x;
tempText2.y = y;
tempText2.setFont(label);
tempText2.textAlign = textAlign;
tempText2.textBaseline = textBaseline;
tempText2.rotation = rotation;
if (rotation) {
tempText2.rotationCenterX = x;
tempText2.rotationCenterY = y;
}
let box = rotation ? Transformable.toCanvas(tempText2) : tempText2.getBBox();
if (box && options.hideWhenNecessary && !rotation) {
const overflowLeft = seriesLeft - box.x;
const overflowRight = box.x + box.width - seriesRight;
const pixelError = 1;
if (overflowLeft > pixelError || overflowRight > pixelError) {
const availWidth = box.width - Math.max(overflowLeft, overflowRight);
text2 = TextWrapper.wrapText(text2, { maxWidth: availWidth, font: label, textWrap: "never" });
if (text2 === TextUtils.EllipsisChar) {
text2 = "";
}
tempText2.text = text2;
box = tempText2.getBBox();
}
}
return {
text: text2,
x,
y,
textAlign,
textBaseline,
hidden: text2 === "" || datum.hidden || isLastTickOverFirst,
rotation,
box
};
});
if (label.avoidCollisions) {
this.avoidLabelCollisions(labelData);
}
return labelData;
}
computeLabelsBBox(options, seriesRect) {
this.labelData = this.createLabelNodeData(this.tickData, options, seriesRect);
const textBoxes = this.labelData.map(({ box }) => box).filter((box) => box != null);
if (!this.label.enabled || textBoxes.length === 0) {
return null;
}
return BBox.merge(textBoxes);
}
getLabelOrientation() {
const { label } = this;
return label instanceof AngleAxisLabel ? label.orientation : "fixed";
}
getLabelRotation(tickAngle) {
let rotation = toRadians(this.label.rotation ?? 0);
tickAngle = normalizeAngle3602(tickAngle);
const orientation = this.getLabelOrientation();
if (orientation === "parallel") {
rotation += tickAngle;
if (tickAngle >= 0 && tickAngle < Math.PI) {
rotation -= Math.PI / 2;
} else {
rotation += Math.PI / 2;
}
} else if (orientation === "perpendicular") {
rotation += tickAngle;
if (tickAngle >= Math.PI / 2 && tickAngle < 1.5 * Math.PI) {
rotation += Math.PI;
}
}
return rotation;
}
getLabelAlign(tickAngle) {
const cos = Math.cos(tickAngle);
const sin = Math.sin(tickAngle);
let textAlign;
let textBaseline;
const orientation = this.getLabelOrientation();
const isCos0 = (0, import_ag_charts_core2.isNumberEqual)(cos, 0);
const isSin0 = (0, import_ag_charts_core2.isNumberEqual)(sin, 0);
const isCos1 = (0, import_ag_charts_core2.isNumberEqual)(cos, 1);
const isSinMinus1 = (0, import_ag_charts_core2.isNumberEqual)(sin, -1);
const isCosPositive = cos > 0 && !isCos0;
const isSinPositive = sin > 0 && !isSin0;
if (orientation === "parallel") {
textAlign = "center";
textBaseline = isCos1 && isSin0 || isSinPositive ? "top" : "bottom";
} else if (orientation === "perpendicular") {
textAlign = isSinMinus1 || isCosPositive ? "left" : "right";
textBaseline = "middle";
} else {
textAlign = "right";
if (isCos0) {
textAlign = "center";
} else if (isCosPositive) {
textAlign = "left";
}
textBaseline = "bottom";
if (isSin0) {
textBaseline = "middle";
} else if (isSinPositive) {
textBaseline = "top";
}
}
return { textAlign, textBaseline };
}
updateCrossLines() {
const { shape, gridLength: radius, innerRadiusRatio } = this;
this.crossLines.forEach((crossLine) => {
if (crossLine instanceof AngleCrossLine) {
crossLine.ticks = this.tickData.map((t) => t.value);
crossLine.shape = shape;
crossLine.axisOuterRadius = radius;
crossLine.axisInnerRadius = radius * innerRadiusRatio;
}
});
super.updateCrossLines();
}
};
AngleAxis.CrossLineConstructor = AngleCrossLine;
__decorateClass([
ProxyOnWrite("rotation"),
TempValidate3(NUMBER2)
], AngleAxis.prototype, "startAngle", 2);
__decorateClass([
TempValidate3(NUMBER2, { optional: true })
], AngleAxis.prototype, "endAngle", 2);
// packages/ag-charts-enterprise/src/axes/angle-category/angleCategoryAxis.ts
var { RATIO: RATIO2, OBJECT: OBJECT2, TempValidate: TempValidate4, CategoryScale } = import_ag_charts_community5._ModuleSupport;
var AngleCategoryAxis = class extends AngleAxis {
constructor(moduleCtx) {
super(moduleCtx, new CategoryScale());
this.groupPaddingInner = 0;
this.paddingInner = 0;
this.interval = new AngleAxisInterval();
}
generateAngleTicks() {
const { scale, gridLength: radius } = this;
const { values, minSpacing } = this.interval;
const ticks = values ?? scale.ticks({
nice: this.nice,
interval: void 0,
tickCount: void 0,
minTickCount: 0,
maxTickCount: Infinity
}) ?? [];
if (ticks.length < 2 || minSpacing == null) {
return ticks.map((value) => {
return { value, visible: true };
});
}
const startTick = ticks[0];
const startAngle = scale.convert(startTick);
const startX = radius * Math.cos(startAngle);
const startY = radius * Math.sin(startAngle);
for (let step = 1; step < ticks.length - 1; step++) {
const nextTick = ticks[step];
const nextAngle = scale.convert(nextTick);
if (nextAngle - startAngle > Math.PI) {
break;
}
const nextX = radius * Math.cos(nextAngle);
const nextY = radius * Math.sin(nextAngle);
const spacing = Math.sqrt((nextX - startX) ** 2 + (nextY - startY) ** 2);
if (spacing > minSpacing) {
const visibleTicks = /* @__PURE__ */ new Set([startTick]);
loopSymmetrically(ticks, step, (_, next) => {
visibleTicks.add(next);
});
return ticks.map((value) => {
const visible = visibleTicks.has(value);
return { value, visible };
});
}
}
return [{ value: startTick, visible: true }];
}
avoidLabelCollisions(labelData) {
const { minSpacing } = this.label;
if (labelData.length < 3)
return;
const labelsCollide = (prev, next) => {
if (prev.hidden || next.hidden) {
return false;
} else if (minSpacing == null) {
return prev.box.co