Getting the X Axis value in HighCharts
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.com/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:
maincontent开发者_运维百科Text: this.x.value +': '+ this.y +' visits',
It's probably very simple, does anyone know why every permutation I try has failed?
Thanks :-)
The 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
精彩评论