How can I select :last-child in d3.js?

后端 未结 6 2153
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-31 08:55

I need to manipulate the text elements of the first and last tick of an axis to bring them more towards the center.

I am trying to select them, one at t

6条回答
  •  心在旅途
    2020-12-31 09:53

    Using .filter() with a function also works selection.filter(filter) :

    var gridlines;
    
    gridlines = svg.selectAll('.gridlines');
    
    gridlines.filter(function(d, i) {
      return i === gridlines.size() - 1;
    }).attr('display', 'none');
    

提交回复
热议问题