@fundar/data-chart-telling 0.0.2 → 0.0.3

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.
@@ -62,12 +62,12 @@
62
62
  </script>
63
63
 
64
64
  {#if resolved}
65
- {@const fromVis = clamp(resolved.from)}
66
- {@const toVis = clamp(resolved.to)}
67
- {@const textPt = pt(resolved.at, textVaryCoord(fromVis, toVis))}
65
+ {@const fromVis = clamp(resolved?.from ?? 0)}
66
+ {@const toVis = clamp(resolved?.to ?? 0)}
67
+ {@const textPt = pt(resolved?.at ?? 0, textVaryCoord(fromVis, toVis))}
68
68
 
69
69
  <Line
70
- data={[pt(resolved.at, fromVis), pt(resolved.at, toVis)]}
70
+ data={[pt(resolved?.at ?? 0, fromVis), pt(resolved?.at ?? 0, toVis)]}
71
71
  x={(p) => p.x}
72
72
  y={(p) => p.y}
73
73
  stroke={strokeStyle?.stroke ?? 'currentColor'}
@@ -77,19 +77,19 @@
77
77
  strokeLinecap={strokeStyle?.strokeLinecap ?? 'round'}
78
78
  />
79
79
  <DotMarker
80
- x={pt(resolved.at, fromVis).x}
81
- y={pt(resolved.at, fromVis).y}
80
+ x={pt(resolved?.at ?? 0, fromVis).x}
81
+ y={pt(resolved?.at ?? 0, fromVis).y}
82
82
  style={{ dotRadius: 4, dotFill: strokeStyle?.stroke, dotStroke: strokeStyle?.stroke, dotStrokeWidth: 2, ...dotStyle }}
83
83
  />
84
84
  <DotMarker
85
- x={pt(resolved.at, toVis).x}
86
- y={pt(resolved.at, toVis).y}
85
+ x={pt(resolved?.at ?? 0, toVis).x}
86
+ y={pt(resolved?.at ?? 0, toVis).y}
87
87
  style={{ dotRadius: 4, dotFill: strokeStyle?.stroke, dotStroke: strokeStyle?.stroke, dotStrokeWidth: 2, ...dotStyle }}
88
88
  />
89
89
  <TextMarker
90
90
  x={textPt.x}
91
91
  y={textPt.y}
92
- text={(formatDiff ?? ((v: number) => v.toFixed(1)))(resolved.diff)}
92
+ text={(formatDiff ?? ((v: number) => v.toFixed(1)))(resolved?.diff ?? 0)}
93
93
  style={{
94
94
  fontWeight: 'bold',
95
95
  fontSize: 14,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fundar/data-chart-telling",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "svelte-package",