d3 작업 삽질

null·2021년 11월 2일
0

d3 그래프

    const axisElem = d3Select(_axis.current).call(axis as any);
      axisElem.selectAll('text')
        .attr('dx', -8)
        .attr('font-size', 11)
        .attr('fill', '#585858');
  
    } else if (orient === 'Right') {
      const axis = axisLeft(scale)
        .tickSize(0);
	const text = '거래량'
      const axisElem = d3Select(_axis.current).call(axis as any);
      axisElem.selectAll('text').remove();
      axisElem.selectAll('text');
      	.data(text)
      	.enter()
        .append('text')
        .text(text);
    }

수정

    const axisElem = d3Select(_axis.current).call(axis as any);
      axisElem.selectAll('text')
        .attr('dx', -8)
        .attr('font-size', 11)
        .attr('fill', '#585858');
  
    } else if (orient === 'Right') {
      const axis = axisLeft(scale)
        .tickSize(0);

      const axisElem = d3Select(_axis.current).call(axis as any);
      axisElem.selectAll('text').remove();
      axisElem.append('g')
        .append('text')
        .attr('dx', -8)
        .attr('dy', 160)
        .attr('fill', '#585858')
        .text('거래량');
    }
profile
개발이 싫어.

0개의 댓글