hyperprop-charting-library 0.1.101 → 0.1.102

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.
@@ -2918,9 +2918,11 @@ function createChart(element, options = {}) {
2918
2918
  const prevBaseline = ctx.textBaseline;
2919
2919
  ctx.font = `500 10px ${mergedOptions.fontFamily}`;
2920
2920
  ctx.textAlign = "center";
2921
+ ctx.textBaseline = "middle";
2921
2922
  const arrowHalf = 5;
2922
2923
  const arrowH = 8;
2923
2924
  const gap = 5;
2925
+ const labelOffset = arrowH + 8;
2924
2926
  for (const marker of tradeMarkers) {
2925
2927
  const ms = typeof marker.time === "number" ? marker.time : Date.parse(String(marker.time));
2926
2928
  if (!Number.isFinite(ms)) continue;
@@ -2945,8 +2947,7 @@ function createChart(element, options = {}) {
2945
2947
  ctx.closePath();
2946
2948
  ctx.fill();
2947
2949
  ctx.fillStyle = textColor;
2948
- ctx.textBaseline = "top";
2949
- ctx.fillText(label, x, tipY + arrowH + 2);
2950
+ ctx.fillText(label, Math.round(x), Math.round(tipY + labelOffset));
2950
2951
  } else {
2951
2952
  const tipY = yFromPrice(bar.h) - gap;
2952
2953
  ctx.beginPath();
@@ -2956,8 +2957,7 @@ function createChart(element, options = {}) {
2956
2957
  ctx.closePath();
2957
2958
  ctx.fill();
2958
2959
  ctx.fillStyle = textColor;
2959
- ctx.textBaseline = "bottom";
2960
- ctx.fillText(label, x, tipY - arrowH - 2);
2960
+ ctx.fillText(label, Math.round(x), Math.round(tipY - labelOffset));
2961
2961
  }
2962
2962
  ctx.restore();
2963
2963
  }
@@ -2892,9 +2892,11 @@ function createChart(element, options = {}) {
2892
2892
  const prevBaseline = ctx.textBaseline;
2893
2893
  ctx.font = `500 10px ${mergedOptions.fontFamily}`;
2894
2894
  ctx.textAlign = "center";
2895
+ ctx.textBaseline = "middle";
2895
2896
  const arrowHalf = 5;
2896
2897
  const arrowH = 8;
2897
2898
  const gap = 5;
2899
+ const labelOffset = arrowH + 8;
2898
2900
  for (const marker of tradeMarkers) {
2899
2901
  const ms = typeof marker.time === "number" ? marker.time : Date.parse(String(marker.time));
2900
2902
  if (!Number.isFinite(ms)) continue;
@@ -2919,8 +2921,7 @@ function createChart(element, options = {}) {
2919
2921
  ctx.closePath();
2920
2922
  ctx.fill();
2921
2923
  ctx.fillStyle = textColor;
2922
- ctx.textBaseline = "top";
2923
- ctx.fillText(label, x, tipY + arrowH + 2);
2924
+ ctx.fillText(label, Math.round(x), Math.round(tipY + labelOffset));
2924
2925
  } else {
2925
2926
  const tipY = yFromPrice(bar.h) - gap;
2926
2927
  ctx.beginPath();
@@ -2930,8 +2931,7 @@ function createChart(element, options = {}) {
2930
2931
  ctx.closePath();
2931
2932
  ctx.fill();
2932
2933
  ctx.fillStyle = textColor;
2933
- ctx.textBaseline = "bottom";
2934
- ctx.fillText(label, x, tipY - arrowH - 2);
2934
+ ctx.fillText(label, Math.round(x), Math.round(tipY - labelOffset));
2935
2935
  }
2936
2936
  ctx.restore();
2937
2937
  }
package/dist/index.cjs CHANGED
@@ -2918,9 +2918,11 @@ function createChart(element, options = {}) {
2918
2918
  const prevBaseline = ctx.textBaseline;
2919
2919
  ctx.font = `500 10px ${mergedOptions.fontFamily}`;
2920
2920
  ctx.textAlign = "center";
2921
+ ctx.textBaseline = "middle";
2921
2922
  const arrowHalf = 5;
2922
2923
  const arrowH = 8;
2923
2924
  const gap = 5;
2925
+ const labelOffset = arrowH + 8;
2924
2926
  for (const marker of tradeMarkers) {
2925
2927
  const ms = typeof marker.time === "number" ? marker.time : Date.parse(String(marker.time));
2926
2928
  if (!Number.isFinite(ms)) continue;
@@ -2945,8 +2947,7 @@ function createChart(element, options = {}) {
2945
2947
  ctx.closePath();
2946
2948
  ctx.fill();
2947
2949
  ctx.fillStyle = textColor;
2948
- ctx.textBaseline = "top";
2949
- ctx.fillText(label, x, tipY + arrowH + 2);
2950
+ ctx.fillText(label, Math.round(x), Math.round(tipY + labelOffset));
2950
2951
  } else {
2951
2952
  const tipY = yFromPrice(bar.h) - gap;
2952
2953
  ctx.beginPath();
@@ -2956,8 +2957,7 @@ function createChart(element, options = {}) {
2956
2957
  ctx.closePath();
2957
2958
  ctx.fill();
2958
2959
  ctx.fillStyle = textColor;
2959
- ctx.textBaseline = "bottom";
2960
- ctx.fillText(label, x, tipY - arrowH - 2);
2960
+ ctx.fillText(label, Math.round(x), Math.round(tipY - labelOffset));
2961
2961
  }
2962
2962
  ctx.restore();
2963
2963
  }
package/dist/index.js CHANGED
@@ -2892,9 +2892,11 @@ function createChart(element, options = {}) {
2892
2892
  const prevBaseline = ctx.textBaseline;
2893
2893
  ctx.font = `500 10px ${mergedOptions.fontFamily}`;
2894
2894
  ctx.textAlign = "center";
2895
+ ctx.textBaseline = "middle";
2895
2896
  const arrowHalf = 5;
2896
2897
  const arrowH = 8;
2897
2898
  const gap = 5;
2899
+ const labelOffset = arrowH + 8;
2898
2900
  for (const marker of tradeMarkers) {
2899
2901
  const ms = typeof marker.time === "number" ? marker.time : Date.parse(String(marker.time));
2900
2902
  if (!Number.isFinite(ms)) continue;
@@ -2919,8 +2921,7 @@ function createChart(element, options = {}) {
2919
2921
  ctx.closePath();
2920
2922
  ctx.fill();
2921
2923
  ctx.fillStyle = textColor;
2922
- ctx.textBaseline = "top";
2923
- ctx.fillText(label, x, tipY + arrowH + 2);
2924
+ ctx.fillText(label, Math.round(x), Math.round(tipY + labelOffset));
2924
2925
  } else {
2925
2926
  const tipY = yFromPrice(bar.h) - gap;
2926
2927
  ctx.beginPath();
@@ -2930,8 +2931,7 @@ function createChart(element, options = {}) {
2930
2931
  ctx.closePath();
2931
2932
  ctx.fill();
2932
2933
  ctx.fillStyle = textColor;
2933
- ctx.textBaseline = "bottom";
2934
- ctx.fillText(label, x, tipY - arrowH - 2);
2934
+ ctx.fillText(label, Math.round(x), Math.round(tipY - labelOffset));
2935
2935
  }
2936
2936
  ctx.restore();
2937
2937
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.101",
3
+ "version": "0.1.102",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",