hyperprop-charting-library 0.1.14 → 0.1.15

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/README.md CHANGED
@@ -54,7 +54,9 @@ If fast ticks make right-side labels jitter, keep width stable:
54
54
  const chart = createChart(root, {
55
55
  priceDecimals: 2,
56
56
  stabilizePriceLabels: true,
57
- priceLabelMinIntegerDigits: 4
57
+ priceLabelMinIntegerDigits: 4,
58
+ // strongest lock (optional):
59
+ // priceLabelWidthTemplate: "88888.88"
58
60
  });
59
61
  ```
60
62
 
@@ -128,6 +128,7 @@ var DEFAULT_OPTIONS = {
128
128
  priceDecimals: 2,
129
129
  stabilizePriceLabels: true,
130
130
  priceLabelMinIntegerDigits: 3,
131
+ priceLabelWidthTemplate: "",
131
132
  initialViewport: "latest",
132
133
  initialVisibleBars: 60,
133
134
  minVisibleBars: 5,
@@ -368,6 +369,10 @@ function createChart(element, options = {}) {
368
369
  return price.toFixed(decimals);
369
370
  };
370
371
  const getStabilizedPriceTemplate = () => {
372
+ const explicitTemplate = mergedOptions.priceLabelWidthTemplate.trim();
373
+ if (explicitTemplate.length > 0) {
374
+ return explicitTemplate;
375
+ }
371
376
  const decimals = clamp(Math.round(mergedOptions.priceDecimals), 0, 8);
372
377
  const configuredDigits = Math.max(1, Math.floor(mergedOptions.priceLabelMinIntegerDigits));
373
378
  let maxAbsPrice = 0;
@@ -7,6 +7,7 @@ interface ChartOptions {
7
7
  priceDecimals?: number;
8
8
  stabilizePriceLabels?: boolean;
9
9
  priceLabelMinIntegerDigits?: number;
10
+ priceLabelWidthTemplate?: string;
10
11
  initialViewport?: "latest" | "center";
11
12
  initialVisibleBars?: number;
12
13
  minVisibleBars?: number;
@@ -104,6 +104,7 @@ var DEFAULT_OPTIONS = {
104
104
  priceDecimals: 2,
105
105
  stabilizePriceLabels: true,
106
106
  priceLabelMinIntegerDigits: 3,
107
+ priceLabelWidthTemplate: "",
107
108
  initialViewport: "latest",
108
109
  initialVisibleBars: 60,
109
110
  minVisibleBars: 5,
@@ -344,6 +345,10 @@ function createChart(element, options = {}) {
344
345
  return price.toFixed(decimals);
345
346
  };
346
347
  const getStabilizedPriceTemplate = () => {
348
+ const explicitTemplate = mergedOptions.priceLabelWidthTemplate.trim();
349
+ if (explicitTemplate.length > 0) {
350
+ return explicitTemplate;
351
+ }
347
352
  const decimals = clamp(Math.round(mergedOptions.priceDecimals), 0, 8);
348
353
  const configuredDigits = Math.max(1, Math.floor(mergedOptions.priceLabelMinIntegerDigits));
349
354
  let maxAbsPrice = 0;
package/dist/index.cjs CHANGED
@@ -128,6 +128,7 @@ var DEFAULT_OPTIONS = {
128
128
  priceDecimals: 2,
129
129
  stabilizePriceLabels: true,
130
130
  priceLabelMinIntegerDigits: 3,
131
+ priceLabelWidthTemplate: "",
131
132
  initialViewport: "latest",
132
133
  initialVisibleBars: 60,
133
134
  minVisibleBars: 5,
@@ -368,6 +369,10 @@ function createChart(element, options = {}) {
368
369
  return price.toFixed(decimals);
369
370
  };
370
371
  const getStabilizedPriceTemplate = () => {
372
+ const explicitTemplate = mergedOptions.priceLabelWidthTemplate.trim();
373
+ if (explicitTemplate.length > 0) {
374
+ return explicitTemplate;
375
+ }
371
376
  const decimals = clamp(Math.round(mergedOptions.priceDecimals), 0, 8);
372
377
  const configuredDigits = Math.max(1, Math.floor(mergedOptions.priceLabelMinIntegerDigits));
373
378
  let maxAbsPrice = 0;
package/dist/index.d.cts CHANGED
@@ -7,6 +7,7 @@ interface ChartOptions {
7
7
  priceDecimals?: number;
8
8
  stabilizePriceLabels?: boolean;
9
9
  priceLabelMinIntegerDigits?: number;
10
+ priceLabelWidthTemplate?: string;
10
11
  initialViewport?: "latest" | "center";
11
12
  initialVisibleBars?: number;
12
13
  minVisibleBars?: number;
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ interface ChartOptions {
7
7
  priceDecimals?: number;
8
8
  stabilizePriceLabels?: boolean;
9
9
  priceLabelMinIntegerDigits?: number;
10
+ priceLabelWidthTemplate?: string;
10
11
  initialViewport?: "latest" | "center";
11
12
  initialVisibleBars?: number;
12
13
  minVisibleBars?: number;
package/dist/index.js CHANGED
@@ -104,6 +104,7 @@ var DEFAULT_OPTIONS = {
104
104
  priceDecimals: 2,
105
105
  stabilizePriceLabels: true,
106
106
  priceLabelMinIntegerDigits: 3,
107
+ priceLabelWidthTemplate: "",
107
108
  initialViewport: "latest",
108
109
  initialVisibleBars: 60,
109
110
  minVisibleBars: 5,
@@ -344,6 +345,10 @@ function createChart(element, options = {}) {
344
345
  return price.toFixed(decimals);
345
346
  };
346
347
  const getStabilizedPriceTemplate = () => {
348
+ const explicitTemplate = mergedOptions.priceLabelWidthTemplate.trim();
349
+ if (explicitTemplate.length > 0) {
350
+ return explicitTemplate;
351
+ }
347
352
  const decimals = clamp(Math.round(mergedOptions.priceDecimals), 0, 8);
348
353
  const configuredDigits = Math.max(1, Math.floor(mergedOptions.priceLabelMinIntegerDigits));
349
354
  let maxAbsPrice = 0;
package/docs/API.md CHANGED
@@ -35,6 +35,7 @@ Top-level options:
35
35
  - `priceDecimals` (default `2`, used for axis/ticker/line price labels)
36
36
  - `stabilizePriceLabels` (default `true`, prevents ticker/crosshair/price-tag width jitter)
37
37
  - `priceLabelMinIntegerDigits` (default `3`, baseline integer-digit width for stabilized labels)
38
+ - `priceLabelWidthTemplate` (default `""`; when set, forces label width from this template, e.g. `"88888.88"`)
38
39
  - `initialViewport` (`"latest"` | `"center"`, default `"latest"`)
39
40
  - `initialVisibleBars` (default `60`)
40
41
  - `minVisibleBars` (default `5`, lower clamp for x zoom)
package/docs/RECIPES.md CHANGED
@@ -57,7 +57,9 @@ const chart = createChart(root, {
57
57
  const chart = createChart(root, {
58
58
  priceDecimals: 2,
59
59
  stabilizePriceLabels: true,
60
- priceLabelMinIntegerDigits: 4
60
+ priceLabelMinIntegerDigits: 4,
61
+ // If you still see any width movement, pin exact width:
62
+ // priceLabelWidthTemplate: "88888.88"
61
63
  });
62
64
  ```
63
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",