Aaron
Aaron

Reputation: 2427

yAxis Categories on Scatter Plot

Highcharts' inferred categories for the yAxis aren't working like I'd expect. Setting yAxis: { type: 'category' } and naming data points { name: 'Green', y: 1, x: 2 } doesn't set the yAxis labels to the name 'Green'. Is it possible to do this? What am I doing wrong?

Fiddle

Upvotes: 0

Views: 4291

Answers (1)

jlbriggs
jlbriggs

Reputation: 17800

That is correct. It will not work that way in Highcharts (with possible exception for pie charts maybe).

You need to set your categories explicitly, and either order the data points in order of their respective category, or supply the category array index as the appropriate x or y value.

example:

Edit: expanded answer based on comment

Ok, I was unaware of the change pointed out in your comment below. Per the API:

'Since Highcharts 3.0, categories can also be extracted by giving each point a name and setting axis type to "category"'.

There are two things going on here though:

1) from what I can see, this only works on the x axis, and not the y (from my very limited testing).

2) even if it did work on the y axis, you are supplying too much info. The category name takes the place of the x value, so you can supply a name, and a y value. You are giving it a name, an x value, and a y value, so I don't think Highcharts could parse that even if it did work for the y axis.

Upvotes: 4

Related Questions