Reputation: 690
I have one highchart with X-axis looks like ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
So,while editing the value in the highchart for Jan month,In the drop event I am getting this.category =Jan. Is there any possiblity to plot x axis point with key-value pair so that I will get key as 'Jan' and value as 1.
Upvotes: 0
Views: 791
Reputation: 4925
Set xAxis type to category.
xAxis: {
type: 'category'
}
Then using name, instead of x in the series data
data: [
{name: 'Jan', y:24.13},
{name: 'Feb', y:17.2},
{name: 'Mar', y:8.11}
]
Upvotes: 2
Reputation: 2023
Create an object and use it for categories as follows
//Define this object
cats = {'Jan':1, 'Feb':2, 'Mar':3, 'Apr':4, 'May':5, 'Jun':6, 'Jul':7, 'Aug':8, 'Sep':9, 'Oct':10, 'Nov':11, 'Dec':12};
months=Object.keys(cats); // Prepare categories for x axis
//In Highcharts object set categories: months
// In drop event use cats.category
Upvotes: 1