admin管理员组文章数量:1323342
I am trying to get the actual value of the x axis into a string but I can't work out the syntax.
I have just started to develop a demonstration version of the HighCharts, so the example below is what I am altering:
(press options to see the code behind this)
I am trying to change the following line of code
maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) +':<br/> '+ this.y +' visits',
This is because my data x axis value is a Month name. Therefore I want to say something like:
maincontentText: this.x.value +': '+ this.y +' visits',
It's probably very simple, does anyone know why every permutation I try has failed?
Thanks :-)
I am trying to get the actual value of the x axis into a string but I can't work out the syntax.
I have just started to develop a demonstration version of the HighCharts, so the example below is what I am altering:
http://www.highcharts./demo/line-ajax/grid
(press options to see the code behind this)
I am trying to change the following line of code
maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) +':<br/> '+ this.y +' visits',
This is because my data x axis value is a Month name. Therefore I want to say something like:
maincontentText: this.x.value +': '+ this.y +' visits',
It's probably very simple, does anyone know why every permutation I try has failed?
Thanks :-)
Share Improve this question asked Aug 24, 2011 at 16:16 HadleighHadleigh 4982 gold badges6 silver badges15 bronze badges 3-
Do you give a try to
this.x
instead ofthis.x.value
? Tell if works for you. – Diosney Commented Aug 24, 2011 at 16:58 -
Yep, I've tried every bination I can think of. I get a mixture of
undefined
orObject object
as responses. – Hadleigh Commented Aug 25, 2011 at 7:54 -
this.x
gives me the array key value, 0, 1, 2 etc.this.x.value
is undefined, as isthis.x.name
.this.data[x].value
givesObject object
– Hadleigh Commented Aug 25, 2011 at 7:56
1 Answer
Reset to default 5The example you started with has a numeric x-axis, a timeline, this.x
will be a number (milliseconds from jan 1, 1970) suitable for Highcharts.dateFormat
.
If you have changed the example to use a categorical x-axis, then you instead find the category in this.category
so I think this will work:
maincontentText: this.category +': '+ this.y +' visits',
Example: here
本文标签: javascriptGetting the X Axis value in HighChartsStack Overflow
版权声明:本文标题:javascript - Getting the X Axis value in HighCharts - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742135233a2422339.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论