Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.2 gives error on scatter_chart #81

Closed
arni1981 opened this issue Jan 11, 2017 · 5 comments
Closed

2.2.2 gives error on scatter_chart #81

arni1981 opened this issue Jan 11, 2017 · 5 comments

Comments

@arni1981
Copy link

I updated chartkick via bower from 2.2.1 to 2.2.2 and now I get the error

Type mismatch. Value 2016-06-26T12:30:00.000Z does not match type number in column index 0

My setup is chartkick in Gemfile set to 2.2.2 and I install the js file via bower, version 2.2.2.
This works perfectly with js file 2.2.1.

@ankane
Copy link
Owner

ankane commented Jan 11, 2017

Hey @arni1981, thanks for reporting 👍 Scatter plots only support a numeric x-axis. A date/time axis wasn't intended to work in previous versions (but sounds like it did with Google Charts).

@arni1981
Copy link
Author

Thanks for the explanation. But when I try to use only the year part of the date, I get the error

Type mismatch. Value 2006 does not match type number in column index 0

This is the complete code
new Chartkick.ScatterChart("#scores_line", [[2006,37],[2007,36],[2008,36],[2008,38],[2009,34],[2009,39],[2012,36],[2013,38],[2014,39],[2014,37],[2014,36],[2014,39],[2014,35],[2014,43],[2016,36]], {"library":{"lineWidth":1,"pointSize":5,"curveType":"function","legend":{"position":"none"},"vAxis":{"gridlines":{"color":"#ddd"},"baselineColor":"#aaa"},"hAxis":{"gridlines":{"color":"#ddd"},"textPosition":"none","baselineColor":"#aaa"},"trendlines":{"0":{"color":"#555","lineWidth":3,"opacity":0.3,"visibleInLegend":true,"pointSize":0}}},"discrete":true,"min":null});

@ankane
Copy link
Owner

ankane commented Jan 11, 2017

That sounds like a bug. Will take a look tonight.

@ankane ankane added bug and removed bug labels Jan 11, 2017
@ankane
Copy link
Owner

ankane commented Jan 12, 2017

This is due to discrete: true. Scatter charts don't support the discrete option.

@ankane ankane closed this as completed Jan 12, 2017
@arni1981
Copy link
Author

Thanks for the explanation. I guess it just accidentally worked with earlier versions.
Anyway, I use your gem/js a lot, good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants