remove unnecessary mapping of sample array to array of objects
This commit is contained in:
parent
6c87a9e712
commit
e0cd95fe5c
|
@ -66,7 +66,8 @@ export const DistributionChart: React.FC<DistributionChartProps> = (props) => {
|
||||||
// color: x.color, // not supported yet
|
// color: x.color, // not supported yet
|
||||||
continuous: shape.continuous,
|
continuous: shape.continuous,
|
||||||
discrete: shape.discrete,
|
discrete: shape.discrete,
|
||||||
samples: [] as point[],
|
samples: [] as number[],
|
||||||
|
// samples: [] as point[],
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -86,14 +87,13 @@ export const DistributionChart: React.FC<DistributionChartProps> = (props) => {
|
||||||
if (sampleSets.length) {
|
if (sampleSets.length) {
|
||||||
for (const set of sampleSets) {
|
for (const set of sampleSets) {
|
||||||
if (set.distribution.t.tag === "SampleSet") {
|
if (set.distribution.t.tag === "SampleSet") {
|
||||||
// this must be duplicated to please typescript, more elegant solution probably exists
|
// this conditional must be duplicated to please typescript, more elegant solution probably exists
|
||||||
shapes.value[0].samples.push(
|
shapes.value[0].samples.push(...set.distribution.t.value);
|
||||||
...set.distribution.t.value.map((v) => ({ x: v, y: 0 }))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(shapes.value);
|
||||||
const spec = buildVegaSpec(props);
|
const spec = buildVegaSpec(props);
|
||||||
|
|
||||||
let widthProp = width ? width : size.width;
|
let widthProp = width ? width : size.width;
|
||||||
|
|
|
@ -316,7 +316,7 @@ export function buildVegaSpec(
|
||||||
from: { data: "sample_facet" },
|
from: { data: "sample_facet" },
|
||||||
encode: {
|
encode: {
|
||||||
enter: {
|
enter: {
|
||||||
x: { scale: "xscale", field: "x" },
|
x: { scale: "xscale", field: "data"},
|
||||||
width: { value: 0.1 },
|
width: { value: 0.1 },
|
||||||
|
|
||||||
y: { value: 25, offset: { signal: "height" } },
|
y: { value: 25, offset: { signal: "height" } },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user