You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.
These two components, XAxis and YAxis, have the same logic more or less. The same is true of the other components listed in the title of the issue.
The main difference is whether we use an x or y axis! Look into generalizing this structure throughout the listed components.
constXAxis=()=>{constref=useRef(null);const{ aes, dimensions }=useContext(ChartContext);// aes contains two values representing either the x or y values we want to visualizeconstscale=useScale(aes[0]);// need to set the range to properly display our graph visuallyscale.range([dimensions.padding,dimensions.width-dimensions.padding]);useEffect(()=>{constaxisLocation=`translate(0, ${dimensions.height-dimensions.padding})`;constnode=select(ref.current).attr('transform',axisLocation);node.call(axisBottom(scale));},[dimensions.height,dimensions.padding,scale]);return<gref={ref}/>;};constYAxis=()=>{constref=useRef(null);const{ aes, dimensions }=useContext(ChartContext);// aes contains two values representing either the x or values we want to visualizeconstscale=useScale(aes[1]);// need to set the range to properly display our graph visuallyscale.range([dimensions.height-dimensions.padding,dimensions.padding]);useEffect(()=>{constaxisLocation=`translate(${dimensions.padding}, 0)`;constnode=select(ref.current).attr('transform',axisLocation);node.call(axisLeft(scale));},[dimensions.padding,scale]);return<gref={ref}/>;};
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
These two components,
XAxis
andYAxis
, have the same logic more or less. The same is true of the other components listed in the title of the issue.The main difference is whether we use an x or y axis! Look into generalizing this structure throughout the listed components.
The text was updated successfully, but these errors were encountered: