I am trying to add labels to my line on D3.js using React. I wrote the code below that will display the axis, but the node text is not displayed, but I see it in the DOM in the developer tools.
import React, { PropTypes, Component } from 'react'; import * as d3 from 'd3'; export default class Axis extends Component { static propTypes= { h: PropTypes.number.isRequired, axis: PropTypes.func.isRequired, axisType: PropTypes.oneOf(['x', 'y']).isRequired, } componentDidMount = () => { this.renderAxis(); } componentDidUpdate = () => { this.renderAxis(); } renderAxis = () => { const node = this.axisRef; d3.select(node).call(this.props.axis);
source share