hyperprop-charting-library 0.1.39 → 0.1.41

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.
@@ -860,7 +860,7 @@ function createChart(element, options = {}) {
860
860
  const diff = tickerPriceTarget - smoothedTickerPrice;
861
861
  if (Math.abs(diff) < 1e-9) {
862
862
  smoothedTickerPrice = tickerPriceTarget;
863
- draw();
863
+ draw({ updateAutoScale: false });
864
864
  return;
865
865
  }
866
866
  const tickerOpts = mergedOptions.tickerLine ?? DEFAULT_OPTIONS.tickerLine;
@@ -868,7 +868,7 @@ function createChart(element, options = {}) {
868
868
  const dt = 1 / 60;
869
869
  const lerp = 1 - Math.exp(-speed * dt);
870
870
  smoothedTickerPrice += diff * lerp;
871
- draw();
871
+ draw({ updateAutoScale: false });
872
872
  smoothingRafId = requestAnimationFrame(tickerSmoothingLoop);
873
873
  };
874
874
  const pushSmoothedPrice = (target) => {
@@ -1585,7 +1585,8 @@ function createChart(element, options = {}) {
1585
1585
  crosshairPoint = point;
1586
1586
  draw();
1587
1587
  };
1588
- const draw = () => {
1588
+ const draw = (options2 = {}) => {
1589
+ const shouldUpdateAutoScale = options2.updateAutoScale ?? true;
1589
1590
  orderActionRegions = [];
1590
1591
  orderDragRegions = [];
1591
1592
  crosshairPriceActionRegion = null;
@@ -1691,6 +1692,9 @@ function createChart(element, options = {}) {
1691
1692
  }
1692
1693
  const visibleValues = [];
1693
1694
  for (let idx = startIndex; idx <= endIndex; idx += 1) {
1695
+ if (mergedOptions.autoScaleIgnoreLatestCandle && data.length > 1 && idx === data.length - 1) {
1696
+ continue;
1697
+ }
1694
1698
  const value = series[idx];
1695
1699
  if (Number.isFinite(value ?? Number.NaN)) {
1696
1700
  visibleValues.push(value);
@@ -1713,7 +1717,7 @@ function createChart(element, options = {}) {
1713
1717
  const autoMin = minPrice - priceRange * 0.08;
1714
1718
  const autoMax = maxPrice + priceRange * 0.08;
1715
1719
  const smoothing = clamp(mergedOptions.autoScaleSmoothing, 0, 1);
1716
- if (yMinOverride === null || yMaxOverride === null) {
1720
+ if ((yMinOverride === null || yMaxOverride === null) && (shouldUpdateAutoScale || autoYMin === null || autoYMax === null)) {
1717
1721
  if (autoYMin === null || autoYMax === null) {
1718
1722
  autoYMin = autoMin;
1719
1723
  autoYMax = autoMax;
@@ -1855,15 +1859,16 @@ function createChart(element, options = {}) {
1855
1859
  continue;
1856
1860
  }
1857
1861
  const isLastCandle = useSmoothedCandle && index === lastDataIndex;
1858
- const displayClose = isLastCandle ? smoothedTickerPrice : point.c;
1859
- const displayHigh = isLastCandle ? Math.max(point.h, smoothedTickerPrice) : point.h;
1860
- const displayLow = isLastCandle ? Math.min(point.l, smoothedTickerPrice) : point.l;
1862
+ const actualDirection = point.c >= point.o ? "up" : "down";
1863
+ const displayClose = isLastCandle ? actualDirection === "up" ? Math.max(point.o, smoothedTickerPrice) : Math.min(point.o, smoothedTickerPrice) : point.c;
1864
+ const displayHigh = isLastCandle ? actualDirection === "up" ? Math.max(point.h, displayClose) : point.h : point.h;
1865
+ const displayLow = isLastCandle ? actualDirection === "up" ? point.l : Math.min(point.l, displayClose) : point.l;
1861
1866
  const centerX = chartLeft + (index + 0.5 - xStart) / xSpan * chartWidth;
1862
1867
  const openY = yFromPrice(point.o);
1863
1868
  const closeY = yFromPrice(displayClose);
1864
1869
  const highY = yFromPrice(displayHigh);
1865
1870
  const lowY = yFromPrice(displayLow);
1866
- const direction = isLastCandle ? displayClose >= point.o ? "up" : "down" : getCandleDirectionByIndex(index);
1871
+ const direction = isLastCandle ? actualDirection : getCandleDirectionByIndex(index);
1867
1872
  const candleColor = direction === "up" ? mergedOptions.upColor : mergedOptions.downColor;
1868
1873
  const roundedCenterX = Math.round(centerX);
1869
1874
  ctx.strokeStyle = candleColor;
@@ -1873,10 +1878,13 @@ function createChart(element, options = {}) {
1873
1878
  ctx.lineTo(roundedCenterX + 0.5, crisp(lowY));
1874
1879
  ctx.stroke();
1875
1880
  const bodyLeft = roundedCenterX - Math.floor(bodyWidth / 2);
1876
- const bodyTop = Math.min(openY, closeY);
1877
- const bodyHeight = Math.max(1, Math.abs(closeY - openY));
1881
+ const openYPx = Math.round(openY);
1882
+ const closeYPx = Math.round(closeY);
1883
+ const bodyIsUp = displayClose >= point.o;
1884
+ const bodyTop = bodyIsUp ? Math.min(closeYPx, openYPx - 1) : openYPx;
1885
+ const bodyBottom = bodyIsUp ? openYPx : Math.max(closeYPx, openYPx + 1);
1878
1886
  ctx.fillStyle = candleColor;
1879
- ctx.fillRect(bodyLeft, Math.round(bodyTop), bodyWidth, Math.max(1, Math.round(bodyHeight)));
1887
+ ctx.fillRect(bodyLeft, bodyTop, bodyWidth, bodyBottom - bodyTop);
1880
1888
  }
1881
1889
  const activeOverlayIndicators = indicators.filter((indicator) => indicator.visible).map((indicator) => ({ indicator, plugin: indicatorRegistry.get(indicator.type) })).filter(
1882
1890
  (value) => value.plugin !== void 0 && (value.indicator.pane ?? value.plugin.pane ?? "overlay") === "overlay"
@@ -2630,6 +2638,7 @@ function createChart(element, options = {}) {
2630
2638
  const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
2631
2639
  if (crosshairButtonRegion) {
2632
2640
  canvas.style.cursor = "pointer";
2641
+ setCrosshairPoint(point);
2633
2642
  return;
2634
2643
  }
2635
2644
  const orderRegion = getOrderActionRegion(point.x, point.y);
@@ -836,7 +836,7 @@ function createChart(element, options = {}) {
836
836
  const diff = tickerPriceTarget - smoothedTickerPrice;
837
837
  if (Math.abs(diff) < 1e-9) {
838
838
  smoothedTickerPrice = tickerPriceTarget;
839
- draw();
839
+ draw({ updateAutoScale: false });
840
840
  return;
841
841
  }
842
842
  const tickerOpts = mergedOptions.tickerLine ?? DEFAULT_OPTIONS.tickerLine;
@@ -844,7 +844,7 @@ function createChart(element, options = {}) {
844
844
  const dt = 1 / 60;
845
845
  const lerp = 1 - Math.exp(-speed * dt);
846
846
  smoothedTickerPrice += diff * lerp;
847
- draw();
847
+ draw({ updateAutoScale: false });
848
848
  smoothingRafId = requestAnimationFrame(tickerSmoothingLoop);
849
849
  };
850
850
  const pushSmoothedPrice = (target) => {
@@ -1561,7 +1561,8 @@ function createChart(element, options = {}) {
1561
1561
  crosshairPoint = point;
1562
1562
  draw();
1563
1563
  };
1564
- const draw = () => {
1564
+ const draw = (options2 = {}) => {
1565
+ const shouldUpdateAutoScale = options2.updateAutoScale ?? true;
1565
1566
  orderActionRegions = [];
1566
1567
  orderDragRegions = [];
1567
1568
  crosshairPriceActionRegion = null;
@@ -1667,6 +1668,9 @@ function createChart(element, options = {}) {
1667
1668
  }
1668
1669
  const visibleValues = [];
1669
1670
  for (let idx = startIndex; idx <= endIndex; idx += 1) {
1671
+ if (mergedOptions.autoScaleIgnoreLatestCandle && data.length > 1 && idx === data.length - 1) {
1672
+ continue;
1673
+ }
1670
1674
  const value = series[idx];
1671
1675
  if (Number.isFinite(value ?? Number.NaN)) {
1672
1676
  visibleValues.push(value);
@@ -1689,7 +1693,7 @@ function createChart(element, options = {}) {
1689
1693
  const autoMin = minPrice - priceRange * 0.08;
1690
1694
  const autoMax = maxPrice + priceRange * 0.08;
1691
1695
  const smoothing = clamp(mergedOptions.autoScaleSmoothing, 0, 1);
1692
- if (yMinOverride === null || yMaxOverride === null) {
1696
+ if ((yMinOverride === null || yMaxOverride === null) && (shouldUpdateAutoScale || autoYMin === null || autoYMax === null)) {
1693
1697
  if (autoYMin === null || autoYMax === null) {
1694
1698
  autoYMin = autoMin;
1695
1699
  autoYMax = autoMax;
@@ -1831,15 +1835,16 @@ function createChart(element, options = {}) {
1831
1835
  continue;
1832
1836
  }
1833
1837
  const isLastCandle = useSmoothedCandle && index === lastDataIndex;
1834
- const displayClose = isLastCandle ? smoothedTickerPrice : point.c;
1835
- const displayHigh = isLastCandle ? Math.max(point.h, smoothedTickerPrice) : point.h;
1836
- const displayLow = isLastCandle ? Math.min(point.l, smoothedTickerPrice) : point.l;
1838
+ const actualDirection = point.c >= point.o ? "up" : "down";
1839
+ const displayClose = isLastCandle ? actualDirection === "up" ? Math.max(point.o, smoothedTickerPrice) : Math.min(point.o, smoothedTickerPrice) : point.c;
1840
+ const displayHigh = isLastCandle ? actualDirection === "up" ? Math.max(point.h, displayClose) : point.h : point.h;
1841
+ const displayLow = isLastCandle ? actualDirection === "up" ? point.l : Math.min(point.l, displayClose) : point.l;
1837
1842
  const centerX = chartLeft + (index + 0.5 - xStart) / xSpan * chartWidth;
1838
1843
  const openY = yFromPrice(point.o);
1839
1844
  const closeY = yFromPrice(displayClose);
1840
1845
  const highY = yFromPrice(displayHigh);
1841
1846
  const lowY = yFromPrice(displayLow);
1842
- const direction = isLastCandle ? displayClose >= point.o ? "up" : "down" : getCandleDirectionByIndex(index);
1847
+ const direction = isLastCandle ? actualDirection : getCandleDirectionByIndex(index);
1843
1848
  const candleColor = direction === "up" ? mergedOptions.upColor : mergedOptions.downColor;
1844
1849
  const roundedCenterX = Math.round(centerX);
1845
1850
  ctx.strokeStyle = candleColor;
@@ -1849,10 +1854,13 @@ function createChart(element, options = {}) {
1849
1854
  ctx.lineTo(roundedCenterX + 0.5, crisp(lowY));
1850
1855
  ctx.stroke();
1851
1856
  const bodyLeft = roundedCenterX - Math.floor(bodyWidth / 2);
1852
- const bodyTop = Math.min(openY, closeY);
1853
- const bodyHeight = Math.max(1, Math.abs(closeY - openY));
1857
+ const openYPx = Math.round(openY);
1858
+ const closeYPx = Math.round(closeY);
1859
+ const bodyIsUp = displayClose >= point.o;
1860
+ const bodyTop = bodyIsUp ? Math.min(closeYPx, openYPx - 1) : openYPx;
1861
+ const bodyBottom = bodyIsUp ? openYPx : Math.max(closeYPx, openYPx + 1);
1854
1862
  ctx.fillStyle = candleColor;
1855
- ctx.fillRect(bodyLeft, Math.round(bodyTop), bodyWidth, Math.max(1, Math.round(bodyHeight)));
1863
+ ctx.fillRect(bodyLeft, bodyTop, bodyWidth, bodyBottom - bodyTop);
1856
1864
  }
1857
1865
  const activeOverlayIndicators = indicators.filter((indicator) => indicator.visible).map((indicator) => ({ indicator, plugin: indicatorRegistry.get(indicator.type) })).filter(
1858
1866
  (value) => value.plugin !== void 0 && (value.indicator.pane ?? value.plugin.pane ?? "overlay") === "overlay"
@@ -2606,6 +2614,7 @@ function createChart(element, options = {}) {
2606
2614
  const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
2607
2615
  if (crosshairButtonRegion) {
2608
2616
  canvas.style.cursor = "pointer";
2617
+ setCrosshairPoint(point);
2609
2618
  return;
2610
2619
  }
2611
2620
  const orderRegion = getOrderActionRegion(point.x, point.y);
package/dist/index.cjs CHANGED
@@ -860,7 +860,7 @@ function createChart(element, options = {}) {
860
860
  const diff = tickerPriceTarget - smoothedTickerPrice;
861
861
  if (Math.abs(diff) < 1e-9) {
862
862
  smoothedTickerPrice = tickerPriceTarget;
863
- draw();
863
+ draw({ updateAutoScale: false });
864
864
  return;
865
865
  }
866
866
  const tickerOpts = mergedOptions.tickerLine ?? DEFAULT_OPTIONS.tickerLine;
@@ -868,7 +868,7 @@ function createChart(element, options = {}) {
868
868
  const dt = 1 / 60;
869
869
  const lerp = 1 - Math.exp(-speed * dt);
870
870
  smoothedTickerPrice += diff * lerp;
871
- draw();
871
+ draw({ updateAutoScale: false });
872
872
  smoothingRafId = requestAnimationFrame(tickerSmoothingLoop);
873
873
  };
874
874
  const pushSmoothedPrice = (target) => {
@@ -1585,7 +1585,8 @@ function createChart(element, options = {}) {
1585
1585
  crosshairPoint = point;
1586
1586
  draw();
1587
1587
  };
1588
- const draw = () => {
1588
+ const draw = (options2 = {}) => {
1589
+ const shouldUpdateAutoScale = options2.updateAutoScale ?? true;
1589
1590
  orderActionRegions = [];
1590
1591
  orderDragRegions = [];
1591
1592
  crosshairPriceActionRegion = null;
@@ -1691,6 +1692,9 @@ function createChart(element, options = {}) {
1691
1692
  }
1692
1693
  const visibleValues = [];
1693
1694
  for (let idx = startIndex; idx <= endIndex; idx += 1) {
1695
+ if (mergedOptions.autoScaleIgnoreLatestCandle && data.length > 1 && idx === data.length - 1) {
1696
+ continue;
1697
+ }
1694
1698
  const value = series[idx];
1695
1699
  if (Number.isFinite(value ?? Number.NaN)) {
1696
1700
  visibleValues.push(value);
@@ -1713,7 +1717,7 @@ function createChart(element, options = {}) {
1713
1717
  const autoMin = minPrice - priceRange * 0.08;
1714
1718
  const autoMax = maxPrice + priceRange * 0.08;
1715
1719
  const smoothing = clamp(mergedOptions.autoScaleSmoothing, 0, 1);
1716
- if (yMinOverride === null || yMaxOverride === null) {
1720
+ if ((yMinOverride === null || yMaxOverride === null) && (shouldUpdateAutoScale || autoYMin === null || autoYMax === null)) {
1717
1721
  if (autoYMin === null || autoYMax === null) {
1718
1722
  autoYMin = autoMin;
1719
1723
  autoYMax = autoMax;
@@ -1855,15 +1859,16 @@ function createChart(element, options = {}) {
1855
1859
  continue;
1856
1860
  }
1857
1861
  const isLastCandle = useSmoothedCandle && index === lastDataIndex;
1858
- const displayClose = isLastCandle ? smoothedTickerPrice : point.c;
1859
- const displayHigh = isLastCandle ? Math.max(point.h, smoothedTickerPrice) : point.h;
1860
- const displayLow = isLastCandle ? Math.min(point.l, smoothedTickerPrice) : point.l;
1862
+ const actualDirection = point.c >= point.o ? "up" : "down";
1863
+ const displayClose = isLastCandle ? actualDirection === "up" ? Math.max(point.o, smoothedTickerPrice) : Math.min(point.o, smoothedTickerPrice) : point.c;
1864
+ const displayHigh = isLastCandle ? actualDirection === "up" ? Math.max(point.h, displayClose) : point.h : point.h;
1865
+ const displayLow = isLastCandle ? actualDirection === "up" ? point.l : Math.min(point.l, displayClose) : point.l;
1861
1866
  const centerX = chartLeft + (index + 0.5 - xStart) / xSpan * chartWidth;
1862
1867
  const openY = yFromPrice(point.o);
1863
1868
  const closeY = yFromPrice(displayClose);
1864
1869
  const highY = yFromPrice(displayHigh);
1865
1870
  const lowY = yFromPrice(displayLow);
1866
- const direction = isLastCandle ? displayClose >= point.o ? "up" : "down" : getCandleDirectionByIndex(index);
1871
+ const direction = isLastCandle ? actualDirection : getCandleDirectionByIndex(index);
1867
1872
  const candleColor = direction === "up" ? mergedOptions.upColor : mergedOptions.downColor;
1868
1873
  const roundedCenterX = Math.round(centerX);
1869
1874
  ctx.strokeStyle = candleColor;
@@ -1873,10 +1878,13 @@ function createChart(element, options = {}) {
1873
1878
  ctx.lineTo(roundedCenterX + 0.5, crisp(lowY));
1874
1879
  ctx.stroke();
1875
1880
  const bodyLeft = roundedCenterX - Math.floor(bodyWidth / 2);
1876
- const bodyTop = Math.min(openY, closeY);
1877
- const bodyHeight = Math.max(1, Math.abs(closeY - openY));
1881
+ const openYPx = Math.round(openY);
1882
+ const closeYPx = Math.round(closeY);
1883
+ const bodyIsUp = displayClose >= point.o;
1884
+ const bodyTop = bodyIsUp ? Math.min(closeYPx, openYPx - 1) : openYPx;
1885
+ const bodyBottom = bodyIsUp ? openYPx : Math.max(closeYPx, openYPx + 1);
1878
1886
  ctx.fillStyle = candleColor;
1879
- ctx.fillRect(bodyLeft, Math.round(bodyTop), bodyWidth, Math.max(1, Math.round(bodyHeight)));
1887
+ ctx.fillRect(bodyLeft, bodyTop, bodyWidth, bodyBottom - bodyTop);
1880
1888
  }
1881
1889
  const activeOverlayIndicators = indicators.filter((indicator) => indicator.visible).map((indicator) => ({ indicator, plugin: indicatorRegistry.get(indicator.type) })).filter(
1882
1890
  (value) => value.plugin !== void 0 && (value.indicator.pane ?? value.plugin.pane ?? "overlay") === "overlay"
@@ -2630,6 +2638,7 @@ function createChart(element, options = {}) {
2630
2638
  const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
2631
2639
  if (crosshairButtonRegion) {
2632
2640
  canvas.style.cursor = "pointer";
2641
+ setCrosshairPoint(point);
2633
2642
  return;
2634
2643
  }
2635
2644
  const orderRegion = getOrderActionRegion(point.x, point.y);
package/dist/index.js CHANGED
@@ -836,7 +836,7 @@ function createChart(element, options = {}) {
836
836
  const diff = tickerPriceTarget - smoothedTickerPrice;
837
837
  if (Math.abs(diff) < 1e-9) {
838
838
  smoothedTickerPrice = tickerPriceTarget;
839
- draw();
839
+ draw({ updateAutoScale: false });
840
840
  return;
841
841
  }
842
842
  const tickerOpts = mergedOptions.tickerLine ?? DEFAULT_OPTIONS.tickerLine;
@@ -844,7 +844,7 @@ function createChart(element, options = {}) {
844
844
  const dt = 1 / 60;
845
845
  const lerp = 1 - Math.exp(-speed * dt);
846
846
  smoothedTickerPrice += diff * lerp;
847
- draw();
847
+ draw({ updateAutoScale: false });
848
848
  smoothingRafId = requestAnimationFrame(tickerSmoothingLoop);
849
849
  };
850
850
  const pushSmoothedPrice = (target) => {
@@ -1561,7 +1561,8 @@ function createChart(element, options = {}) {
1561
1561
  crosshairPoint = point;
1562
1562
  draw();
1563
1563
  };
1564
- const draw = () => {
1564
+ const draw = (options2 = {}) => {
1565
+ const shouldUpdateAutoScale = options2.updateAutoScale ?? true;
1565
1566
  orderActionRegions = [];
1566
1567
  orderDragRegions = [];
1567
1568
  crosshairPriceActionRegion = null;
@@ -1667,6 +1668,9 @@ function createChart(element, options = {}) {
1667
1668
  }
1668
1669
  const visibleValues = [];
1669
1670
  for (let idx = startIndex; idx <= endIndex; idx += 1) {
1671
+ if (mergedOptions.autoScaleIgnoreLatestCandle && data.length > 1 && idx === data.length - 1) {
1672
+ continue;
1673
+ }
1670
1674
  const value = series[idx];
1671
1675
  if (Number.isFinite(value ?? Number.NaN)) {
1672
1676
  visibleValues.push(value);
@@ -1689,7 +1693,7 @@ function createChart(element, options = {}) {
1689
1693
  const autoMin = minPrice - priceRange * 0.08;
1690
1694
  const autoMax = maxPrice + priceRange * 0.08;
1691
1695
  const smoothing = clamp(mergedOptions.autoScaleSmoothing, 0, 1);
1692
- if (yMinOverride === null || yMaxOverride === null) {
1696
+ if ((yMinOverride === null || yMaxOverride === null) && (shouldUpdateAutoScale || autoYMin === null || autoYMax === null)) {
1693
1697
  if (autoYMin === null || autoYMax === null) {
1694
1698
  autoYMin = autoMin;
1695
1699
  autoYMax = autoMax;
@@ -1831,15 +1835,16 @@ function createChart(element, options = {}) {
1831
1835
  continue;
1832
1836
  }
1833
1837
  const isLastCandle = useSmoothedCandle && index === lastDataIndex;
1834
- const displayClose = isLastCandle ? smoothedTickerPrice : point.c;
1835
- const displayHigh = isLastCandle ? Math.max(point.h, smoothedTickerPrice) : point.h;
1836
- const displayLow = isLastCandle ? Math.min(point.l, smoothedTickerPrice) : point.l;
1838
+ const actualDirection = point.c >= point.o ? "up" : "down";
1839
+ const displayClose = isLastCandle ? actualDirection === "up" ? Math.max(point.o, smoothedTickerPrice) : Math.min(point.o, smoothedTickerPrice) : point.c;
1840
+ const displayHigh = isLastCandle ? actualDirection === "up" ? Math.max(point.h, displayClose) : point.h : point.h;
1841
+ const displayLow = isLastCandle ? actualDirection === "up" ? point.l : Math.min(point.l, displayClose) : point.l;
1837
1842
  const centerX = chartLeft + (index + 0.5 - xStart) / xSpan * chartWidth;
1838
1843
  const openY = yFromPrice(point.o);
1839
1844
  const closeY = yFromPrice(displayClose);
1840
1845
  const highY = yFromPrice(displayHigh);
1841
1846
  const lowY = yFromPrice(displayLow);
1842
- const direction = isLastCandle ? displayClose >= point.o ? "up" : "down" : getCandleDirectionByIndex(index);
1847
+ const direction = isLastCandle ? actualDirection : getCandleDirectionByIndex(index);
1843
1848
  const candleColor = direction === "up" ? mergedOptions.upColor : mergedOptions.downColor;
1844
1849
  const roundedCenterX = Math.round(centerX);
1845
1850
  ctx.strokeStyle = candleColor;
@@ -1849,10 +1854,13 @@ function createChart(element, options = {}) {
1849
1854
  ctx.lineTo(roundedCenterX + 0.5, crisp(lowY));
1850
1855
  ctx.stroke();
1851
1856
  const bodyLeft = roundedCenterX - Math.floor(bodyWidth / 2);
1852
- const bodyTop = Math.min(openY, closeY);
1853
- const bodyHeight = Math.max(1, Math.abs(closeY - openY));
1857
+ const openYPx = Math.round(openY);
1858
+ const closeYPx = Math.round(closeY);
1859
+ const bodyIsUp = displayClose >= point.o;
1860
+ const bodyTop = bodyIsUp ? Math.min(closeYPx, openYPx - 1) : openYPx;
1861
+ const bodyBottom = bodyIsUp ? openYPx : Math.max(closeYPx, openYPx + 1);
1854
1862
  ctx.fillStyle = candleColor;
1855
- ctx.fillRect(bodyLeft, Math.round(bodyTop), bodyWidth, Math.max(1, Math.round(bodyHeight)));
1863
+ ctx.fillRect(bodyLeft, bodyTop, bodyWidth, bodyBottom - bodyTop);
1856
1864
  }
1857
1865
  const activeOverlayIndicators = indicators.filter((indicator) => indicator.visible).map((indicator) => ({ indicator, plugin: indicatorRegistry.get(indicator.type) })).filter(
1858
1866
  (value) => value.plugin !== void 0 && (value.indicator.pane ?? value.plugin.pane ?? "overlay") === "overlay"
@@ -2606,6 +2614,7 @@ function createChart(element, options = {}) {
2606
2614
  const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
2607
2615
  if (crosshairButtonRegion) {
2608
2616
  canvas.style.cursor = "pointer";
2617
+ setCrosshairPoint(point);
2609
2618
  return;
2610
2619
  }
2611
2620
  const orderRegion = getOrderActionRegion(point.x, point.y);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",