remove dead comments and simplify sample inclusion

This commit is contained in:
Conor Barnes 2022-09-07 11:01:18 -03:00
parent 0c614a3fcf
commit 5b0d7a898f

View File

@ -63,7 +63,6 @@ export const DistributionChart: React.FC<DistributionChartProps> = (props) => {
name: x.name, name: x.name,
// color: x.color, // not supported yet // color: x.color, // not supported yet
...pointSet.asShape(), ...pointSet.asShape(),
// samples: [] as number[],
})) }))
) )
); );
@ -78,16 +77,9 @@ export const DistributionChart: React.FC<DistributionChartProps> = (props) => {
// if this is a sample set, include the samples // if this is a sample set, include the samples
const samples: number[] = []; const samples: number[] = [];
const sampleSets = plot?.distributions.filter( for (const { distribution } of plot?.distributions) {
(dist) => dist.distribution.tag === SqDistributionTag.SampleSet if (distribution.tag === SqDistributionTag.SampleSet) {
); samples.push(...distribution.value());
if (sampleSets.length) {
for (const { distribution } of sampleSets) {
if (distribution.tag === SqDistributionTag.SampleSet) {
// this conditional must be duplicated to please typescript, more elegant solution probably exists
samples.push(...distribution.value());
// shapes.value[0].samples.push(...distribution.value());
}
} }
} }