iocentos
iocentos

Reputation: 263

Skip yAxis gridLines if there is no data in them

I am trying to create a simple chart where xAxis is the date the user selected an attribute while yAxis is the attribute the user selected.

Each attribute corresponds to a value starting from 0. So for example, attribute0 has a value of 0 and so on.

What i would like to do is to not display yAxis grid lines for attributes that were not selected by the user.Sample picture

As can be seen in the screenshot the user has selected attributes 3,4,5 and 9. The problem is that i don't want to show yAxis grid lines for the rest of the attributes(1,2,6,7 and 8) while preserving the value of the displayed attributes. This means that i want attribute 9 to have a value of 9 even if it is displayed in line 4 in this example(assuming that there is a way to skip empty gridLines)

The end result i would like to be like this for this example.End result

If the user selects a new attribute the next day, one that does not already exists in the graph, this attribute should be added in the same way.

Any ideas?

I hope i am explaining my self correctly. Thank you in advance.

Upvotes: 0

Views: 258

Answers (1)

jlbriggs
jlbriggs

Reputation: 17800

You can do this by using categories on the y axis.

Your y values then need to be the category index of the selected value, rather than the value itself.

So, in your example, you would have:

categories = ['3','4','5','9']

And the y values for that would be 0,1,2,3 instead of 3,4,5,9.

Something like (random x value used):

data: [[100,0],[100,1],[100,2],[100,3]]

Example:

Upvotes: 3

Related Questions