Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button to show more histogram plots #205

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions gui/src/app/SamplerOutputView/HistsView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ResponsiveGrid from "@SpComponents/ResponsiveGrid";
import SequenceHistogramWidget from "@SpComponents/SequenceHistogramWidget";
import { FunctionComponent, useMemo } from "react";
import { Button } from "@mui/material";
import { FunctionComponent, useMemo, useState } from "react";

type HistsViewProps = {
draws: number[][];
Expand All @@ -18,17 +19,32 @@ const HistsView: FunctionComponent<HistsViewProps> = ({
const namesWithSuffix = paramNames.filter((name) => name.endsWith("__"));
return [...names, ...namesWithSuffix];
}, [paramNames]);
const [abbreviatedToNumPlots, setAbbreviatedToNumPlots] =
useState<number>(30);
return (
<ResponsiveGrid>
{paramNamesResorted.map((paramName) => (
<SequenceHistogramWidget
key={paramName}
histData={draws[paramNames.indexOf(paramName)]}
title={paramName}
variableName={paramName}
/>
))}
</ResponsiveGrid>
<>
<ResponsiveGrid>
{paramNamesResorted.slice(0, abbreviatedToNumPlots).map((paramName) => (
<SequenceHistogramWidget
key={paramName}
histData={draws[paramNames.indexOf(paramName)]}
title={paramName}
variableName={paramName}
/>
))}
</ResponsiveGrid>
{abbreviatedToNumPlots < paramNamesResorted.length && (
<div className="PlotAbbreviationToggle">
<Button
onClick={() => {
setAbbreviatedToNumPlots((x) => x + 30);
}}
>
Show more
</Button>
</div>
)}
</>
);
};

Expand Down
7 changes: 7 additions & 0 deletions gui/src/localStyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ span.EditorTitle {
padding: 5px;
}

/* Histograms */

.PlotAbbreviationToggle {
background: white;
padding: 5px;
}

/* Trace Plots */
.TracePlotsView {
}
Expand Down