hyperprop-charting-library 0.1.75 → 0.1.77

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.
@@ -3909,8 +3909,9 @@ function createChart(element, options = {}) {
3909
3909
  if (activeDrawingTool === "long-position" || activeDrawingTool === "short-position") {
3910
3910
  const isLong = activeDrawingTool === "long-position";
3911
3911
  const tick = getConfiguredTickSize();
3912
- const priceOffset = tick > 0 ? tick * 20 : Math.abs(point.price) * 0.01 || 1;
3913
- const width2 = Math.max(5, Math.round(xSpan * 0.15));
3912
+ const visibleRange = drawState.yMax - drawState.yMin;
3913
+ const priceOffset = visibleRange > 0 ? visibleRange * 0.12 : tick > 0 ? tick * 60 : Math.abs(point.price) * 0.025 || 1;
3914
+ const width2 = Math.max(8, Math.round(xSpan * 0.2));
3914
3915
  const entryPrice = point.price;
3915
3916
  const targetPrice = isLong ? entryPrice + priceOffset : entryPrice - priceOffset;
3916
3917
  const stopPrice = isLong ? entryPrice - priceOffset : entryPrice + priceOffset;
@@ -3883,8 +3883,9 @@ function createChart(element, options = {}) {
3883
3883
  if (activeDrawingTool === "long-position" || activeDrawingTool === "short-position") {
3884
3884
  const isLong = activeDrawingTool === "long-position";
3885
3885
  const tick = getConfiguredTickSize();
3886
- const priceOffset = tick > 0 ? tick * 20 : Math.abs(point.price) * 0.01 || 1;
3887
- const width2 = Math.max(5, Math.round(xSpan * 0.15));
3886
+ const visibleRange = drawState.yMax - drawState.yMin;
3887
+ const priceOffset = visibleRange > 0 ? visibleRange * 0.12 : tick > 0 ? tick * 60 : Math.abs(point.price) * 0.025 || 1;
3888
+ const width2 = Math.max(8, Math.round(xSpan * 0.2));
3888
3889
  const entryPrice = point.price;
3889
3890
  const targetPrice = isLong ? entryPrice + priceOffset : entryPrice - priceOffset;
3890
3891
  const stopPrice = isLong ? entryPrice - priceOffset : entryPrice + priceOffset;
package/dist/index.cjs CHANGED
@@ -3909,8 +3909,9 @@ function createChart(element, options = {}) {
3909
3909
  if (activeDrawingTool === "long-position" || activeDrawingTool === "short-position") {
3910
3910
  const isLong = activeDrawingTool === "long-position";
3911
3911
  const tick = getConfiguredTickSize();
3912
- const priceOffset = tick > 0 ? tick * 20 : Math.abs(point.price) * 0.01 || 1;
3913
- const width2 = Math.max(5, Math.round(xSpan * 0.15));
3912
+ const visibleRange = drawState.yMax - drawState.yMin;
3913
+ const priceOffset = visibleRange > 0 ? visibleRange * 0.12 : tick > 0 ? tick * 60 : Math.abs(point.price) * 0.025 || 1;
3914
+ const width2 = Math.max(8, Math.round(xSpan * 0.2));
3914
3915
  const entryPrice = point.price;
3915
3916
  const targetPrice = isLong ? entryPrice + priceOffset : entryPrice - priceOffset;
3916
3917
  const stopPrice = isLong ? entryPrice - priceOffset : entryPrice + priceOffset;
package/dist/index.js CHANGED
@@ -3883,8 +3883,9 @@ function createChart(element, options = {}) {
3883
3883
  if (activeDrawingTool === "long-position" || activeDrawingTool === "short-position") {
3884
3884
  const isLong = activeDrawingTool === "long-position";
3885
3885
  const tick = getConfiguredTickSize();
3886
- const priceOffset = tick > 0 ? tick * 20 : Math.abs(point.price) * 0.01 || 1;
3887
- const width2 = Math.max(5, Math.round(xSpan * 0.15));
3886
+ const visibleRange = drawState.yMax - drawState.yMin;
3887
+ const priceOffset = visibleRange > 0 ? visibleRange * 0.12 : tick > 0 ? tick * 60 : Math.abs(point.price) * 0.025 || 1;
3888
+ const width2 = Math.max(8, Math.round(xSpan * 0.2));
3888
3889
  const entryPrice = point.price;
3889
3890
  const targetPrice = isLong ? entryPrice + priceOffset : entryPrice - priceOffset;
3890
3891
  const stopPrice = isLong ? entryPrice - priceOffset : entryPrice + priceOffset;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.75",
3
+ "version": "0.1.77",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",