Skip to content

Commit

Permalink
Bugfix: disinclude Degree and Deviation from plottable attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
NateLanza committed Jan 8, 2025
1 parent 064918b commit c93cf45
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion packages/upset/src/atoms/attributeAtom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { atom, selectorFamily } from 'recoil';
import { atom, selector, selectorFamily } from 'recoil';

import { itemsAtom } from './itemsAtoms';

Expand All @@ -10,6 +10,17 @@ export const attributeAtom = atom<string[]>({
default: [],
});

/**
* All attribute columns except Degree and Deviation
*/
export const dataAttributeSelector = selector<string[]>({
key: 'data-attribute-columns',
get: ({ get }) => {
const atts = get(attributeAtom);
return atts.filter((att) => att !== 'Degree' && att !== 'Deviation');
},
});

/**
* Gets all non-NaN values for a given attribute
* @param {string} attribute Attribute name
Expand Down
4 changes: 2 additions & 2 deletions packages/upset/src/components/ElementView/AddPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { FC, useContext, useState } from 'react';
import { useRecoilValue } from 'recoil';

import { attributeAtom } from '../../atoms/attributeAtom';
import { attributeAtom, dataAttributeSelector } from '../../atoms/attributeAtom';
import { itemsAtom } from '../../atoms/itemsAtoms';
import { ProvenanceContext } from '../Root';
import { HistogramPlot } from './HistogramPlot';
Expand Down Expand Up @@ -140,7 +140,7 @@ export const AddScatterplot: FC<Props> = ({ handleClose }) => {
export const AddHistogram: FC<Props> = ({ handleClose }) => {
const { actions } = useContext(ProvenanceContext);
const items = useRecoilValue(itemsAtom);
const attributeColumns = useRecoilValue(attributeAtom);
const attributeColumns = useRecoilValue(dataAttributeSelector);
const [attribute, setAttribute] = useState(attributeColumns[0]);
const [bins, setBins] = useState(20);
// Frequency plots are temporarily disabled, see comment further down
Expand Down

0 comments on commit c93cf45

Please sign in to comment.