Adding images into a label of a bar chart

1,150 views
Skip to first unread message

Sixs

unread,
Nov 9, 2016, 6:35:09 PM11/9/16
to Google Visualization API
How can I add an image into the label of a bar chart? I'm reading the data from a spreadsheet and in one column I have the image's urls.

Sixs

unread,
Nov 9, 2016, 7:18:25 PM11/9/16
to Google Visualization API
I found this: https://developers.google.com/chart/interactive/docs/customizing_tooltip_content
But in my case I'm getting the data from a spreadsheet. how can I set the 'role': 'tooltip' to my column that have the urls of the images?

Sixs

unread,
Nov 9, 2016, 7:54:30 PM11/9/16
to Google Visualization API
Ok I got it, but only in with BarChart (I think that if work in barchart can work in the same way with Histogram):

My query is:

    var query = new google.visualization.Query(tqUrl);
    query.setQuery('Select B, G, C');

Where in column C I have the url image, the column C have the index 2 (start in 0) so I use:

    var data = response.getDataTable();
    data.setColumnProperties( 2, {
     role: 'tooltip',
     html: true
    }); 

and then in chart properties:

        'focusTarget': 'category',
        'tooltip': {'isHtml': 'true'},

But when I replace BarChart with Histogram I get the message:

Focus target [object Object] is not supported for the chosen chart type   

How can I use it with Histogram this option?

Daniel LaLiberte

unread,
Nov 10, 2016, 10:50:57 AM11/10/16
to Google Visualization API
Hi Sixs,

Looks like you have found a bug.  At least it shouldn't report such an obtuse error, though I believe the focusTarget of 'category' should be supported with custom html tooltips.  

The only workaround I can suggest at this time is that you could implement your own histogram using ColumnChart (or BarChart).  

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/f0e47169-cd28-4968-9598-af3d366a4615%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages