Skip to content

Commit

Permalink
Merge pull request #312 from anshikjain18/anshikjain18/issue310
Browse files Browse the repository at this point in the history
removed Word Cloud tab from Add Plot for #310
  • Loading branch information
JakeWags authored Mar 25, 2024
2 parents 39bcd27 + 3f1b8d0 commit 68eeeef
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 68 deletions.
1 change: 0 additions & 1 deletion packages/core/src/defaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const DefaultConfig: UpsetConfig = {
plots: {
scatterplots: [],
histograms: [],
wordClouds: [],
},
allSets: [],
};
7 changes: 1 addition & 6 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,7 @@ export type Histogram = BasePlot & {
frequency: boolean;
};

export type WordCloud = BasePlot & {
type: 'Word Cloud';
};

export type Plot = Scatterplot | Histogram | WordCloud;
export type Plot = Scatterplot | Histogram;

export type Bookmark = { id: string; label: string; size: number }

Expand All @@ -186,7 +182,6 @@ export type UpsetConfig = {
plots: {
scatterplots: Scatterplot[];
histograms: Histogram[];
wordClouds: WordCloud[];
};
allSets: Column[];
};
Expand Down
6 changes: 0 additions & 6 deletions packages/upset/src/atoms/config/plotAtoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@ export const histogramSelector = selector({
get: ({ get }) => get(plotsMapSelector).histograms,
});

export const wordCloudSelector = selector({
key: 'wordcloud',
get: ({ get }) => get(plotsMapSelector).wordClouds,
});

export const plotsSelector = selector({
key: 'all-plots',
get: ({ get }) => [
...get(scatterplotsSelector),
...get(histogramSelector),
...get(wordCloudSelector),
],
});
17 changes: 0 additions & 17 deletions packages/upset/src/components/ElementView/AddPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,20 +230,3 @@ export const AddHistogram: FC<Props> = ({ handleClose }) => {
</Grid>
);
};

export const AddWordCloud = () => (
<Grid container spacing={1} sx={{ width: '100%', height: '100%' }}>
<Grid container item xs={12}>
Coming Soon...
{/* {Object.values(items).length && (
<VegaLite
spec={createWordCloudSpec()}
data={{
elements: Object.values(JSON.parse(JSON.stringify(items))),
}}
actions={false}
/>
)} */}
</Grid>
</Grid>
);
8 changes: 2 additions & 6 deletions packages/upset/src/components/ElementView/AddPlotDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
} from '@mui/material';
import { FC, ReactNode, useState } from 'react';

import { AddHistogram, AddScatterplot, AddWordCloud } from './AddPlot';
import { AddHistogram, AddScatterplot } from './AddPlot';

type PlotType = 'Scatterplot' | 'Histogram' | 'WordCloud';
type PlotType = 'Scatterplot' | 'Histogram';

type TabProps = {
children?: ReactNode;
Expand Down Expand Up @@ -69,7 +69,6 @@ export const AddPlotDialog: FC<Props> = ({ open, onClose }) => {
>
<Tab label="Scatterplot" value="Scatterplot" />
<Tab label="Histogram" value="Histogram" />
<Tab label="Word Cloud" value="WordCloud" />
</Tabs>

<TabPanel index="Scatterplot" value={currentTab}>
Expand All @@ -78,9 +77,6 @@ export const AddPlotDialog: FC<Props> = ({ open, onClose }) => {
<TabPanel index="Histogram" value={currentTab}>
<AddHistogram handleClose={onClose} />
</TabPanel>
<TabPanel index="WordCloud" value={currentTab}>
<AddWordCloud />
</TabPanel>
</Dialog>
);
};
24 changes: 0 additions & 24 deletions packages/upset/src/components/ElementView/generatePlotSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,27 +214,3 @@ export function generateVega(

return base;
}

export function createWordCloudSpec(): VisualizationSpec {
return {
width: 400,
height: 400,
data: {
name: 'elements',
},
mark: 'text',
transform: [
{
type: 'wordcloud',
size: [800, 400],
text: { field: 'label' },
rotate: { random: [-60, -30, 0, 30, 60] },
font: 'Helvetica Neue, Arial',
fontSize: { field: 'datum.count' },
fontWeight: { field: 'datum.weight' },
fontSizeRange: [12, 56],
padding: 2,
} as any,
],
};
}
8 changes: 0 additions & 8 deletions packages/upset/src/provenance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ const addPlotAction = registry.register(
case 'Scatterplot':
state.plots.scatterplots = [...state.plots.scatterplots, plot];
break;
case 'Word Cloud':
state.plots.wordClouds = [...state.plots.wordClouds, plot];
break;
default:
throw new Error(`Unknown plot type: ${plot.type}`);
}
Expand All @@ -211,11 +208,6 @@ const removePlotAction = registry.register(
(d) => d.id !== plot.id,
);
break;
case 'Word Cloud':
state.plots.wordClouds = state.plots.wordClouds.filter(
(d) => d.id !== plot.id,
);
break;
default:
throw new Error(`Unknown plot type: ${plot.type}`);
}
Expand Down

0 comments on commit 68eeeef

Please sign in to comment.