javascript - HighCharts Time-based Quarterly Data - xAxis Label Issue -


we displaying dynamic data on our site. user can select different types of time periods such monthly, quarterly, annual, decennial, etc. our issue comes in trying show quarterly data cleanly on xaxis. can use formatter show tool-tip correctly "q1 2008". want have xaxis similar. partially there think doing fat-finger error here. example on jsfiddle.

the code trying work in xaxis label [formatter][2]:

xaxis: {             alternategridcolor: '#fafafa',             labels: {                 style: {                     fontsize: '9px',                     width: '175px'                 },                 formatter: function () {                     var s;                     if (highcharts.dateformat('%b', this.value) == 'jan') {                         s = s + "q1"                     };                     if (highcharts.dateformat('%b', this.value) == 'apr') {                         s = s + "q2"                     };                     if (highcharts.dateformat('%b', this.value) == 'jul') {                         s = s + "q3"                     };                     if (highcharts.dateformat('%b', this.value) == 'oct') {                         s = s + "q4"                     };                     s = s + " " + highcharts.dateformat('%y', this.value);                     return s;                 }             },             tickinterval: 31536000000,             type: 'datetime'         } 

this using datetime type of xaxis , running under highcharts. if change tickinterval 3 months (259200000) goes pear shaped. our desired outcome xaxis has entries like: q1 2007 q2 2007 q3 2007 q4 2007 .. q4 2012

you can set tickinterval 3 months

http://jsfiddle.net/yhmrz/5/

tickinterval: 3 * 30 * 24 * 3600 * 1000, 

but when dynamic change ranges, should use tickpostitioner


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -