Conversation
| const chartBox = d3.select(`#${id}`) | ||
| const svg = chartBox.select('.svg') | ||
| const tooltipBox = chartBox.select('.tooltip-box') | ||
| const tooltipSircle = chartBox.select('.tooltip-sircle') |
There was a problem hiding this comment.
p5. sircle 은 어떤 의미로 사용된건가요? circle 의 오타인가 하여 남깁니다.
| return arc(d) | ||
| } | ||
| }) | ||
| }, [JSON.stringify(data)]) |
There was a problem hiding this comment.
p5. 다른 props(colors, style, duration, tooltip 등)은 안들어가도 될까요
| <WrapLegendItem key={`WrapLegendItem__${key}`}> | ||
| <WrapKey color={colors[idx]}>{key}</WrapKey> | ||
| <WrapValue>{value || 0}</WrapValue> | ||
| <WrapValue>{((value * 100) / totalCount).toFixed(2)}%</WrapValue> |
There was a problem hiding this comment.
p3. legend 에 value를 노출 시킬 필요가 있을까요? 기본적으로 이름을 노출하고 필요하다면 legend 를 custom 할 수 있도록 옵션을 전달할 수 있으면 좋겠습니다.
| const colorSizeDiff = _.size(data) - _.size(colors) | ||
| if (colorSizeDiff !== 0) { | ||
| _.forEach(_.range(colorSizeDiff + 1), () => | ||
| colors.push(`#${Math.round(Math.random() * 0xffffff).toString(16)}`), |
There was a problem hiding this comment.
p4. 랜덤색상 말고 고정적인 default color 가 있는게 더 좋지 않을까요?
| const tooltipTextBox = chartBox.select('.tooltip-text-box') | ||
|
|
||
| // default value | ||
| const SVG_WIDTH = svg.node().getBoundingClientRect().width - 16 |
There was a problem hiding this comment.
p4. 16은 어떤값인가요? 상수화할 수 없을까요?
| .text(`${data.key} :`) | ||
| tooltipTextBox.append('div').text(`${data.value}`) |
There was a problem hiding this comment.
p3. tooltip 내용을 커스텀할 수 있는 방법은 없을까요?
|
|
||
| useEffect(() => { | ||
| // selector | ||
| const chartBox = d3.select(`#${id}`) |
There was a problem hiding this comment.
p5. select 코드는 useEffect 바깥으로 빼도 괜찮지 않을까요 ..?
| const SVG_WIDTH = svg.node().getBoundingClientRect().width - 16 | ||
| const SVG_HEIGHT = svg.node().getBoundingClientRect().height | ||
| const MARGIN = 8 | ||
| const INIT_DURATION_MS = 600 |
There was a problem hiding this comment.
p5. 상수도 바깥으로 빼도 괜찮을 것 같습니다 ~
| opacity: 1; | ||
| ` | ||
|
|
||
| const WrapSircle = styled.div` |
There was a problem hiding this comment.
p2. WrapCircle로 수정해야할 것 같습니다 ~
| } | ||
|
|
||
| const mouseleave = ({ target }) => { | ||
| d3.select(target).transition().duration(300).attr('stroke-width', 0) |
There was a problem hiding this comment.
p5. durtaion(300)에서 300도 상수처리하면 좋을 것 같습니다 ~
| const tooltipTextBox = chartBox.select('.tooltip-text-box') | ||
|
|
||
| // default value | ||
| const SVG_WIDTH = svg.node().getBoundingClientRect().width - 16 |
There was a problem hiding this comment.
p5. 여기서 - 16 은 무엇을 의미할까요 ..?
| return arc(d) | ||
| } | ||
| }) | ||
| }, [JSON.stringify(data)]) |
There was a problem hiding this comment.
p5. JSON.stringify(data)가 좋은 방법이 아니어서 이리저리 다르게 시도하고 있는데ㅜ 나중에는 대체되어야 할 것 같아요..
의존성에 이것저것 넣어버리게 되면 동작을 해야할 경우에도 그대로인 경우가 있어서 아예 의존성을 빼도 괜찮을 것 같기도 합니다..
아니면 아예 다 넣어버려야 할까요 🥲
구현 사항
추가 논의 필요 사항
1. legend의 위치 및 list가 과하게 많은 경우
1-1. 덮어 씌기 + 전체 다 노출 (rechart 방식)
1-2. pagination 혹은 scroll
2. 기본 architecture 구현 방식
2-1. legend, tooltip 등 react component를 만들어서 필요한 state를 구현하여 전달하는 방식 (예전 방식)
2-2. 기본(default) element와 styled만 구현 후, 설정이나 인터렉션이 필요한 경우 d3 selection으로 접근하여 컨트롤 (현 코드 방식)
2-3. 최초 box(혹은 svg)만 구성 후 나머지 요소들은 생성하여 appending 하는 방식 (기본 라이브러리 방식들)
3.props 전달 방식
3-1. 각개 props 형식
3-2. Object 형식