hyperprop-charting-library 0.1.115 → 0.1.116

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.
@@ -1239,7 +1239,15 @@ function createChart(element, options = {}) {
1239
1239
  const minSpan = minVisibleBars;
1240
1240
  const maxSpan = Math.min(maxVisibleBars, Math.max(minSpan, count + maxPanBars * 2));
1241
1241
  xSpan = clamp(xSpan, minSpan, maxSpan);
1242
- xCenter = clamp(xCenter, -maxPanBars, count + maxPanBars);
1242
+ const halfSpan = xSpan / 2;
1243
+ const minOverlap = Math.max(1, Math.min(count, Math.ceil(xSpan * 0.1)));
1244
+ const lowCenter = minOverlap - halfSpan;
1245
+ const highCenter = count - minOverlap + halfSpan;
1246
+ xCenter = clamp(
1247
+ xCenter,
1248
+ Math.max(lowCenter, -maxPanBars),
1249
+ Math.min(highCenter, count + maxPanBars)
1250
+ );
1243
1251
  };
1244
1252
  const fitXViewport = () => {
1245
1253
  const count = data.length;
@@ -1213,7 +1213,15 @@ function createChart(element, options = {}) {
1213
1213
  const minSpan = minVisibleBars;
1214
1214
  const maxSpan = Math.min(maxVisibleBars, Math.max(minSpan, count + maxPanBars * 2));
1215
1215
  xSpan = clamp(xSpan, minSpan, maxSpan);
1216
- xCenter = clamp(xCenter, -maxPanBars, count + maxPanBars);
1216
+ const halfSpan = xSpan / 2;
1217
+ const minOverlap = Math.max(1, Math.min(count, Math.ceil(xSpan * 0.1)));
1218
+ const lowCenter = minOverlap - halfSpan;
1219
+ const highCenter = count - minOverlap + halfSpan;
1220
+ xCenter = clamp(
1221
+ xCenter,
1222
+ Math.max(lowCenter, -maxPanBars),
1223
+ Math.min(highCenter, count + maxPanBars)
1224
+ );
1217
1225
  };
1218
1226
  const fitXViewport = () => {
1219
1227
  const count = data.length;
package/dist/index.cjs CHANGED
@@ -1239,7 +1239,15 @@ function createChart(element, options = {}) {
1239
1239
  const minSpan = minVisibleBars;
1240
1240
  const maxSpan = Math.min(maxVisibleBars, Math.max(minSpan, count + maxPanBars * 2));
1241
1241
  xSpan = clamp(xSpan, minSpan, maxSpan);
1242
- xCenter = clamp(xCenter, -maxPanBars, count + maxPanBars);
1242
+ const halfSpan = xSpan / 2;
1243
+ const minOverlap = Math.max(1, Math.min(count, Math.ceil(xSpan * 0.1)));
1244
+ const lowCenter = minOverlap - halfSpan;
1245
+ const highCenter = count - minOverlap + halfSpan;
1246
+ xCenter = clamp(
1247
+ xCenter,
1248
+ Math.max(lowCenter, -maxPanBars),
1249
+ Math.min(highCenter, count + maxPanBars)
1250
+ );
1243
1251
  };
1244
1252
  const fitXViewport = () => {
1245
1253
  const count = data.length;
package/dist/index.js CHANGED
@@ -1213,7 +1213,15 @@ function createChart(element, options = {}) {
1213
1213
  const minSpan = minVisibleBars;
1214
1214
  const maxSpan = Math.min(maxVisibleBars, Math.max(minSpan, count + maxPanBars * 2));
1215
1215
  xSpan = clamp(xSpan, minSpan, maxSpan);
1216
- xCenter = clamp(xCenter, -maxPanBars, count + maxPanBars);
1216
+ const halfSpan = xSpan / 2;
1217
+ const minOverlap = Math.max(1, Math.min(count, Math.ceil(xSpan * 0.1)));
1218
+ const lowCenter = minOverlap - halfSpan;
1219
+ const highCenter = count - minOverlap + halfSpan;
1220
+ xCenter = clamp(
1221
+ xCenter,
1222
+ Math.max(lowCenter, -maxPanBars),
1223
+ Math.min(highCenter, count + maxPanBars)
1224
+ );
1217
1225
  };
1218
1226
  const fitXViewport = () => {
1219
1227
  const count = data.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.115",
3
+ "version": "0.1.116",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",