@constela/runtime 2.0.9 → 2.0.10

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -974,6 +974,7 @@ var GLOBAL_FUNCTIONS = {
974
974
  getRadarAxes: (labels, cx, cy, radius) => getRadarAxes(labels, cx, cy, radius),
975
975
  // Chart helpers - Utilities
976
976
  getChartBounds: (data, valueKey) => getChartBounds(data, valueKey),
977
+ scaleChartY: (value, boundsMin, boundsMax, height, paddingTop, paddingBottom) => scaleChartY(value, boundsMin, boundsMax, height, paddingTop, paddingBottom),
977
978
  generateTicks: (min, max, count) => generateTicks(min, max, count),
978
979
  // Chart helpers - Data aggregation
979
980
  binData: (data, valueKey, binCount) => binData(data, valueKey, binCount),
@@ -1330,6 +1331,20 @@ function scaleValue(value, domainMin, domainMax, rangeMin, rangeMax) {
1330
1331
  const normalized = (value - domainMin) / (domainMax - domainMin);
1331
1332
  return rangeMin + normalized * (rangeMax - rangeMin);
1332
1333
  }
1334
+ function scaleChartY(value, boundsMin, boundsMax, height, paddingTop, paddingBottom) {
1335
+ if (typeof value !== "number" || typeof boundsMin !== "number" || typeof boundsMax !== "number" || typeof height !== "number" || typeof paddingTop !== "number" || typeof paddingBottom !== "number") {
1336
+ return void 0;
1337
+ }
1338
+ const drawableHeight = height - paddingTop - paddingBottom;
1339
+ if (drawableHeight <= 0) {
1340
+ return paddingTop;
1341
+ }
1342
+ if (boundsMax === boundsMin) {
1343
+ return paddingTop + drawableHeight / 2;
1344
+ }
1345
+ const normalized = (value - boundsMin) / (boundsMax - boundsMin);
1346
+ return paddingTop + drawableHeight * (1 - normalized);
1347
+ }
1333
1348
  function getBarDimensions(data, index, width, height, gap, orientation) {
1334
1349
  if (!Array.isArray(data) || data.length === 0) {
1335
1350
  return void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/runtime",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "Runtime DOM renderer for Constela UI framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",