@carbon/charts 0.51.0 → 0.51.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon/charts",
3
- "version": "0.51.0",
3
+ "version": "0.51.1",
4
4
  "description": "Carbon charting components",
5
5
  "main": "./bundle.js",
6
6
  "module": "./index.js",
@@ -68,7 +68,9 @@ export function polarToCartesianCoords(a, r, t) {
68
68
  if (t === void 0) { t = { x: 0, y: 0 }; }
69
69
  var x = r * Math.cos(a) + t.x;
70
70
  var y = r * Math.sin(a) + t.y;
71
- return { x: x, y: y };
71
+ // NaN is rendered at coordinate 0 in browsers
72
+ // By setting it to 0, further operations can be performed
73
+ return { x: isNaN(x) ? 0 : x, y: isNaN(y) ? 0 : y };
72
74
  }
73
75
  // Return the distance between a point (described with polar coordinates)
74
76
  // on a circumference and the vertical diameter.
@@ -1 +1 @@
1
- {"version":3,"file":"angle-utils.js","sourceRoot":"","sources":["angle-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAcnE,MAAM,UAAU,oBAAoB,CAAC,YAAmB;IACvD,IAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC;IAE/C,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE;QAC5D,OAAO;YACN,UAAU,EAAE,UAAU,CAAC,KAAK;YAC5B,gBAAgB,EAAE,gBAAgB,CAAC,MAAM;SACzC,CAAC;KACF;SAAM,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE;QACtC,OAAO;YACN,UAAU,EAAE,UAAU,CA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C,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,SAAS,CAAC,CAAS,EAAE,EAA4B;QAA3B,WAAG,EAAE,WAAG;IACtC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAU;IAClC,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAU;IAClC,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,sBAAsB,CACrC,CAAQ,EACR,CAAS,EACT,CAAyB;IAAzB,kBAAA,EAAA,MAAa,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAEzB,IAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChC,IAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChC,OAAO,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,CAAC;AACjB,CAAC;AAED,yEAAyE;AACzE,gDAAgD;AAChD,yEAAyE;AACzE,mEAAmE;AACnE,MAAM,UAAU,6CAA6C,CAC5D,CAAQ,EACR,CAAS;IAET,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { TextAnchor, DominantBaseline } from '../interfaces/enums';\n\nexport interface Point {\n\tx: number;\n\ty: number;\n}\n\nexport type Angle = number;\n\ninterface LabelAlignment {\n\ttextAnchor: TextAnchor;\n\tdominantBaseline: DominantBaseline;\n}\n\nexport function radialLabelPlacement(angleRadians: Angle): LabelAlignment {\n\tconst angle = mod(radToDeg(angleRadians), 360);\n\n\tif (isInRange(angle, [0, 10]) || isInRange(angle, [350, 0])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.START,\n\t\t\tdominantBaseline: DominantBaseline.MIDDLE,\n\t\t};\n\t} else if (isInRange(angle, [10, 80])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.START,\n\t\t\tdominantBaseline: DominantBaseline.HANGING,\n\t\t};\n\t} else if (isInRange(angle, [80, 100])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.MIDDLE,\n\t\t\tdominantBaseline: DominantBaseline.HANGING,\n\t\t};\n\t} else if (isInRange(angle, [100, 170])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.END,\n\t\t\tdominantBaseline: DominantBaseline.HANGING,\n\t\t};\n\t} else if (isInRange(angle, [170, 190])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.END,\n\t\t\tdominantBaseline: DominantBaseline.MIDDLE,\n\t\t};\n\t} else if (isInRange(angle, [190, 260])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.END,\n\t\t\tdominantBaseline: DominantBaseline.BASELINE,\n\t\t};\n\t} else if (isInRange(angle, [260, 280])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.MIDDLE,\n\t\t\tdominantBaseline: DominantBaseline.BASELINE,\n\t\t};\n\t} else {\n\t\t// 280 - 350\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.START,\n\t\t\tdominantBaseline: DominantBaseline.BASELINE,\n\t\t};\n\t}\n}\n\nfunction mod(n: number, m: number) {\n\treturn ((n % m) + m) % m;\n}\n\nfunction isInRange(x: number, [min, max]: [number, number]) {\n\treturn x >= min && x <= max;\n}\n\nexport function radToDeg(rad: Angle): Angle {\n\treturn rad * (180 / Math.PI);\n}\n\nexport function degToRad(deg: Angle): Angle {\n\treturn deg * (Math.PI / 180);\n}\n\nexport function polarToCartesianCoords(\n\ta: Angle,\n\tr: number,\n\tt: Point = { x: 0, y: 0 }\n): Point {\n\tconst x = r * Math.cos(a) + t.x;\n\tconst y = r * Math.sin(a) + t.y;\n\treturn { x, y };\n}\n\n// Return the distance between a point (described with polar coordinates)\n// on a circumference and the vertical diameter.\n// If the point is on the left if the diameter, its distance is positive,\n// if it is on the right of the diameter, its distance is negative.\nexport function distanceBetweenPointOnCircAndVerticalDiameter(\n\ta: Angle,\n\tr: number\n) {\n\treturn r * Math.sin(a - Math.PI / 2);\n}\n"]}
1
+ {"version":3,"file":"angle-utils.js","sourceRoot":"","sources":["angle-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAcnE,MAAM,UAAU,oBAAoB,CAAC,YAAmB;IACvD,IAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC;IAE/C,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE;QAC5D,OAAO;YACN,UAAU,EAAE,UAAU,CAAC,KAAK;YAC5B,gBAAgB,EAAE,gBAAgB,CAAC,MAAM;SACzC,CAAC;KACF;SAAM,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE;QACtC,OAAO;YACN,UAAU,EAAE,UAAU,CAAC,KAAK;YAC5B,gBAAgB,EAAE,gBAAgB,CAAC,OAAO;SAC1C,CAAC;KACF;SAAM,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE;QACvC,OAAO;YACN,UAAU,EAAE,UAAU,CAAC,MAAM;YAC7B,gBAAgB,EAAE,gBAAgB,CAAC,OAAO;SAC1C,CAAC;KACF;SAAM,IAAI,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AC,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAU;IAClC,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,sBAAsB,CACrC,CAAQ,EACR,CAAS,EACT,CAAyB;IAAzB,kBAAA,EAAA,MAAa,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAEzB,IAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChC,IAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEhC,8CAA8C;IAC9C,0DAA0D;IAC1D,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,yEAAyE;AACzE,gDAAgD;AAChD,yEAAyE;AACzE,mEAAmE;AACnE,MAAM,UAAU,6CAA6C,CAC5D,CAAQ,EACR,CAAS;IAET,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { TextAnchor, DominantBaseline } from '../interfaces/enums';\n\nexport interface Point {\n\tx: number;\n\ty: number;\n}\n\nexport type Angle = number;\n\ninterface LabelAlignment {\n\ttextAnchor: TextAnchor;\n\tdominantBaseline: DominantBaseline;\n}\n\nexport function radialLabelPlacement(angleRadians: Angle): LabelAlignment {\n\tconst angle = mod(radToDeg(angleRadians), 360);\n\n\tif (isInRange(angle, [0, 10]) || isInRange(angle, [350, 0])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.START,\n\t\t\tdominantBaseline: DominantBaseline.MIDDLE,\n\t\t};\n\t} else if (isInRange(angle, [10, 80])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.START,\n\t\t\tdominantBaseline: DominantBaseline.HANGING,\n\t\t};\n\t} else if (isInRange(angle, [80, 100])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.MIDDLE,\n\t\t\tdominantBaseline: DominantBaseline.HANGING,\n\t\t};\n\t} else if (isInRange(angle, [100, 170])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.END,\n\t\t\tdominantBaseline: DominantBaseline.HANGING,\n\t\t};\n\t} else if (isInRange(angle, [170, 190])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.END,\n\t\t\tdominantBaseline: DominantBaseline.MIDDLE,\n\t\t};\n\t} else if (isInRange(angle, [190, 260])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.END,\n\t\t\tdominantBaseline: DominantBaseline.BASELINE,\n\t\t};\n\t} else if (isInRange(angle, [260, 280])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.MIDDLE,\n\t\t\tdominantBaseline: DominantBaseline.BASELINE,\n\t\t};\n\t} else {\n\t\t// 280 - 350\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.START,\n\t\t\tdominantBaseline: DominantBaseline.BASELINE,\n\t\t};\n\t}\n}\n\nfunction mod(n: number, m: number) {\n\treturn ((n % m) + m) % m;\n}\n\nfunction isInRange(x: number, [min, max]: [number, number]) {\n\treturn x >= min && x <= max;\n}\n\nexport function radToDeg(rad: Angle): Angle {\n\treturn rad * (180 / Math.PI);\n}\n\nexport function degToRad(deg: Angle): Angle {\n\treturn deg * (Math.PI / 180);\n}\n\nexport function polarToCartesianCoords(\n\ta: Angle,\n\tr: number,\n\tt: Point = { x: 0, y: 0 }\n): Point {\n\tconst x = r * Math.cos(a) + t.x;\n\tconst y = r * Math.sin(a) + t.y;\n\n\t// NaN is rendered at coordinate 0 in browsers\n\t// By setting it to 0, further operations can be performed\n\treturn { x: isNaN(x) ? 0 : x, y: isNaN(y) ? 0 : y };\n}\n\n// Return the distance between a point (described with polar coordinates)\n// on a circumference and the vertical diameter.\n// If the point is on the left if the diameter, its distance is positive,\n// if it is on the right of the diameter, its distance is negative.\nexport function distanceBetweenPointOnCircAndVerticalDiameter(\n\ta: Angle,\n\tr: number\n) {\n\treturn r * Math.sin(a - Math.PI / 2);\n}\n"]}
@@ -414,7 +414,7 @@
414
414
  "signature": "a9b0d32f1fa317d79f856036abed65ce6367b88d367ef743886ac6bd76f7adc7"
415
415
  },
416
416
  "../src/services/angle-utils.ts": {
417
- "version": "1343417043b486114240a3d6e52467ddab449aecff57512731eef13fe2cb08a7",
417
+ "version": "ffcb2333af918b68ef832e9ac9c41f4944ac37fe5be4d951647e65c1c288eb72",
418
418
  "signature": "4798872bc73b632e7cbb5dcb7211c2d991234c273068d0dbc0c87f0e776d0ce4"
419
419
  },
420
420
  "../src/components/graphs/radar.ts": {