hyperprop-charting-library 0.1.53 → 0.1.54

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.
@@ -2541,8 +2541,14 @@ function createChart(element, options = {}) {
2541
2541
  drawOrderLine(orderLine, yFromPrice, chartLeft, chartTop, chartRight, chartBottom);
2542
2542
  }
2543
2543
  if (labels.visible && (labels.showIndicatorNames || labels.showIndicatorValues)) {
2544
- const labelEntries = [...activeOverlayIndicators, ...activeSeparateIndicators].map(({ indicator, plugin }) => {
2545
- const inputValues = Object.entries(indicator.inputs).filter(([, value]) => typeof value === "number" || typeof value === "string" || typeof value === "boolean").slice(0, 2).map(([, value]) => String(value));
2544
+ const isLegendInputValue = (value) => {
2545
+ if (typeof value === "number" || typeof value === "boolean") {
2546
+ return true;
2547
+ }
2548
+ return typeof value === "string" && !/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value.trim());
2549
+ };
2550
+ const labelEntries = activeOverlayIndicators.map(({ indicator, plugin }) => {
2551
+ const inputValues = Object.entries(indicator.inputs).filter(([, value]) => isLegendInputValue(value)).slice(0, 2).map(([, value]) => String(value));
2546
2552
  if (labels.showIndicatorNames && labels.showIndicatorValues && inputValues.length > 0) {
2547
2553
  return `${plugin.name} ${inputValues.join(" ")}`;
2548
2554
  }
@@ -2517,8 +2517,14 @@ function createChart(element, options = {}) {
2517
2517
  drawOrderLine(orderLine, yFromPrice, chartLeft, chartTop, chartRight, chartBottom);
2518
2518
  }
2519
2519
  if (labels.visible && (labels.showIndicatorNames || labels.showIndicatorValues)) {
2520
- const labelEntries = [...activeOverlayIndicators, ...activeSeparateIndicators].map(({ indicator, plugin }) => {
2521
- const inputValues = Object.entries(indicator.inputs).filter(([, value]) => typeof value === "number" || typeof value === "string" || typeof value === "boolean").slice(0, 2).map(([, value]) => String(value));
2520
+ const isLegendInputValue = (value) => {
2521
+ if (typeof value === "number" || typeof value === "boolean") {
2522
+ return true;
2523
+ }
2524
+ return typeof value === "string" && !/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value.trim());
2525
+ };
2526
+ const labelEntries = activeOverlayIndicators.map(({ indicator, plugin }) => {
2527
+ const inputValues = Object.entries(indicator.inputs).filter(([, value]) => isLegendInputValue(value)).slice(0, 2).map(([, value]) => String(value));
2522
2528
  if (labels.showIndicatorNames && labels.showIndicatorValues && inputValues.length > 0) {
2523
2529
  return `${plugin.name} ${inputValues.join(" ")}`;
2524
2530
  }
package/dist/index.cjs CHANGED
@@ -2541,8 +2541,14 @@ function createChart(element, options = {}) {
2541
2541
  drawOrderLine(orderLine, yFromPrice, chartLeft, chartTop, chartRight, chartBottom);
2542
2542
  }
2543
2543
  if (labels.visible && (labels.showIndicatorNames || labels.showIndicatorValues)) {
2544
- const labelEntries = [...activeOverlayIndicators, ...activeSeparateIndicators].map(({ indicator, plugin }) => {
2545
- const inputValues = Object.entries(indicator.inputs).filter(([, value]) => typeof value === "number" || typeof value === "string" || typeof value === "boolean").slice(0, 2).map(([, value]) => String(value));
2544
+ const isLegendInputValue = (value) => {
2545
+ if (typeof value === "number" || typeof value === "boolean") {
2546
+ return true;
2547
+ }
2548
+ return typeof value === "string" && !/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value.trim());
2549
+ };
2550
+ const labelEntries = activeOverlayIndicators.map(({ indicator, plugin }) => {
2551
+ const inputValues = Object.entries(indicator.inputs).filter(([, value]) => isLegendInputValue(value)).slice(0, 2).map(([, value]) => String(value));
2546
2552
  if (labels.showIndicatorNames && labels.showIndicatorValues && inputValues.length > 0) {
2547
2553
  return `${plugin.name} ${inputValues.join(" ")}`;
2548
2554
  }
package/dist/index.js CHANGED
@@ -2517,8 +2517,14 @@ function createChart(element, options = {}) {
2517
2517
  drawOrderLine(orderLine, yFromPrice, chartLeft, chartTop, chartRight, chartBottom);
2518
2518
  }
2519
2519
  if (labels.visible && (labels.showIndicatorNames || labels.showIndicatorValues)) {
2520
- const labelEntries = [...activeOverlayIndicators, ...activeSeparateIndicators].map(({ indicator, plugin }) => {
2521
- const inputValues = Object.entries(indicator.inputs).filter(([, value]) => typeof value === "number" || typeof value === "string" || typeof value === "boolean").slice(0, 2).map(([, value]) => String(value));
2520
+ const isLegendInputValue = (value) => {
2521
+ if (typeof value === "number" || typeof value === "boolean") {
2522
+ return true;
2523
+ }
2524
+ return typeof value === "string" && !/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value.trim());
2525
+ };
2526
+ const labelEntries = activeOverlayIndicators.map(({ indicator, plugin }) => {
2527
+ const inputValues = Object.entries(indicator.inputs).filter(([, value]) => isLegendInputValue(value)).slice(0, 2).map(([, value]) => String(value));
2522
2528
  if (labels.showIndicatorNames && labels.showIndicatorValues && inputValues.length > 0) {
2523
2529
  return `${plugin.name} ${inputValues.join(" ")}`;
2524
2530
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",