hyperprop-charting-library 0.1.111 → 0.1.112

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.
@@ -1650,23 +1650,26 @@ function createChart(element, options = {}) {
1650
1650
  if (!mergedLine.visible || !Number.isFinite(renderPrice)) {
1651
1651
  return;
1652
1652
  }
1653
+ const rawLineY = yFromPrice(renderPrice);
1653
1654
  const lineY = getLineY(renderPrice, yFromPrice, chartTop, chartBottom, mergedLine.pinOutOfRange);
1655
+ if (Number.isFinite(mergedLine.fillToPrice) && Number.isFinite(rawLineY)) {
1656
+ const fillY = getLineY(mergedLine.fillToPrice, yFromPrice, chartTop, chartBottom, true);
1657
+ if (fillY !== null) {
1658
+ const zoneY = clamp(rawLineY, chartTop + 1, chartBottom - 1);
1659
+ const topY = Math.min(zoneY, fillY);
1660
+ const heightY = Math.abs(zoneY - fillY);
1661
+ if (heightY >= 1) {
1662
+ ctx.save();
1663
+ ctx.fillStyle = mergedLine.fillColor ?? "rgba(37,99,235,0.18)";
1664
+ ctx.fillRect(Math.round(chartLeft), Math.round(topY), Math.max(1, Math.round(chartRight - chartLeft)), Math.round(heightY));
1665
+ ctx.restore();
1666
+ }
1667
+ }
1668
+ }
1654
1669
  if (lineY === null) {
1655
1670
  return;
1656
1671
  }
1657
1672
  const color = line.color ?? (mergedLine.type === "takeProfit" ? "rgba(45,212,191,0.86)" : mergedLine.type === "stop" ? "rgba(245,158,11,0.86)" : "rgba(59,130,246,0.8)");
1658
- if (Number.isFinite(mergedLine.fillToPrice)) {
1659
- const fillY = getLineY(mergedLine.fillToPrice, yFromPrice, chartTop, chartBottom, true);
1660
- if (fillY === null) {
1661
- return;
1662
- }
1663
- const topY = Math.min(lineY, fillY);
1664
- const heightY = Math.max(1, Math.abs(lineY - fillY));
1665
- ctx.save();
1666
- ctx.fillStyle = mergedLine.fillColor ?? "rgba(37,99,235,0.18)";
1667
- ctx.fillRect(Math.round(chartLeft), Math.round(topY), Math.max(1, Math.round(chartRight - chartLeft)), Math.round(heightY));
1668
- ctx.restore();
1669
- }
1670
1673
  ctx.save();
1671
1674
  ctx.strokeStyle = color;
1672
1675
  ctx.lineWidth = Math.max(1, mergedLine.thickness);
@@ -1624,23 +1624,26 @@ function createChart(element, options = {}) {
1624
1624
  if (!mergedLine.visible || !Number.isFinite(renderPrice)) {
1625
1625
  return;
1626
1626
  }
1627
+ const rawLineY = yFromPrice(renderPrice);
1627
1628
  const lineY = getLineY(renderPrice, yFromPrice, chartTop, chartBottom, mergedLine.pinOutOfRange);
1629
+ if (Number.isFinite(mergedLine.fillToPrice) && Number.isFinite(rawLineY)) {
1630
+ const fillY = getLineY(mergedLine.fillToPrice, yFromPrice, chartTop, chartBottom, true);
1631
+ if (fillY !== null) {
1632
+ const zoneY = clamp(rawLineY, chartTop + 1, chartBottom - 1);
1633
+ const topY = Math.min(zoneY, fillY);
1634
+ const heightY = Math.abs(zoneY - fillY);
1635
+ if (heightY >= 1) {
1636
+ ctx.save();
1637
+ ctx.fillStyle = mergedLine.fillColor ?? "rgba(37,99,235,0.18)";
1638
+ ctx.fillRect(Math.round(chartLeft), Math.round(topY), Math.max(1, Math.round(chartRight - chartLeft)), Math.round(heightY));
1639
+ ctx.restore();
1640
+ }
1641
+ }
1642
+ }
1628
1643
  if (lineY === null) {
1629
1644
  return;
1630
1645
  }
1631
1646
  const color = line.color ?? (mergedLine.type === "takeProfit" ? "rgba(45,212,191,0.86)" : mergedLine.type === "stop" ? "rgba(245,158,11,0.86)" : "rgba(59,130,246,0.8)");
1632
- if (Number.isFinite(mergedLine.fillToPrice)) {
1633
- const fillY = getLineY(mergedLine.fillToPrice, yFromPrice, chartTop, chartBottom, true);
1634
- if (fillY === null) {
1635
- return;
1636
- }
1637
- const topY = Math.min(lineY, fillY);
1638
- const heightY = Math.max(1, Math.abs(lineY - fillY));
1639
- ctx.save();
1640
- ctx.fillStyle = mergedLine.fillColor ?? "rgba(37,99,235,0.18)";
1641
- ctx.fillRect(Math.round(chartLeft), Math.round(topY), Math.max(1, Math.round(chartRight - chartLeft)), Math.round(heightY));
1642
- ctx.restore();
1643
- }
1644
1647
  ctx.save();
1645
1648
  ctx.strokeStyle = color;
1646
1649
  ctx.lineWidth = Math.max(1, mergedLine.thickness);
package/dist/index.cjs CHANGED
@@ -1650,23 +1650,26 @@ function createChart(element, options = {}) {
1650
1650
  if (!mergedLine.visible || !Number.isFinite(renderPrice)) {
1651
1651
  return;
1652
1652
  }
1653
+ const rawLineY = yFromPrice(renderPrice);
1653
1654
  const lineY = getLineY(renderPrice, yFromPrice, chartTop, chartBottom, mergedLine.pinOutOfRange);
1655
+ if (Number.isFinite(mergedLine.fillToPrice) && Number.isFinite(rawLineY)) {
1656
+ const fillY = getLineY(mergedLine.fillToPrice, yFromPrice, chartTop, chartBottom, true);
1657
+ if (fillY !== null) {
1658
+ const zoneY = clamp(rawLineY, chartTop + 1, chartBottom - 1);
1659
+ const topY = Math.min(zoneY, fillY);
1660
+ const heightY = Math.abs(zoneY - fillY);
1661
+ if (heightY >= 1) {
1662
+ ctx.save();
1663
+ ctx.fillStyle = mergedLine.fillColor ?? "rgba(37,99,235,0.18)";
1664
+ ctx.fillRect(Math.round(chartLeft), Math.round(topY), Math.max(1, Math.round(chartRight - chartLeft)), Math.round(heightY));
1665
+ ctx.restore();
1666
+ }
1667
+ }
1668
+ }
1654
1669
  if (lineY === null) {
1655
1670
  return;
1656
1671
  }
1657
1672
  const color = line.color ?? (mergedLine.type === "takeProfit" ? "rgba(45,212,191,0.86)" : mergedLine.type === "stop" ? "rgba(245,158,11,0.86)" : "rgba(59,130,246,0.8)");
1658
- if (Number.isFinite(mergedLine.fillToPrice)) {
1659
- const fillY = getLineY(mergedLine.fillToPrice, yFromPrice, chartTop, chartBottom, true);
1660
- if (fillY === null) {
1661
- return;
1662
- }
1663
- const topY = Math.min(lineY, fillY);
1664
- const heightY = Math.max(1, Math.abs(lineY - fillY));
1665
- ctx.save();
1666
- ctx.fillStyle = mergedLine.fillColor ?? "rgba(37,99,235,0.18)";
1667
- ctx.fillRect(Math.round(chartLeft), Math.round(topY), Math.max(1, Math.round(chartRight - chartLeft)), Math.round(heightY));
1668
- ctx.restore();
1669
- }
1670
1673
  ctx.save();
1671
1674
  ctx.strokeStyle = color;
1672
1675
  ctx.lineWidth = Math.max(1, mergedLine.thickness);
package/dist/index.js CHANGED
@@ -1624,23 +1624,26 @@ function createChart(element, options = {}) {
1624
1624
  if (!mergedLine.visible || !Number.isFinite(renderPrice)) {
1625
1625
  return;
1626
1626
  }
1627
+ const rawLineY = yFromPrice(renderPrice);
1627
1628
  const lineY = getLineY(renderPrice, yFromPrice, chartTop, chartBottom, mergedLine.pinOutOfRange);
1629
+ if (Number.isFinite(mergedLine.fillToPrice) && Number.isFinite(rawLineY)) {
1630
+ const fillY = getLineY(mergedLine.fillToPrice, yFromPrice, chartTop, chartBottom, true);
1631
+ if (fillY !== null) {
1632
+ const zoneY = clamp(rawLineY, chartTop + 1, chartBottom - 1);
1633
+ const topY = Math.min(zoneY, fillY);
1634
+ const heightY = Math.abs(zoneY - fillY);
1635
+ if (heightY >= 1) {
1636
+ ctx.save();
1637
+ ctx.fillStyle = mergedLine.fillColor ?? "rgba(37,99,235,0.18)";
1638
+ ctx.fillRect(Math.round(chartLeft), Math.round(topY), Math.max(1, Math.round(chartRight - chartLeft)), Math.round(heightY));
1639
+ ctx.restore();
1640
+ }
1641
+ }
1642
+ }
1628
1643
  if (lineY === null) {
1629
1644
  return;
1630
1645
  }
1631
1646
  const color = line.color ?? (mergedLine.type === "takeProfit" ? "rgba(45,212,191,0.86)" : mergedLine.type === "stop" ? "rgba(245,158,11,0.86)" : "rgba(59,130,246,0.8)");
1632
- if (Number.isFinite(mergedLine.fillToPrice)) {
1633
- const fillY = getLineY(mergedLine.fillToPrice, yFromPrice, chartTop, chartBottom, true);
1634
- if (fillY === null) {
1635
- return;
1636
- }
1637
- const topY = Math.min(lineY, fillY);
1638
- const heightY = Math.max(1, Math.abs(lineY - fillY));
1639
- ctx.save();
1640
- ctx.fillStyle = mergedLine.fillColor ?? "rgba(37,99,235,0.18)";
1641
- ctx.fillRect(Math.round(chartLeft), Math.round(topY), Math.max(1, Math.round(chartRight - chartLeft)), Math.round(heightY));
1642
- ctx.restore();
1643
- }
1644
1647
  ctx.save();
1645
1648
  ctx.strokeStyle = color;
1646
1649
  ctx.lineWidth = Math.max(1, mergedLine.thickness);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.111",
3
+ "version": "0.1.112",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",