@@ -7,15 +7,14 @@ import {
77 Tooltip ,
88 Legend ,
99 ResponsiveContainer ,
10+ TooltipContentProps ,
1011} from "recharts" ;
1112import { Box , BoxProps , Center , Spinner } from "@chakra-ui/react" ;
1213import { useGraphInputStore } from "../../store/GraphInputStore" ;
1314import { usePlotSettingsStore } from "../../store/PlotSettingsStore" ;
1415import { capitalizeFirstLetter } from "../../hooks/utils" ;
1516import { CustomTooltip } from "./CustomTooltip" ;
16- import {
17- formatHoursSinceLaunch ,
18- } from "../../hooks/graphing/utils" ;
17+ import { formatHoursSinceLaunch } from "../../hooks/graphing/utils" ;
1918import { BiError } from "react-icons/bi" ;
2019import { ErrorMessage } from "../Input/StandardLayoutInput/ErrorMessage" ;
2120import useGetPlotData from "../../hooks/graphing/processPlottingData" ;
@@ -30,14 +29,15 @@ import PlotCustomizationButtons from "../Common/PlotCustomizationButtons";
3029 */
3130function GraphComponent ( props : BoxProps ) {
3231 const { plotQuery, leagues } = useGraphInputStore ( ) ;
33- const { result : plotData ,
32+ const {
33+ result : plotData ,
3434 mostCommonCurrencyUsed,
3535 confidenceRating,
3636 upperBoundryChaos,
3737 upperBoundrySecondary,
3838 fetchStatus,
39- error } = useGetPlotData ( plotQuery ) ;
40-
39+ error,
40+ } = useGetPlotData ( plotQuery ) ;
4141
4242 const mostCommonCurrencyUsedName = `${ capitalizeFirstLetter ( mostCommonCurrencyUsed ?? "" ) } value` ;
4343 const renderGraph =
@@ -57,9 +57,17 @@ function GraphComponent(props: BoxProps) {
5757 : "ui.input" ;
5858
5959 const colors = [
60- "#1f77b4" , "#ff7f0e" , "#2ca02c" , "#d62728" , "#9467bd" , "#8c564b" , "#e377c2" , "#7f7f7f" , "#bcbd22" , "#17becf"
61- ]
62-
60+ "#1f77b4" ,
61+ "#ff7f0e" ,
62+ "#2ca02c" ,
63+ "#d62728" ,
64+ "#9467bd" ,
65+ "#8c564b" ,
66+ "#e377c2" ,
67+ "#7f7f7f" ,
68+ "#bcbd22" ,
69+ "#17becf" ,
70+ ] ;
6371
6472 if ( fetchStatus === "fetching" ) {
6573 return (
@@ -145,25 +153,35 @@ function GraphComponent(props: BoxProps) {
145153 allowDataOverflow
146154 />
147155 < Tooltip
148- content = { < CustomTooltip upperBoundry = { upperBoundryChaos } fetchedLeagues = { fetchedLeagues } colors = { colors } /> }
156+ content = { ( props : TooltipContentProps < number , number > ) => (
157+ < CustomTooltip
158+ { ...props }
159+ upperBoundry = { upperBoundryChaos }
160+ fetchedLeagues = { fetchedLeagues }
161+ colors = { colors }
162+ />
163+ ) }
149164 isAnimationActive = { false }
150165 />
151166 < Legend verticalAlign = "top" height = { 36 } />
152- { plotData . data . map ( ( series , idx ) => (
153- leagues . includes ( series . name ) && ( < Line
154- type = "monotone"
155- data = { series . data }
156- dataKey = { "valueInChaos" }
157- key = { series . name }
158- name = { series . name + " - " + "Chaos Value" }
159- stroke = { colors [ idx ] }
160- yAxisId = { 0 }
161- hide = { ! showChaos }
162- isAnimationActive = { false }
163- dot = { { fill : colors [ idx ] } }
164- legendType = { showChaos ? "line" : "none" }
165- /> )
166- ) ) }
167+ { plotData . data . map (
168+ ( series , idx ) =>
169+ leagues . includes ( series . name ) && (
170+ < Line
171+ type = "monotone"
172+ data = { series . data }
173+ dataKey = { "valueInChaos" }
174+ key = { series . name }
175+ name = { series . name + " - " + "Chaos Value" }
176+ stroke = { colors [ idx ] }
177+ yAxisId = { 0 }
178+ hide = { ! showChaos }
179+ isAnimationActive = { false }
180+ dot = { { fill : colors [ idx ] } }
181+ legendType = { showChaos ? "line" : "none" }
182+ />
183+ ) ,
184+ ) }
167185 < YAxis
168186 label = { {
169187 value : mostCommonCurrencyUsedName ,
@@ -178,21 +196,25 @@ function GraphComponent(props: BoxProps) {
178196 domain = { [ 0 , upperBoundrySecondary ] }
179197 allowDataOverflow
180198 />
181- { mostCommonCurrencyUsed !== "chaos" && plotData . data . map ( ( series , idx ) => (
182- leagues . includes ( series . name ) && ( < Line
183- type = "monotone"
184- data = { series . data }
185- dataKey = { "valueInMostCommonCurrencyUsed" }
186- key = { series . name }
187- name = { series . name + " - " + mostCommonCurrencyUsedName }
188- stroke = { colors [ idx ] }
189- yAxisId = { 1 }
190- hide = { ! showSecondary }
191- isAnimationActive = { false }
192- dot = { { fill : colors [ idx ] } }
193- legendType = { showSecondary ? "line" : "none" }
194- /> )
195- ) ) }
199+ { mostCommonCurrencyUsed !== "chaos" &&
200+ plotData . data . map (
201+ ( series , idx ) =>
202+ leagues . includes ( series . name ) && (
203+ < Line
204+ type = "monotone"
205+ data = { series . data }
206+ dataKey = { "valueInMostCommonCurrencyUsed" }
207+ key = { series . name }
208+ name = { series . name + " - " + mostCommonCurrencyUsedName }
209+ stroke = { colors [ idx ] }
210+ yAxisId = { 1 }
211+ hide = { ! showSecondary }
212+ isAnimationActive = { false }
213+ dot = { { fill : colors [ idx ] } }
214+ legendType = { showSecondary ? "line" : "none" }
215+ />
216+ ) ,
217+ ) }
196218 </ LineChart >
197219 </ ResponsiveContainer >
198220 </ Box >
0 commit comments