GoogleWebComponents / google-chart

Google Charts API web components
https://www.webcomponents.org/element/@google-web-components/google-chart/elements/google-chart
Apache License 2.0
358 stars 130 forks source link

Assign ID in chart elements #156

Closed eduardodallmann closed 8 years ago

eduardodallmann commented 8 years ago

I need to assign ID to the title and subtitled chart, to use the onclick event.

I'm testing like this: $("svg g:eq(0) text:eq(0)").attr('id','gtitle'); But as the chart is created dynamically, sometimes, the title element is in a different position.

Also I have used: $('text:textEquals("Availability of equipment")').attr('id','gtitle'); The onclick event title is used by the user to change the title, but some special characters that the user can use break the search code.

An official feature to assign ID in chart elements? Or some infallible code to locate element and assign an ID?

wesalvaro commented 8 years ago

This is really just a wrapper around the real google-chart visualization and your question seems better poised for that team. You should copy-paste your question here: https://github.com/google/google-visualization-issues/issues

wesalvaro commented 8 years ago

For what it's worth, I think, given current constraints, you're going with a decent approach.