问答详情
源自:2-1 画布制作

为g元素添加属性无效

import React from 'react';

import * as d3 from 'd3'


import './Dthree.css'


class Dthree extends React.Component{

constructor(props){

super(props)

this.useD3 = this.useD3.bind(this)

}

componentDidMount(){

this.useD3()

}

useD3() {

const svg1 = d3.select('#container')

.append('svg')

.attr("width", 500)

.attr("height", 250)


const g = d3.select('svg')

.append('g')

.attr('transform', 'translate(50,50)')

.style('width','50px')


}

render () {

return (

<div id='container'>

</div>

)

}

}


export default Dthree


提问者:阿常先森 2019-07-17 11:53

个回答

  • isu_腾飞
    2020-08-01 18:16:00

    添加的那个属性无效你要说清楚啊 ?