axis with labels in months

I am trying to create a graph for plotting height with respect to age in years using d3js in angular js.

I created a linear scale but the linear scale is in multiples of 5
5,5.5,6,...

I want to create an x-axis scale as 5,5.6,6,6.6,7...18 . Here 5 will represent January and 5.6 will represent June .

Since there are 12 months when calculating the years the data is getting plotted wrongly.

for example

date of birth is 01-jan-2011
date of entry is 05-dec-2016
when calculating the years it is 5.11
I am unable to plot this in graph

I have tried passing the values as tickValues but the space between the ticks is irregular.

EDIT:

Or Is it possible to set a major tick after every 5 minor tick.

(ie) 5 is a major tick then 5.1, 5.2, 5.3, 5.4, 5.5 are minor ticks and 5.6 will be a major tick.

This is my graph. I don't want to show the minor tick values, but i need to plot values like 5.11,6.10 and so on.

Edit2 :

Now I have set the values in months like this .tickValues(d3.range(60, 217, 6)) So the x axis values are 60,66,72... and this is equivalent to 5, 5.6, 6... in years 60 months = 5 years.

How do I show the label in years and plot the graph using the month values

链接地址: http://www.djcxy.com/p/61046.html

上一篇: 为什么在Mac OS上安装Nokogiri失败,libiconv丢失?

下一篇: 在几个月内带有标签的轴