-
Notifications
You must be signed in to change notification settings - Fork 1
Time slider #93
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
Merged
Merged
Time slider #93
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
af5323b
Add select box to vertical profiles; data updates but plot doesn't
Peter9192 8057616
Make plot label reactive
Peter9192 c329745
Export supportedscales
Peter9192 4bdb0bc
Able to update scale's domain, but updating scale in place doesn't tr…
Peter9192 485d9f8
Separate scale from scaleprops; now scale is updated as an effect of …
Peter9192 0941892
Make more plot elements reactive; everything works at this point
Peter9192 ac70cb4
Extract variable picker into reusable component
Peter9192 27aaa08
Relax type of variable and prep for also making time configurable
Peter9192 036654a
Nicer formatting
Peter9192 dfb4140
suppress linter for generated code
Peter9192 06c3ac8
Install solid-ui slider component
Peter9192 b0b9cb3
Add slider to set time
Peter9192 6a8158c
Slightly cleaner code
Peter9192 581daf1
Create flatExperiments derived store + make time slider work for mult…
Peter9192 61ddf95
Axis limits now fixed during sliding, but extent calculating still wonky
Peter9192 c376c9a
Refactor timeseries plot using new flatExperiments store
Peter9192 fe85d66
Fix issue with selecting same variable twice
Peter9192 38c9b36
Reuse flatExperiments for skewT plot data
Peter9192 cb9e243
Also add time slider to skew-T plot
Peter9192 f0cbdbe
Get output var names from BMI model - isn't this a bit too entangled?
Peter9192 876529c
Picker must have value
sverhoeven df85e38
fix type issue with suggestion from code review
Peter9192 5aa6e60
use nice description in dropdown for vertical profiles; add todo for …
Peter9192 3e6e339
use analyses store for variable picker
Peter9192 1ac2441
also for vertical profiles
Peter9192 baaea00
Merge branch 'variable-picker' into time-slider
Peter9192 7b82d88
format
Peter9192 00b9827
remove dead code
Peter9192 b3a5163
also lift time signal to analysis store
Peter9192 e0d1baa
prevent overflow of time slider
Peter9192 ad7909a
Reuse time formatter on timeseries x-axis
Peter9192 491554f
Rename lineplot to line
Peter9192 6b2d69f
Merge remote-tracking branch 'origin/main' into time-slider
Peter9192 c1c0c31
Revert "Merge remote-tracking branch 'origin/main' into time-slider"
Peter9192 670dcf7
undo accidental deletion of Line.tsx
Peter9192 4adaf72
format
Peter9192 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import * as d3 from "d3"; | ||
| import { createSignal } from "solid-js"; | ||
| import type { ChartData } from "./ChartContainer"; | ||
| import { useChartContext } from "./ChartContainer"; | ||
|
|
||
| export interface Point { | ||
| x: number; | ||
| y: number; | ||
| } | ||
|
|
||
| export function Line(d: ChartData<Point>) { | ||
| const [chart, updateChart] = useChartContext(); | ||
| const [hovered, setHovered] = createSignal(false); | ||
|
|
||
| const l = d3.line<Point>( | ||
| (d) => chart.scaleX(d.x), | ||
| (d) => chart.scaleY(d.y), | ||
| ); | ||
| return ( | ||
| <path | ||
| onMouseEnter={() => setHovered(true)} | ||
| onMouseLeave={() => setHovered(false)} | ||
| fill="none" | ||
| stroke={d.color} | ||
| stroke-dasharray={d.linestyle} | ||
| stroke-width={hovered() ? 5 : 3} | ||
| d={l(d.data) || ""} | ||
| > | ||
| <title>{d.label}</title> | ||
| </path> | ||
| ); | ||
| } |
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import type { Component, ComponentProps } from "solid-js"; | ||
| import { splitProps } from "solid-js"; | ||
|
|
||
| import { cn } from "~/lib/utils"; | ||
|
|
||
| const Label: Component<ComponentProps<"label">> = (props) => { | ||
| const [local, others] = splitProps(props, ["class"]); | ||
| return ( | ||
| <label | ||
| class={cn( | ||
| "font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", | ||
| local.class, | ||
| )} | ||
| {...others} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export { Label }; |
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 |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| import type { JSX, ValidComponent } from "solid-js"; | ||
| import { splitProps } from "solid-js"; | ||
|
|
||
| import type { PolymorphicProps } from "@kobalte/core/polymorphic"; | ||
| import * as SliderPrimitive from "@kobalte/core/slider"; | ||
|
|
||
| import { Label } from "~/components/ui/label"; | ||
| import { cn } from "~/lib/utils"; | ||
|
|
||
| type SliderRootProps<T extends ValidComponent = "div"> = | ||
| SliderPrimitive.SliderRootProps<T> & { | ||
| class?: string | undefined; | ||
| }; | ||
|
|
||
| const Slider = <T extends ValidComponent = "div">( | ||
| props: PolymorphicProps<T, SliderRootProps<T>>, | ||
| ) => { | ||
| const [local, others] = splitProps(props as SliderRootProps, ["class"]); | ||
| return ( | ||
| <SliderPrimitive.Root | ||
| class={cn( | ||
| "relative flex w-full touch-none select-none flex-col items-center", | ||
| local.class, | ||
| )} | ||
| {...others} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| type SliderTrackProps<T extends ValidComponent = "div"> = | ||
| SliderPrimitive.SliderTrackProps<T> & { | ||
| class?: string | undefined; | ||
| }; | ||
|
|
||
| const SliderTrack = <T extends ValidComponent = "div">( | ||
| props: PolymorphicProps<T, SliderTrackProps<T>>, | ||
| ) => { | ||
| const [local, others] = splitProps(props as SliderTrackProps, ["class"]); | ||
| return ( | ||
| <SliderPrimitive.Track | ||
| class={cn( | ||
| "relative h-2 w-full grow rounded-full bg-secondary", | ||
| local.class, | ||
| )} | ||
| {...others} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| type SliderFillProps<T extends ValidComponent = "div"> = | ||
| SliderPrimitive.SliderFillProps<T> & { | ||
| class?: string | undefined; | ||
| }; | ||
|
|
||
| const SliderFill = <T extends ValidComponent = "div">( | ||
| props: PolymorphicProps<T, SliderFillProps<T>>, | ||
| ) => { | ||
| const [local, others] = splitProps(props as SliderFillProps, ["class"]); | ||
| return ( | ||
| <SliderPrimitive.Fill | ||
| class={cn("absolute h-full rounded-full bg-primary", local.class)} | ||
| {...others} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| type SliderThumbProps<T extends ValidComponent = "span"> = | ||
| SliderPrimitive.SliderThumbProps<T> & { | ||
| class?: string | undefined; | ||
| children?: JSX.Element; | ||
| }; | ||
|
|
||
| const SliderThumb = <T extends ValidComponent = "span">( | ||
| props: PolymorphicProps<T, SliderThumbProps<T>>, | ||
| ) => { | ||
| const [local, others] = splitProps(props as SliderThumbProps, [ | ||
| "class", | ||
| "children", | ||
| ]); | ||
| return ( | ||
| <SliderPrimitive.Thumb | ||
| class={cn( | ||
| "top-[-6px] block size-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", | ||
| local.class, | ||
| )} | ||
| {...others} | ||
| > | ||
| <SliderPrimitive.Input /> | ||
| </SliderPrimitive.Thumb> | ||
| ); | ||
| }; | ||
|
|
||
| const SliderLabel = <T extends ValidComponent = "label">( | ||
| props: PolymorphicProps<T, SliderPrimitive.SliderLabelProps<T>>, | ||
| ) => { | ||
| return <SliderPrimitive.Label as={Label} {...props} />; | ||
| }; | ||
|
|
||
| const SliderValueLabel = <T extends ValidComponent = "label">( | ||
| props: PolymorphicProps<T, SliderPrimitive.SliderValueLabelProps<T>>, | ||
| ) => { | ||
| return <SliderPrimitive.ValueLabel as={Label} {...props} />; | ||
| }; | ||
|
|
||
| export { | ||
| Slider, | ||
| SliderTrack, | ||
| SliderFill, | ||
| SliderThumb, | ||
| SliderLabel, | ||
| SliderValueLabel, | ||
| }; |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.