@opendata-ai/openchart-vanilla 2.8.1 → 2.9.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendata-ai/openchart-vanilla",
3
- "version": "2.8.1",
3
+ "version": "2.9.1",
4
4
  "description": "Vanilla JS renderer for openchart: SVG charts, HTML tables, force-directed graphs",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Riley Hilliard",
@@ -49,8 +49,8 @@
49
49
  "typecheck": "tsc --noEmit"
50
50
  },
51
51
  "dependencies": {
52
- "@opendata-ai/openchart-core": "2.8.1",
53
- "@opendata-ai/openchart-engine": "2.8.1",
52
+ "@opendata-ai/openchart-core": "2.9.1",
53
+ "@opendata-ai/openchart-engine": "2.9.1",
54
54
  "d3-force": "^3.0.0",
55
55
  "d3-quadtree": "^3.0.1"
56
56
  },
package/src/graph/zoom.ts CHANGED
@@ -88,11 +88,12 @@ export class ZoomTransform {
88
88
  const availH = canvasH - padding * 2;
89
89
  const k = Math.min(availW / graphW, availH / graphH);
90
90
 
91
- // Center the graph in the canvas
91
+ // Center horizontally, top-align vertically.
92
+ // Centering both axes leaves dead space below compact clusters
93
+ // on mobile/portrait containers.
92
94
  const cx = (minX + maxX) / 2;
93
- const cy = (minY + maxY) / 2;
94
95
  const tx = canvasW / 2 - cx * k;
95
- const ty = canvasH / 2 - cy * k;
96
+ const ty = padding - minY * k;
96
97
 
97
98
  return new ZoomTransform(tx, ty, k);
98
99
  }