This is a migrated thread and some comments may be shown as answers.

How to set axisCrossingValue to always be maximum value?

1 Answer 256 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 23 Aug 2012, 06:22 PM
Hi, I'm trying to make a line chart that uses two y-axes, one on the left side of the chart and one on the right.

Originally I got it to work by using the length of values in the datasource, like this:

axisCrossingValue: [0, datasource.data().length] }

However, this doesn't work when I interpolate the missing values on the chart, as there can be many more categories on the x-axis than there are elements in the data array. I end up getting an axis hanging out somewhere in the middle of the chart.

Does anyone know a way I can get the number of categories on the x-axis WHILE instantiating the chart?
Or would I have to access the number of categories and change the axisCrossingValue after the chart has been built and call refresh()?

Thanks for any ideas!
Erik

1 Answer, 1 is accepted

Sort by
0
Erik
Top achievements
Rank 1
answered on 23 Aug 2012, 07:28 PM
Whoops, problem resolved!

I didn't realize that you could simply set an obscenely large number for the second element in the axisCrossingValue array.

So setting the number higher than what could ever be displayed in the chart works just fine!
Tags
Charts
Asked by
Erik
Top achievements
Rank 1
Answers by
Erik
Top achievements
Rank 1
Share this question
or