-
Notifications
You must be signed in to change notification settings - Fork 1
added download options for 3d plot #49
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
Open
sophiaxzhang
wants to merge
6
commits into
main
Choose a base branch
from
sophia_dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eee7ff9
add autoscale z check box for 3d bar graph
sophiaxzhang 7934f61
Merge pull request #34 from sys-bio/main
sophiaxzhang 42cfaae
added color schemes and thickened 2d plot line
sophiaxzhang 0c2f276
add download for 3d model
sophiaxzhang a07d980
adjusted distnaces for 3d axis labels
sophiaxzhang 467c242
linting fix
sophiaxzhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,17 @@ | ||
| import { useState } from "react"; | ||
| import { useAtomValue } from "jotai"; | ||
| import { useAtomValue, useAtom } from "jotai"; | ||
|
|
||
| import styles from "./results.module.css"; | ||
|
|
||
| import SelectProperty from "@/components/property-list/SelectProperty"; | ||
| import BooleanProperty from "@/components/property-list/BooleanProperty"; | ||
| import NumericProperty from "@/components/property-list/NumericProperty"; | ||
| import PropertyList from "@/components/property-list/PropertyList"; | ||
| import ArrayBarChart3D from "./visuals/ArrayBarChart3D"; | ||
| import { Allotment } from "allotment"; | ||
|
|
||
| import { simulationResultAtom } from "@/globals/simulation"; | ||
| import { graphSettingsAtom, steadyState3DItemAtom } from "@/globals/settings"; | ||
| import { PALETTES } from "@/features/colors"; | ||
|
|
||
| const ITEMS = [ | ||
| "Jacobian", | ||
|
|
@@ -24,12 +29,25 @@ const AXES: { [name: string]: { x: string; y: string; z: string } } = { | |
|
|
||
| const ITEM_OPTIONS = Object.fromEntries(ITEMS.map((i) => [i, i])); | ||
|
|
||
| type Item = (typeof ITEMS)[number]; | ||
|
|
||
| const SteadyState3DPanel = () => { | ||
| const result = useAtomValue(simulationResultAtom); | ||
| const [graphSettings, setGraphSettings] = useAtom(graphSettingsAtom); | ||
| const [item, setItem] = useAtom(steadyState3DItemAtom); | ||
|
|
||
| const handleZAxisChangeFor = ( | ||
| setting: keyof Pick< | ||
| typeof graphSettings, | ||
| "isAutoscaledZ" | "minZ" | "maxZ" | "colorScheme3D" | ||
| >, | ||
| ): ((newValue: unknown) => void) => { | ||
| return (newValue) => { | ||
| setGraphSettings({ ...graphSettings, [setting]: newValue }); | ||
| }; | ||
| }; | ||
|
|
||
| const [item, setItem] = useState<Item>("Jacobian"); | ||
| const colorSchemeOptions = Object.fromEntries( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can be moved outside the component, similar to ITEM_OPTIONS |
||
| Object.keys(PALETTES).map((name) => [name, name]), | ||
| ); | ||
|
|
||
| if (result?.type !== "steadyState") { | ||
| return null; | ||
|
|
@@ -44,22 +62,66 @@ const SteadyState3DPanel = () => { | |
|
|
||
| return ( | ||
| <div className={styles.panel}> | ||
| <div className={styles.steadyState3DPanel}> | ||
| <SelectProperty | ||
| name="Item" | ||
| value={item} | ||
| options={ITEM_OPTIONS} | ||
| onChange={setItem} | ||
| /> | ||
| <Allotment vertical> | ||
| <div className={styles.plotContainer}> | ||
| <div className={styles.steadyState3DPanel}> | ||
| <SelectProperty | ||
| name="Item" | ||
| value={item} | ||
| options={ITEM_OPTIONS} | ||
| onChange={(newValue) => setItem(newValue as typeof item)} | ||
| /> | ||
|
|
||
| <ArrayBarChart3D | ||
| name={item} | ||
| data={resultItem} | ||
| x={AXES[item].x} | ||
| y={AXES[item].y} | ||
| z={AXES[item].z} | ||
| isAutoscaledZ={graphSettings.isAutoscaledZ} | ||
| minZ={graphSettings.minZ} | ||
| maxZ={graphSettings.maxZ} | ||
| colorScheme={graphSettings.colorScheme3D} | ||
| /> | ||
| </div> | ||
| </div> | ||
|
|
||
| <ArrayBarChart3D | ||
| name={item} | ||
| data={resultItem} | ||
| x={AXES[item].x} | ||
| y={AXES[item].y} | ||
| z={AXES[item].z} | ||
| /> | ||
| </div> | ||
| <Allotment.Pane preferredSize={200}> | ||
| <div className={styles.quickActionsContainer}> | ||
| <div className={styles.quickActionsSettings}> | ||
| <PropertyList alignment="leftSmall"> | ||
| <BooleanProperty | ||
| name="Autoscale Z" | ||
| value={graphSettings.isAutoscaledZ} | ||
| onChange={handleZAxisChangeFor("isAutoscaledZ")} | ||
| /> | ||
| {!graphSettings.isAutoscaledZ && ( | ||
| <NumericProperty | ||
| name="Z Minimum" | ||
| value={graphSettings.minZ} | ||
| onChange={handleZAxisChangeFor("minZ")} | ||
| validator={(newValue) => newValue < graphSettings.maxZ} | ||
| /> | ||
| )} | ||
| {!graphSettings.isAutoscaledZ && ( | ||
| <NumericProperty | ||
| name="Z Maximum" | ||
| value={graphSettings.maxZ} | ||
| onChange={handleZAxisChangeFor("maxZ")} | ||
| validator={(newValue) => newValue > graphSettings.minZ} | ||
| /> | ||
| )} | ||
| <SelectProperty | ||
| name="Color Scheme" | ||
| value={graphSettings.colorScheme3D} | ||
| options={colorSchemeOptions} | ||
| onChange={handleZAxisChangeFor("colorScheme3D") as (newValue: string) => void} | ||
| /> | ||
| </PropertyList> | ||
| </div> | ||
| </div> | ||
| </Allotment.Pane> | ||
| </Allotment> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.