相关疑难解决方法(0)

你可以在转换后链接一个函数而不是转换的一部分吗?

例如,如果我想转换yAxis域,我可以这样做

this.yAxis
    .transition()
    .call(this.createYAxis)
    .attr('transform', `translate( ${this.Axes.Y.offset}, 0 )`);
Run Code Online (Sandbox Code Playgroud)

我还想在相同的选择中设置文本大小,但我不想为文本大小设置动画.这可能在同一个链中吗?例如,

this.yAxis
    .transition()
    .call(this.createYAxis)
    .attr('transform', `translate( ${this.Axes.Y.offset}, 0 )`)
    //I don't want anything past this point to be a part of the transition
  .selectAll('text')
    .style('font-size', '15px');
Run Code Online (Sandbox Code Playgroud)

现在我只是使用两个单独的调用

this.yAxis
    .transition()
    .call(this.createYAxis)
    .attr('transform', `translate( ${this.Axes.Y.offset}, 0 )`);

this.yAxis.selectAll( 'text')
   .style( 'font-size', '15px' )
Run Code Online (Sandbox Code Playgroud)

javascript d3.js

2
推荐指数
1
解决办法
85
查看次数

标签 统计

d3.js ×1

javascript ×1