remove unnecessary mapping of sample array to array of objects

This commit is contained in:
Conor Barnes 2022-09-06 14:52:57 -03:00
parent 6c87a9e712
commit e0cd95fe5c
2 changed files with 6 additions and 6 deletions

View File

@ -66,7 +66,8 @@ export const DistributionChart: React.FC<DistributionChartProps> = (props) => {
// color: x.color, // not supported yet
continuous: shape.continuous,
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) {
for (const set of sampleSets) {
if (set.distribution.t.tag === "SampleSet") {
// this must be duplicated to please typescript, more elegant solution probably exists
shapes.value[0].samples.push(
...set.distribution.t.value.map((v) => ({ x: v, y: 0 }))
);
// this conditional must be duplicated to please typescript, more elegant solution probably exists
shapes.value[0].samples.push(...set.distribution.t.value);
}
}
}
console.log(shapes.value);
const spec = buildVegaSpec(props);
let widthProp = width ? width : size.width;

View File

@ -316,7 +316,7 @@ export function buildVegaSpec(
from: { data: "sample_facet" },
encode: {
enter: {
x: { scale: "xscale", field: "x" },
x: { scale: "xscale", field: "data"},
width: { value: 0.1 },
y: { value: 25, offset: { signal: "height" } },