How to set axisCrossingValue to always be maximum value?

2 posts, 0 answers
  1. Erik
    Erik avatar
    6 posts
    Member since:
    Aug 2012

    Posted 23 Aug 2012 Link to this post

    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
  2. Erik
    Erik avatar
    6 posts
    Member since:
    Aug 2012

    Posted 23 Aug 2012 Link to this post

    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!
Back to Top