svelteplot 0.4.4-pr-105.0 → 0.4.4-pr-105.2
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/dist/helpers/resolve.js
CHANGED
|
@@ -11,7 +11,7 @@ export function resolveProp(accessor, datum, _defaultValue = null) {
|
|
|
11
11
|
// so we're passing the original value to accessor functions instead of our wrapped record
|
|
12
12
|
return datum == null
|
|
13
13
|
? accessor()
|
|
14
|
-
: accessor(datum
|
|
14
|
+
: accessor(datum.hasOwnProperty(RAW_VALUE) ? datum[RAW_VALUE] : datum, datum[INDEX]);
|
|
15
15
|
}
|
|
16
16
|
else if ((typeof accessor === 'string' || typeof accessor === 'symbol') &&
|
|
17
17
|
datum &&
|
package/dist/marks/AreaY.svelte
CHANGED
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
import Area from './Area.svelte';
|
|
11
11
|
import { renameChannels } from '../transforms/rename.js';
|
|
12
12
|
import { stackY } from '../transforms/stack.js';
|
|
13
|
-
import { recordizeY } from '../transforms/recordize.js';
|
|
13
|
+
import { RAW_VALUE, recordizeY } from '../transforms/recordize.js';
|
|
14
14
|
import type { ChannelAccessor, DataRow, PlotDefaults } from '../types/index.js';
|
|
15
15
|
import { getContext, type Component, type ComponentProps } from 'svelte';
|
|
16
|
+
import { area } from 'd3-shape';
|
|
16
17
|
|
|
17
18
|
let markProps: AreaYMarkProps = $props();
|
|
18
19
|
|
|
@@ -13,12 +13,15 @@ export function indexData(data) {
|
|
|
13
13
|
export function recordizeX({ data, ...channels }, { withIndex } = { withIndex: true }) {
|
|
14
14
|
const dataIsRawValueArray = !isDataRecord(data[0]) && !Array.isArray(data[0]) && channels.x == null;
|
|
15
15
|
if (dataIsRawValueArray) {
|
|
16
|
+
// we remove x, x1 and x2 from the channels since they make no sense when
|
|
17
|
+
// the data is a raw value array
|
|
18
|
+
const { x, x1, x2, ...nonXChannels } = channels;
|
|
16
19
|
return {
|
|
17
20
|
data: data.map((value, index) => ({
|
|
18
21
|
[RAW_VALUE]: value,
|
|
19
22
|
[INDEX]: index
|
|
20
23
|
})),
|
|
21
|
-
...
|
|
24
|
+
...nonXChannels,
|
|
22
25
|
x: RAW_VALUE,
|
|
23
26
|
...(withIndex ? { y: INDEX } : {})
|
|
24
27
|
};
|
|
@@ -34,12 +37,15 @@ export function recordizeY({ data, ...channels }, { withIndex } = { withIndex: t
|
|
|
34
37
|
return { data, ...channels };
|
|
35
38
|
const dataIsRawValueArray = !isDataRecord(data[0]) && !Array.isArray(data[0]) && channels.y == null;
|
|
36
39
|
if (dataIsRawValueArray) {
|
|
40
|
+
// we remove y, y1 and y2 from the channels since they make no sense when
|
|
41
|
+
// the data is a raw value array
|
|
42
|
+
const { y, y1, y2, ...nonYChannels } = channels;
|
|
37
43
|
return {
|
|
38
44
|
data: Array.from(data).map((value, index) => ({
|
|
39
45
|
[INDEX]: index,
|
|
40
46
|
[RAW_VALUE]: value
|
|
41
47
|
})),
|
|
42
|
-
...
|
|
48
|
+
...nonYChannels,
|
|
43
49
|
...(withIndex ? { x: INDEX } : {}),
|
|
44
50
|
y: RAW_VALUE
|
|
45
51
|
};
|
package/dist/transforms/stack.js
CHANGED
|
@@ -128,7 +128,7 @@ function stackXY(byDim, data, channels, options) {
|
|
|
128
128
|
: STACK_OFFSET[options.offset])
|
|
129
129
|
.keys(keys)
|
|
130
130
|
.value((d, key, i, data) => {
|
|
131
|
-
return d[key]?.v;
|
|
131
|
+
return d[key]?.v == null ? undefined : d[key]?.v;
|
|
132
132
|
})(stackData);
|
|
133
133
|
// and combine it all back into a flat array
|
|
134
134
|
const newData = series
|