-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Display integrals for the ranges
close #1225
- Loading branch information
1 parent
31bce41
commit 2644fae
Showing
13 changed files
with
251 additions
and
117 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,30 @@ | ||
import { useChartData } from '../../context/ChartContext'; | ||
import useIntegralPath from '../utilities/useIntegralPath'; | ||
|
||
interface IntegralProps { | ||
range: { id: string; from: number; to: number; integral?: number }; | ||
} | ||
|
||
function RangeIntegral({ range }: IntegralProps) { | ||
const path = useIntegralPath(range, { | ||
useActiveSpectrum: true, | ||
useConstantScale: true, | ||
}); | ||
const { height } = useChartData(); | ||
|
||
return ( | ||
<path | ||
className="line" | ||
stroke="black" | ||
strokeWidth="1" | ||
fill="none" | ||
style={{ | ||
transformOrigin: 'center center', | ||
transform: `translateY(-${height / 4}px)`, | ||
}} | ||
d={path} | ||
/> | ||
); | ||
} | ||
|
||
export default RangeIntegral; |
This file contains 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 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.