@windborne/grapher 1.0.38 → 1.0.39

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": "@windborne/grapher",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "Graphing library",
5
5
  "main": "src/index.js",
6
6
  "module": "dist/bundle.esm.js",
@@ -29,7 +29,6 @@ export default function drawLine(dataInRenderSpace, {
29
29
  return;
30
30
  }
31
31
 
32
- // Check if this is a WebGL context instead of 2D context
33
32
  if (!context.setLineDash) {
34
33
  console.error('drawLine called with WebGL context instead of 2D context');
35
34
  return;
@@ -66,10 +66,18 @@ export default function calculateTooltipState({mousePresent, mouseX, mouseY, siz
66
66
  continue;
67
67
  }
68
68
 
69
- const dataMinX = data[0][0];
70
- const dataMaxX = data[data.length - 1][0];
69
+ let dataMinX = data[0][0];
70
+ let dataMaxX = data[data.length - 1][0];
71
+
72
+ if (dataMinX instanceof Date) {
73
+ dataMinX = dataMinX.getTime();
74
+ }
75
+ if (dataMaxX instanceof Date) {
76
+ dataMaxX = dataMaxX.getTime();
77
+ }
78
+
71
79
  const dataRange = dataMaxX - dataMinX;
72
- const padding = Math.max(dataRange * 0.05, (bounds.maxX - bounds.minX) * 0.02);
80
+ const padding = 0;
73
81
 
74
82
  if (trueX < dataMinX - padding || trueX > dataMaxX + padding) {
75
83
  continue;