2014-04-26 12 views

cevap

6

Bazı d3 ile çizim yaptıktan sonra bunu değiştirebilirsiniz. İşte

// Pass in an axis object and an interval. 
var cleanAxis = function (axis, oneInEvery) { 
    // This should have been called after draw, otherwise do nothing 
    if (axis.shapes.length > 0) { 
     // Leave the first label 
     var del = 0; 
     // If there is an interval set 
     if (oneInEvery > 1) { 
      // Operate on all the axis text 
      axis.shapes.selectAll("text").each(function (d) { 
       // Remove all but the nth label 
       if (del % oneInEvery !== 0) { 
        this.remove(); 
        // Find the corresponding tick line and remove 
        axis.shapes.selectAll("line").each(function (d2) { 
         if (d === d2) { 
          this.remove(); 
         } 
        }); 
       } 
      del += 1; 
      }); 
     } 
    } 
}; 

keman var:

http://jsfiddle.net/V3jt5/1/

İşte her n birini bırakarak etiketleri kaldıracaktır bir yöntemdir
İlgili konular