javascript - Changing Ticks values to text using D3 -


i have d3 code

 svg = d3.select("svg")  var myscale = d3.scale.linear()     .domain([0,100])     .range([0,400]);   var ticks = [0,50,60,100];    var myaxis = d3.svg.axis() .scale(myscale) .tickvalues(ticks);    svg.append("g")     .attr("class", "axis")     .call(myaxis)     .attr("transform","translate(100,100)"); 

http://tributary.io/inlet/5207532

i want tick labels a,b,c,d instead 0,50,60,100

svg = d3.select("svg")  var myscale = d3.scale.linear()         .domain([0,100])         .range([0,400]);   var ticks = [0,50,60,100]; var ticklabels = ['a','b','c','d']  var myaxis = d3.svg.axis()   .scale(myscale)   .tickvalues(ticks) .tickformat(function(d,i){ return ticklabels[i] });  svg.append("g")         .attr("class", "axis")         .call(myaxis)         .attr("transform","translate(100,100)"); 

use .tickformat


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -