I am creating a svg x-y-chart in d3.js. Is it possible to create ticks of different lengths depending on tickValue?
I have made my own tickFormat function myTi
Variant on the answer that suits my requirements. Picked the values I just wanted tick marks for instead of ticks and value, added the "hide" class. But this can be used for any variation on the theme.
var gy = humiditySVG.append( "g" )
.attr( "class", "y axis" )
.attr( "transform", "translate(" + 154 + "," + 0 + ")" )
.call( yAxis );
humiditySVG.selectAll( "text" )
.attr( "class", function ( d ) {
if ( $.inArray(d, [0,50,100])==-1 ) {
return "hide";
}
return;
} );
humiditySVG.selectAll( "line" )
.attr( "x2", function ( d ) {
if ( $.inArray(d, [0,50,100])==-1 ) {
return 1;
} else {
return 3;
}
return;
} );