UNPKG

tango-chart

Version:
31 lines (23 loc) 573 B
import React, {PropTypes, Component} from 'react'; import d3 from 'd3'; export default class Axis extends React.Component { constructor(props) { super(props); } componentDidMount() { this.renderAxis(); } componentDidUpdate() { this.renderAxis(); } renderAxis() { var node = this.refs.axis; var axis = d3.svg.axis().orient(this.props.orient).ticks(5).scale(this.props.scale); d3.select(node).call(axis); } render() { return <g className="axis" ref="axis" transform={this.props.translate} />; } } Axis.propTypes = { };