d3.js - D3 Line chart using category name (string) in x-axis -


in d3 chart, don't want use date in x-axis. have simple category , count of category value , want create chart using these value.

i using below url create line chart http://bl.ocks.org/mbostock/3883245

but in place of year, want show category name in x-axis.

you want use ordinal scale instead of time-scale x-axis, have @ this.

basically replace

var x = d3.scaletime()     .rangeround([0, width]); ... x.domain(d3.extent(data, function(d) { return d.date; })); 

with

var x = d3.scaleband()     .rangeround([0, width]); ... x.domain(data.map(function(d) { return d.date; })); 

but hard answer question without code examples of have tried far , hide. if provide example jsfiddle of code better answers , not question gets downvoted.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -