hyperprop-charting-library 0.1.51 → 0.1.52

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.
@@ -2227,11 +2227,13 @@ function createChart(element, options = {}) {
2227
2227
  const uniqueTicks = Array.from(new Set(axisTicks.filter((tick) => Number.isFinite(tick))));
2228
2228
  ctx.save();
2229
2229
  ctx.font = `${yAxisFontSize}px ${mergedOptions.fontFamily}`;
2230
+ const paneTickLabelInset = yAxisFontSize / 2 + 3;
2230
2231
  for (const tick of uniqueTicks) {
2231
2232
  if (tick < axisInfo.min || tick > axisInfo.max) {
2232
2233
  continue;
2233
2234
  }
2234
- drawText(formatPaneValue(tick), chartRight + 6, yFromPaneValue(tick), "left", "middle", yAxis.textColor);
2235
+ const labelY = clamp(yFromPaneValue(tick), paneTop + paneTickLabelInset, paneBottom - paneTickLabelInset);
2236
+ drawText(formatPaneValue(tick), chartRight + 6, labelY, "left", "middle", yAxis.textColor);
2235
2237
  }
2236
2238
  ctx.restore();
2237
2239
  if (labels.visible) {
@@ -2203,11 +2203,13 @@ function createChart(element, options = {}) {
2203
2203
  const uniqueTicks = Array.from(new Set(axisTicks.filter((tick) => Number.isFinite(tick))));
2204
2204
  ctx.save();
2205
2205
  ctx.font = `${yAxisFontSize}px ${mergedOptions.fontFamily}`;
2206
+ const paneTickLabelInset = yAxisFontSize / 2 + 3;
2206
2207
  for (const tick of uniqueTicks) {
2207
2208
  if (tick < axisInfo.min || tick > axisInfo.max) {
2208
2209
  continue;
2209
2210
  }
2210
- drawText(formatPaneValue(tick), chartRight + 6, yFromPaneValue(tick), "left", "middle", yAxis.textColor);
2211
+ const labelY = clamp(yFromPaneValue(tick), paneTop + paneTickLabelInset, paneBottom - paneTickLabelInset);
2212
+ drawText(formatPaneValue(tick), chartRight + 6, labelY, "left", "middle", yAxis.textColor);
2211
2213
  }
2212
2214
  ctx.restore();
2213
2215
  if (labels.visible) {
package/dist/index.cjs CHANGED
@@ -2227,11 +2227,13 @@ function createChart(element, options = {}) {
2227
2227
  const uniqueTicks = Array.from(new Set(axisTicks.filter((tick) => Number.isFinite(tick))));
2228
2228
  ctx.save();
2229
2229
  ctx.font = `${yAxisFontSize}px ${mergedOptions.fontFamily}`;
2230
+ const paneTickLabelInset = yAxisFontSize / 2 + 3;
2230
2231
  for (const tick of uniqueTicks) {
2231
2232
  if (tick < axisInfo.min || tick > axisInfo.max) {
2232
2233
  continue;
2233
2234
  }
2234
- drawText(formatPaneValue(tick), chartRight + 6, yFromPaneValue(tick), "left", "middle", yAxis.textColor);
2235
+ const labelY = clamp(yFromPaneValue(tick), paneTop + paneTickLabelInset, paneBottom - paneTickLabelInset);
2236
+ drawText(formatPaneValue(tick), chartRight + 6, labelY, "left", "middle", yAxis.textColor);
2235
2237
  }
2236
2238
  ctx.restore();
2237
2239
  if (labels.visible) {
package/dist/index.js CHANGED
@@ -2203,11 +2203,13 @@ function createChart(element, options = {}) {
2203
2203
  const uniqueTicks = Array.from(new Set(axisTicks.filter((tick) => Number.isFinite(tick))));
2204
2204
  ctx.save();
2205
2205
  ctx.font = `${yAxisFontSize}px ${mergedOptions.fontFamily}`;
2206
+ const paneTickLabelInset = yAxisFontSize / 2 + 3;
2206
2207
  for (const tick of uniqueTicks) {
2207
2208
  if (tick < axisInfo.min || tick > axisInfo.max) {
2208
2209
  continue;
2209
2210
  }
2210
- drawText(formatPaneValue(tick), chartRight + 6, yFromPaneValue(tick), "left", "middle", yAxis.textColor);
2211
+ const labelY = clamp(yFromPaneValue(tick), paneTop + paneTickLabelInset, paneBottom - paneTickLabelInset);
2212
+ drawText(formatPaneValue(tick), chartRight + 6, labelY, "left", "middle", yAxis.textColor);
2211
2213
  }
2212
2214
  ctx.restore();
2213
2215
  if (labels.visible) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",