简体   繁体   中英

Chartkick google geo-chart - is it possible to use a string as tooltip value?

I'm using Chartkick to display this map using the Google api:

geo_chart @final_output, library: {backgroundColor: "transparent", width: 400}

Right now if I pass it a string as the 2nd value it won't work. But an integer will.

[['Canada','cat'],['United States',4]]  <- first one won't work

Is there a way from rails to make this happen? I checked the google docs and chartkick and it does not mention it anywhere.

Thanks!

for Reference: https://developers.google.com/chart/interactive/docs/gallery/geochart#important

I think you are working in text mode, and in that case the second argument is the text size - so will need to be a number. From the documentation you link to:

Text mode format

The label is entered in the first column, plus one optional column:

Text label [String, Required] A specific string address (for example, "1600 Pennsylvania Ave"). Text size [Number, Optional] The second column is an optional numeric column used to assign the size of the label. If this column is not present, all labels will be the same size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM