@@ -13,7 +13,9 @@ interface PlotLineProps {
1313 pointColor ?: string ;
1414 interpolation ?: 'linear' | 'curved' ;
1515 height :number ,
16- pointSetters :pointSetters
16+ pointSetters :pointSetters ,
17+ yScale :number ,
18+ xScale :number
1719}
1820
1921interface pointSetters {
@@ -104,10 +106,12 @@ export const PlotLine = ({
104106 lineWidth = 5 ,
105107 showPoints = true ,
106108 pointSize = 5 ,
107- pointColor = "white " ,
109+ pointColor = "#777777 " ,
108110 interpolation = 'linear' ,
109111 height,
110- pointSetters
112+ pointSetters,
113+ yScale,
114+ xScale
111115} : PlotLineProps ) => {
112116
113117 const { scaling, timeSeries} = useContext ( plotContext )
@@ -129,11 +133,11 @@ export const PlotLine = ({
129133 if ( ! data || data . length === 0 ) return [ [ new THREE . Vector3 ( 0 , 0 , 0 ) ] , [ 0 ] ] ;
130134 const viewWidth = window . innerWidth ;
131135 const viewHeight = ( window . innerHeight - height - 50 ) ; //The 50 here is the footer at the bottom
132- const xCoords = linspace ( - viewWidth / 2 , viewWidth / 2 , data . length )
136+ const xCoords = linspace ( - viewWidth * xScale / 2 , viewWidth * xScale / 2 , data . length )
133137 const normed = data . map ( ( i ) => ( i - minVal ) / ( maxVal - minVal ) ) ;
134- const points = normed . map ( ( val , idx ) => new THREE . Vector3 ( xCoords [ idx ] , ( val - .5 ) * viewHeight , 5 ) ) ;
138+ const points = normed . map ( ( val , idx ) => new THREE . Vector3 ( xCoords [ idx ] , ( val - .5 ) * viewHeight * yScale , 5 ) ) ;
135139 return [ points , normed ]
136- } , [ data , interpolation , height ] )
140+ } , [ data , interpolation , height , yScale , xScale ] )
137141
138142 const geometry = useMemo ( ( ) => {
139143 if ( ! data || data . length === 0 ) return null ;
0 commit comments