layerchart 0.25.0 → 0.25.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.
|
@@ -30,22 +30,22 @@ function getCoords(tick) {
|
|
|
30
30
|
case 'top':
|
|
31
31
|
return {
|
|
32
32
|
x: $xScale(tick) + (isScaleBand($xScale) ? $xScale.bandwidth() / 2 : 0),
|
|
33
|
-
y: xRangeMin
|
|
33
|
+
y: xRangeMin,
|
|
34
34
|
};
|
|
35
35
|
case 'bottom':
|
|
36
36
|
return {
|
|
37
37
|
x: $xScale(tick) + (isScaleBand($xScale) ? $xScale.bandwidth() / 2 : 0),
|
|
38
|
-
y: yRangeMax
|
|
38
|
+
y: yRangeMax,
|
|
39
39
|
};
|
|
40
40
|
case 'left':
|
|
41
41
|
return {
|
|
42
42
|
x: xRangeMin,
|
|
43
|
-
y: $yScale(tick) + (isScaleBand($yScale) ? $yScale.bandwidth() / 2 : 0)
|
|
43
|
+
y: $yScale(tick) + (isScaleBand($yScale) ? $yScale.bandwidth() / 2 : 0),
|
|
44
44
|
};
|
|
45
45
|
case 'right':
|
|
46
46
|
return {
|
|
47
47
|
x: xRangeMax,
|
|
48
|
-
y: $yScale(tick) + (isScaleBand($yScale) ? $yScale.bandwidth() / 2 : 0)
|
|
48
|
+
y: $yScale(tick) + (isScaleBand($yScale) ? $yScale.bandwidth() / 2 : 0),
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -55,27 +55,27 @@ function getDefaultLabelProps() {
|
|
|
55
55
|
return {
|
|
56
56
|
textAnchor: 'middle',
|
|
57
57
|
verticalAnchor: 'end',
|
|
58
|
-
dy: -6 // manually adjusted until Text supports custom styles
|
|
58
|
+
dy: -6, // manually adjusted until Text supports custom styles
|
|
59
59
|
};
|
|
60
60
|
case 'bottom':
|
|
61
61
|
return {
|
|
62
62
|
textAnchor: 'middle',
|
|
63
63
|
verticalAnchor: 'start',
|
|
64
|
-
dy: 4 // manually adjusted until Text supports custom styles
|
|
64
|
+
dy: 4, // manually adjusted until Text supports custom styles
|
|
65
65
|
};
|
|
66
66
|
case 'left':
|
|
67
67
|
return {
|
|
68
68
|
textAnchor: 'end',
|
|
69
69
|
verticalAnchor: 'middle',
|
|
70
70
|
dx: -4,
|
|
71
|
-
dy: -2 // manually adjusted until Text supports custom styles
|
|
71
|
+
dy: -2, // manually adjusted until Text supports custom styles
|
|
72
72
|
};
|
|
73
73
|
case 'right':
|
|
74
74
|
return {
|
|
75
75
|
textAnchor: 'start',
|
|
76
76
|
verticalAnchor: 'middle',
|
|
77
77
|
dx: 4,
|
|
78
|
-
dy: -2 // manually adjusted until Text supports custom styles
|
|
78
|
+
dy: -2, // manually adjusted until Text supports custom styles
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -155,10 +155,13 @@ function getDefaultLabelProps() {
|
|
|
155
155
|
<Text
|
|
156
156
|
x={tickCoords.x}
|
|
157
157
|
y={tickCoords.y}
|
|
158
|
-
class="label text-[10px] stroke-white [stroke-width:2px] font-light"
|
|
159
158
|
value={formatValue(tick, format ?? scale.tickFormat?.())}
|
|
160
159
|
{...getDefaultLabelProps()}
|
|
161
160
|
{...labelProps}
|
|
161
|
+
class={cls(
|
|
162
|
+
'label text-[10px] stroke-white [stroke-width:2px] font-light',
|
|
163
|
+
labelProps?.class
|
|
164
|
+
)}
|
|
162
165
|
/>
|
|
163
166
|
</g>
|
|
164
167
|
{/each}
|
|
@@ -40,10 +40,10 @@ let wordsByLines = [];
|
|
|
40
40
|
let wordsWithWidth = [];
|
|
41
41
|
let spaceWidth = 0;
|
|
42
42
|
let style = undefined; // TODO: read from DOM?
|
|
43
|
-
$: words = value ? value.toString().split(/(?:(?!\u00A0+)\s+)/) : [];
|
|
43
|
+
$: words = value != null ? value.toString().split(/(?:(?!\u00A0+)\s+)/) : [];
|
|
44
44
|
$: wordsWithWidth = words.map((word) => ({
|
|
45
45
|
word,
|
|
46
|
-
width: getStringWidth(word, style) || 0
|
|
46
|
+
width: getStringWidth(word, style) || 0,
|
|
47
47
|
}));
|
|
48
48
|
$: spaceWidth = getStringWidth('\u00A0', style) || 0;
|
|
49
49
|
$: wordsByLines = wordsWithWidth.reduce((result, item) => {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "techniq/layerchart",
|
|
7
|
-
"version": "0.25.
|
|
7
|
+
"version": "0.25.1",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "vite dev",
|
|
10
10
|
"build": "vite build",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"layercake": "^8.0.2",
|
|
90
90
|
"lodash-es": "^4.17.21",
|
|
91
91
|
"shapefile": "^0.6.6",
|
|
92
|
-
"svelte-ux": "^0.53.
|
|
92
|
+
"svelte-ux": "^0.53.8",
|
|
93
93
|
"topojson-client": "^3.1.0"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|